akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
using namespace std;
string s;
int i,j,l;
int main()
{
	cin>>s;
	l=s.size();
	for (i=0;i<=l-1;i++)
	  if (s[i]=='C')
	    for (j=i+1;j<=l-1;j++)
	      if (s[j]=='F')
	      {
	      	cout<<"Yes"<<endl;
	      	return 0;
		  }
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
/* kop Chy_Chy*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll , ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define si(x)   scanf("%d", &x)
#define sl(x)   scanf("%lld", &x)
#define pi(x)   printf("%d\n", x)
#define pl(x)   printf("%lld\n", x)
#define deb(x)  cout<< #x << " = " << x << endl // debugging kop 
#define mp      make_pair
#define pb      push_back
#define MOD     1000000007
#define PI      acos(-1)
#define ff      first
#define ss      second
#define newline printf("\n")
ll binpow(ll a, ll b); // binary exponentiation kop
void prime_factorization(ll n, vll &prime_factors); // prime factorization kop
ll gcd(ll a, ll b); // greatest common divisor kop. Use LONG LONG
void speedup() {
    ios::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
}
void func(string s , string t){
    int a = s.size();
    int b = t.size();
    int m = (int)1e9;
    int cnt = 0;
    for(int i = 0; i <= a-b; i++){
        for(int j = 0; j < b; j++){
            if(s[j+i] != t[j]){
                cnt++;
            }
        }
        // cout<< cnt << "\n";
        m = min(cnt, m);
        cnt = 0;
    }
    cout<< m << "\n";
}
int main(){
    speedup();
    int t = 1;
    // cin>> t;
    while(t--){
        // khela final Mamooo
        string s , t; cin>> s >> t;
        func(s, t);
        
        
        
    }
    // kop kop return 
    return 0;
}


// kop kop functions:
ll binpow(ll a, ll b){
    a = a % MOD; ll res = 1;
    while(b > 0){
        if(b & 1) res *= a % MOD;
        a = a* a % MOD;b = b >> 1;}
    return res;
}
/*---------------------------------------------------------------------------------------------------------------*/
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a%b);
}
/*---------------------------------------------------------------------------------------------------------------*/
void prime_factorization(ll n, vll &prime_factors){
    // first two step taking care of composite number
    // taking care of 2
    while(n%2 == 0){
        prime_factors.pb(2);
        n = n / 2;
    }
    // now n must be odd. And the remaining prime divisors are odd. so we start from 3 and increamenting 2
    for(ll i = 3; i <= sqrt(n); i = i + 2){
        while(n%i == 0){
            prime_factors.pb(i);
            n = n / i;
        }
    }
    // now we are taking care of  n is prime number and greater than 2
    if(n > 2){
        prime_factors.pb(n);
    }
}
/*---------------------------------------------------------------------------------------------------------------*/















Measured memory_bytes: 3608
s=list(input())
n=len(s)-1

ans=0
for bit in range(1<<n):
  l=[s[0]]
  for i in range(n):
    if (bit>>i)&1:
      l.extend(['+',s[i+1]])
    else:
      l.append(s[i+1])
  ans+=eval(''.join(l))
print(ans)  

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
using namespace std;
int  b[10000009];
ll ans=0;
int main(){
    ll t,n,cnt,x,maxi;
    string s;
    cin>>s;
    int a = (s[0]-'0')*10 + (s[1]-'0');
    int b = (s[2]-'0')*10 + (s[3]-'0');
    if(a <=12 && b<=12 && a>0 && b>0)
    	cout << "AMBIGUOUS";
    else if(a <= 12 && a > 0)
    	cout << "MMYY";
    else if(b <= 12 && b > 0)
    	cout << "YYMM";
    else
    	cout << "NA";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;

  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);

  cout << *max_element(A.begin(), A.end()) - *min_element(A.begin(), A.end()) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  int H, W;
  cin >> H >> W;
  string a, b = "#";
  
  for (int i = 0; i < W+1; i++) {
    b += '#';
  }
  cout << b << endl;
  
  for (int i = 0; i < H; i++) {
    cin >> a;
    cout << '#' + a + '#' << endl;
  }

  cout << b << endl;
}


Measured memory_bytes: 256
using System;

	
	public class Class1
	{
		static void Main()
		{
		 string abc=Console.ReadLine();
		 string[] abcArray=abc.Split();
		 int a=int.Parse(abcArray[0]);
		 int b=int.Parse(abcArray[1]);
		  int c=int.Parse(abcArray[2]);
		  
		  if(a<b&&b<c)
		 {
		 	Console.WriteLine("Yes");
		 }
		 else 
		 {
		 	Console.WriteLine("No");
		 }
		
		}
	}

Measured memory_bytes: 8836
n=int(input())
a=list(map(int,input().split()))
li=[0 for i in range(n+1)]
for i in a:
  li[i]+=1
co=[]
cok=[]
for i in li:
  co.append(int(i*(i-1)/2))
  cok.append(int((i-1)*(i-2)/2))
su=sum(co)
for i in a:
  print(su-co[i]+cok[i]) 

Measured memory_bytes: 24992
#include <iostream>
#include <deque>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

vector<vector<int>> fie(500,vector<int>(500));
vector<vector<vector<int>>> dp(500,vector<vector<int>>(500,vector<int>(6,1e9)));

vector<vector<int>> dx = {{0,1,1,0,-1,-1}, {0,1,1,0,-1,-1}};
vector<vector<int>> dy = {{1,0,-1,-1,-1,0},{1,1,0,-1,0,1}};

int sx,sy,gx,gy;
int lx,ly;
int n;

int & get_a(vector<vector<int>>& arr,int x,int y){
	return arr[x + 200][y + 200];
}
int & get_a(vector<vector<vector<int>>>& arr,int x,int y,int t){
	return arr[x + 200][y + 200][t];
}

bool limit(int x,int y){
	return -lx <= x && x <= lx && -ly <= y && y <= ly;
}


int main(){
	cin >> sx >> sy >> gx >> gy;
	cin >> n;
	rep(i,1,n){
		int x,y;
		cin >> x >> y;
		get_a(fie,x,y) = 1;
	}
	cin >> lx >> ly;
	get_a(dp,sx,sy,0) = 0;

	using P2 = pair<int,P>;
	deque<pair<int,P2>> que;

	que.push_back({0,{0,{sx,sy}}});

	while(!que.empty()){
		auto p = que.front();
		que.pop_front();
		int t = p.second.first;
		int x = p.second.second.first;
		int y = p.second.second.second;
		int d = p.first;

		if(get_a(dp,x,y,t) < d) continue;

		int pa = (1000 + x) % 2;
		int todo = abs(x * y * t) % 6;

		for(int i = 0;i < 6;i++){
			int nx = x + dx[pa][i];
			int ny = y + dy[pa][i];
			if(get_a(fie,nx,ny)) continue;
			if(!limit(nx,ny)) continue;
			if(todo == i){
				if(get_a(dp,nx,ny,(t + 1) % 6) > d){
					get_a(dp,nx,ny,(t + 1) % 6) = d;
					que.push_front({d,{(t + 1) % 6 , {nx,ny}}});
				}
			}
			else{
				if(get_a(dp,nx,ny,(t + 1) % 6) > d + 1){
					get_a(dp,nx,ny,(t + 1) % 6) = d + 1;
					que.push_back({d + 1,{(t + 1) % 6 , {nx,ny}}});
				}
			}
		}
		//wait
		if(get_a(dp,x,y,(t + 1) % 6) > d + 1){
			get_a(dp,x,y,(t + 1) % 6) = d + 1;
			que.push_back({d + 1,{(t + 1) % 6 , {x,y}}});
		}
	}

	int result = 1e9;
	for(int i = 0;i < 6;i++){
		result = min(get_a(dp,gx,gy,i),result);
	}
	if(result == 1e9) result = -1;
	cout << result << endl;
}



Measured memory_bytes: 17928
m, d = map(int, input().split())
cnt = 0
for i in range(1, m+1):
  for j in range(22, d+1):
    d10, d1 = j // 10,j % 10
    if d10 >= 2 and d1 >= 2:
      if i == d10*d1:
        cnt+=1
print(cnt)
#もし，dが22以上の時，

Measured memory_bytes: 3060
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      cin.tie(0);
      ios::sync_with_stdio(false);
      
      int x, a, b;
      cin >> x >> a >> b;
      int rest = x - a;
      int donut = rest / b;
      cout << rest - b * donut << endl;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;

#define INF 1e9
#define MOD 1000000007
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (a); i > (b); i--)
#define each(x, v) for (auto& x: (v))
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl

void solve();
void in(){} template<class T, class... U> void in(T &t, U &...u){ cin >> t; in(u...); }
int main() { cin.tie(0); ios::sync_with_stdio(0); solve(); }

void solve() {
  int N;
  in(N);
  vi A(N);
  each(x, A) in(x);
  int mx = 0,smx = 0;
  each(x, A) {
    if (x > mx) {
      smx = mx;
      mx = x;
    } else {
      smx = max(smx, x);
    }
  }
  each(x, A) {
    print(x == mx ? smx : mx);
  }
}


Measured memory_bytes: 2432
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順

using namespace std;
using ll = long long int;

ll mod_pow(ll a,ll index,ll divider){
    ll ret = 1;
    for(;index>0;index/=2,a=a*a%divider){
        if(index%2==1){
            ret = ret * a % divider;
        }
    }
    return ret;
}

int main(){
    ll cnt[2020] = {0};
    string S;cin>>S;
    int a;
    vector<int> num(S.length()+1);
    num[S.length()] = 0;
    for(int j=S.length()-1;j>=0;j--){
        a = S[j] - '0';
        num[j] = num[j+1] + a*mod_pow(10,S.length()-j-1,2019);
        num[j] %= 2019;
        cnt[num[j]]++;
    }
    ll ans = cnt[0] * (cnt[0] + 1) / 2;
    for(int i=1;i<2020;i++){
        ans += cnt[i] * (cnt[i] - 1 ) / 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4364
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define ALL(C)     (C).begin(),(C).end()

typedef long long ll;

bool bt(int n,int now,int *inp,int *vol);

set<ll> D[100];
bool distribute(int n,int now,int *inp,int *vol){
  if (vol[now] == 0)return bt(n,now+1,inp,vol);

  ll state = 0;
  REP(i,now,n){
    state=(state<<1);
    if (vol[i] == inp[i])state++;
  }
  
  if (D[now].find(state) != D[now].end())return false;
  D[now].insert(state);
  if (vol[now] == 0)return false;



  REP(i,now+1,n){
    if (vol[i] != 0)continue;
    if (vol[now]-inp[i] < 0)continue;
    if (i-1 >= now+1 && inp[i-1] == inp[i] && vol[i-1] == 0)continue;
    vol[now]-=inp[i];
    vol[i]=inp[i];
    if (distribute(n,now,inp,vol))return true;
    vol[i]=0;
    vol[now]+=inp[i];
  }
  return false;
}


bool bt(int n,int now,int *inp,int *vol){
  if (now == n){
    return true;
  }
  if (vol[now] == 0)return false;
 

  //through
  if (bt(n,now+1,inp,vol))return true;

  //distribute
  if (distribute(n,now,inp,vol))return true;
  return false;
}

main(){
  int n;
  while(cin>>n && n){
    int in[n];
    int vol[n];
    vector<int> a;
    rep(i,n){
      cin>>in[i];vol[i]=0;a.push_back(in[i]);
      D[i].clear();
    }
    sort(in,in+n,greater<int>());
    sort(ALL(a));
    vol[0]=in[0];
    if (bt(n,0,in,vol) == true)puts("YES");
    else puts("NO");
  }
  return false;
}

Measured memory_bytes: 3032
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  string s, d[4] = {"dream", "dreamer", "erase", "eraser"};
  cin >> s;
  int len = s.size(), it = len, l[4] = {5, 7, 5, 6};
  while(it > 0){
    int tmp = it;
    for(int i = 0; i < 4; i++){
      if(it >= l[i] && s.substr(it - l[i], l[i]) == d[i]){
        it -= l[i];
//        cout << it << " " << d[i] << endl;
      }
    }
    if(tmp == it){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"

using namespace std;

void Main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    for (int i = K; i < N; ++i) {
        if (A[i - K] < A[i]) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 4044
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int A = 1e6 + 1;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> c(A, 0);
  rep(i, n) {
    cin >> a.at(i);
    c.at(a.at(i))++;
  }

  bool pairwise = true;
  for (int i = 2; i < A; i++) {
    int cnt = 0;
    for (int j = i; j < A; j += i) {
      cnt += c.at(j);
    }
    if (cnt > 1) {
      pairwise = false;
      break;
    }
  }

  if (pairwise) {
    cout << "pairwise coprime" << endl;
    return 0;
  }

  int g = a.at(n - 1);
  rep(i, n - 1) {
    g = __gcd(g, a.at(i));
  }
  if (g == 1) {
    cout << "setwise coprime" << endl;
  } else {
    cout << "not coprime" << endl;
  }
  return 0;
}

Measured memory_bytes: 11104
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i, n) cin >> p[i];

  sort(p.begin(), p.end());

  int ans = 0;
  for(int i=0;i<k;i++) {
    ans += p[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
/* https://atcoder.jp/contests/abc126/tasks/abc126_c */

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>

using namespace std;

/* {{{ Variables */
int N, K;
/* }}} */

int main(int argc, char *argv[])
{
  /* {{{ Input */
  cin >> N >> K;
  /* }}} */

  /* {{{ Output */
  int n = 0;
  double p = 0;

  for (int i = N; i >= 1; --i) {
    while (i*pow(2, n) < K) {
      n++;
    }

    p += pow(0.5, n)/(double)N;
  }

  cout.precision(15);
  cout << p << endl;
  /* }}} */

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;
typedef pair<int,int>           P;
typedef vector<P>               vip; 
typedef vector<int>             vi;
typedef vector<vi>              vvi;






int main (){
    ll ans = 0;
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    if(x - y > 0){
        int money = min(a+b, c*2);
        ans += money * y;
        int okane = min(a, c*2);
        ans += (x-y) * okane;
    }
    if(x - y <= 0){
        int money = min(a+b, c*2);
        ans += money * x;
        int okane = min(b, c*2);
        ans += (y-x) * okane;
    }

    cout << ans << endl;







    return 0;
}

Measured memory_bytes: 256
Term = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(Term[K-1])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;

int main() {
  int k,n;
  double max = 0,premax;
  cin >> n >> k;
  vector<double>data(n);
  for(int i = 0;i < n;i++){
    double p,d;
    cin >> p;
    d = (p+1)/2.0;
    data.at(i) = d;
  }
  for(int i = 0;i < k;i++){
    max += data.at(i);
  }
  premax = max;
  for(int i = k;i < n;i++){
    premax += data.at(i)-data.at(i-k);
    if(max < premax){
      max = premax;
    }
  }
  cout << fixed;
  cout << setprecision(12) << max << endl;
}


Measured memory_bytes: 1792
s = input()
K = int(input())

N = len(s)

li = []
for i in range(N):
    for j in range(5):
        if (i+j >= N):
            break
        li.append(s[i:i+j+1])
    li = sorted(list(set(li)))[:6]
    

print(li[K-1])



Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    int n, k; cin >> n >> k;
    double ans = 0;
    FOR(i, 1, n + 1) {
        int score = i;
        double tmp = 1.0 / n;
        while(score <= k - 1) {
            score *= 2;
            tmp *= 1.0 / 2.0;
        }
        ans += tmp;
    }
    printf("%.12lf\n", ans);
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;

class LowLink{
public:
	int n, cnt1;
	vector<vector<int> > G, G2;	//G2は作ったグラフ(木)
	vector<int> pre, low, cmp, used;	//cmpは作成後のindex
	void init(int m){
		n = m;cnt1 = 0;
		pre.resize(n);low.resize(n);used.resize(n);
		G.resize(n);G2.resize(n);cmp.resize(n);
		fill(all(pre), -1);
	}
	void add_edge(int x, int y){
		G[x].pb(y);G[y].pb(x);
	}
	int dfs(int p = 0, int par = -1){	//橋の検出
		if(pre[p] >= 0)return pre[p];
		pre[p] = low[p] = cnt1++;
		rep(i,G[p].size())if(par != G[p][i]){
			int res = dfs(G[p][i], p);
			low[p] = min(low[p], res);
		}
		return low[p];
	}
	int build(int p = 0, int x = 0){	//橋のみを残した木の構築
		int mx = x;cmp[p] = x;
		used[p] = 1;
		rep(i,G[p].size())if(!used[G[p][i]]){
			if(pre[G[p][i]] == low[G[p][i]]){			//橋
				G2[cmp[p]].pb(x+1);G2[x+1].pb(cmp[p]);
				chmax(mx, build(G[p][i], x+1));x++;
			}else chmax(mx, build(G[p][i], cmp[p]));
		}
		return mx;
	}
	int lowlink(){
		rep(i,n)if(!used[i])dfs(i);
		fill(all(used), 0);
		int k = 0;
		rep(i,n)if(!used[i])k += (build(i, k)-k)+1;
		return k;
	}
};

vector<P> ans;
vector<vector<int> > G, G2;
signed main(){
	LowLink low;
	int n, m;
	scanf("%lld%lld", &n, &m);
	G.resize(n);
	low.init(n);
	rep(i,m){
		int v, u;
		scanf("%lld%lld", &v, &u);
		low.add_edge(v, u);
		G[v].pb(u);G[u].pb(v);
	}
	int size = low.lowlink();
	vector<vector<int> > G2 = low.G2;
	vector<int> cmp = low.cmp;
	rep(i,n){
		rep(j,G[i].size()){
			int from = cmp[i], to = cmp[G[i][j]];
			if(from != to and i < G[i][j])ans.push_back(P(i, G[i][j]));
		}
	}
	ZIP(ans);
	size = ans.size();
	rep(i,size)printf("%lld %lld\n", ans[i].fi, ans[i].se);
	return 0;
}







Measured memory_bytes: 7372
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    N = NI()
    A = NLI()
    B = [[0]*2 for _ in range(62)]
    for a in A:
        for i in range(62):
            B[i][(a >> i) & 1] += 1
    ans = 0
    for i, b in enumerate(B):
        ans += b[0] * b[1] * pow(2, i, MOD)
    print(ans % MOD)


if __name__ == "__main__":
    main()

Measured memory_bytes: 126392
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	static ArrayList<Integer>[] e = null;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		long[] x = new long[n];
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextLong();
		}
		long[] y = new long[m];
		for (int i = 0; i < m; i++) {
			y[i] = sc.nextLong();
		}
		sc.close();

		long MOD = 1000000007L;
		long[][] Z = new long[2][];
		Z[0] = x;
		Z[1] = y;
		long[] ll = new long[2];
		for (int i = 0; i < Z.length; i++) {
			for (int j = 0; j < Z[i].length - 1; j++) {
				long a = (Z[i][j + 1] - Z[i][j]) % MOD;
				a = (a * (j + 1)) % MOD;
				a = (a * (Z[i].length - j - 1)) % MOD;
				ll[i] = (ll[i] + a) % MOD;
			}
		}

		System.out.println((ll[0] * ll[1]) % MOD);
	}
}


Measured memory_bytes: 91008
#include<bits/stdc++.h>
using namespace std;
#define forr(i,a,n)     for(long long int i=a; i<n; i++)
#define loop(i,a,n)     for(long long int i=a; i>=n; i--)     

int main()
{
	ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(0);
	
	int a;
	cin>>a;
	int b[a+a+a+a]={};
	forr(i,1,(a)+1)
	{
		forr(j,1,a+1)
		{
			forr(k,1,(a)+1)
			{
				long long int val=(i*i)+(j*j)+(k*k)+i*j+j*k+k*i;
				//cout<<i<<' '<<j<<' '<<k<<" "<<val<<'\n';
				if(val<=a)
					b[val]+=1;
				else
					break;
			}
		}
	}
	forr(i,1,a+1)
		cout<<b[i]<<'\n';
	
		
	return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>

using namespace std;

char bar[10][1001];
int sum[10][1001];
bool cut[1001];

int h, w, k;

int solve(int mask) {
    int res = __builtin_popcount(mask);
    memset(cut, 0, sizeof(cut));

    vector<int> sts, ens, sums;

    int st = 0;
    for (int i = 0; i < h - 1; i++) {
        if (mask & (1<<i)) {
            sts.push_back(st);
            ens.push_back(i);
            sums.push_back(0);
            st = i + 1;
        }
    }

    sts.push_back(st);
    ens.push_back(h - 1);
    sums.push_back(0);

    int g = sts.size();
    for (int j = 0; j < w; j++) {
        bool toCut = false;
        
        for (int i = 0; i < g; i++) {
            int sumCol = sum[ens[i]][j] - sum[sts[i]][j] + (bar[sts[i]][j] - '0');

            if (sumCol > k) {
                return h + w;
            }

            if (sumCol + sums[i] > k) {
                toCut = true;
            }

            sums[i] += sumCol;
        }

        if (toCut) {
            res++;

            for (int i = 0; i < g; i++) {
                int sumCol = sum[ens[i]][j] - sum[sts[i]][j] + (bar[sts[i]][j] - '0');
                sums[i] = sumCol;
            }
        }
    }

    return res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    memset(sum, 0, sizeof(sum));

    cin >> h >> w >> k;
    for (int i = 0; i < h; i++) {
        cin >> bar[i];
        for (int j = 0; j < w; j++) {
            if (i > 0) sum[i][j] = sum[i - 1][j];
            sum[i][j] += bar[i][j] - '0';
        }
    }

    int best = w + h;

    for (int mask = 0; mask < (1<<(h-1)); mask++) {
        best = min(best, solve(mask));
    }

    cout << best << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{	int a,b;
	int i=0;
	scanf("%d%d",&a,&b);
	
	if((a+b)%2==1)
	printf("IMPOSSIBLE");
	
	else
	printf("%d",(a+b)/2);
	

	return 0;
}
		

Measured memory_bytes: 1704
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int x,y;
  cin >> x >> y;
  int awa = 0;
  if(x < 4 && y < 4){
   awa = (-1*x+4)*100000 + (-1*y+4)*100000;
 }
  else if(x < 4) awa = (-1*x+4)*100000;
  else if(y < 4) awa = (-1*y+4)*100000;
  if(x == 1 && y == 1) awa += 400000;
  cout << awa << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x,y,z;
    int count=0;
    scanf("%d",&x);
    scanf("%d",&y);
    scanf("%d",&z);
   if(1<=x,y,z<=100)
   {

    if(x!=y&&y!=z&&z!=x)

   {
    printf("3\n");

    }

    if(x==y&&y!=z&&x!=z)
    {

    printf("2\n");

    }
     if(z==y&&z!=x&&y!=x)
    {


    printf("2\n");

    }
     if(z==x&&z!=y&&y!=x)
        printf("2\n");

     if(z==y&&y==x&&x==z)
        {
            printf("1\n");
        }
   }
return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int MX = 2e5+5;

typedef long long ll;

int color[MX];
vector<int> adj[MX];
ll dp[MX], depth[MX], overc[MX];

ll sum(ll n) { return n*(n+1)/2; }

void dfs(int u, int par) {
    depth[u] = 1; ll cur = dp[color[u]];
    for(auto& v: adj[u]) if (v != par) {
        dp[color[u]] = 0; dfs(v,u);
        depth[u] += depth[v];
        overc[color[u]] += sum(depth[v]-dp[color[u]]);
    }
    dp[color[u]] = cur+depth[u];
}

int32_t main() {

    ios_base::sync_with_stdio(0); cin.tie(0);

    int N; cin >> N;

    for (int i = 0; i < N; ++i) {
        cin >> color[i];
    }

    for (int i = 0; i < N-1; ++i) {
        int u,v; cin >> u >> v; --u,--v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    dfs(0,-1);

    for (int i = 1; i <= N; ++i) {
        cout << sum(N)-sum(N-dp[i])-overc[i] << "\n";
    }

}


Measured memory_bytes: 38776
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Double d = 0.0;
		Scanner scan = new Scanner(System.in);
		int a = Integer.parseInt(scan.nextLine());
		for (int i = 0; i < a; i++) {
			d += 1 / scan.nextDouble();
		}
		System.out.println(1 / d);
		scan.close();
	}
}

Measured memory_bytes: 23252
import math

N = int(input())
xy = [list(map(int, input().split(' '))) for i in range(N)]
'''
dist = []
for i in range(N):
    dist.append([])
    for j in range(N):
        if i == j:
            dist[i].append(0)
            continue
        dist_x = (xy[i][0] - xy[j][0]) ** 2
        dist_y = (xy[i][1] - xy[j][1]) ** 2
        dist[i].append((dist_x + dist_y) ** 0.5)
print(*dist, sep='\n')
'''
sum = 0
bias = 2 * math.factorial(N-1)
for i in range(N-1):
    for j in range(i + 1, N):
        dist_x = (xy[i][0] - xy[j][0]) ** 2
        dist_y = (xy[i][1] - xy[j][1]) ** 2
        #print((dist_x + dist_y) ** 0.5)
        sum += ((dist_x + dist_y) ** 0.5) * bias
print(sum/math.factorial(N))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
int main(){
    int n, m; cin >> n >> m;
    vector<int> v(n);
    int sum = 0;
    for(int i = 0; i < n; i++) {
        cin >> v[i];
        sum += v[i];
    }
    sort(v.begin(), v.end());
    int cnt = 0;
    for(int i = n - 1; i >= 0; i--) {
        if((double)1 / (double) (4 * m) > (double)v[i] / (double)sum) {
            break;
        }
        else{
            cnt++;
        }
    }
    if(cnt >= m) {
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
from fractions import gcd
from functools import reduce

def convert(i):
	return int(i) - x

def my_gcd(numbers):
	return reduce(gcd, numbers)

n, x = map(int, input().split())
# h1 = int(input())
# n = int(input())
cities = map(convert, input().split())

def main():
	print(abs(my_gcd(cities)))
			
main()


Measured memory_bytes: 13108
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, H;
  cin >> N >> H;
  vll a(N), b(N);
  for(int i = 0; i < N; i++){
    cin >> a.at(i) >> b.at(i);
  }
  sort(ALL(a)); sort(ALL(b));
  auto ite = lower_bound(ALL(b), a.at(N-1));
  ll sum = 0;
  ll ans = 0;
  for(auto i = b.end()-1; i != ite-1; i--){
    sum += *i;
    ans++;
    if(sum >= H){
      cout << ans << endl;
      return 0;
    }
  }
  ll d = H - sum;
  ans += (d + a.at(N-1) -1) / a.at(N-1);
  cout << ans << endl;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            String s = Console.ReadLine();
            String[] strArr = s.Split(' ');

            int intA = int.Parse(strArr[0]);
            int intB = int.Parse(strArr[1]);

            String strSimbol = " ";

            if (intA < intB) {
                strSimbol = "<";
            }else if (intA > intB){
                strSimbol = ">";
            }else if(intA == intB){
                strSimbol = "==";
            }

            Console.WriteLine("a " + strSimbol + " b");
        }
    }
}


Measured memory_bytes: 15908
#include<bits/stdc++.h>
#define fr(i,a,n) for(ll i=a;i<n;i++)
#define YES cout<<"YES"<<endl
#define all(v) v.begin(),v.end()
#define NO cout<<"NO"<<endl
#define pb(x) emplace_back(x)
#define fastio std::ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define vi vector<ll>
#define mi map<ll,ll>
#define pi pair<ll,ll>
#define what(x) cout<<#x<<" ="<<x<<endl;
#define scn(n) scanf("%d",&n)
#define print(a) printf("%d",a);
using namespace std;
using ll =int;
ll n;

ll dp[200005],a[200005]={1000000000};
ll invalid=1e9;
ll cnt=0;
int solve(ll i,ll p)
{ //cnt++;
    if(i==n-1)return dp[i]=0;
    if(i>=n)return 1e9;
    if(dp[i]!=-1)return dp[i];
    //what(p-a[i]);
    //cout<<i<<" GG "<<i+1<<endl;

    ll x=abs(a[i+1]-a[i])+solve( i+1,a[i]);

   // what(x);

    ll y=abs(a[i+2]-a[i])+solve(i+2,a[i]);
   // cout<<i<<" "<<i+2<<endl;
   //what(x); what(y);
    x=min(x,y);



    return dp[i]=x;

}

int main()
{
    ll t;
    memset(dp,-1,sizeof dp);

    scn(n);
    fr(i,0,n)cin>>a[i];

    solve(0,a[0]);

    printf("%d\n",dp[0]);
    //what(cnt);
    //fr(i,0,n)cout<<dp[i]<<" ";

}



























Measured memory_bytes: 11212
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
vector<int> n(3);
cin >> n[0]  >> n[1] >> n[2];
sort(n.begin(), n.end());
cout<< (n == vector<int>{5, 5, 7} ? "YES" : "NO") << endl;
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>

using namespace std;
#define MAX 100

const int INF = (1<<21);
int mat[MAX][MAX] = {};
int n, d[MAX] = {};
bool c[MAX];

void bfs(int u){
    queue<int> p; 
    int now = 0;
    d[u] = now++;
    c[u] = true;

    p.push(u);
    while(!p.empty()){
        int x = p.front(); p.pop();
        for(int i = 0; i < n; i++){
            if(mat[x][i] && !c[i]){
                p.push(i);
                c[i] = true;
                d[i] = d[x]+1;
            }
        }
    }
}

int main(){
    cin >> n;
    
    for(int i = 0; i < n; i++){
        int x, k, y;
        cin >> x >> k;
        while(k-- > 0){
            cin >> y;
            mat[x-1][y-1] = 1;
        }
    }

    for(int i = 0; i < n; i++) d[i] = INF;
    
    bfs(0);

    for(int i = 0; i < n; i++){
        cout << (i+1) << " " << (d[i] == INF ? -1 : d[i]) << endl;
    }
    return 0;
}


Measured memory_bytes: 3052
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;
using pis = std::pair<int, std::string>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int h, n;
	cin >> h >> n;
	pii* ab = new pii[n];
	rep(i, n) cin >> ab[i].first >> ab[i].second;

	int* dp = new int[h + 1];
	rep(i, h+1) {
		dp[i] = _MOD;
		rep(j, n) {
			if (ab[j].first >= i) dp[i] = min(dp[i], ab[j].second);
			else dp[i] = min(dp[i], dp[i - ab[j].first] + ab[j].second);
		}
	}

	cout << dp[h] << "\n";

	return 0;
}


Measured memory_bytes: 3692
using System;

namespace AtCoder.Problems
{
    public class ProblemB
    {
        public static void Main(string[] args)
        {
            var s = new SolveB();
            s.Solve();
        }

        public class Scanner
        {
            private string[] _s;
            private int _i;
            private readonly char[] _separators = new char[] { ' ' };

            public Scanner()
            {
                _s = new string[0];
                _i = 0;
            }

            public string Next()
            {
                if (_i < _s.Length) return _s[_i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();
                _s = st.Split(_separators, StringSplitOptions.RemoveEmptyEntries);
                if (_s.Length == 0) return Next();
                _i = 0;
                return _s[_i++];
            }

            public int NextInt() => int.Parse(Next());
            public long NextLong() => long.Parse(Next());
            public ulong NextULong() => ulong.Parse(Next());
            public double NextDouble() => double.Parse(Next());

            public int[] GetIntArray(int n, int add = 0)
            {
                int[] array = new int[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextInt() + add;
                }
                return array;
            }

            public long[] GetLongArray(int n, long add = 0)
            {
                long[] array = new long[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextLong() + add;
                }
                return array;
            }

            public double[] GetDoubleArray(int n, double add = 0)
            {
                double[] array = new double[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextDouble() + add;
                }
                return array;
            }

            public string[] GetStringArray(int n)
            {
                string[] array = new string[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = Next();
                }
                return array;
            }
        }
    }

    public class SolveB
    {
        public void Solve()
        {
            var cin = new ProblemB.Scanner();
            var k = cin.NextInt();
            var s = cin.Next();

            var result = GetAnswer(k, s);
            Console.WriteLine(result);
        }

        public string GetAnswer(int k, string s)
        {
            if (s.Length <= k) { return s;}
            return $"{s.Substring(0,k)}...";
        }
    }
}


Measured memory_bytes: 27496
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <climits>
#include <array>
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)

using ll = long long;
using ull = unsigned long long;
constexpr ll mod = 1e9 + 7;
using namespace std;

int main() {

	int N, K; cin >> N >> K;
	int ans = 0;
	rep(i, N) {
		int h; cin >> h;
		if (h >= K)ans++;
	}

	cout << ans;

	return 0;

}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
int w,h,x,y,r,f;

scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);

f=0;
if(x+r>w)f=1;
if(y+r>h)f=1;
if(r>x)f=1;
if(r>y)f=1;

if(f==0)printf("Yes\n");
else printf("No\n");

return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ld long double
#define pb push_back
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define umap unordered_map
#define uset unordered_set
#define forz(i, n) for (ll i = 0; i < n; i++)
#define fore(i, m, n) for (ll i = m; i <= n; i++)
#define forr(i, n, m) for (ll i = n; i >= m; i--)
#define itor(it,x) for(auto it=x.begin();it!=x.end();it++)
#define itor2(it,x) for(auto it=x->begin();it!=x->end();it++)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define deci(n) fixed << setprecision(n)
#define setbits(n) __builtin_popcountll(n)
#define zrobits(n) __builtin_ctzll(n)
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define gcd __gcd
#define raunak ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define pv(v) forz(qaz,v.size()) cout<<v[qaz]<<" "; cout<<endl;
#define pa(arr,n) forz(qaz,n) cout<<arr[qaz]<<" "; cout<<endl;

#define oset tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

ll po(ll a,ll b,ll m){
    ll res=1;
    while(b>0){
        if(b&1) res=((res%m)*(a%m))%m;
        a=((a%m)*(a%m))%m;
        b>>=1;
    }
    return res;
}
ll modi(ll a,ll m){
    return po(a,m-2,m);
}
ll lcm(ll a, ll b){ 
    return (a*b)/(gcd(a, b));
}

/////////////////////(^_^)/////////////////////(^_^)/////////////////////(^_^)/////////////////////

int main(){
    raunak;
    ll a=1;
    cin>>a;
    p1(a+a*a+a*a*a);
    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll long long 

int n;
map<int,int>mp;

int main()
{
	
	std::ios::sync_with_stdio(false);cin.tie(0);
	int flag = 1;
	cin >> n;
	for(int i = 0; i < n; i++) {
		int x; cin >> x;
		if(mp[x]) flag = 0;
		else mp[x]++;
	}		
	if(flag) puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 9600
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll A;
  string tmpB;
  cin>>A>>tmpB;
  string tmpB1;
  for(int i=0;i<tmpB.size();++i) {
    if(tmpB[i]=='.') continue;
    tmpB1.push_back(tmpB[i]);
  }
  ll B = stoll(tmpB1);
  ll ans = A*B;
  cout<<ans/100<<endl;
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
#define Pos(i) cout<<(i?"Possible":"Impossible")<<endl
#define co(i) cout<<i<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
using namespace std;

ll gcd(ll a,ll b){
    if(a==0||b==0) return a+b;
    else if(a>=b) return gcd(a%b,b);
    else return gcd(a,b%a);
}
ll om(ll a,ll b){
    if(a<=0){
        return -((-a)/b);
    }else{
        return (a+b-1)/b;
    }
}
bool solve(ll a,ll b,ll c,ll d){
	if(a<b) return false;
	if(b>d) return false;
	ll g=gcd(d-b,b);
	ll k=om(c+1-a+b,g);
	return k*g>=-a+2*b;
}

int main(){
	int t; cin>>t;
	FOR(i,0,t){
		ll a,b,c,d; cin>>a>>b>>c>>d;
		Yes(solve(a,b,c,d));
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define LL long long 
#define pb push_back
#define ls rt<<1, l, m
#define rs rt<<1|1, m+1, r
#define mem(a, b) memset(a, b, sizeof(a))

const int N = 2e5 + 5;
int a[N];
map<LL,int>mp;
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	mp[0]++;
	LL sum = 0, ans = 0;
	for (int i = 1; i <= n; i++) {
		sum += a[i];
		ans += mp[sum];
		mp[sum]++; 
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 13568
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#define repN_1(i, n) for(int i = 0; i < (int)(n - 1); i++)
#define repM(i, n) for(int i = (int)(n - 1); i >= 0; i--)
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }


ll judge(vector<pair<ll, ll>> t, ll N, ll T)
{
	ll sum = 0;
	rep(i, N)
	{
		ll tmp;
		tmp = max(0ll, t[i].first - (T / t[i].second));
		sum += tmp;
	}

	return sum;
}

int main()
{
	ll N, K;
	vector<ll> A;
	vector<ll> F;
	vector<pair<ll, ll>> t;
	ll tmp;
	
	cin >> N >> K;

	rep(i, N) {
		cin >> tmp;
		A.push_back(tmp);
	}
	rep(i, N) {
		cin >> tmp;
		F.push_back(tmp);
	}

	sort(A.begin(), A.end());
	sort(F.begin(), F.end(), greater<ll>());

	rep(i, N)
		t.push_back(make_pair(A[i], F[i]));


	ll l = -1;
	ll r = 1e12;

	while (r - 1 > l)
	{
		ll i = (l + r) / 2;
		if (judge(t, N, i) <= K)
			r = i;
		else
			l = i;
	}

	cout << r << endl;

	return 0;
}

Measured memory_bytes: 10732
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int N;
    while(~scanf("%d",&N))
    {
        long long a[N+10];
        for(int i=0; i<N; i++) 
		scanf("%lld",&a[i]);
        sort(a,a+N);
        long long cnt=0,n,m;
        for(int i=N-1; i>0; i--)
        {
            if(a[i]==a[i-1])
            {
                cnt++;
				i--;
                if(cnt==1) 
				n=a[i];
                if(cnt==2)
				{
                    m=a[i];
                    break;
                }
            }
        }
        if(cnt==2) 
		printf("%lld\n",n*m);
        else 
        printf("0\n");
    }
    return 0;
}

Measured memory_bytes: 1024
N,M = map(int,input().split())
t = [[] for i in range(N)]
ans = []
for i in range(M): 
    p,y = map(int,input().split())
    t[p-1].append([y,i])
    ans.append('')
for i in range(N):
    t[i].sort(key=lambda x:x[0])
    for j in range(len(t[i])):
        ans[t[i][j][1]] = str(i+1).zfill(6)+str(j+1).zfill(6)
for i in range(M):
    print(ans[i])


Measured memory_bytes: 84256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int n;ll k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i=0;i<n;i++){
      cin >> a.at(i);
  }

  vector<int> s;
  vector<int> ord(n+1,-1);
  int c = 1;
  int l=0;
  {
    int v = 1;
    while (ord[v]== -1) {
      ord[v] = s.size();
      s.push_back(v);
      v = a[v-1];
    }
    c = s.size() - ord[v];
    l = ord[v];
  }

  if(k < l) 
    cout << s[k] << endl;
  else {
    k -= l;
    k %= c;
    cout << s[l+k] << endl;
  }
  return 0;
}


Measured memory_bytes: 5776
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int n, k;
  scanf("%d%d", &n, &k);
  printf("%d\n", (int)pow(k - 1, n - 1) * k);
  return 0;
}


Measured memory_bytes: 384
n = int(input())
s = ""
if n == 0:
    print("0")
else:
    while n != 1 and n != -1:
        if n % 2 == 1:
            s += "1"
        else:
            s += "0"
        n = (n//2)*(-1)
    if n == 1:
        s += "1"
    else:
        s += "11"
print(s[::-1])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define int long long

int sumofdigits(int x) {
  int sum = 0;
  while (x > 0) {
    sum += x % 10;
    x /= 10;
  }
  return sum;
}

signed main() {
  std::string s;
  std::cin >> s;
  
  std::string ret = "None";
  bool flag = false;
  for (int i = 97; i < 123; i++) {
    flag = false;
    for (int j = 0; j < s.size(); j++) {
      if (s.at(j) == i) {
        flag = true;
        break;
      }
    }
    if (!flag) {
      ret = {(char)i};
      break;
    }
  }
  std::cout << ret << '\n';
  
  return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"

using namespace std;

typedef long double ld;
typedef long long ll;

#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define f first
#define s second

template<typename T, typename U> bool ckmin(T &a, U b){ return b < a ? a = b, true : false; }
template<typename T, typename U> bool ckmax(T &a, U b){ return b > a ? a = b, true : false; }

int n;
vector<int> res;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    res.assign(n + 1, 0);
    for(int i = 1; i <= 100; ++i){
        for(int j = 1; j <= 100; ++j){
            for(int k = 1; k <= 100; ++k){
                int cur = i * i + j * j + k * k + i * j + i * k + j * k;
                if(cur <= n) res[cur]++;
            }
        }
    }
    for(int i = 1; i <= n; ++i) cout << res[i] << "\n";
    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

using namespace std;

typedef long long ll;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>pb_ds;

#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
#define pi pair<int,int>
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define mod 1000000007
#define pai acos(-1)
#define N 100005


int main ()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   string s;cin>>s;
   int sum=0;
   for(int i=0;i<s.size();i++){
      sum=(sum+s[i]-'0')%9;
   }
   if(sum) cout<<"No\n";
   else cout<<"Yes\n";
   return 0;
}



Measured memory_bytes: 3764
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        int n;
        n=sc.nextInt();
        int i=1;
        do{
            int x=i;
            if(i%3==0){
                System.out.print(" "+i);
            }else{
                while(true){
                    if(x%10==3){
                        System.out.print(" "+i);
                        break;
                    }
                    x/=10;
                    if(x!=0) continue;
                    else break;
                }
            }
        }while(++i<=n);
        System.out.println();
    }
}


Measured memory_bytes: 28780
#include <stdio.h>
#define num_element 150
int main(void)
{
	int i,n,m;
	char array[num_element];
	char a[2];
	char b[2];
	char input[2];
	while(1)
	{
		for(i=0;i<num_element;i++)
		{
			array[i] = i;
		}
		scanf("%d",&n);
		if(n == 0)return 0;
		for(i=0;i<n;i++)
		{
			scanf("%s %s",a,b);
			array[a[0]] = b[0];
		}
		scanf("%d",&m);
		for(i=0;i<m;i++)
		{
			scanf("%s",input);
			printf("%c",array[input[0]]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1008