akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>

using namespace std;

int main(){
	string s; cin >> s;
	bool f[26] = {};
	for(int i = 0; i < s.length(); i++) f[s[i] - 'a'] = 1;
	int res = 26;
	for(int i = 0; i < 26; i++) if(!f[i]){
		res = i; break;
	}
	if(res == 26) cout << "None" << endl;
	else cout << (char)('a' + res) << endl;
	return 0;
}

Measured memory_bytes: 512
#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);
  }
int count=0;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(i<j){
      count=count+A.at(i)*A.at(j);
      }
   }
  }
  cout<<count<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int A,B,C,K;
cin >> A >> B >> C >> K;
if(A >= K){
cout << K << endl;}
if(A < K && K <= (A + B)){
cout << A << endl;}
if((A + B) < K && K <= (A + B + C)){
cout << A - (K - A - B) << endl;}

}

Measured memory_bytes: 3672
#include <iostream>
#include <string>
typedef long long LL;

int main() {
  std::string S; std::cin >> S;
  LL cnt = 0;
  int num_B = 0;
  for (char c : S) {
    if (c == 'B') ++num_B;
    else cnt += num_B;
  }
  std::cout << cnt << std::endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int sum_w[200005];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N;
    string S;
    cin >> N >> S;
    int cnt_w = 0;
    for(int i = 0; i < N; i++){
        if(S[i] == 'R') {
            cnt_w++;
        }
    }
    int ans = 0;
    for(int i = 0; i < cnt_w; i++){
        if(S[i] == 'W') {
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3776
import java.math.*;
import java.util.*;

class Main{
	static Scanner s=new Scanner(System.in);
	public static void main(String[] $){
		int n=s.nextInt(),a=s.nextInt(),b=s.nextInt();
		long[] v=new long[n];
		Arrays.setAll(v,i->s.nextLong());
		Arrays.sort(v);
		long sum=0;
		int use=0,count=0;
		for(int i=n-a;i<n;++i){
			if(v[n-a]==v[i]){
				++use;
				++count;
			}
			sum+=v[i];
		}
		System.out.println(BigDecimal.valueOf(sum*1.0/a).toPlainString());
		for(int i=0;i<n-a;++i)
			if(v[n-a]==v[i])
				++count;
		
		System.err.println(count+" "+use);
		if(v[n-a]==v[n-1]){
			long r=0;
			for(int i=0,e=Math.min(b-a,count-use);i<=e;++i)
				r+=comb(count,use+i);
			System.out.println(r);
		}else{
			System.out.println(comb(count,use));
		}
	}
	static long comb(int count,int use){
		long r=1;
		for(int i=use+1;i<=count;++i){
				r*=i;
				r/=i-use;
		}
		return r;
	}
}


Measured memory_bytes: 28756
//Between a and b ...

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using garph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int a,b,x;cin>>a>>b>>x;
    int ans=ans=b/x-a/x+(a%x==0);
    cout<<ans<<nnn;
    return 0;
}

Measured memory_bytes: 3548
using System;

namespace A___Rotation
{
    class Program
    {
        static void Main(string[] args)
        {
            var b = Console.ReadLine();
            var a = Console.ReadLine();
            if (b[0] == a[2] && b[1] == a[1] && b[2] == a[0])
            {
                Console.WriteLine("YES");
            }
            else
                Console.WriteLine("NO");
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

ll mod = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	string s, t;
	cin >> s >> t;
	int n = s.size(); int m = t.size();
	vector<int> scnt(n + 1); 
	vector<int> tcnt(m + 1);
	for (int i = 0; i < n; i++) {
		if (s[i] == 'A') scnt[i + 1] = scnt[i] + 1;
		else scnt[i + 1] = scnt[i];
	}
	for (int i = 0; i < m; i++) {
		if (t[i] == 'A') tcnt[i + 1] = tcnt[i] + 1;
		else tcnt[i + 1] = tcnt[i];
	}
	int q; cin >> q;
	rep(_, q) {
		int ls, rs, lt, rt;
		cin >> ls >> rs >> lt >> rt;
		int as = scnt[rs] - scnt[ls - 1];
		int bs = rs - ls + 1 - as;
		int at = tcnt[rt] - tcnt[lt - 1];
		int bt = rt - lt + 1 - at;
		if ((as + bt) % 3 == (at + bs) % 3) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

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

//ofstream outputfile("test.txt");
int main(){
    //outputfile.close();
    int n;
    string t[10];
    t[1] = ".,!? ";
    t[2] = "abc";
    t[3] = "def";
    t[4] = "ghi";
    t[5] = "jkl";
    t[6] = "mno";
    t[7] = "pqrs";
    t[8] = "tuv";
    t[9] = "wxyz";
    int cc=0;
    while(cin>>n){
        cc++;
        string s[n];
        string ans="";
        int cnt=0;
        for(int i=0;i<n;i++)cin>>s[i];
        for(int i=0;i<n;i++){
            ans="";
            //if(s[i][i]=='0')break;
            for(int j=0;j<s[i].length()-1;j++){
                cnt=0;
                bool fl = false;
                while(1){
                    if(s[i][j]=='0'){
                        j++;
                        if(j>(s[i].length()-1)){
                            fl=true;
                            break;
                        }
                        continue;
                    }
                    if(s[i][j]==s[i][j+1]){
                        cnt++;j++;
                    }
                    if(s[i][j+1]=='0'){
                        break;
                    }
                }
                if(fl)break;
                int tmp = s[i][j]-'0';
                ans += t[tmp][(cnt)%t[tmp].length()];
                j++;
            }
        cout<<ans<<endl;
        }
        if(cc==n)break;
    }
}


Measured memory_bytes: 3220
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <string>
#include <deque>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <assert.h>
typedef long long ll;
using namespace std;

const int MOD = 998244353;
const int mxn = 200000;
int dX1[4] = { 0, 0, -1, 1 };
int dY1[4] = { -1, 1, 0, 0 };
int dX2[8] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int dY2[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };

class SegTree {
public:
	int N;
	vector<int> arr;
	int tree[mxn << 2];
	int lazy[mxn << 2];
	SegTree() : tree{0}, lazy{0} {}

	void init(int N, vector<int>& arr) {
		this->N = N;
		this->arr = arr;
		build(1, 0, N);
		for (int i = 0; i < N << 2; i++) {
			lazy[i] = N;
		}
	}

	void build(int idx, int l, int r) {
		if (r - l < 2) {
			tree[idx] = arr[l]; return;
		}
		int mid = (l + r) / 2;
		build(2 * idx, l, mid);
		build(2 * idx + 1, mid, r);
		tree[idx] = min(tree[2 * idx], tree[2 * idx + 1]);
	}

	void change(int idx, int val) {
		tree[idx] = min(tree[idx], val);
		lazy[idx] = min(lazy[idx], val);
	}

	void push(int idx) {
		if (lazy[idx] != N) {
			change(2 * idx, lazy[idx]);
			change(2 * idx + 1, lazy[idx]);
			lazy[idx] = N;
		}
	}

	void update(int x, int y, int val, int idx, int l, int r) {
		if (x >= r || l >= y) return;
		if (x <= l && r <= y) {
			change(idx, val); return;
		}
		push(idx);
		int mid = (l + r) / 2;
		update(x, y, val, 2 * idx, l, mid);
		update(x, y, val, 2 * idx + 1, mid, r);
		tree[idx] = min(tree[2 * idx], tree[2 * idx + 1]);
	}

	int query(int x, int y, int idx, int l, int r) {
		if (x >= r || l >= y) return N;
		if (x <= l && r <= y) return tree[idx];
		push(idx);
		int mid = (l + r) / 2;
		return min(query(x, y, 2 * idx, l, mid), query(x, y, 2 * idx + 1, mid, r));
	}
};


SegTree seg1, seg2;
int main() {
	int N, Q, t, x;
	cin >> N >> Q;
	vector<int> v1(N, N), v2(N, N);
	seg1.init(N, v1);
	seg2.init(N, v2);

	ll ans = (N - 2LL) * (N - 2LL);
	for (int q = 0; q < Q; q++) {
		cin >> t >> x;
		if (t == 1) {
			int l = seg1.query(x, x + 1, 1, 0, N);
			ans += 2LL - l;
			seg2.update(0, l, x, 1, 0, N);
		}
		else {
			int l = seg2.query(x, x + 1, 1, 0, N);
			ans += 2LL - l;
			seg1.update(0, l, x, 1, 0, N);
		}
	}
	cout << ans << '\n';
}


Measured memory_bytes: 18808
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

ll gcd(ll a, ll b){
    if(b==0) return a;
    else return gcd(b, a%b);
}

int main(){
    ll A, B;  cin >> A >> B;
    ll N = max(A, B);
    vector<ll> divs;
    for(ll i=2; i*i<=N; i++){
        if(A%i == 0 && B%i == 0)
            divs.push_back(i);
        while(A%i == 0){
            A /= i;
        }
        while(B%i == 0){
            B /= i;
        }
    }
    if(A != 1 && A == B)
        divs.push_back(A);

    cout << divs.size() + 1 << endl;
}

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

ll val[110];
ll weight[110];
ll dp[110][100010] = {0};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin >> t;
	while(t != 0) {
	    ll n, w;
        cin >> n >> w;
        for(ll i = 1; i <= n; i++) {
            cin >> weight[i] >> val[i];
        }
        for(ll i = 1; i <= n; i++) {
            for(ll j = 1; j <= w; j++) {
                dp[i][j] = dp[i-1][j];
                if(j >= weight[i]) {
                    dp[i][j] = max(dp[i][j], val[i] + dp[i-1][j-weight[i]]);
                }
            }
        }
        cout << dp[n][w] << "\n";
	    t--;
	}
	return 0;
}


Measured memory_bytes: 79360
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define bash push_back
#define alles(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define WF(d,v) FOR(k,v){ FOR(i,v){ FOR(j,v) d[i][j]=min(d[i][j],d[[i][k]+d[k][j]) } }
int dx[]={1,0,-1,0,1,1,-1,-1};
int dy[]={0,-1,0,1,-1,1,-1,1};
const int INF=1 << 30;
bool inside(int x,int y,int w,int h){
  return (x>=0 && y>=0 && x<w && y<h);}
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vit;
typedef map<string,int> mstit;
typedef priority_queue<int> pqit;
 
 
int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n,ans=0;
  cin >>n;
  while(n){
    if(n%10==2) ans++;
    n/=10;
  }
  cout <<  ans fin;


  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#define NIL -1
#define MAX 100005

typedef struct node{
  int p,l,r;
}Node;
Node T[MAX];
int D[MAX];
int n;

void print(int);
int rec(int,int);

int main(){
  int i,j,d,v,c,l,r;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p=T[i].l=T[i].r=NIL;
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&v,&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      if(j==0)T[v].l=c;
      else T[l].r=c;
      l=c;
      T[c].p=v;
    }
  }
  for(i=0;i<n;i++)
    if(T[i].p==NIL)
      r=i;
  rec(r,0);
  for(i=0;i<n;i++)
    print(i);


  return 0;
}
void print(int u){
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",D[u]);
  if(T[u].p==NIL){
    printf("root, ");
  }
  else if(T[u].l==NIL){
    printf("leaf, ");
  }
  else printf("internal node, ");

  printf("[");
  for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
    if(i)printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}
int rec(int u,int p){
  D[u]=p;
  if(T[u].r!=NIL)
    rec(T[u].r,p);
  if(T[u].l!=NIL)
    rec(T[u].l,p+1);
}






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

vector<int> v(303030);
int n,k,m,a,b,c,d;
string s,t;

int main() {
  cin >> n;
  int ans=0;
  rep(i,n){
  cin >> a;
  while(!(a&1)) a/=2,ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;
typedef vector<vector<ll>> mat;
const int INF = 1e9;

int N;
string S1, S2;
string SS1, SS2;
int dp[60];

signed main()
{
    cin >> N;
    cin >> S1 >> S2;

    REP(i,N) {
        if (i != 0 && S1[i] == S1[i-1]) {
            continue;
        }
        SS1 += S1[i];
        SS2 += S2[i];
    }

    if (SS1[0] == SS2[0]) {
        dp[0] = 3;
    } else {
        dp[0] = 6;
    }
    for (int i=1; i<SS1.length(); i++) {
        if (SS1[i-1] != SS2[i-1]) {
            if (SS1[i] != SS2[i]) {
                dp[i] = dp[i-1] * 3;
                dp[i] %= MOD;
            } else {
                dp[i] = dp[i-1];
            }
        } else {
            if (SS1[i] != SS2[i]) {
                dp[i] = dp[i-1] * 2;
                dp[i] %= MOD;
            } else {
                dp[i] = dp[i-1] * 2;
                dp[i] %= MOD;
            }
        }
    }

    cout << dp[SS1.length()-1] << endl;
}


Measured memory_bytes: 256
import bisect
n = int( input() )
l = sorted( list( map( int, input().split() ) ))

cnt = 0
for i in range( n ):
  for j in range( i + 1, n ):
    cnt += bisect.bisect_left( l, l[ i ] + l[ j ] ) - ( j + 1 )
    
print( cnt )

Measured memory_bytes: 3188
#include <iostream>
#include <stack>

using namespace std;

int R;

int main(int argc, char** argv) {
    cin >> R;
    if (R < 1200)
        cout << "ABC" << endl;
    else if (R < 2800)
        cout << "ARC" << endl;
    else
        cout << "AGC" << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;

int main()
{
    double weight;
    while(cin >> weight)
    {
        if(weight> 91){cout <<"heavy" << endl; continue;}
        if(weight> 81){cout <<"light heavy" << endl; continue;}
        if(weight> 75){cout <<"middle" << endl; continue;}
        if(weight> 69){cout <<"light middle" << endl; continue;}
        if(weight> 64){cout <<"welter" << endl; continue;}
        if(weight> 60){cout <<"light welter" << endl; continue;}
        if(weight> 57){cout <<"light" << endl; continue;}
        if(weight> 54){cout <<"feather" << endl; continue;}
        if(weight> 51){cout <<"bantam" << endl; continue;}
        if(weight> 48){cout <<"fly" << endl; continue;}
        else {cout <<"light fly" << endl; continue;}

    }
    
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n;cin >> n;
    vl v(n);rep(i,n)cin >> v[i];
    vl x(n);x=v;
    sort(all(x));
    ll ans=0;
    rep(i,n){
        ll d=lower_bound(all(x),v[i])-x.begin();
        if(d%2!=i%2)ans++;
    }
    cout << ans/2 <<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int n,f[100005],a[100005],L,s;
int q,p[100005][50];
int power(int a,int k){
	if(k == 0) return 1;
	if(k == 1) return a;
	int t = power(a,k >> 1);
	if(k % 2) return t * t * a;
	else return t * t;
}
int main(){
	scanf("%d",&n);
	for(int i = 1; i <= n; i++)scanf("%d",&a[i]);
	scanf("%d",&L);
	for(int i = 1,step = 1; i <= n; i++){
		while(a[i] - a[step] > L)step++;
		p[i][0] = step;
	}
	for(int i = 1,j = 2; j <= n; i++,j *= 2,s++){
		for(int k = 1; k <= n; k++){
			p[k][i] = p[p[k][i - 1]][i - 1];
		}
	}
	scanf("%d",&q);
	int x,y,j,k,ans;
	for(int i = 1; i <= q; i++){
		scanf("%d%d",&x,&y);
		if(x > y) swap(x,y);
		ans = 1;
		k = y;
		for(int j = s; j >= 0; j--){
			if(p[k][j] > x){
				k = p[k][j];
				ans += power(2,j);
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 23680
A,B,C,D=gets.chomp.split.map(&:to_i)

def gcd(a,b)
  return a if b == 0
  gcd(b,a%b)
end

def lcm(a,b)
  a * b / gcd(a,b)
end

def hoge(n,c,d)
  ret = n - n / c
  ret += n - n / d
  ret -=  n - n / lcm(c,d)
  ret
end

puts hoge(B,C,D) - hoge(A-1, C, D)

Measured memory_bytes: 1788
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
int main(void)
{
    long long A, B, C, la, lb, lc, K, i;

    cin >> A >> B >> C >> K;

    if(abs(A-B) > 1e18){
        cout << "Unfair" << endl;
    }

    else{
        if(K%2 == 0){
            cout << A-B << endl;
        }

        else{
            cout << B-A << endl;
        }
    }
 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>

using namespace std;

struct Section{
  int d;
  int p;
};

bool operator<( const Section& s1, const Section& s2 ){
  return s1.p < s2.p;
}

int main () {
  while ( 1 ){
    int n, m;

    cin >> n >> m;
    if( !n && !m ) { return EXIT_SUCCESS; }

    vector<Section> vs;

    for( int i = 0; i < n; i++ ) {
      Section s;
      cin >> s.d >> s.p;
      vs.push_back( s );
    }

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

    int rp = 0;
    for(
        vector<Section>::iterator it = vs.end() - 1;
        it != vs.begin() - 1;
        it--
       ){
      if( m >= it->d ){
        m -= it->d;
      }else{
        rp += ( it->p * ( it->d - m ) );
        m = 0;
      }
    }
    cout << rp << endl;
  }
}

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	long long N; cin >> N;
	long long q = 1;
	while(q * q <= N) ++ q;
	long long ans = 0;
	for(long long m = 1; N / m > q; ++ m) {
		if(N % m == N / m) ans += m;
	}
	for(; q >= 1; -- q) {
		long long m = (N - q) / q;
		if(m && N % m == N / m) ans += m;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
# Problem: https://atcoder.jp/contests/abc088/tasks/abc088_c
# Python 2nd Try

import sys
# from collections import defaultdict
# import heapq,copy
import pprint as pp
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


YES = "Yes"
NO  = "No"


def solver(grid):
    result = NO
    # algorithm
    a0 = 0
    b0 = grid[0][0]
    b1 = grid[0][1]
    b2 = grid[0][2]
    a1 = grid[1][0] - b0
    a2 = grid[2][0] - b0
    if a1+b1 == grid[1][1] and a1+b2 == grid[1][2] \
        and a2 + b1 == grid[2][1] and a2+b2 == grid[2][2]:
        result = YES
    return result


if __name__ == "__main__":
    grid_c = [ [0] * 3 for j in range(0, 3)]
    # pp.pprint(grid_c)
    for j in range(0, 3):
        grid_c[j][0], grid_c[j][1], grid_c[j][2] = MI()
    # pp.pprint(grid_c)
    print("{}".format(solver(grid_c)))


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

int main() {
  int A,B,C,D,p,q;
  
  cin >> A >> B >> C >> D;
  
  p=A+B;
  q=C+D;
  
  if (p>q) {
    cout << "Left" << endl;
    }
  else if (q>p){
    cout << "Right" << endl;
    }
  else {
    cout << "Balanced" <<endl;
   }
  
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
// #define DEBUG
#ifdef DEBUG
	#define debug printf
#else
	#define debug(...)
#endif
ll n,p;
const ll maxn = 1e12 + 5;
ll powme(ll k,ll s)
{
	if(s == 0ll)
	{
		return 1ll;
	}
	else if(s == 1ll)
	{
		return k;
	}
	ll t = powme(k,s / 2);
	if(t == -1)
	{
		debug("1::t = %lld\n",t);
		return -1;
	}
	// t *= t;
	if(t > p / t)
	{
		debug("2::t = %lld\n",t);
		return -1;
	} 
	t *= t;
	t *= powme(k,s % 2);
	debug("t = %lld\n",t);
	return t <= p ? t : -1ll;
}
int main(int argc, char const *argv[])
{
	cin>>n>>p;
	if(n == 1ll)
	{
		printf("%lld\n",p);
		return 0;
	}
	ll maxa = ll(pow(maxn,1.0 / (n + 0.0)));
	debug("maxa = %lld\n",maxa);
	for(ll i = maxa + 1;i >= 1; --i)
	{
		ll now = powme(i,n);
		debug("powme(%lld,%lld) = %lld\n",i,n,now);
		if(now <= p)
		{
			if(now > 0 && p % now == 0)
			{
				printf("%lld\n",i);
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ちゃんとユニークな配列にする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int resultCount = 0;
  repto(a, A) {
      repto(b, B) {
        repto(c, C) { 
          int sum = a * 500 + b * 100 + c * 50;
          if(X == sum) {
            resultCount++;
          }
        }
      }
  }
  cout << resultCount << endl;
}


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

using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
#define inf 1ll<<60
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
#define int llong
#define be(x) x.begin(), x.end()
typedef pair<int, int> P;
typedef pair<int, P> PP;

signed main(){
	vector<PP> v;
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		int a, b;
		cin >> a >> b;
		v.pb(PP(a+b, P(a,b)));
	}

	sort(be(v), greater<PP>());

	int tk = 0, ao = 0;
	for(int i = 0; i < n; i++){
		if(i%2 == 0)
			tk += v[i].second.first;
		else
			ao += v[i].second.second;
	}

	cout << tk - ao << endl;

	return 0;
}

Measured memory_bytes: 4724
#include<stdio.h>
#include<string.h>

int main(void)
{
	int i;
	int len;
	char s[200001];
	char t[200001];
	int s_n[200001]={0};
	int t_n[200001]={0};
	int s_a[26]={0};
	int t_a[26]={0};
	
	scanf("%s%s",s,t);
	
	len=strlen(s);
	
	for(i=0;i<len;i++){
		s_a[s[i]-'a']++;
		s_n[i]=s_a[s[i]-'a'];
	}
	
	for(i=0;i<len;i++){
		t_a[t[i]-'a']++;
		t_n[i]=t_a[t[i]-'a'];
	}

	for(i=0;i<len;i++){
		if(t_n[i]!=s_n[i]){
			printf("No");
			return 0;
		}
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 2176
#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>;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(int n) {
  if (n == 0) return 1;
  mint x = f(n/2);
  x *= x;
  if (n%2 == 1) x *= 2;
  return x;
}

mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i,a) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  mint ans = f(n);
  ans -= 1;
  ans -= choose(n,a);
  ans -= choose(n,b);
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
int main() {
  ll N;
  cin >> N;
  int k=1;
  while(k*(k+1)/2<N) k++;
  REP(i, 1, k+1) if(i != k*(k+1)/2-N) cout << i << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	
	if (a <= b && b <= c)
		cout << a << " " << b << " " << c << endl;
	else if (a <= c && c <= b)
		cout << a << " " << c << " " << b << endl;
	else if (b <= a && a <= c)
		cout << b << " " << a << " " << c << endl;
	else if (b <= c && c <= a)
		cout << b << " " << c << " " << a << endl;
	else if (c <= a && a <= b)
		cout << c << " " << a << " " << b << endl;
	else if (c <= b && b <= a)
		cout << c << " " << b << " " << a << endl;
	
	return 0;
}


Measured memory_bytes: 3124
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;
char table[6][7] = { { 0,0,0,0,0,0,0 },
{ 0,'a','f','k','p','u','z' },
{ 0,'b','g','l','q','v','.' },
{ 0,'c','h','m','r','w','?' },
{ 0,'d','i','n','s','x','!' },
{ 0,'e','j','o','t','y',' ' }
 };

int main()
{
//	cut here before submit 
//	freopen ("testcase.ppi", "r", stdin );
	string str = "";

	while (getline (cin, str ) ){

		string res = "";
		int len = str.length();
		int row, col;
		int i;
		bool notfound = false;

		if (len % 2 != 0 ){
			notfound = true;
		} // end if

		for (i = 0; i < len - 1; i += 2){
			col = str[i] - '0';
			row = str[i+1] - '0';
			if (col <= 0 || col >= 7 || row <= 0 || row >= 6 ){
				notfound = true;
			} // end if
		} // end for

		if (notfound ){
			cout << "NA" << endl;
			continue;
		} // end if

		for (i = 0; i < len - 1; i += 2){
			col = str[i] - '0';
			row = str[i+1] - '0';
			cout << table[row][col];
		} // end for
		cout << endl;
	} // end loop
		
	return 0;
}

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

int main(){
  int N;
  cin>>N;
  if(N==3 or N==5 or N==7){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int N, A;
  double res = 0;

  scanf("%d", &N);
  for (int n = 0; n < N; ++n) {
    scanf("%d", &A);
    res += 1.0/A;
  }
  printf("%.10f\n", 1.0/res);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int h[n+1],f[n+1];
	for(int i=1;i<=n;i++) cin>>h[i];
	f[1]=0;
	f[2]=abs(h[2]-h[1]);
	for(int i=3;i<=n;i++)
	   f[i]=min(f[i-1]+abs(h[i]-h[i-1]),f[i-2]+abs(h[i]-h[i-2]));
	cout<<f[n]<<endl;
	return 0;
}


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

const int N = 1003;
int n;
char ans[N][N];
char m4[4][5] = {
	"aacd",
	"bbcd",
	"cdaa",
	"cdbb"
};
char m5[5][6] = {
	"aabbc",
	"hii.c",
	"h..jd",
	"g..jd",
	"gffee"
};
char m6[6][7] = {
	"aacd..",
	"bbcd..",
	"..aacd",
	"..bbcd",
	"ab..aa",
	"ab..bb"
};
char m7[7][8] = {
	"aabbcc.",
	"dd.dd.a",
	"..d..da",
	"..d..db",
	"dd.dd.b",
	"..d..dc",
	"..d..dc",
};

char get(int x, int y, int type) {
	switch (type) {
		case 0 : return m4[x][y];
		case 1 : return m5[x][y];
		case 2 : return m6[x][y];
		case 3 : return m7[x][y];
		default : return '.';
	}
}
int main() {
	memset(ans, '.', sizeof(ans));
	scanf("%d", &n);
	if(n == 2) {printf("-1\n"); return 0;}
	else if(n == 3) {printf("aa.\n..a\n..a"); return 0;}
	for(int i = 0; i < 4 + n % 4; i++)
		for(int j = 0; j < 4 + n % 4; j++)
			ans[n - n % 4 - 4 + i][n - n % 4 - 4 + j] = get(i, j, n % 4);
	for(int k = 0; k * 4 < n / 4 * 4 - 4; k++) 
		for(int i = 0; i < 4; i++)
			for(int j = 0; j < 4; j++)
				ans[4 * k + i][4 * k + j] = get(i, j, 0);
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++)
			printf("%c", ans[i][j]);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <cmath>

using namespace std;
const double eps = 1e-6;


typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,d;
    int cnt = 0;
    cin >> n >> d;
    for(int i = 1; i <= n; i++) {
        ll x,y;
        cin >> x >> y;
        double dis = sqrt(x*x + y*y);
        if(dis - eps < d) cnt++;
    }
    printf("%d\n", cnt);
    return 0;
}

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

struct Benri {
    Benri() {
        std::cin.tie(0); ios::sync_with_stdio(false);
        cout << fixed << setprecision(12);
    }
} benri;
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; }

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define MOD 1000000007
#define MOD2 998244353




int main() {
    int N; cin >> N;
    vi L(N);
    int num=0;
    rep(i,N){
        cin >> L[i];
        chmax(num,L[i]);
    }
    int S = accumulate(all(L),0);
    cout << (S > 2* num ? "Yes" :"No") << endl;

}




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

int main(){
	int n, k;	cin >> n >> k;
	int h[n];
	for (int i = 0; i < n; ++i){
		cin >> h[i];
	}
	sort(h, h+n, greater<int>());
	long long ans = 0;
	for (int i = k; i < n; ++i){
		ans += h[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
	static class MaxFlow {
		//dinic
		public class Edge {
			int to, rev;
			long cap;

			public Edge(int to, long cap, int rev) {
				this.to = to;
				this.cap = cap;
				this.rev = rev;
			}
		}

		int V;
		ArrayList<ArrayList<Edge>> G;
		int[] level;
		int[] iter;
		public final long INF = 100000000000000l;
		
		public MaxFlow(int V) {
			this.V = V;
			G = new ArrayList<ArrayList<Edge>>();
			for(int i=0; i<V; i++)
				G.add(new ArrayList<Edge>());
			level = new int[V];
			iter = new int[V];
		}
		
		public void addEdge(int from, int to, long cap) {
			G.get(from).add(new Edge(to, cap, G.get(to).size()));
			G.get(to).add(new Edge(from, 0, G.get(from).size()-1));
		}
		
		void bfs(int s) {
			Arrays.fill(level, -1);
			Queue<Integer> que = new LinkedList<Integer>();
			level[s] = 0;
			que.add(s);
			while(!que.isEmpty()) {
				int v = que.remove();
				for(int i=0; i<G.get(v).size(); i++) {
					Edge e = G.get(v).get(i);
					if(e.cap>0 && level[e.to]<0) {
						level[e.to] = level[v] + 1;
						que.add(e.to);
					}
				}
			}
		}
		
		long dfs(int v, int t, long f) {
			if(v==t) return f;
			for(; iter[v]<G.get(v).size(); iter[v]++) {
				Edge e = G.get(v).get(iter[v]);
				if(e.cap>0 && level[v] < level[e.to]) {
					long d = dfs(e.to, t, Math.min(f, e.cap));
					if(d>0) {
						e.cap -= d;
						G.get(e.to).get(e.rev).cap += d;
						return d;
					}
				}
			}
			return 0;
		}
		
		long getMaxFlow(int s, int t) {
			long flow = 0;
			while(true) {
				bfs(s);
				if(level[t]<0)
					return flow;
				
				Arrays.fill(iter, 0);
				long f;
				while((f = dfs(s, t, INF)) > 0) {
					flow += f;
				}
			}
		}
	}


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final long INF = 100000000000000l;
		
		int N = sc.nextInt();
		int[] a = new int[N];
		for(int i=0; i<N; i++)
			a[i] = sc.nextInt();
		
		MaxFlow mf = new MaxFlow(N+2);
		int s = N;
		int t = s+1;
		long sum = 0;
		for(int i=0; i<N; i++) {
			if(a[i]>0) {
				sum += a[i];
				mf.addEdge(i, t, a[i]);
			} else {
				mf.addEdge(s, i, -a[i]);
			}
			for(int j=i+(i+1); j<N; j+=(i+1)) {
				mf.addEdge(i, j, INF);
			}
		}
		
		System.out.println(sum - mf.getMaxFlow(s, t));
		sc.close();
	}
}


Measured memory_bytes: 23764
#!/usr/bin/env python3

import math
import sys


def LI():
    return list(map(int, sys.stdin.buffer.readline().split()))


def I():
    return int(sys.stdin.buffer.readline())


def LS():
    return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()


def S():
    return sys.stdin.buffer.readline().rstrip().decode('utf-8')


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


def SRL(n):
    return [list(S()) for i in range(n)]


def MSRL(n):
    return [[int(j) for j in list(S())] for i in range(n)]

# ----------------------------------------------------------------


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def main():
    n, m = LI()

    if n + m < 2:
        print(0)
        sys.exit

    ans = 0
    if n >= 2:
        ans += combinations_count(n, 2)
    if m >= 2:
        ans += combinations_count(m, 2)

    print(ans)


main()


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int n;
int a[10000];
int main(void){
	int i,c,x;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	c=0;
	for(i=0;i<n;i++){
		x=a[i];
		while(x%2==0){
			c++;
			x/=2;
		}
	}
	cout<<c<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
#define chmax(a, b) a = max(a, b)
using ll = long long;

ll dp[200009][9];

int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  int k=1+n%2;
  rep(i,n+1)rep(j,k+1)dp[i][j]=-LLINF;
  dp[0][0]=0;
  rep(i,n){
    rep(j,k+1){
      chmax(dp[i+1][j+1],dp[i][j]);
      ll now=dp[i][j];
      if((i+j)%2==0)now+=a[i];
      chmax(dp[i+1][j],now);
    }
  }
  cout<<dp[n][k]<<endl;
  return(0);
}


Measured memory_bytes: 18052
#include <iostream>
#include <vector>
#include <map>
#include <cassert>
#include <sstream>
#include <string>

template<typename Type>
struct Matrix {
private:
    int R, C;
public:
    std::vector< std::vector<Type> > mat;
    Matrix (int R_, int C_, bool is_identity=false) {
        R = R_, C = C_;
        mat = std::vector< std::vector<Type> >(R, std::vector<Type>(C));
        if(is_identity) {
            assert(R == C);
            for(int i=0; i<R; i++) {
                mat[i][i] = 1;
            }
        }
    }
    int get_row() const {
        return mat.size();
    }
    int get_col() const {
        assert(mat.size() > 0);
        return mat[0].size();
    }
    std::vector<Type>& operator[](int x) {
        return mat[x];
    }
    Matrix& operator=(const Matrix &a) {
        mat = a.mat;
        return *this;
    }
    Matrix operator*(Matrix a) {
        assert(this->get_col() == a.get_row());
        int R = this->get_row(), C = a.get_col(), X = this->get_col();
        Matrix<Type> ret(R, C);

        for(int i=0; i<R; i++) {
            for(int j=0; j<C; j++) {
                for(int k=0; k<X; k++) {
                    ret[i][j] += ((*this)[i][k] * a[k][j]);
                }
            }
        }
        return ret;
    }
    Matrix pow(Matrix a, long long int k) {
        assert(a.get_row() == a.get_col());
        Matrix<Type> ret(a.get_row(), a.get_col(), true);
        for(; k>0; k>>=1) {
            if(k & 1) ret = ret * a;
            a = a * a;
        }
        return ret;
    }
};

int main() {
    int N, M, L; std::cin >> N >> M >> L;
    Matrix<long long> A(N, M), B(M, L);

    for(int i=0; i<N; i++) {
        for(int j=0; j<M; j++) {
            std::cin >> A[i][j];
        }
    }

    for(int i=0; i<M; i++) {
        for(int j=0; j<L; j++) {
            std::cin >> B[i][j];
        }
    }

    Matrix<long long> C = A * B;
    for(int i=0; i<N; i++) {
        for(int j=0; j<L; j++) {
            std::cout << C[i][j] << " \n"[j+1==L];
        }
    }
    return 0;
}


Measured memory_bytes: 3332
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    print(input()[::2])

if __name__ == '__main__':
    main()


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

int main() {
  int W,a,b;
  cin>>W>>a>>b;
  if(a+W<b){
    cout<<b-(a+W)<<endl;
  }
  else if(a>b+W){
    cout<<a-(b+W)<<endl;
  }
  else{
    cout<<0<<endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>

int main ()
{
	int n, m, a[100005], in;
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= n; i++)
		a[i] = -1;
	for (int i = 1; i <= m; i++)
	{
		scanf("%d", &in);
		a[in] = 0;
	}
	if (a[1] != 0)
		a[1] = 1;
	if (a[2] != 0)
		a[2] = 1 + a[1];
	for (int i = 3; i <= n; i++)
		if (a[i] == -1)
			a[i] = (a[i - 2] + a[i - 1]) % 1000000007;
	printf("%d", a[n]);
	return 0;
}

Measured memory_bytes: 2120
import qualified Data.ByteString.Char8 as C
import qualified Data.Vector.Unboxed as V

main = C.interact $ put . sol . get

get = V.unfoldr (C.readInt . C.dropWhile (<'0'))

put = C.pack . unwords . map show . V.toList

sol v
  | even n    = V.reverse o V.++ e
  | otherwise = V.reverse e V.++ o
  where
  n = V.head v
  e = V.fromList $ map (v V.!) [1,3..n] 
  o = V.fromList $ map (v V.!) [2,4..n]

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

#include <iostream>
#define rep(i,a,b) for(i=a;i<=b;i++)
#define pb push_back
#define sort_incr(v) sort(v.begin(),v.end());
#define sort_decr(v) {sort(v.begin(),v.end()); reverse(v.begin(),v.end());}
#define take_input(v,n) for(ll i=0,temp;i<n;i++){cin>>temp;v.pb(temp);}
#define fastio {ios_base::sync_with_stdio(false);    cin.tie(NULL);}
#define ALL(v) v.begin(),v.end()

typedef long long ll;
using namespace std; 

int main() 
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r", stdin);
    freopen("output.txt","w", stdout);
    #endif

   	int n,red=0,white=0;
    cin>>n;
    string s;
    cin>>s;
    int inRed=-1;
    for(int i=n-1;i>=0;i--)
    {
      if(s[i]=='R')
      {inRed=i;
      break;}
    }
    int inWhite=-1;
    for(int i=n-1;i>=0;i--)
    {
      if(s[i]=='W')
      {inWhite=i;
      break;}
    }
    
    if(inRed==-1 || inWhite==-1)
    return cout<<0,0;
		
	int i=0,j=n-1;
	int ans=0;
	while(i<j)
	{
		if(s[i]=='W' &&  s[j]=='R')
		{
			s[i]='R';
			s[j]='W';
			ans++;
			i++;
			j--;

		}
		else {
			if(s[i]=='R')
			i++;
			if(s[j]=='W')
				j--;
		}


	}
	cout<<ans;




	return 0;
} 























Measured memory_bytes: 3728
#include<iostream>
#include<algorithm>
#include<cstring>

using namespace std;

int a[30],b[30],dp[31][1<<16];

int count(int bits){
  bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
  bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
  bits =(((bits >> 4) + bits) & 0x0f0f0f0f);
  bits += bits >> 8;
  return (bits + (bits >> 16)) & 0xff;
}

int main(void){
  
  int n,c,in;
  
  while(cin >> n >> c,n|c){
    
    fill(a,a+n,0);
    fill(b,b+c,0);

    for(int i=0;i<n;i++){
      for(int j=0;j<16;j++){
	cin >> in;
	a[i] |= in<<(15-j);
      }
    }

    for(int i=0;i<c;i++){
      for(int j=0;j<16;j++){
	cin >> in;
	b[i] |= in<<15-j;
      }
    }

    memset(dp,-1,sizeof(dp));
    dp[0][0]=0;

    for(int i=0;i<n;i++){
      for(int j=0;j<(1<<16);j++){
	if(dp[i][j]<0)continue;

	int now=a[i]|j;
	for(int k=0;k<c;k++){
	  int next=now & ~b[k];
	  dp[i+1][next]=max(dp[i+1][next],dp[i][j]+count(now & b[k]));
	}
      }
    }

    int ans=0;
    for(int i=0;i<(1<<16);i++){
      ans=max(ans,dp[n][i]);
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 9104
#include "bits/stdc++.h"
using namespace std;

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define isin(tx, ty, w, h) (0 <= tx && tx <= w && 0 <= ty && ty <= h)

/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;

/* constant */
const int inf = pow(2, 62);
const int mod = 1e9 + 7;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}

/* general_method */
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; }
template<class T>T cut(T &a, int l, int r){return T(a.begin()+l, a.begin()+r);}

/* main */

int x, y;
void in(){
    cin >> x >> y;
}

void solve(){

    if(x % y == 0){
        print(-1);
        return ;
    }

    print(x);

}

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    in();
    solve();
    
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int high[10];
	int temp;
	int i=0;
	int j=0;
	int k=0;
	int l=0;
	
	while(i<10){
		scanf("%d",&high[i]);
		i++;
	}

	while(j<10){
		k=0;
		while(k<10){
			if(high[j]<high[k]){
				temp=high[j];
				high[j]=high[k];
				high[k]=temp;
			}
			k++;
		}
		j++;
	}

	while(l<3){
		printf("%d\n",high[9-l]);
		l++;
	}
	

	return 0;
}

Measured memory_bytes: 600
def main():
    h, w = map(int, input().split())

    field = [input() for _ in range(h)]

    points = [[0 for _ in range(w)] for _ in range(h)]

    for i in range(h):
        left = 0
        for j in range(w):
            if field[i][j] == '#':
                for k in range(left, j):
                    points[i][k] += j-left
                left = j+1
                continue
        for k in range(left, w):
            points[i][k] += w-left

    #print("\n".join(str(point) for point in points))
    for j in range(w):
        up = 0
        for i in range(h):
            if field[i][j] == '#':
                for k in range(up, i):
                    points[k][j] += i-up
                up = i+1
                continue
        for k in range(up, h):
            points[k][j] += h-up

    psoudo_ans = max(max(line) for line in points)
    print(max(0, psoudo_ans-1))
    #print("\n".join(str(point) for point in points))


main()

Measured memory_bytes: 101592
import java.io.*;

class Main {
    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();

        int n = Integer.parseInt(br.readLine());
        String[] str = br.readLine().split(" ");

        for (int i = n - 1; i >= 0; i--) {
            sb.append(str[i] + " ");
        }
        int a = sb.length();
        sb.deleteCharAt(a-1);
        System.out.println(sb);
    }
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


signed main(){
    double T, X;
    cin >> T >> X;
    PRINT(T / X);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s;
    cin >> s;
    if (s[0] == 'S') cout << "Cloudy" << endl;
    if (s[0] == 'C') cout << "Rainy" << endl;
    if (s[0] == 'R') cout << "Sunny" << endl;
}

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

using namespace std;

int a[10];
int main() {
  string s;
  cin >> s;

  if(s[0] == s[1] && s[1] == s[2] || s[1] == s[2] && s[2] == s[3]) {
    cout << "Yes" << endl;
  }

  else cout << "No" << endl;
}


Measured memory_bytes: 256