akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}

int main() {
    long long a = 0, b = -1, c = 0;
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T') {
            a++;
        } else {
            c++;
            if (a > b) {
                b = a;
            }
            a = 0;
        }
    }
    if (c == 0) {
        cout << a << endl;
        return 0;
    }
    if (a > b){
        b = a;
    }
    cout << b << endl;
}

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

int count(int x, int y, vector<int> &L) {
  int left = x;
  int right = L.size();
  
  while (right - left > 1) {
    int mid = left + (right - left) / 2;
    if (L.at(mid) < y) left = mid;
    else right = mid;
  }
  
  return right - x - 1;
}

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  for (int i = 0; i < N; ++i) cin >> L.at(i);
  
  sort(L.begin(), L.end());
  int ans = 0;
  for (int i = 0; i < N - 2; ++i) {
    for (int j = i + 1; j < N - 1; ++j) {
      ans += count(j, L.at(i) + L.at(j), L);
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep**(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define out(x) cout<<x<<endl
#define put(x) out(x)
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;
const ll mod = 1000000007;

int main() {
string S;
  in(S);

  int nen = (S[0]-48)*1000+(S[1]-48)*100+(S[2]-48)*10+S[3]-48;
  int tuki = (S[5]-48)*10+(S[6]-48);
  int niti = (S[8]-48)*10+S[9]-48;
  bool f = true;
  if(nen<2019) f = false;
  else if(tuki<5) f = false;
  if(f) out("TBD");
  else out("Heisei");
}

Measured memory_bytes: 256
#include<stdio.h>
int a[200002],n,ans=200000000;
int main()
{
    scanf("%d",&n);
    while(getchar()!='\n');
    for(int i=1;i<=n;i++)a[i]=a[i-1]+(getchar()=='#');
    for(int i=0;i<=n;i++)if((a[i]<<1)+n-i-a[n]<ans)ans=(a[i]<<1)+n-i-a[n];
    printf("%d",ans);
}

Measured memory_bytes: 896
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int k = scan.nextInt();
    int q = scan.nextInt();

    int [] g = new int[n];
    for (int i=0;i<q;i++){
      int t = scan.nextInt();
      g[t-1] += 1;
    }

    for (int j=0;j<n;j++){
      if (k-q+g[j] > 0){
        System.out.println("Yes");
      }
      else{
        System.out.println("No");
      }
    }
  }
}


Measured memory_bytes: 60552
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<list>
#include<set>
#include<numeric>

#define MOD 1000000007

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

struct data {
	int mi_t;
	int mx_t;
	int c;
};
int t[210];
int d[210][2];
int dp[210][2];

int main()
{
	int D, N;
	struct data Data[210];
	cin >> D >> N;

	for (int i = 0; i < D; i++) 
		cin >> t[i];

	for (int i = 0; i < N; i++) 
		cin >> Data[i].mi_t >> Data[i].mx_t >> Data[i].c;

	for (int i = 0; i < 210; i++) {
		d[i][0] = -1;
		d[i][1] = 1000000000;
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < D; j++) {
			if (Data[i].mi_t <= t[j] && Data[i].mx_t >= t[j]) {
				d[j][0] = max(d[j][0], Data[i].c);
				d[j][1] = min(d[j][1], Data[i].c);
			}
		}
	}
	for (int i = 1; i < D; i++) {
		for (int j = 0; j < 2; j++) {
			dp[i][j] = max(abs(d[i - 1][0] - d[i][j]) + dp[i - 1][0],
				abs(d[i - 1][1] - d[i][j]) + dp[i - 1][1]);
		}
	}
	cout << max(dp[D-1][0],dp[D-1][1]) << endl;
	return 0;
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long LL;
int N,M;
vector<LL>G[200001];
vector<LL>C[200001];
LL pos[100001];
bool used[100001];

bool bfs(int x){
	if(used[x]==true)return true;
	used[x]=true;
	REP(i,G[x].size()){
		pos[G[x][i]]=pos[x]+C[x][i];
		bfs(G[x][i]);
	}
	return true;
}

int main(){
	cin>>N>>M;
	REP(i,N){
		used[i]=false;
		pos[i]=0;
	}
	REP(i,M){
		int L,R,D;
		cin>>L>>R>>D;
		L--;
		R--;
		G[L].push_back(R);
		C[L].push_back(D);
		G[R].push_back(L);
		C[R].push_back(-D);
	}
	
	
	REP(i,N){
		if(used[i]==false){
			bool c=bfs(i);
			if(c==false){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	
	bool c=false;
	REP(i,N){
		REP(j,G[i].size()){
			if(pos[G[i][j]]!=pos[i]+C[i][j]){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
	
    return 0;
}

Measured memory_bytes: 27520
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, p, q;
  int x = 1;
  cin >> N >> K;
  
  for (int i = 0; i < N; i++) {
 	p = x * 2;
    q = x + K;
    if ( p < q) {
      x = p;
    } else {
      x = q;
    }
   
  }
  cout << x << endl;
  
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
using ll = long long;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define rep(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288

int main(){
    double r;
    cin>>r;
    r*=2*Ma_PI;
    printf("%.10f\n",r);
    return 0;
}

Measured memory_bytes: 3784
#include<stdio.h>


int search(int A[],int n,int k){
  int i = 0;
  A[n]=k;
  while(A[i]!=k) i++;
  return i != n;
}


int main(){
  int i,A[10000+1],n,q,k,sum=0;

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&k);
    if(search(A,n,k)) sum++;
  }

  printf("%d\n",sum);

  return 0;
}





Measured memory_bytes: 2076
[a, b, c, d] = [int(i) for i in input().split()]

mi = min(c, d)
ma = max(c, d)

l = int(mi ** (1 / 2))
r = []
s = mi
for i in range(1, l + 1):
    if (mi % i == 0):
        r.append([i, mi // i])
ind = len(r)
for i in range(ind):
    if ((ma * r[i][0]) % mi == 0):
        s = r[i][0]
        break
if (s == mi):
    for i in range(ind):
        if ((ma * r[ind - 1 - i][1]) % mi == 0):
            s = r[ind - 1 - i][1]
            break

e = ma * s
cl = a // c + 1 if a % c != 0 else a // c
dl = a // d + 1 if a % d != 0 else a // d
el = a // e + 1 if a % e != 0 else a // e
ch = b // c
dh = b // d
eh = b // e

print(b - a - (ch - cl + dh - dl) + eh - el)


Measured memory_bytes: 3188
import os, sys, re, math

(N, M) = [int(n) for n in input().split()]

minC = 1
maxC = N
for i in range(M):
    (L, R) = [int(n) for n in input().split()]
    minC = max(minC, L)
    maxC = min(maxC, R)

print(max((maxC - minC + 1), 0))


Measured memory_bytes: 3188
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)




int main() {
    ll n;
    
    cin >> n;
    while(n){
        vector<string> s(n);
        REP(i, n){
            cin >> s[i];
        }
        
        vector<ll> p(n);
        for(ll i = 1; i < n; i++){
            ll c = 0;
            REP(j, s[i].size()){
                if(s[i][j] == '.'){
                    c++;
                }
                else{
                    break;
                }
            }
            p[i] = c;
        }
        
        for(ll i = 1; i < n; i++){
            s[i][p[i] - 1] = '+';
            
            bool f = false;
            for(ll j = i + 1; j < n; j++){
                if(p[i] > p[j]){
                    break;
                }
                
                if(p[i] == p[j]){
                    for(ll k = i + 1; k < j; k++){
                        s[k][p[i] - 1] = '|';
                    }
                    f = true;
                }
                if(f){
                    break;
                }
            }
            
            for(ll j = 0; j < p[i]; j++){
                if(s[i][j] == '.'){
                    s[i][j] = ' ' ;
                }
            }
        }
        
        REP(i, n){
            cout << s[i] << '\n';
        }
        
        cin >> n;
    }
}


Measured memory_bytes: 3692
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>
#include<queue>
#define MM 1000000007
using namespace std;

int main(void)
{
	int n,i,a[200000];
	long long mul,sum;
	scanf("%d",&n);
	for(i=0;i<n;i++)	scanf("%d",&a[i]);
	mul=0;	sum=a[0];
	for(i=1;i<n;i++)	{
		mul=mul+(long long)a[i]*sum;
		mul=mul%MM;
		sum=sum+a[i];
		sum=sum%MM;
	}
	printf("%lld\n",mul);
	return 0;
}

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

//#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;
using namespace std;

//template<typename T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef vector<int> vi;
typedef long long ll;

#define pb push_back
#define inf 0x3f3f3f3f
#define all(v) (v).begin() , (v).end()
#define ones(n) __builtin_popcount(n)
#define watch(x) cout << (#x) << " is " << (x) << endl

int di[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dj[] = {1, -1, 0, 0, -1, 1, 1, -1};


int main() {
//#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//#endif
    int a , b;
    cin >> a >> b;

    for(int i = 1 ; i <= 3 ; ++i){
        if((i * a * b) & 1){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long
using pi=pair<int,int>;
#define mp make_pair
const int mod = 1e9+7;

signed main(){
  int x,y;
  cin>>x>>y;
  int gx,gy;
  if(x==2)gx=0;
  else if(x<=7)gx=(x%2?2:1);
  else gx=(x%2?1:2);
  if(y==2)gy=0;
  else if(y<=7)gy=(y%2?2:1);
  else gy=(y%2?1:2);
  cout<<(gx==gy?"Yes":"No");
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod

set<int> find_divisor(int N){
    set<int> divisor;
    for(int i = 1; i * i <= N; i++) if(N % i == 0){
        divisor.insert(i);
        divisor.insert(N / i);
    }
    return divisor;
}

signed main(){

    int N, K; cin >> N >> K;
    vec A(N); cin >> A;

    int S = 0;
    REP(i, N) S += A[i];

    auto y = find_divisor(S);
    int ans = 1;
    vec B(N);
    for(int x: y){
        int p = 0, m = 0;
        REP(i, N) B[i] = A[i] % x;
        Sort(B);
        int i0 = 0, i1 = N - 1;
        int cnt = 0;
        while(i0 < i1){
            int M = min(B[i0], x - B[i1]);
            B[i0] -= M;
            B[i1] += M;
            cnt += M;
            if(B[i0] == 0) i0++;
            if(B[i1] == x) i1--;
        }
        bool f = true;
        REP(i, N) if(B[i] % x != 0) f = false;
        if(f && cnt <= K) Max(ans, x);
    }
    Out(ans);

    return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int read(){
	int x=0,w=1;
	char ch=0;
	while (ch<'0' || ch>'9'){
		  if (ch=='-') w=-1;
		  ch=getchar();
	}
	while (ch<='9' && ch>='0'){
		  x=(x<<1)+(x<<3)+ch-'0';
		  ch=getchar();
	}
	return x*w;
}
char s[100010]; 
int main(){
	scanf("%s",s);
	int k=strlen(s);
	for (int i=k;i>=1;--i){
		int l=k-i,r=i-1;
		int flag=1;
		for (int j=l;j<r;++j)
			if (s[j]!=s[j+1]){
				flag=0;
				break;
			}
		if (flag){
			printf("%d\n",i);
			break;	
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
using ld = long double;
#define dump(x) cout << #x << " = " << x << "\n";
#define SELECTOR(_1, _2, _3, SELECT, ...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__, _rep1, _rep0)(__VA_ARGS__)
#define _rep0(i, n) for (ll i = 0; i < n; ++i)
#define _rep1(i, k, n) for (ll i = k; i < n; ++i)
template <typename T> void vecout(const T &v) {
  for(auto it=v.begin();it!=v.end();++it,cout<<(it!=v.end()?" ":"\n")) {
    cout << *it;
  }
}

void solve() {
  // main coding
  ll n; cin>>n; // n:odd
  vector<ld> p(n+1);
  rep(i,n) cin>>p[i+1]; // 1-indexed
  // dp[i][j]: j枚まで投げてi枚が表の確率
  vector<vector<ld>> dp(n+1,vector<ld>(n+1,0));
  dp[0][0]=1;
  rep(i,n+1) rep(j,n+1) {
    if(i+1<=n && j+1<=n) {
      dp[i+1][j+1]+=dp[i][j]*p[j+1];
      dp[i][j+1]+=dp[i][j]*(1-p[j+1]);
    }
  }
  ld ans=0;
  rep(i,0,n+1) if(2*i>n) ans+=dp[i][n];
  cout<<ans<<"\n";
}

int main() {
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


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

int main(){
  int A,B,K; cin >> A >> B >> K;
  int rank = 0;
  for(int i=min(A,B);i>-1;i--){
   if(B%i==0 && A%i==0){
     rank++;
     if(rank==K){
       cout << i << endl;
       break;
     }
   }
  }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader std = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        while (true) {
            String str[] = std.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int w = Integer.parseInt(str[1]);
            if (h == 0 && w == 0) {
                break;
            }
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    sb.append("#");

                }
                sb.append("\n");

            }
            sb.append("\n");

        }
        System.out.print(sb);

    }
}

Measured memory_bytes: 25372
N = int(input())
A = [int(input()) for _ in range(N)]
_A = [-a for a in A]

def LIS(seq):
    import bisect
    dp = [seq[0]]
    for s in seq[1:]:
        if s >= dp[-1]:
            dp.append(s)
        else:
            dp[bisect.bisect_right(dp,s)] = s
    return len(dp)
assert(LIS([2,2,1,4,1,5,1,1,1])==5)

print(LIS(_A))
    

Measured memory_bytes: 58840
#include<stdio.h>
int main(){
  int unused __attribute__((unused));
  char X, Y;
  unused = scanf("%c %c", &X, &Y);

  if((int)X < (int)Y) printf("<");
  else if((int)X > (int)Y) printf(">");
  else printf("=");

  return 0;
}

Measured memory_bytes: 128
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

T_1 = T - 0.006 * int(H[0])
diff = abs(T_1 - A)
index = 1
for i in range(1, N):
    T_new = T - 0.006 * int(H[i])
    diff_new = abs(T_new - A)
    if diff_new < diff:
        diff = diff_new
        index = i + 1
        
print(index)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int k,a,b,count=0;
  cin>>k>>a>>b;
  for(int i=a;i<=b;i++)
  {
    if(i%k==0){
    count++;
    break;
    }
    
  }
  if(count==1)
  cout<<"OK"<<endl;
  else
  cout<<"NG"<<endl;
}

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

int main() {
  int n, l;
  cin >> n >> l;
  string s[n];
  for (int i=0; i<n; i++) cin >> s[i];
  sort(s, s+n);
  string ans = "";
  for (int i=0; i<n; i++) ans += s[i];
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mood) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mood;
		}
		x = x * x % mood;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

long double getRadian(double x, double y, double x2, double y2) {
	double radian = atan2(y2 - y, x2 - x);
	return radian;
}

long double a, b, x;
long double xx;
long double ra;

signed main() {
	cin >> a >> b >> x;
	xx = a * a * b - x;
	if (xx >= x) {
		ra = getRadian(0, 0, 2 * x / a / b, b);
	}
	else ra = getRadian(0, 0, a, 2 * xx / a / a);
	printf("%.10Lf", ra * 180.0 / pie);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
	using namespace std;
const int N=100010;
int n;
long long k[N];
long long s[N];
struct dd{
	long long a,bh;
}a[N];
bool cmp(dd a,dd b){
	return a.a<b.a || (a.a==b.a && a.bh<b.bh);
}
long long tot=0;
long long mn=~0u>>1;
int main(){
	cin>>n;
	for (int i=1;i<=n;i++) {
		cin>>a[i].a;
		a[i].bh=i;
	}
	sort(a+1,a+n+1,cmp);
	for (int i=n;i>=1;i--) {
		tot++;
		mn=min(mn,a[i].bh);
		if (a[i-1].a!=a[i].a) 
			k[mn]+=tot*(a[i].a-a[i-1].a);
		
	}
	for (int i=1;i<=n;i++) cout<<k[i]<<endl;
	return 0;
}

Measured memory_bytes: 3456
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sca = new Scanner(System.in);

		int l = sca.nextInt();

		double i = l/3.0;
		double j = l/3.0;
		double k = l/3.0;
		double max = i*j*k;
		BigDecimal bd = new BigDecimal(max);

		System.out.println(bd.setScale(8, RoundingMode.DOWN));

		// 後始末
		sca.close();
	}
}

Measured memory_bytes: 22484
n, m = map(int, input().split())
a = set([int(input()) for _ in range(m)])

mod = 10**9+7

dp = [0] * -~n
dp[0] = 1
dp[1] = 0 + (1 not in a)

for i in range(2, -~n):
    if i in a:
        continue
    dp[i] = (dp[i - 1] + dp[i - 2]) % mod

print(dp[n])

Measured memory_bytes: 56664
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	while(1)
	{
		bool k = 0;
		for(int i=2;i*i<=n;i++) if(!(n%i)) {
			k = 1;
			break;
		}
		if(!k) cout<<n,exit(0);
		n++;
	}
}

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

//#pragma gcc optimize("O3,unroll-loop")
//#pragma gcc target("sse,sse2,sse3,ssse3,sse4,avx,avx2,fma,abm,mmx,popcnt,tune=native")
//#define int long long
//#define double long double

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

    string s, t;
    cin >> s >> t;
    if (s == t.substr(0, t.size() - 1))
        cout << "Yes\n";
    else
        cout << "No\n";

    return 0;
}

//      *   *  *****  *   *  *   *
//     *   *  *      **  *  *   *
//    *****  *****  * * *  *   *
//   *   *      *  *  **  *   *
//  *   *  *****  *   *   ***

//      ***** ***** *   * *     ***** *   * ***** *****
//        *  *   * *   * *       *   **  *   *   *   *
//       *  *   * ***** *       *   * * *   *   *****
//   *  *  *   *   *   *       *   *  **   *   *
//  ****  *****   *   ***** ***** *   *   *   *


Measured memory_bytes: 3652
h, w = map(int, input().split())

S = [[x for x in str(input())] for _ in range(h)]
S.append(['/']*w)
S.insert(0, ['/']*w)

for i in range(h+2):
    S[i].append('/')
    S[i].insert(0, '/')

ans = [[] for _ in range(h)]

for i in range(1, h+1):
    for j in range(1, w+1):
        count = 0
        if S[i][j] == '#':
            ans[i-1].append('#')
        else:
            count += S[i-1][j-1:j+2].count('#')
            count += S[i][j-1:j+2].count('#')
            count += S[i+1][j-1:j+2].count('#')
            ans[i-1].append(str(count))

for k in range(h):
    print(''.join(ans[k]))
    

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

const int MAXN = 55555;

bool prime[MAXN];

int main(){

    int n;

    memset(prime, 1, sizeof(prime));
    for(int i = 2; i * i <= MAXN; i++) if(prime[i]) for(int j = i * i; j <= MAXN; j += i) prime[j] = 0;

    cin >> n;
    for(int i = 2; i <= MAXN && n; i++){
        if(prime[i] && i % 5 == 1){
            cout << i << ' ';
            n--;
        }
    }
    // for(int i = 2; i <= MAXN; i++){
    //     if(prime[i]){
    //         cout << i << ' ';
    //         n--;
    //         if(n) continue;
    //         else break;
    //     }
    // }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 998244353LL

bool dbgflag = false;


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(15);
  
  char c;
  cin >> c;
  if (('a' <= c) && (c <= 'z')) {
    cout << "a"  << endl;
    return 0;
  }
  cout << "A" << endl;

}


Measured memory_bytes: 3648
//naveen mall
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb               push_back
#define sz(c)            (int)c.size()
#define len(c)           (int)c.length()
#define vec              vector
#define int              long long int
#define all(c)           c.begin(), c.end()
#define rall(c)          c.rbegin(), c.rend()
#define trav(a,i)        for(auto i: a)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define invect(v,n)       for(int i=0;i<n;i++ ){int arb;cin>>arb;v.pb(arb);}
#define inset(s,n)        fl(i,0,n){int aset;cin>>aset;s.insert(aset);}
#define display(c)        trav(c,i) cout<<i<<" ";cout<<"\n";
#define F                 first
#define S                 second
#define pii               pair<int,int>
#define PB                pop_back
#define endl              "\n"
#define what(x) cerr <<	 #x << " is " << x << endl;
int sum() { return 0; }template<typename T,typename... Args>T sum(T a, Args... args) { return a + sum(args...); }
#define p   200005



  
void solve()
{   

int x,y,z;
cin>>x>>y>>z;
cout<<z<<" "<<x<<" "<<y;













}
signed main()
{fast
	int t;
	//cin>>t;
	t=1;
	while(t--)
	{
solve();}
  
}












Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO.Pipes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder {
    class RangeSet {
        const long MOD = 1000000007L;

        static void Main(string[] args) {
            var parts = Console.ReadLine().Split(' ');
            int N = int.Parse(parts[0]);
            int A = int.Parse(parts[1]);
            int B = int.Parse(parts[2]);
            if (A>B) {
                int tmp = A;
                A = B;
                B = tmp;
            }

            long ans = 1;
            for (int i = 0; i < N; i++) {
                ans = (2 * ans) % MOD;
            }

            long[][] dp1 = new long[N + 1][];
            for (int i = 0; i <= N; i++) {
                dp1[i] = new long[2];
            }

            dp1[1][1] = 1;
            for (int len = 1; len < N; len++) {
                dp1[len + 1][1] += dp1[len][0] + dp1[len][1];
                dp1[len + 1][1] %= MOD;

                for (int zLen = A; len + zLen <= N; zLen++) {
                    dp1[len + zLen][0] += dp1[len][1];
                    dp1[len + zLen][0] %= MOD;
                }
            }

            long[][] dp2 = new long[N + 1][];
            for (int i = 0; i <= N; i++) {
                dp2[i] = new long[2];
            }

            dp2[0][0] = 1;
            dp2[0][1] = 1;
            for (int oLen = 1; oLen < B; oLen++) {
                dp2[oLen][1] = dp1[oLen][0];
            }

            for (int len = 0; len < N; len++) {
                for (int zLen = 1; zLen < A && len + zLen <= N; zLen++) {
                    dp2[len + zLen][0] += dp2[len][1];
                    dp2[len + zLen][0] %= MOD;
                }
                for (int oLen = 1; oLen < B && len + oLen <= N; oLen++) {
                    dp2[len + oLen][1] += dp2[len][0] * dp1[oLen][1];
                    dp2[len + oLen][1] %= MOD;

                    if (len + oLen == N) {
                        dp2[len + oLen][1] += dp2[len][0] * dp1[oLen][0];
                        dp2[len + oLen][1] %= MOD;
                    }
                }
            }

            ans -= dp2[N][0] + dp2[N][1];
            ans = (ans + 2 * MOD) % MOD;
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 18352
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define REP(i,a,n) for(int i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;

int T;
int t[10];

bool solve(){
  int left=0,right=0;
  rep(i,10){
    if(t[i] < left && t[i] < right) return false;
    if(t[i] > left){
      if(t[i] > right && left < right){
        right = t[i];
      }
      else{
        left = t[i];
      }
    }
    else{
      right = t[i];
    }
  }
  return true;
}

int main(){
  cin>>T;
  while(T--){
    rep(i,10){
      cin>>t[i];
    }
    cout<<(solve() ? "YES" : "NO")<<endl;
  }
}

Measured memory_bytes: 0
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7

N = int(input())
sumt = suma = 0

for i in range(N):
	nt,na = map(int,input().split())
	if i==0:
		sumt = nt
		suma = na
	else:
		timest = (sumt-1)//nt+1
		timesa = (suma-1)//na+1
		times = max(timest,timesa)
		sumt = nt * times
		suma = na * times

print(sumt+suma)

Measured memory_bytes: 3948
import java.util.*;

public class Main{
	public static String solve(char[][] map, boolean[][] record, int[] now){
		while( map[now[0]][now[1]] != '.' ){
			if( record[now[0]][now[1]] == true ){
				return "LOOP";
			}
			record[now[0]][now[1]] = true;
			if( map[now[0]][now[1]] == '>' ){
				++now[1];
			} else if( map[now[0]][now[1]] == '<' ){
				--now[1];
			} else if( map[now[0]][now[1]] == '^' ){
				--now[0];					
			} else if( map[now[0]][now[1]] == 'v' ){
				++now[0];				
			}
								
		}
		return Integer.toString(now[1]) + " " + Integer.toString(now[0]);
	}
	
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		List<String> result = new ArrayList<String>();
		
		String str;
		while( !(str = stdIn.nextLine()).equals("0 0") ){
			int H, W;
			String[] s = str.split(" ");
			H = Integer.parseInt(s[0]); W = Integer.parseInt(s[1]);
			char[][] map = new char[H][W];
			boolean[][] record = new boolean[H][W];
			int[] now = new int[2];
			for(int i = 0; i < H; i++){
				String data = stdIn.next();
				map[i] = data.toCharArray();
			}
			result.add(solve(map,record,now));
			stdIn.nextLine();				
		}
		
		for(String ans : result){
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    double r, g;
    cin >> r >> g;

    cout << g * 2 - r  << endl;

    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn main() {
    let n: i64 = read();
    let a: Vec<i64> = (0..n).map(|_| read::<i64>()).collect();
    let sum: i64 = a.iter().sum();
    let mut ok = true;
    if (sum * 2) % (n * (n + 1)) == 0 {
        let k: i64 = (sum * 2) / (n * (n + 1));
        for i in 0..n as usize {
            if a[i] < k || k * n < a[i] {
                ok = false;
            }
            let d: i64 = a[((i + 1) as i64 % n) as usize] - a[i];
            if (d + k * (n - 1)) % n != 0 {
                ok = false;
            }
        }
    } else {
        ok = false;
    }
    println!("{}", if ok { "YES" } else { "NO" });
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


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

int main() {
  
  string S, T; cin >> S >> T; int count = 0;
  
  for (int i = 0; i < S.size(); i++) {
    
    if (S.at(i) != T.at(i)) count++;
    
  }
  
  cout << count << endl;
  
}

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

const int N = 100010;

int n, m;
int p[N];//, size[N];

int find(int x)
{
    if (p[x] != x) p[x] = find(p[x]);
    return p[x];
}

int main()
{
    cin >> n >> m;

    for (int i = 1; i <= n; i ++ )
    {
        p[i] = i;
       // size[i] = 1;
    }
    int cnt =n;

    while (m -- )
    {
        string op;
        int a, b;
        //cin >> op;

     //   if (op == "C")
      //  {
            cin >> a >> b;
            a = find(a), b = find(b);
            if (a != b)
            {
                p[a] = b;
           //     size[b] += size[a];
                cnt --;
            }

      /*  else if (op == "Q1")
        {
            cin >> a >> b;
            if (find(a) == find(b)) puts("Yes");
            else puts("No");
        }
        else
        {
            cin >> a;
            cout << size[find(a)] << endl;
        }*/
    }
    printf("%d\n",cnt-1);

    return 0;
}


Measured memory_bytes: 4108
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

signed main(){
    int n;
    cin >> n;

    vector<int> a(n);
    rep(i, n) cin >> a[i];

    vector<int> s(n);
    s[0] = a[0];
    for(int i = 1; i < n; i++){
        s[i] = s[i-1] + a[i];
    }
    sort(s.begin(), s.end());
    int x = s[0];
    int c = 0;
    int ans = 0;

    rep(i, n){
        if(x == s[i]){
            c++;
        }else{
            if(x == 0){
                ans += c;
            }
            ans += c * (c - 1) / 2;
            x = s[i];
            c = 1;
        }
    }
    if(x == 0){
        ans += c;
    }
    ans += c * (c - 1) / 2;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    string S,T; cin >> S >> T;
    bool found = true;
    set<string> HIT;
    for (int i = 0; i < S.size(); i++) {
        found = true;
        for (int j = 0; j < T.size(); j++) {
            char c = S[i+j];
            if (!(c == '?' || c == T[j])) {
                found = false;
                break;
            }
        }
        if (found) {
            string news = S.substr(0, i) + T + S.substr(i + T.size(), S.size() - (i + T.size()));
            rep(i,news.size()) if (news[i] == '?') news[i] = 'a';
            HIT.insert(news);
        }
    }
    if (HIT.size() > 0) {
        cout << *begin(HIT) << endl;
    } else {
        cout << "UNRESTORABLE" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll              long long int
#define int             ll
#define ff              first
#define ss              second
#define pb              emplace_back
#define mpair           make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define sbits(x)      __builtin_popcountll(x)
#define zbits(x)      __builtin_popcountlliltin_ctzll(x)
#define w(t)            int t;cin>>t;while(t--)
#define uset            unordered_set
#define dor(i, a, b)    for(int i =(a);i<=(b);i++)
#define mem(a,val)      memset((a),(val),sizeof((a))); 
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
    template <typename Arg1>
     void __f(const char* name,Arg1&& arg1){
        cout<<name<<" : "<<arg1<<std::endl;
     }
     template <typename Arg1, typename... Args>
     void __f(const char* names,Arg1&& arg1,Args&&... args){
        const char* comma = strchr(names+1 ,',');
        cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
     }
#else
#define trace(...)
#endif
/*     
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
*/
double pi = 2.0*acos(0);
void fast(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout<<fixed<<setprecision(10);}
int max2(int a,int b){ if(a>b) return a;return b;}
int min2(int a,int b){ if(a<b)return a;return b;}
int max3(int a,int b,int c){ return max2(a,max2(b,c));}
int min3(int a,int b,int c){ return min2(a,min2(b,c));}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////



void solve()
{
  int a,b,c;
  cin>>a>>b>>c;
  if((a==b && a!=c) ||(b==c && b!=a)||(c==a && b!=c))
  cout<<"Yes"<<endl;
  else
  cout<<"No"<<endl;  
}

signed main(void)
{
      fast();
      //w(t)
      solve();

}


Measured memory_bytes: 256
/*######################################################
#########~~~~~####~~~~###~~##~~##~~##~~##~~##~~#########
#########~~##~~##~~##~~##~~~#~~##~~~#~~##~~##~~#########
#~~~~~~##~~~~~###~~~~~~##~~#~~~##~~#~~~##~~##~~##~~~~~~#
#########~~######~~##~~##~~##~~##~~##~~##~~##~~#########
#########~~######~~##~~##~~##~~##~~##~~###~~~~##########
######################################################*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define str string
#define rtn return
#define endl '\n'
#define f first
#define s second
#define pb push_back
#define db long double
#define Mod 1000000007
#define nu 100005
#define inf 2e18
#define eps 1e-15
#define pll pair <ll, ll>
#define vi vector<ll>
#define fill(a,v) memset(a,v,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loop1(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,b) for(ll i=0;i<b;i++)
#define pool(i,a,b) for(ll i=b-1;i>=a;i--)
#define per(i,a) for(ll i=(a-1);i>=0;i--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " = " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " = " << arg1<<" |";
  __f(comma+1, args...);
}
#else
#define trace(...)
#endif

//

int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  //start
  int n;
  cin >> n;
  n = 2 * n;
  vi a;
  rep (i, n) {
    int c;
    cin >> c;
    a.pb(c);
  }
  sort(all(a));
  int ans = 0;
  rep (i, n) {
    ans += a[i];
    ++i;
  }
  cout << ans << endl;
  rtn 0;
}


Measured memory_bytes: 256
#include <iostream>

int main(void) {
  int limit = 1;
  int max_square = 1;
  std::cin >> limit;
  for(int i = 1; i*i <= limit; i++) {
    max_square = i * i;
  }
  std::cout << max_square << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

#define dump1(v) for(auto i:v) std::cout << i << ' '; std::cout << "\n";
#define dump2(v) for(auto i:v) { for(auto j:i) std::cout << j << ' '; std::cout << "\n"; }


signed main() {
	std::string s,t;
	std::cin >> s >> t;

	int n = s.size();
	int m = t.size();
	std::vector<int> As(n+1,0);
	std::vector<int> Bs(n+1,0);
	std::vector<int> At(m+1,0);
	std::vector<int> Bt(m+1,0);

	rep(i,n) {
		As[i+1] = As[i];
		if(s[i]=='A') As[i+1]++;
		Bs[i+1] = Bs[i];
		if(s[i]=='B') Bs[i+1]++;
	}
	rep(i,m) {
		At[i+1] = At[i];
		if(t[i]=='A') At[i+1]++;
		Bt[i+1] = Bt[i];
		if(t[i]=='B') Bt[i+1]++;
	}

	int q;
	std::cin >> q;
	rep(i,q) {
		int a,b,c,d;
		std::cin >> a >> b >> c >> d;
		a--;b--;c--;d--;
		int sAc = As[b+1]-As[a];
		int sBc = Bs[b+1]-Bs[a];

		if( ( ( (As[b+1]-As[a]) - (Bs[b+1]-Bs[a]) )%3+3)%3 == ( ( (At[d+1]-At[c]) - (Bt[d+1]-Bt[c]) )%3+3)%3 ) print("YES");
		else print("NO");
	}
	return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
    int N;
    cin >> N;
    vector<int> A(N, 0);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    sort(A.begin(), A.end(), greater<int>());
    
    int Alice = 0;
    int Bob = 0;
    bool flag = false;
    for (int i = 0; i < A.size(); i++) {
        if (!flag) {
            Alice += A[i]; 
        }else{
            Bob += A[i];
        }
        flag = !flag;
    }
    cout << Alice - Bob << endl;
}

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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main()
        {
            var read = Console.ReadLine();
            var read2 = Console.ReadLine();

            int length = read.Length;
            int length2 = read2.Length;

            string output = "";

            if (length == length2)
            {
                for (int c = 0; c < length2; c++)
                {
                    output += read[c];
                    output += read2[c];
                }


            }
            else
            {
                for (int c = 0; c < length2; c++)
                {
                    output += read[c];
                    output += read2[c];
                }
                output += read[length2++];
            }
            Console.WriteLine(output);
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
main()
{
    int x,y,a,b,i;
    cin>>x>>y;
    for(i=0;i<=x;i++)
    {
        if((i*2+(x-i)*4)==y)
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
}



Measured memory_bytes: 3592
#include <iostream>

int main() {
  int a, b, c, d;
  std::cin >> a >> b >> c >> d;
  bool first_win = true;
  bool turn = false;
  while (a > 0 && c > 0) {
    if (!turn) c -= b;
    else a -= d;
    if (a <= 0) first_win = false;
    else if (c <= 0) first_win = true;
    turn = !turn;
  }
  if (first_win) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
  return 0;
}


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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pll> P;
const ll INF = 1ll<<30;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int main() {
	ll x, a, b;
	cin >> x >> a >> b;
	
	if (a >= b) puts("delicious");
	else {
		if (b - a <= x) puts("safe");
		else puts("dangerous");
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (int argc, const char * argv[]) {
    double data;
	double high;
	double low;
	double sa;
	int i;
	
	high = 0;
	low = 0;
	sa = 0;
	i = 0;
	
	while (scanf("%lf", &data) != EOF) {
		if (high < data) {
			high = data;
		}
		else if (low > data) {
			low = data;
		}
		if (i == 0) {
			low = data;
			i++;
		}
	}
	sa = high - low;
	printf("%.1f\n", sa);
	
    return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <stack>
#include <queue>
using namespace std;

int n;
int r;
int p;
int c;

int main() {
  while (1) {
    scanf("%d%d", &n, &r);
    if (n == 0 && r == 0) return 0;

    stack<int> st;
    for (int i=1; i<=n; i++) {
      st.push(i);
    }

    while (r--) {
      stack<int> st2, st3;

      scanf("%d%d", &p, &c);
      for (int i=0; i<p-1; i++) {
        int t = st.top(); st.pop();
        st2.push(t);
      }

      for (int i=0; i<c; i++) {
        int t = st.top(); st.pop();
        st3.push(t);
      }

      while (!st2.empty()) {
        int t = st2.top(); st2.pop();
        st.push(t);
      }

      while (!st3.empty()) {
        int t = st3.top(); st3.pop();
        st.push(t);
      }
    }

    printf("%d\n", st.top());
  }
}

Measured memory_bytes: 2624
s = list(input())
n = len(s)
a = ['0'] * n
b = ['0'] * n
for i in range(n):
    if i % 2 ==1:
        a[i] = '1'
    else:
        b[i] = '1'

cnt_a, cnt_b = 0, 0
for i in range(n):
    if s[i] != a[i]:
        cnt_a += 1
    if s[i] != b[i]:
        cnt_b += 1
print(min(cnt_a, cnt_b))

Measured memory_bytes: 11212
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    int H,N;
  	int check=0;
    cin >> H >>N;
    REP(i,N){
        int a;cin>>a;
        check +=a;
    }
    if(check>=H){
        cout << "Yes"<< endl;
    }
    else{
        cout <<"No" << endl;
    }
}
    

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

int main() {
  int N; 
  cin >> N;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    if ((i + 1) % 2 == 1 && A % 2 == 1) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
/*
	Swamy Saranam

	Date	: 14/09/2016 22:25:16
	Author	: Krishna Mohan A M
	Problem	:
	Status	:
*/
#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

typedef long long ll;
typedef pair<int,int>	pii;
typedef pair<ld,ld>	pdd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef pair<ll,ll> pl;

#define FASTIO          ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define FOR(i,a,b)		for(int i=(a);i<(b);i++)
#define REP(i,n)		FOR(i,0,n)
#define SORT(v)			sort((v).begin(),(v).end())
#define UN(v)			SORT(v),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define CL(a,b)			memset(a,b,sizeof a)
#define pb				push_back
#define x               first
#define y               second
#define endl            "\n"
#define sendl           " \n"

const int mod = 1000000007;
bool n, s, e, w;
string st;

int main()
{
    FASTIO
    cin>>st;
    n = s = e = w = false;
    for(auto i : st){
      //cout<<i<<endl;
      if(i=='N')
        n = true;
      else if(i=='S')
        s = true;
      else if(i=='E')
        e = true;
      else if(i=='W')
        w = true;
    }
    if((e&&w&&!n&&!s) || (n&&s&&e&&w) || (n&&s&&!e&&!w))
      cout<<"Yes\n";
    else
      cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <set>
using namespace std;

int main(){
  // 入力
  int N, K;
  cin >> N >> K;

  int d[100];
  int A[100][100];
  int count[100];
  set<int> st;
  for (int i=0; i<K; i++) {
    cin >> d[i];
    for (int j=0; j<d[i]; j++) {
      int tmp;
      cin >> tmp;
      st.insert(tmp);
    }
  }

  int result = 0;
  for (int i=1; i<=N; i++) {
    // cout << i << " " << st.count(i) << endl;
    if (st.count(i) == 0) {
      result++;
      
    }
  }

  cout << result << endl;
  return 0;
}

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

int main(int argc, char const *argv[])
{
	int n; cin >> n;
	vector<tuple<string, int, int>> v;
	rep(i, n){
		string s; int p; cin >> s >> p;
		v.push_back(make_tuple(s, -p, i + 1));
	}
	sort(v.begin(), v.end());

	for (auto u : v) {
		string a; int b, c;
		tie(a, b, c) = u;
		cout << c << endl;
	}

	return 0;
}

Measured memory_bytes: 256