# Codeforces Round #415 (Div. 2) Archive

## Codeforces Round #415 (Div. 2), problem: (E) Find a car Solution In JAVA

import java.util.*; public class C{ final int MOD = (int)1e9 + 7; long get(int x, int y, int lim){ if (Math.min(x,y) < 0) return 0L; long d = new long, sm = new long; d …

## Codeforces Round #415 (Div. 2), problem: (D) Glad to see you! Solution In C/C++

#include <cstdio> using namespace std; #define ff fflush(stdout) #define mid (lef+rig>>1) int n, k, x, t1, t2; char s; inline bool I(int a, int b){printf(“1 %d %d\n”,a,b), ff, scanf(“%s”,s); return s==’T’;} inline int Binary(int lef, …

## Codeforces Round #415 (Div. 2), problem: (C) Do you want a date? Solution In C/C++

#include <bits/stdc++.h> using namespace std; long long n,a,r,m=1e9+7,sum=0; int main(){ std::cin >> n;r = 1; for(int i = 0;i<n;i++)cin>>a,r=(r*2)%m; sort(a,a+n); for(int i=0;i<n;i++) sum+=(a*(r-r))%m,sum%=m; cout << sum%m; }

## Codeforces Round #415 (Div. 2), problem: (B) Summer sell-off Solution In C/C++

#include<bits/stdc++.h> using namespace std; int64_t n,f,k,l,i,w,s,a; int main(){ for(cin>>n>>f;i<n;i++)cin>>k>>l,w=min(k,l),a=min(2*k,l)-w,s+=w; sort(a,a+n); for(i=0;i<n;i++)s+=i<f?a:0; cout<<s; }

## Codeforces Round #415 (Div. 2), problem: (A) Straight <> Solution In C/C++

#include <cstdio> int n,k,sum=0,mark; int main() { scanf(“%d%d”,&n,&k); for(int i=1;i<=n;i++)scanf(“%d”,&mark),sum+=mark; mark=(n*k-sum)*2-n; if(mark>0)printf(“%d”,mark); else printf(“0”); }