akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define int long long int
#define fi first
#define se second
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define pow10(n) stoll("1"+string(n,'0'))
//fill(all(arr),1)
//if(map.count(key)){}
//bitset<20>(n);
//int mini=min({a,b,c,d,e});
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;

int32_t main(){
	FIO
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int cnt=0;
	while(a>0&&c>0)
	{
		if(cnt%2==0)c-=b;
		else a-=d;
		cnt++;
	}
	if(a<=0)cout<<"No";
	else cout<<"Yes";
	
	return 0;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int x = 0;
            int y = 0;
            int value = 0;
            for (int i = 1; i <= N; ++i)
            {
                x = x + 800;
                if (i % 15 == 0)
                {
                    y = y + 200;
                }
            }
            value = x - y;
            Console.WriteLine(value);
        }
    }
}


Measured memory_bytes: 11092
// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
#define mod9 1000000009LL
#define mod7 1000000007LL
#define INF  1023456789LL
#define INF16 10000000000000000LL
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add( LL _x , LL _y , LL _mod = mod7 ){
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline LL sub( LL _x , LL _y , LL _mod = mod7 ){
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline LL mul( LL _x , LL _y , LL _mod = mod7 ){
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
LL mypow( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 1LL;
  LL _ret = mypow( mul( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = mul( _ret , _a , _mod );
  return _ret;
}
LL mymul( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 0LL;
  LL _ret = mymul( add( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = add( _ret , _a , _mod );
  return _ret;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/

void build(){

}
LL a , b , c;
void init(){
  a = getint();
  b = getint();
  c = getint();
}
void solve(){
  for( int rnd = 1 ; rnd <= 10000000 ; rnd ++ ){
    if( a % 2 or b % 2 or c % 2 ){
      printf( "%d\n" , rnd - 1 );
      Bye;
    }
    LL na = b / 2 + c / 2;
    LL nb = a / 2 + c / 2;
    LL nc = a / 2 + b / 2;
    a = na;
    b = nb;
    c = nc;
  }
  puts( "-1" );
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


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

const int INF=1<<30;

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

int main(){
    int H, W, N; cin >> H >> W >> N;
    int sx, sy;
    vector<pair<int, int>> plant(N);
    vector<vector<char>> data(H, vector<char>(W));
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cin >> data[i][j];
            if(data[i][j] == 'S') sx=i, sy=j;
            for(int k=0; k<N; k++){
                if(data[i][j]-'0' == k+1){
                    plant[k]=make_pair(i, j);
                }
            }
        }
    }
    ll res=0;
    vector<vector<int>> dist(H, vector<int>(W, -1));
    dist[sx][sy]=0;
    queue<pair<int, int>> que;
    que.push(make_pair(sx, sy));
    for(int i=-1; i<N-1; i++){
        if(i > -1){
            tie(sx, sy)=plant[i];
            dist.assign(H, vector<int>(W, -1));
            dist[sx][sy]=0;
            que.push(make_pair(sx, sy));
        }
        while(!que.empty()){
            int x, y;
            tie(x, y)=que.front();
            que.pop();
            for(int j=0; j<4; j++){
                int nx=x+dx[j];
                int ny=y+dy[j];
                if(nx<0 || nx>=H || ny<0 || ny>=W) continue;
                if(dist[nx][ny] != -1) continue;
                if(data[nx][ny] == 'X') continue;
                dist[nx][ny]=dist[x][y]+1;
                que.push(make_pair(nx, ny));
            }
        }
        int gx, gy;
        tie(gx, gy)=plant[i+1];
        res+=dist[gx][gy];
    }
    cout << res << endl; 
    return 0;
}


Measured memory_bytes: 7848
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

ll gcd (ll a, ll b){
    ll k = a % b;
    while (k > 0){
        a = b;
        b = k;
        k = a % b;
    }
    return b;
}

int main() {
    int n; cin >> n;
    int a; cin >> a;
    rep(i,n-1){
        int b; cin >> b;
        a = gcd(a,b);
    }
    cout << a << endl;
}

Measured memory_bytes: 3532
#
# abc088 a
#
import unittest
from io import StringIO
import sys


def input():
    return sys.stdin.readline().rstrip()


def resolve():
    N = int(input())
    A = int(input())
    if N % 500 <= A:
        print("Yes")
    else:
        print("No")


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2018
218"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2763
0"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """37
514"""
        output = """Yes"""
        self.assertIO(input, output)


if __name__ == "__main__":
    #unittest.main()
    resolve()


Measured memory_bytes: 5592
import java.util.*;
import java.io.*;

public class Main {


	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int r = in.nextInt();
		int g = in.nextInt();
		int b = in.nextInt();
		System.out.println(Integer.parseInt(r+""+g+""+b)%4==0?"YES":"NO");
	}

}


Measured memory_bytes: 21844
s=raw_input()
n=len(s)
ans=[]
for i in xrange(n):
    if s[i]=="B" and ans==[]:
        continue
    if s[i]=="B":
        del ans[-1]
    elif s[i]=="0":
        ans.append("0")
    else:
        ans.append("1")
print("".join(ans))

Measured memory_bytes: 2568
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int H,W,m;
  cin >> H >> W >> m;
  map<P,int> bs;
  vector<int> t(H),y(W);
  rep(i,0,m) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    bs[P(a,b)]++;
    t[a]++; y[b]++;
  }
  vector<int> p,q;
  int ma = -1,mb = -1;
  rep(i,0,H) {
    if (t[i] > ma) {
      ma = t[i];
      p.clear();
      p.pb(i);
    } else if (t[i] == ma) {
      p.pb(i);
    }
  }
  rep(i,0,W) {
    if (y[i] > mb) {
      mb = y[i];
      q.clear();
      q.pb(i);
    } else if (y[i] == mb) {
      q.pb(i);
    }
  }
  bool flag = true;
  rep(i,0,len(p)) rep(j,0,len(q)) {
    if (bs[P(p[i],q[j])] == 0) {flag = false; break;}
  }
  int ans = ma + mb;
  if (flag) ans--;
  cout << ans << endl;
  return 0;
}


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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	for (int N; cin >> N&&N;) {
		vector<string> v(N); rep(i, 0, N) { cin >> v[i]; }
		bool none = false;
		rep(i, 1, N) {
			if (v[i] == "x"&&v[i - 1] == "x") {
				none = true;
				break;
			}
			if (v[i - 1] != "x"&&v[i] != "x") {
				if (i & 1) {
					if (stoi(v[i - 1]) >= stoi(v[i])) {
						none = true;
						break;
					}
				}
				else {
					if (stoi(v[i - 1]) <= stoi(v[i])) {
						none = true;
						break;
					}
				}
			}
		}
		if (none) {
			cout << "none" << endl;
			continue;
		}
		int l = -INF, r = INF;
		rep(i, 0, N) {
			if (v[i] != "x") continue;
			if (i & 1) {
				if (i != 0)l = max(l, stoi(v[i - 1]) + 1);
				if (i != N - 1)l = max(l, stoi(v[i + 1]) + 1);
			}
			else {
				if (i != 0)r = min(r, stoi(v[i - 1]) - 1);
				if (i != N - 1)r = min(r, stoi(v[i + 1]) - 1);
			}
		}
		if (l == r) {
			cout << l << endl;
		}
		else if (l < r) {
			cout << "ambiguous" << endl;
		}
		else {
			cout << "none" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3196
/*input
6
15
1 2
1 3
2 4
2 5
3 6
3 7
4 8
4 9
5 10
5 11
6 12
6 13
7 14
7 15
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=80000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int n;
vector<int> edge[maxn];
pii e[maxn];

int d[maxn];
bool vis[maxn];
void dfs(int u){
	vis[u]=1;
	for(int v:edge[u]) if(!vis[v]){
		d[v]=d[u]+1;
		dfs(v);
	}
}

int far(int u){
	REP(i,n) vis[i]=0;
	d[u]=0;
	dfs(u);
	return max_element(d,d+n)-d;
}

vector<int> path;
vector<int> sz;
vector<int> rsz;

bool onpath[maxn];
bool dfs(int u,int x){
	vis[u]=1;
	path.pb(u);
	if(u==x) return 1;
	for(int v:edge[u]) if(!vis[v]){
		if(dfs(v,x)) return 1;
	}
	path.pop_back();
	return 0;
}

int main()
{
	IOS;
	cin>>n;
	REP(i,n-1) cin>>e[i].F>>e[i].S;
	REP(i,n) e[i].F--,e[i].S--;
	// REP(i,n) cout<<e[i]<<'\n';
	REP(i,n-1) edge[e[i].F].pb(e[i].S),edge[e[i].S].pb(e[i].F);

	pii dia=MP(0,0);
	dia.F=far(0);
	dia.S=far(dia.F);
	REP(i,n) vis[i]=0;
	dfs(dia.F,dia.S);
	for(int i:path) sz.pb(SZ(edge[i]));
	sz[0]++,sz.back()++;
	REP(i,SZ(sz)) sz[i]-=2;
	rsz=sz;

	for(int i:path) onpath[i]=1;
	REP(i,n) if(!onpath[i]) if(SZ(edge[i])!=1){
		cout<<"-1\n";
		return 0;
	}

	reverse(ALL(rsz));
	{
		int i=0;
		while(i<SZ(sz)&&sz[i]==rsz[i]) i++;
		if(i<SZ(sz)&&rsz[i]<sz[i]) swap(rsz,sz);
	}
	int pt=1;
	for(int i:sz){
		for(int j=pt+1;j<=pt+i;j++) cout<<j<<' ';
		cout<<pt<<' ';
		pt+=i+1;
	}
	cout<<'\n';
	return 0;
}


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

int main(void){
    int x = 0;
    int ans = 1;
    int tmp = 1;

    scanf("%d", &x);
    for(int i = 2; i <= x/2; i++){
        for(int j = 0; tmp <= x; j++){
            if(ans < tmp){
                ans = tmp;
            }
            tmp = tmp * i;
//            fprintf(stderr, "i = %d, j = %d, tmp = %d, ans = %d\n", i, j, tmp, ans);
        }
        tmp = 1;
    }
    printf("%d\n", ans);


    return 0;

} 


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <bitset>
#include <set>

using ll = long long;
using namespace std;

int main(void) {
	int a, b;
	cin >> a >> b;
	
	int ans = 0;
	for(int i = 1; i < 1100; ++i) {
		if( a == (i * 8) / 100 && b == (i * 10) / 100 ) { 
			cout << i << endl;
			return 0;
		}
	}
	
	cout << -1 << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	string s;
	cin >> s;
	REVE(s);
	cout << s << endl;
}


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;

#define ZP(a, len) setfill('0') << setw(len) << right << a
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
const ll LINF = 1e11;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }


void solvenewR() {
    int n, m, x;
    cin >> n >> m >> x;
    set<int> si;
    for (int i = 0; i < m; ++i) {
        int a;
        cin >> a;
        si.insert(a);
    }

    int c1 = 0;
    for (int i = x; i < n; ++i) {
        if (si.find(i) != si.end()) {
            c1++;
        }
    }

    int c2 = 0;
    for (int i = x; i > 0; --i) {
        if (si.find(i) != si.end()) {
            c2++;
        }
    }

    int ans = min(c1, c2);

    cout << ans << "\n";
}


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

    solvenewR();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long mod =998244353;
main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    long long a = 0, b= 0, c= 0;
    long long ans = 1;
    for(int i = 1; i <= n; i++)
        ans = ans * i % mod;
    for(long long i = 0; i < s.size(); i++){
        if(s[i] == 'R'){
            a++;
            if(a <= b && a <= c) ans = ans * (min(b, c) - a + 1) % mod; else
            if(a <= b || a <= c) ans = ans * (max(b, c) - a + 1)% mod;
        }
        if(s[i] == 'B'){
             b++;
            if(b <= a && b <= c) ans = ans * (min(a, c) - b + 1) % mod; else
            if(b <= a || b <= c) ans = ans * (max(a, c) - b + 1) % mod;
        }
        if(s[i] == 'G') {
            c++;
            if(c <= a && c <= b) ans = ans * (min(a, b) - c+1) % mod; else
            if(c <= a || c <= b) ans = ans * (max(a, b) - c +1) % mod;
        }

    }
    cout<<ans<<endl;

}


Measured memory_bytes: 900
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	for i,_ := range s{
		for j := i + 1; j < len(s); j++{
			if s[i] == s[j]{
				fmt.Println("no")
				return
			}
		}
	}
	fmt.Println("yes")
}


Measured memory_bytes: 512
import bisect
import heapq
import math
from copy import copy
import sys
from queue import Queue, LifoQueue, PriorityQueue
from collections import defaultdict
from operator import itemgetter

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N = int(readline())

    d = defaultdict(list)
    for i in range(N):
        A = int(readline())
        for _ in range(A):
            x, y = map(int, readline().split())                
            d[i].append((x-1, y))
            
    ret = 0
    for i in range(2 ** N):
        contradiction = False
        for j in range(N):
            for x, y in d[j]:
                # 証言が正しい時のみ矛盾を考慮　証言が真偽不明な時は考えない
                if (i >> j) & 1:
                    if (i >> x) & 1:
                        if y == 0:
                            contradiction = True
                            break
                    else:
                        if y == 1:
                            contradiction = True
                            break

        if contradiction:
            continue
        else:
            ret = max(bin(i).count("1"), ret)

    print(ret)


if __name__ == "__main__":
    main()

Measured memory_bytes: 46552
#include <iostream>

using namespace std;

int main(){
  int a[25], b[25], n;
  while(1){
    int sum = 0;
    cin >> n;
    if(n == 0) break;

    for(int i = 0;i < n;i++){
      cin >> a[i] >> b[i];
    }

    for(int i = 0;i < n;i++){
      for(int j = i+1;j < n;j++){
        if(b[i] > b[j]){
          swap(a[i], a[j]);
          swap(b[i], b[j]);
        }
      }
    }

    for(int i = 0;i < n;i++){
      sum+=a[i];
      if(sum > b[i]){
        cout << "No" << endl;
        break;
      } else if (i == n-1){
        cout << "Yes" << endl;
      }
    }
  }

  return 0;
}

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

void Solve(int n, int k) {
    int ans=0;
    while(n) {
        n = n/k;
        ans++;
    }
    cout << ans;
}

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

    int n, k;
    cin >> n >> k;
    Solve(n, k);
    return 0;
}

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

int gcd(int a,int b){
    if(a == 1 || b == 1){return 1;}
    if(a>b){return gcd(b,a);}
    if(b%a == 0){return a;}
    else {return gcd(b%a,a);}


}

int main(){
    int a;
    long long int sum=0;
    cin >>a;
    for (int i=0;i<a;i++){
        for(int j=0;j<a;j++){
            for(int t=0;t<a;t++){
                sum += gcd(gcd(i+1,j+1),t+1);
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <numeric>
#include <algorithm>
#include <vector>
#include <map>

int main()
{
    int64_t N;
    std::cin >> N;
    std::vector<int64_t> A;
    int64_t x = 0;
    for (size_t n = 0; n < N; ++n)
    {
        int64_t a;
        std::cin >> a;
        A.emplace_back(a);
        x ^= a;
    }

    for (size_t n = 0; n < N; ++n)
    {
        std::cout << (A[n] ^ x) << " ";
    }
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 5312
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int n;
	while (cin >> n){
		if (n == 0)return 0;
		int l[101];
		int sum = 0;
		for (int i = 0; i < n; i++){
			int a; cin >> a;
			l[i] = a;
		}
		for (int i = n; i > 0; i--){
			for (int j = 0; j < n - 1; j++) {
				if (l[j] > l[j + 1]){
					swap(l[j], l[j + 1]);
					sum++;
				}
			}
		}
		cout << sum << endl;
	}
}

Measured memory_bytes: 3076
#include<iostream>
using namespace std;
int main() {
  int N;
  char S[55];
  int i,count = 0;
  cin >> N >> S;
  for(i=0;i<N-2;i++) {
    if(S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') {
      count++;
      i += 2;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <cstdio>

void swap(int array[], int a, int b){
	int c = array[a];
	array[a] = array[b];
	array[b] = c;
}

int main(){
	int array[50];
	int w,n,a,b;

	for(int i=0 ; i<50 ; i++){
		array[i] = i;
	}
	
	scanf("%d", &w);
	scanf("%d", &n);
	for(int i=0 ; i<n ; i++){
		scanf("%d,%d", &a, &b);
		swap( array , a , b );
	}
	for(int i=1 ; i<=w ; i++){
		printf("%d\n", array[i]);
	}
}

Measured memory_bytes: 0
using namespace std;
 
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <numeric>
#include <map>
#include<iomanip>
using namespace std;
 
 
int main(void){
	long long int  W,H,x,y;
 
	cin >>W>>H>>x>>y;
  
  	long long int xmin = min(W - x, x), ymin = min(H - y, y);
	
	cout << (long double)W * (long double)H / (long double)2.0 << " " << (xmin * 2 == W && ymin * 2 == H ? 1 : 0) << endl;
 
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    double d = sc.nextDouble();
    
    int count = 0;
    
    for(int i = 0 ; i < n ; ++i){
      long x = sc.nextLong();
      long y = sc.nextLong();
      double num = 0;
      
      num = Math.sqrt(x*x + y*y);

      if(num <= d){
        count++;
      }
    }
    
    System.out.println(count);
    
  }
}

Measured memory_bytes: 61044
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
		String s = "" + (sc.nextLong() + 1);
        
//        桁数を求める（c99..99）
        
//        for(int i=0; i<s.length(); i++){
        int i = 0;
        int ans = s.charAt(i) - '1' + (s.length() -1) * 9 ;

//        }
        System.out.println(ans);
        
    }
}

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

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b,c,d; cin>>a>>b>>c>>d;
	if (a+b<c+d) cout<<"Right"<<endl;
	else if (a+b>c+d) cout<<"Left"<<endl;
	else if (a+b==c+d) cout<<"Balanced"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<pair<ll, ll>> pll;
 
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)
 
const long double PI = acos(-1);
 
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}

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

  ll n;
  cin >> n;
  vector<ll> a(n), b(n);
  for(ll i = 0; i < n; i++) cin >> a[i];
  for(ll i = 0; i < n; i++) cin >> b[i];

  ll suma = 0, sumb = 0;
  for(ll i = 0; i < n; i++){
    suma += a[i], sumb += b[i];
  }
  if(suma < sumb){
    cout << -1 << endl;
    return 0;
  }

  ll ans = 0;
  ll decsum = 0;
  bool allok = true;
  for(ll i = 0; i < n; i++){
    if(a[i] < b[i]){
      ans++;
      decsum += b[i] - a[i];
      allok = false;
    }
  }
  if(allok){
    cout << 0 << endl;
    return 0;
  }

  vector<ll> dec(n);
  for(ll i = 0; i < n; i++){
    dec[i] = a[i] - b[i];
  }
  sort(all(dec), greater<ll>());
  for(ll i = 0; i < n; i++){
    decsum -= dec[i];
    ans++;
    if(decsum <= 0) break;
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
const int N = 200003;
int n, a[N], stk[N], num[N], top;
inline bool check(int m){
    top = 1; stk[1] = 1; num[1] = a[1];
    for(Rint i = 2;i <= n;++ i){
        if(a[i] > a[i - 1]){
            if(stk[top] == 1) num[top] += a[i] - a[i - 1];
            else stk[++ top] = 1, num[top] = a[i] - a[i - 1];
        } else {
            int x = a[i - 1] - a[i];
            while(top && x >= num[top]) x -= num[top], -- top;
            num[top] -= x;
            int t = 0;
            while(stk[top] == m) t += num[top], -- top;
            if(!top) return false;
            if(num[top] == 1) ++ stk[top];
            else {
                -- num[top], stk[top + 1] = stk[top] + 1, ++ top, num[top] = 1;
            }
            if(t) stk[++ top] = 1, num[top] = t;
        }
    }
    return true;
}
int main(){
    scanf("%d", &n);
    for(Rint i = 1;i <= n;++ i) scanf("%d", a + i);
    int l = 1, r = n, ans, mid;
    while(l <= r){
        mid = l + r >> 1;
        if(check(mid)) ans = mid, r = mid - 1;
        else l = mid + 1;
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define IOS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define debug(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define IN freopen("in.txt", "r", stdin);
#define endl '\n'
#define pb push_back
#define eb emplace_back
#define fi first
#define int long long
#define se second
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> pii;
const int inf = 0x3f3f3f3f;

const int N = 2e5+10;
int a[N],f[N];

int32_t main(){
    IOS;
    int n;cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    if(n%2==0){
        f[1]=a[1],f[2]=a[2];
        for(int i=2;i<=n/2;i++){
            f[i*2-1]=f[(i-1)*2-1]+a[i*2-1];
            f[i*2]=max(f[(i-1)*2],f[(i-1)*2-1])+a[i*2];
        }
        cout<<max(f[n],f[n-1])<<endl;
        return 0;
    }
    f[1]=a[1],f[2]=a[2],f[3]=a[3];
    for(int i=2;i<=n/2;i++){
        f[i*2+1]=max(f[(i-1)*2-1],max(f[(i-1)*2],f[(i-1)*2+1]))+a[i*2+1];
        f[i*2]=max(f[(i-1)*2-1],f[(i-1)*2])+a[i*2];
        f[i*2-1]=f[(i-1)*2-1]+a[i*2-1];
    }
    cout<<max(f[n-2],max(f[n-1],f[n]))<<endl;
    return 0;
}

Measured memory_bytes: 6780
/*input
a
z
*/
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define input(str) freopen(str,"r",stdin);
#define output(str) freopen(str,"w",stdout);
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define INF  3e16+1
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld\n",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define modd 1000000007
#define len(x) x.size()
#define all(v) (v.begin(),v.end())
#define ll int
#define pi 3.1415926535897932384626
#define ld double
#define endl '\n'
const int N =6e5+5;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
int powmod(int base,int exp,int mod)
{
	int res=1LL;
	while(exp>0)
	{
		if(exp&1LL)
			res=(res*base)%mod;
		exp/=2LL;
		base=(base*base)%mod;
	}
	return res%mod;
}
int dp[3001][3001];
string ans(string s,string t)
{
	int n=len(s);
	int m=len(t);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(s[i-1]==t[j-1])
			{
				dp[i][j]=1+dp[i-1][j-1];
			}
			else
			{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
	string str="";
	int i=n,j=m;
	while(i>0&&j>0)
	{
		if(s[i-1]==t[j-1])
		{
			str+=s[i-1];
			i--;
			j--;
		}
		else
		{
			if(dp[i-1][j]>dp[i][j-1])
			{
				i--;
			}
			else
			{
				j--;
			}
		}
	}
	reverse(str.begin(),str.end());
	return str;
}
signed main()
{
	string s,t;
	cin>>s>>t;
	string temp=ans(s,t);
	cout<<temp<<endl;;

}

Measured memory_bytes: 70656
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int H, W, N;
int ans = 0;
int main()
{
  cin >> H >> W >> N;
  while (N > 0)
  {
    N = min(N - W, N - H);
    // cout << N << endl;
    ans++;
  }

  cout << ans << endl;

  return 0;
}


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



int main() {

	int n;	//配列数

	int l, i = 0, a[2];
	while (std::cin >> l)
	{
		a[i] = l;
		i++;
		if (i >= 2) {
			break;
		}
	}

	int com=0;
	//com = kai(a[0]) /( kai(a[1]) * kai(a[0] - a[1]));
	com = a[0] - a[1] + 1;
	printf("%d\n",com);

	return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <bits/stdc++.h> // only for GCC

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

//container util
//------------------------------------------
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

//repetition
//------------------------------------------
#define loop(i,a,b) for(ull i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)

//constant
//--------------------------------------------
const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

// output vector
// ------------------------------------------
namespace std {
    template<typename T>ostream&operator<<(ostream&os, vector<T>const&v){
        iter(it,v) os<<*it<<(it+1==v.end()?"":",");
        return os;
    }
    template<typename T, typename U>ostream&operator<<(ostream&os,const pair<T,U>&p){
        return os << "[" << p.dirst << "," << p.second << "]";
    }
}

//clear memory
// ------------------------------------------
#define clr(a,i) memset((a), (i) ,sizeof(a))

int main(){
   double n,h,m,hantei;
   char c;
   cin >> n;
   rep(i,n){
      cin >> h>>c>>m;
      h=360*h/12+360*m/12/60;
      m=360*m/60;
      hantei=abs(h-m);
      if(hantei>180) hantei=360-hantei;
      if(hantei<30) cout << "alert" << endl;
      else if(hantei<90) cout << "warning" << endl;
      else cout << "safe" << endl;
   }
}

Measured memory_bytes: 1220
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <numeric>
 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll K,N;
ll ans;
string S;
ll now;
ll INF = 1e18;
ll dp[3001][3001];
ll A[3001];
ll M = 998244353;

 
int main(){
    cin >> N >> K;
    dp[0][0] = 1;
    for(int i=0;i<N;i++){
        ll a;
        cin >> a;
        for(int j=0;j<=K;j++){
            if(j+a<=K){
                dp[i+1][j+a] = (dp[i+1][j+a] + dp[i][j])%M;
            }
            dp[i+1][j] = (dp[i+1][j] + (dp[i][j]*2)%M)%M;
        }
    }
    cout << dp[N][K] << endl;
    
    
    
    
}


Measured memory_bytes: 73868
///supercalifragilisticexpialidocious.
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <cstdlib>
#include <cctype>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <utility>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <list>
#include <bitset>
#include <complex>
using namespace std;
#define f first
//#define s second
#define PB pop_back 
#define pb push_back
#define mp make_pair
#define int long long
#define y1 y_golabi
#define sz(s) (int)s.size()
#define seper(n) setprecision(n)
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a,b,sizeof a)
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long ll; 
typedef map<int , int> mii;
typedef pair<int , int> pii; 
typedef map<string , int> msi;
typedef pair<int , string> pis; 
typedef pair<int , pair<int , int> > piii;
int n , a , b;
int32_t main()
{
	cin >> n >> a >> b;
	if(n == 1 || a > b)
	{
		if(a == b)
			return cout << 1 << endl , 0;
		return cout << 0 << endl , 0;	
	}
	return cout << (n - 2) * (b - a) + 1 << endl , 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < int(n);i++)


int main(){
  int n,k;
  cin >> n >> k;
  int now = 1;
  rep(i,n){
    now = min(now*2,now+k);
  }
  cout << now << endl;



  

  return 0;
   

}


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

typedef long long ll;

int main()
{
    ll n,m;
    ll i,j;
    
    cin >> n;
    m = 0;
    if(n%2){
        cout << m << endl;
    }else{
        i = 10;
        while(i <= n){
            m += n/i;
            i *= 5;
        }
        cout << m << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
   
using namespace std;
     
#define PB(x) push_back(x)
#define ALL(x) (x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define MP(x) make_pair(x);
    
#define debug(x) cerr << #x << '=' << x << endl;
#define debug2(x, y) cerr << #x << '=' << x << ' ' << #y << '=' << y << endl;
#define debugn(a) for (int x: a) cerr << x << ' '; cerr << endl;
     
#define int long long
     
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vii;
typedef vector<string> vs;
typedef unsigned long long ull;

const int INF = 1e13;
const int mmod = 1000000007;

int32_t main()
{	
	int n;
	cin >> n;
	int a[n], r[n];
	for (int& x: a) cin >> x;
	
	for (int i = 0; i < n; i++)
		r[a[i]-1] = i+1;
	
	for (int& x: r) cout << x << ' ';
	cout << endl;
}


Measured memory_bytes: 2432
#include <iostream>

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
      a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
      a = b;
      return true;
    }
    return false;
}

int main() {
    using namespace std;
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    int plus_max = -2e9, minus_max = -2e9, plus_min = 2e9, minus_min = 2e9;
    for(int i = 0; i < N; i++){
        int A,B;
        cin >> A >> B;
        chmax( plus_max, A + B );
        chmax( minus_max, A - B );
        chmin( plus_min, A + B );
        chmin( minus_min, A - B );
    }
    cout << max( plus_max - plus_min, minus_max - minus_min ) << '\n';
}

Measured memory_bytes: 3652
/*Infor {{{
 ******************************************************
 * > File Name: d.cpp
 * > Author: zrz_orz
 * > Mail: 1281941815@qq.com
 * > Created Time: 2018/9/8/周六 20:28:10
 ******************************************************
}}}*/

#include <bits/stdc++.h>

using namespace std;

/*Abbreviation {{{ */
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define ROF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define cini(a) scanf("%d", &(a))
#define cinc(a) scanf("%c", &(a))
#define cinl(a) scanf("%lld", &(a))
#define cins(a) scanf("%s", (a))
#define cind(a) scanf("%lf", &(a))
#define coui(a) printf("%d", (a))
#define couc(a) printf("%c", (a))
#define coul(a) printf("%lld", (a))
#define cous(a) printf("%s", (a))
#define coud(a) printf("%f", (a))
#define SPA printf(" ")
#define LIN printf("\n")
#define ull unsigned long long int
/*}}}*/

/*Constant {{{*/
const int N = 501;
/*}}}*/

/*Class {{{*/
struct dd {
  int x, y, xi, yi;
}ans[N * N];
/*}}}*/

/*Variable {{{*/
int h, w, cnt;
int a[N][N];
bool used[N][N];
/*}}}*/

/*Declare {{{*/
/*}}}*/

/*Main {{{*/
int main() {
  scanf ("%d%d", &h, &w);
  for (int i = 1; i <= h; i++)
    for (int j = 1; j <= w; j++)
      scanf ("%d", &a[i][j]);
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      if (a[i][j] & 1) {
      	if (a[i][j + 1] & 1 && j != w) {
      		a[i][j] --;
      		a[i][j + 1] ++;
      		ans[++cnt] = (dd){i, j, i, j + 1};
				}
        else if (a[i + 1][j] & 1 && i != h) {
          a[i][j]--;
          a[i + 1][j] ++;
          ans[++cnt] = (dd){i, j, i + 1, j};
        }
        else if (a[i][j + 1] == 0 && j != w) {
       		a[i][j] --;
      		a[i][j + 1] ++;
      		ans[++cnt] = (dd){i, j, i, j + 1};
        }
        else if (a[i + 1][j] == 0 && i != h) {
        a[i][j]--;
        a[i + 1][j] ++;
        ans[++cnt] = (dd){i, j, i + 1, j};
        }
        else if (i != h) {
          a[i][j]--;
          a[i + 1][j] ++;
          ans[++cnt] = (dd){i, j, i + 1, j};
        }
        else if(j != w) {
          a[i][j]--;
          a[i][j + 1] ++;
          ans[++cnt] = (dd){i, j, i, j + 1};
        }
          
      }
     }
   }
 	cout<<cnt<<endl;
  for (int i = 1; i <= cnt; i++) {
    printf("%d %d %d %d\n", ans[i].x, ans[i].y, ans[i].xi, ans[i].yi);
  }
  return 0;
}
/*}}}*/

/*Define {{{*/
/*}}}*/


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){

  string s;
  cin >> s;
  P res = make_pair(-2,-2);
  rep(i,s.size()-1)if(s[i] == s[i+1])res = make_pair(i,i+1);
  rep(i,s.size()-2)if(s[i] == s[i+2])res = make_pair(i,i+2);
  cout << res.first+1 << " " << res.second+1 << endl;




  

  return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include <math.h>
int main(void){
	int a[101],b,n,i,j,k;
	scanf("%d%*c",&n );
	for(i=0;i<n;i++){
		scanf("%d",&a[i] );
	}
	for(k=0;k<n;k++){
		if(k==n-1){
			printf("%d\n",a[k] );
			break;
		}
		printf("%d ",a[k] );
	}
	for(i=1;i<n;i++){
		b=a[i];
		j=i-1;
		while(j>=0 && a[j]>b){
			a[j+1]=a[j];
			j--;
			a[j+1]=b;
		}
		for(k=0;k<n;k++){
			if(k==n-1){
				printf("%d\n",a[k] );
				break;
			}
			printf("%d ",a[k] );
		}
	}
	return 0;
}

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

int main() {
  
  string s;
  cin >> s;
  
  REP(i,s.size()) {
    if (i % 2 == 0) cout << s[i];
  }
  
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

int main()
{
  int n;
  cin >> n;
  map<string, int> mp;
  for(int i = 0 ; i < n ; i++){
    string s;
    cin >> s;
    sort(all(s));
    mp[s]++;
  }
  long long ans = 0;
  for(auto& x : mp){
    int cnt = x.second;
    ans += 1LL * cnt * (cnt - 1) / 2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 11136
N = int(input())
a = list(map(int,input().split(" ")))
a.append(0)
a.insert(0,0)
dis = 0
for i in range(N+1):
	dis += (abs(a[i+1] - a[i]))


for i in range(N):
	ans = dis - abs(a[i+1] - a[i]) - abs(a[i+2] - a[i+1]) + abs(a[i+2] - a[i])
	print(ans)

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

ll power(int a,int b,int c){
    ll res=1;
    while(b){
        if(b&1)res=res*a%c;
        a=a*a%c;
        b/=2;
    }
    return res;
}

int main(){
    int n,p;string s;
    cin>>n>>p>>s;
    ll ans=0;
    if(p==2||p==5){
        for(int i=0;i<n;i++)if((s[i]-'0')%p==0)ans+=i+1;
        cout<<ans<<endl;return 0;
    }
    map<int,ll> m;
    vector<ll> v(n+1,0);
    for(int i=1;i<=n;i++){
        v[i]=(v[i-1]+(s[n-i]-'0')*power(10ll,i-1,p))%p;
    }
    for(int i=0;i<=n;i++)m[v[i]]++;
    for(auto x=m.begin();x!=m.end();x++){
        ans+=(x->second)*(x->second-1)/2;
    }
    cout<<ans;
}

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

int main()
{
	int N,i;
	string S;

	cin >> N;

	for (i = 0; i < N; i++){
		cin >> S;

		if (S == "Y"){
			cout << "Four" << endl;
			break;
		}
        //クソコード,
		if (i == (N - 1)){
			cout << "Three" << endl;
		}
	}
}

Measured memory_bytes: 3588
import java.io.IOException;
import java.util.Scanner;

public class Main {
    private static StringBuilder sb = new StringBuilder();

    public static void main(String... args) throws IOException {
        final int[] targetAry = load();

        insertionSort(targetAry);

        System.out.print(sb.toString());
    }

    public static int[] load() throws IOException {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = scanner.nextInt();
        }

        return nums;
    }

    public static void insertionSort(final int[] targetAry) {
        for (int i = 0; i < targetAry.length; i++) {
            for (int j = i; 0 < j; j--) {
                if (targetAry[j - 1] > targetAry[j]) {
                    swap(targetAry, j - 1, j);
                }
                if ((1 < j) && (targetAry[j - 1] > targetAry[j - 2])) {
                    break;
                }
            }

            append(targetAry);
        }
    }

    public static void swap(final int[] targetAry, final int from, final int to) {
        final int tmp = targetAry[to];
        targetAry[to] = targetAry[from];
        targetAry[from] = tmp;
    }

    public static void append(final int[] targetAry) {
        for (int j = 0; j < targetAry.length; j++) {
            sb.append(targetAry[j]).append(j != targetAry.length - 1 ? ' ' : '\n');
        }
    }
}

Measured memory_bytes: 20928
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll=long long;
using P=pair<int,int>;
int main() {
    ll a,b,x;cin>>a>>b>>x;
    ll cnt;
    if(b==0) cnt=1;
    else if(a==0) cnt=(b/x)+1;

    else{
        cnt=b/x-(a-1)/x;
    }
    cout<<cnt<<endl;
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int main()
{
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    
    int K,X;
    cin >> K >> X;
    if(500*K>=X) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
import java.lang.StringBuilder

fun main(args:Array<String>) {
    val n = readLine()!!.toInt()
    val num = (1..n).map { readLine()!!.toInt() }
    val sorted = num.sortedDescending()
    val ans = StringBuilder()
    num.map { if(it == sorted.first()) sorted[1] else sorted.first() }.forEach { ans.appendln(it) }
    print(ans.toString())

}


Measured memory_bytes: 62472
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define df 0
int dp[100000+1],len=0;
int serach(int x){
  //  dp[j-1]<=a[i]<dp[j]
  int a=0,b=len+1;
  while(b-a>1){
    int c=(a+b)/2;
    if(dp[c]>=x)a=c;
    else b=c;
    if(df) printf("(s)[%d]%d %d %d[%d]\n",a,dp[a],x,dp[b],b);
  }
  return b;
}

int main(){
  int n;
  scanf("%d",&n);
  int a[n],i;
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  dp[0]=1000000010;dp[1]=-1;
  for(i=0;i<n;i++){
    int j=serach(a[i]);
    if(df) printf("[%d]%d %d %d\n",j-1,dp[j],a[i],dp[j]);
    dp[j]=a[i];
    if(j!=len+1)continue;
    len++;
    dp[len+1]=-1;
  }
  printf("%d\n",len);
  if(df){
    for(i=0;i<=len;i++){
      printf(" %d ",dp[i]);
    }
  }
  return 0;
}


/// confirm df==0 ///


Measured memory_bytes: 896