akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

string day[7] =  {"Sunny", "Cloudy", "Rainy"};

int main(){
    int A, B;
    cin >> A >> B;
    if(A >= 13){
        cout << B << endl;
    }else if(A >= 6){
        cout << B / 2 << endl;
    }else{
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = a; i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP1(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using ll = long long;
int pow(int a, int b, int mod) {
  if (b == 0) {
    return 1;
  } else if (b % 2 == 1) {
    return pow(a, b - 1, mod) * a % mod;
  }
  int c = pow(a, b / 2, mod);
  return c * c % mod;
}
int main() {
  int k;
  cin >> k;
  queue<ll> que;
  REP1(i, 9) { que.push(i); }
  REP(i, k - 1) {
    ll x = que.front();
    que.pop();
    if (x % 10 > 0) {
      que.push(10 * x + x % 10 - 1);
    }
    que.push(10 * x + x % 10);
    if (x % 10 < 9) {
      que.push(10 * x + x % 10 + 1);
    }
  }
  cout << que.front() << endl;
  return 0;
}


Measured memory_bytes: 5132
use std::io::*;
const MOD: usize = 1_000_000_007;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let m: usize = itr.next().unwrap().parse().unwrap();

    let mut dp: Vec<Vec<Vec<usize>>> = vec![vec![vec![0; n + 5]; n + 5]; m + 5];
    dp[0][1][1] = 1;
    for i in 0..m {
        for j in 1..n + 1 {
            for k in 1..j + 1 {
                dp[i + 1][j + 1][k] += dp[i][j][k] * (n - j) % MOD;
                dp[i + 1][j][k] += dp[i][j][k] * (j - k) % MOD;
                dp[i + 1][j][j] += dp[i][j][k] * k % MOD;
                dp[i + 1][j + 1][k] %= MOD;
                dp[i + 1][j][k] %= MOD;
                dp[i + 1][j][j] %= MOD;
            }
        }
    }
    println!("{}", dp[m][n][n]);
}


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

int main() {
  int n; cin >> n;
  vector<int> a(n), ball(n); rep(i, n) cin >> a[i];
  for (int i = n-1; i >= 0; i--) {
    ll sum = 0;
    for (int j = 1; (i+1) * j - 1 <= n-1; j++)
      sum += ball[(i+1) * j - 1];
    ball[i] = a[i] ^ sum % 2;
  }
  int m = 0;
  rep(i, n) if (ball[i]) m++;
  cout << m << endl;
  rep(i, n) if (ball[i]) cout << i+1 << " ";
  cout << endl;
  return 0;
}

Measured memory_bytes: 2432
package main

import "fmt"

var totalCount int = 0
var inputWord string
var lastWord string = ""

func main() {
	var result bool = true
	wordDict := make(map[string]int)
	fmt.Scanf("%d\n", &totalCount)
	for i := 0; i < totalCount; i++ {
		fmt.Scanf("%s\n", &inputWord)
		if i > 0 {
			if lastWord[len(lastWord)-1] != inputWord[0] {
				result = false
			}
		}
		_, present := wordDict[inputWord]
		if present {
			result = false
		}
		wordDict[inputWord] = 1
		lastWord = inputWord
	}

	if result {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x) cout<<#x<<" = "<<(x)<<endl;
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

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

int main() {
  int n,a; cin >> n;
  int ans=0;
  REP(i,n) { cin >> a; ans = gcd(ans,a); }
  COUT(ans);
  return 0;
}


Measured memory_bytes: 384
// author - shreyanshjn (Shreyansh Jain)
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair <int,int> PII;
typedef pair <ll, ll> PLL;
typedef pair <int,string> PIS;
typedef vector <int> vec;
typedef priority_queue<int> PQ;
/* #define input 1 */
#define INF 100000000000000000
#define endl '\n'
#define debug(x) cout<<#x<<": "<<x<<endl
#define pi 3.141592653589793
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
#define sz(x) (int)(x).size()
#define len(x) (int)x.length()
#define rep(a,b,c) for(int a=b; a<c; a++)
#define fori(z,n)  for(int i=z;i<n;i++)
#define fork(z,n)  for(int k=z;k<n;k++)
#define forii(z,n) for(int i=z;i<=n;i++)
#define forkk(z,n) for(int k=z;k<=n;k++)
const int mod = 1e9 + 7;
int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}
string trim(const string& str) {
    size_t first = str.find_first_not_of(' ');
    if (string::npos == first)
    {
        return str;
    }
    int last = str.find_last_not_of(' ');
    return str.substr(first, (last - first + 1));
}

int main() { 
    #ifdef input
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout.precision(15);
    int n, m; cin >> n >> m;
    char arr[n][m];
    fori(0, n) {
        fork(0, m) {
            cin >> arr[i][k];
        }
    }
    int dp[n][m];
    dp[0][0] = 1;
    fori(0, n) {
        fork(0, m) {
            if(i == 0 and k == 0) continue;
            dp[i][k] = 0;
            if(arr[i][k] == '#') {
                dp[i][k] = INT_MAX; 
            }
            else {
                if(i - 1 >= 0 and dp[i - 1][k] != INT_MAX) {
                    dp[i][k] = (dp[i][k] + dp[i - 1][k]) % mod;
                }
                if(k - 1 >= 0 and dp[i][k - 1] != INT_MAX) {
                    dp[i][k] = (dp[i][k] + dp[i][k - 1]) % mod;
                }
            }
        }
    }
    cout << dp[n - 1][m - 1] << endl;
    cerr<<"Time elapsed"<<1.0*clock()/CLOCKS_PER_SEC<<"s\n";
    return 0;
}

Measured memory_bytes: 8664
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cassert>
using namespace std;

#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long ll;

int main ()
{
    string S; cin >> S;

    if (S.size() == 1) {
        cout << 1 << endl;
        return 0;
    }

    int n = (int)S.size();
    int ans = n;
    REP(i,S.size() - 1) {
        if (S[i] != S[i + 1]) {
            ans = min(ans, max(i + 1, n - 1 - i));
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define ii pair<int,int>
#define MAX 1000000007

using namespace std;

int main(void){
	string s;
	ll k;
	cin>>s>>k;
	int ans=1;
	rep(i,k){
		int tmp=s[i]-'0';
		if(tmp!=1){
			ans=tmp;
			break;
		}
	}
	cout<<ans<<endl;
	return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb emplace_back
using namespace std;
using ll = long long;
const int maxn = 10;
const ll inf = 1e16;
ll cost[maxn];
ll solve() {
	ll n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	cost[2] = a, cost[3] = b, cost[5] = c;
	map<ll, ll> dp;
	queue<ll> togo;
	togo.push(n);
	ll res = inf / n >= d ? d * n : inf;
	while (togo.size()) {
		ll n = togo.front(), v = dp[n];
		togo.pop();
		if (v >= res) continue;
		auto update = [&](ll val, ll cost) {
			//cerr << val << ' ' << cost << "  VC\n";
			if (val == 0) res = min(res, cost);
			else if (!dp.count(val) || dp[val] > cost)
				dp[val] = cost, togo.push(val);
		};
		//cerr << n << " : " << v << '\n';
		if (inf / n >= d) res = min(res, v + d * n);
		for (int i : {2, 3, 5}) {
			for (int j = -i;j <= i;++j) if ((n+j > 0) && (n + j) % i == 0 && (cost[i] + abs(j) * d + v <= inf))
				update((n + j) / i, v + abs(j) * d + cost[i]);
		}
	}
	//cerr << '\n';
	return res;
}
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	int t;
	cin >> t;
	while (t--)
		cout << solve() << '\n';
}



Measured memory_bytes: 4944
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;

int main(){
	ll n,x,ans=0;
	cin >> n >> x;
	vector<ll>a(n);
	for(int i=0;i<n;i++) cin >> a[i];
	for(int i=0;i<n-1;i++){
		if(a[i]+a[i+1]>x){
			if(a[i+1]>=a[i+1]+a[i]-x){
				ans+=a[i+1]+a[i]-x;
				a[i+1]-=a[i+1]+a[i]-x;
			}else{
				ans+=a[i+1]+a[i]-x;
				a[i+1]=0;
				a[i]-=a[i]-x;
			}
		}else{
			continue;
		}
	}
	cout<<ans;
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define _GLIBCXX_DEBUG

int main(void){

    string S;

    cin >> S;

    if(S == "ABC"){
        cout << "ARC" << endl;
    }

    else {
        cout << "ABC" << endl;
    }

}

Measured memory_bytes: 3592
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2631>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll solve(){
    ll n; cin >> n;
    vector<ll> a(n); for(auto& in:a) cin >> in;
    ll res = 0;
    sort(a.begin(),a.end());
    ll X = accumulate(a.begin(),a.end(),0LL);
    if(n == 1) return X;
    if(n == 2) return X - 1;
    if(n == 3) return X - 3;
    if(n == 4){
        if(*a.rbegin() == 2) return X-4;
        else if(*a.begin() == 2) return X - 5;
        else return X - 6;
    }
    if(n == 5){
        if(*a.rbegin() <= 3){
            if(X < 12) return X - 6;
            else if(X < 14) return X - 7;
            else return X - 8;
        }else{
            if(a[1] == 2) return X - 7;
            else if(X <= 20) return X - 8;
            else return X - 6 - min(a[0],4LL);
        }
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() <<endl;
    return 0;
}



Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define LL long int

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


    return ;
}

int main(){
    solve();

    return 0;
}

Measured memory_bytes: 256
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

#define P 1000000007

long m(long a, int x){
	if(x==0) return 1;
	if(x%2==0){
		return m(a*a%P, x/2);
	}else{
		return m(a*a%P, x/2)*a%P;
	}
}

long r(long a){
	return m(a, P-2);
}

long c(int a, int b){
	a=a-b;
	long x=1, y=1;
	int i;
	for(i=1; i<=b; i++){
		x=x*i%P;
		y=y*(i+a)%P;
	}
	return y*r(x)%P;
}

int main(void){
	int n, a, b;
	scanf("%d%d%d\n", &n, &a, &b);
	long ans = (P*3L + m(2, n) - c(n, a) - c(n, b) - 1)%P;
	printf("%ld\n", ans);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=3e3+9;
int a[N],b[N],p;
int fac[N],inv[N];
void init(){
    fac[0]=fac[1]=inv[0]=inv[1]=1;
    for(int i=2;i<p;i++)fac[i]=fac[i-1]*i%p,inv[i]=(p-p/i)*inv[p%i]%p;
    for(int i=2;i<p;i++)inv[i]=inv[i]*inv[i-1]%p;
}
int C(int i,int j){
    return fac[i]*inv[j]%p*inv[i-j]%p;
}
int main(){
    cin>>p;init();
   // for(int i=1;i<=10;i++)cout<<fac[i]<<" "<<fac[i]*inv[i]%p<<endl;
    for(int i=0;i<p;i++)cin>>a[i];
    for(int i=0;i<p;i++)if(a[i]){
        b[0]++;
        int t=-1;//if(p==2)t=1;
        for(int j=p-1;j>=0;j--){
            (b[j]+=t*C(p-1,j)%p)%=p;
            (t*=-i)%=p;
        }
    }
    for(int i=0;i<p;i++)cout<<(b[i]%p+p)%p<<" ";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Text;

namespace ABC136.D2 {
    class Program {
        static void Main(string[] args) {
            var n = Console.ReadLine() + "R";
            var charArray = n.ToCharArray();
            var chunkCount = 0;
            var repeatCount = 0;
            var chunkCount2 = 0;
            var dic = new Dictionary<int, int>();
            for (int i = 0; i < n.Length; i++) {
                if (i == 0) {
                    chunkCount++;
                    continue;
                }
                if (charArray[i] == charArray[i - 1]) {
                    chunkCount++;
                    continue;
                }
                repeatCount++;
                if (repeatCount % 2 == 1) {
                    chunkCount2 = chunkCount;
                    chunkCount = 1;
                    continue;
                }
                dic.Add(i - chunkCount - 1, CountChildren(chunkCount2, chunkCount));
                dic.Add(i - chunkCount, CountChildren(chunkCount, chunkCount2));
                chunkCount = 1;
            }
            var output = new StringBuilder();
            for (int i = 0; i < n.Length - 1; i++) {
                var v = 0;
                dic.TryGetValue(i, out v);
                output.Append(v.ToString() + " ");
            }
            Console.WriteLine(output);
        }

        private static int CountChildren(int a, int b) {
            if (a % 2 == 0 && b % 2 == 0) return (a + b) / 2;
            else if (a % 2 == 1 && b % 2 == 0) return (a + b + 1) / 2;
            else if (a % 2 == 0 && b % 2 == 1) return (a + b - 1) / 2;
            else return (a + b) / 2;
        }
    }
}


Measured memory_bytes: 21212
// ALLAH \\
                        who is Hussain? -> whoishussain.org

#include <bits/stdc++.h>
using namespace std;

#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,n,a) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define aLL(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long LL;
typedef pair<int,int> PII;
const int mod=1000000007;
LL powmod(LL a,LL b) {LL res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int in(){ int x; scanf("%d",&x); return x; }
const int N = 4e6;
int n, k, fact[N], dp[2001][2001];
int C(int n, int nn){
        return 1ll*fact[n]*powmod(fact[nn],mod-2)%mod * powmod(fact[n-nn],mod-2)%mod;
}
int32_t main(){
        cin >>n >> k;
        if( k == 1 ) return cout << 1 << endl,0;
        int ans = 1;
        fact[0] = 1;
        for(int i = 1; i < N; i++)
                fact[i] = 1ll*fact[i-1]*i%mod;
        dp[1][0] = dp[0][0] =  1;
        for(int i = 1;i <= n;i ++)
        {
                dp[i][i] = (dp[i-1][i] + 1ll*dp[i-1][i-1]*C(i*(k-1)+i-2,k-2)%mod)%mod; 
               for(int j = i+1; j <= n; j++){
                       dp[i][j] = (dp[i-1][j] + 1ll*dp[i][j-1]*C(j*(k-1)+i-2,k-2)%mod)%mod; 
               } 
        }
        cout << 1ll*dp[n][n]*fact[n]%mod << endl;
}

// C/C++ File
// AUTHOR:   truth-seeker
// FILE:     le.cpp
// ROLE:     TODO (some explanation)
// CREATED:  2017-01-20 16:56:08
// MODIFIED: 2017-01-20 16:56:08


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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef pair<string, ll> psi;
typedef pair<ll, string> pis;
typedef pair<ll, vll> plv;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define REP(i, a, b) for(ll i=ll(a);i<=ll(b);++i)
#define REPR(i, a, b) for(ll i=ll(a);i>=ll(b);--i)
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define MAX 1000000ll

template<typename T>
T absolute(T a) { return a >= 0 ? a : -a; }

template<typename T>
T sqr(T a) { return a * a; }

bool check(set<int> s, ll j) {
    ll p = j;
    while (p) {
        if (find(all(s), p % 10) != s.end())return false;
        p /= 10;
    }
    return true;
}

ll sum(ll a[], ll ind, ll n, set<int> s) {
    if (ind <= (n - 1)) {
        if (check(s, a[ind])) {
            set<int> s1(all(s));
            int j = a[ind];
            while (j) {
                s.insert(j % 10);
                j /= 10;
            }
            return max(a[ind] + sum(a, ind + 1, n, s), sum(a, ind + 1, n, s1));
        } else return sum(a, ind + 1, n, s);
    } else return 0;
}

int main() {
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    ll a,p;
    cin>>a>>p;
    cout<<(3*a+p)/2<<endl;
}


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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

template<typename T>
T gcd(T x, T y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	int n, l;
	cin >> n >> l;
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		ans += i + l;
	}
	if (0 <= l) {
		ans -= l;
	}
	else if (n <= -l) {
		ans -= n - 1 + l;
	}
	cout << ans << "\n";
}


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


Measured memory_bytes: 256
#include<stdio.h>
main(){
  int N,i,A,B,x,y;
  scanf("%d",&N);
  A=1000000001,B=A;
  for(i=0;i<N;i++){
    scanf("%d %d",&x,&y);
    if(y<B)A=x,B=y;
  }
  printf("%d",A+B);
  return 0;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }
    else x=x->right;
  }
  z->parent=y;
  if(y==NIL) root=z;
  else{
    if(z->key < y->key) y->left = z;
  else y->right = z;
  }
}

void inorder(Node u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
       }
  }

  return 0;
}









Measured memory_bytes: 25124
#include <iostream>

using namespace std;

typedef long long ll;

int main() {
    ll a = 0, b = 0, k = 0;
    cin >> a >> b >> k;
    for(ll i = a;i <= b;i++) {
        if(i - a < k || b - i < k) cout << i << endl;
    }
   
   return 0;
}

Measured memory_bytes: 256
arr = 5.times.map { gets.chomp.to_i }

non_zero = arr.select { |e| e % 10 != 0 }

nz = non_zero.sort_by { |e| e % 10 }.first
ans = 0
arr.each do |e|
  if e == nz
    ans += e
    nz = -1
    next
  end
  if e % 10 == 0
    ans += e
  else
    ans += ((e / 10) + 1) * 10
  end
end

puts ans


Measured memory_bytes: 1788
/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd

#define eps 1e-11
#define M_PI 3.141592653589793
#define bsize 512

#define ldouble long double
using namespace std;

#define bs 1000000007
const int N = 500031;

long long n,ar[N],ans;

long long gcd(long long a,long long b)
{
	while (a&&b)a>b?a%=b:b%=a;
	return a+b;
}

int main(){
	//freopen("tree.in","r",stdin);
	//freopen("tree.out","w",stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	//cin.tie(0);

	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>ar[i];
	}
	ans=ar[1];
	for (int i=2;i<=n;i++)
	{
		long long Q=gcd(ans,ar[i]);
		ans=ans/Q*ar[i];
	}
	cout<<ans<<endl;

	cin.get(); cin.get();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pr;
typedef vector<pr> vpr;
typedef vector<vector<int>> vvi;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    ll n,s,sum=0;
    vll v;
    cin >> n;
    rep(i,n){
        cin >> s;
        if(s%10) v.pb(s);
        sum+=s;
    }
    sort(all(v));
    if(sum%10) cout << sum << endl;
    else{
        if(v.size()==0) cout << 0 << endl;
        else cout << sum-v[0] << endl;
    }
    return 0;
}


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

int main()
{
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int sum = 0;
    if (k >= a)
    {
        sum += a;
        k -= a;
    }
    else
    {
        sum += k;
        k = 0;
    }

    if (k >= b)
    {
        k -= b;
    }
    else
    {
        k = 0;
    }

    if (k >= c)
    {
        sum -= c;
        k -= c;
    }
    else
    {
        sum -= k;
        k = 0;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>n>>s;
  std::vector<ll> v(n,0);
  if(s[i]=='.') v[0]=1;
  repl(i,1,n) {
    if(s[i]=='.') v[i] = v[i-1] + 1;
    else v[i]=v[i-1];
  }
  ll ans = INF;
  rep(i,n){
    // cout<<ans<<endl;
    // cout<<v[i]<<endl;
    ans = MIN(ans,i+1-v[i]+v[n-1]-v[i]);
  }
  ll p =0,sa=0,flg,ss=0,sss=0;
  rep(i,n) if(s[i]=='#') p++;
  rep(i,n){
    if(s[i]=='#') sa++;
    else {
      flg = i;
    }
  }
  repl(i,flg,n){
    if(s[i]=='.') ss++;
  }
  rep(i,n){
    if(s[i]=='#') sss++;
  }  // cout<<sa<<" "<<ss<<endl;
  ans = MIN(ans,sss);
  ans = MIN(ans,n-sss);
  if(sa+ss==n){
    ans = MIN(ans,sa);
    ans = MIN(ans,n-sa);
  }
  if(p==n) cout<<0<<endl;
  else cout<<ans<<endl;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 2196
#include <bits/stdc++.h>
#define REP(i, n) for (decltype(n) i = 0; i < (n); ++i)
using namespace std;
using i64 = long long;
using u64 = unsigned long long;

const i64 MOD = 1000000000 + 7;

struct mint {
  long long x;
  mint(long long 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 { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(long long 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 { return mint(*this) /= a; }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

i64 N, K;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> K;

  mint ans;
  ans += 1;            // no zero
  ans += N * (N - 1);  // 1 zero

  int L = min(N, K + 1);
  vector<mint> c1(L), c2(L);
  c1[1] = N;
  c2[1] = N - 1;
  // nCi * (n-1)Ci
  // i is the number of zeros.
  for (int i = 2; i < L; ++i) {
    mint mi = mint(i).inv();
    c1[i] = c1[i - 1] * (N + 1 - i) * mi;
    c2[i] = c2[i - 1] * (N - i) * mi;
    ans += c1[i] * c2[i];
  }
  cout << ans << endl;
}

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

int main(){
    string t;
    cin >> t;

    int a = 0, b = 0, c = 0;
    for (int i = 0; i < 3; ++i) {
        if (t[i] == 'a')
            ++a;
        if (t[i] == 'b')
            ++b;
        if (t[i] == 'c')
            ++c;
    }
    if (a == 1 && b == 1 && c == 1) {
        cout << "Yes" << '\n';
    } else {
        cout << "No" << '\n';
    }
    return 0;
}


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

const int Maxn = 105;
const int Maxl = 26;

bool mark[Maxl][Maxn];
string s;

void Mark(int let, int a, int b)
{
    for (int i = a; i <= b; i++) if (0 <= i && i < s.length())
        mark[let][i] = true;
}

bool Check(int len)
{
    for (int i = 0; i < Maxl; i++) {
        bool ok = true;
        for (int j = 0; j < len && ok; j++)
            ok = mark[i][j];
        if (ok) return true;
    }
    return false;
}

int main()
{
    cin >> s;
    for (int i = int(s.length()); i > 0; i--) {
        fill((bool*)mark, (bool*)mark + Maxl * Maxn, false);
        int ops = int(s.length()) - i;
        for (int j = 0; j < s.length(); j++)
            Mark(s[j] - 'a', j - ops, j);
        if (Check(i)) { printf("%d\n", ops); return 0; }
    }
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from collections import deque
import heapq
INF = float("inf")


def main():
    # 10**6くらいのループ
    # 毎回、logN以内で閉路を検出できると嬉しい
    # 見るべき場所は、新しく追加したところだけで、即座にわかるのでO(1)か
    N = int(input())
    A = [None]*N
    for i in range(N):
        A[i] = list(map(lambda x: int(x)-1, input().split()))
    # print(A)

    # それぞれの選手の手合進行
    indices = [0]*N
    E = [-1 for _ in range(N)]
    change = []
    for i in range(N):
        # 選手iは次選手A[i][indices[i]]と勝負したい
        E[i] = A[i][indices[i]]
        if E[E[i]] == i:
            # 勝負成立
            change.append(i)
            change.append(E[i])
            indices[i] += 1
            indices[E[i]] += 1
    if len(change) == 0:
        # print("一巡目終了")
        print(-1)
        return

    ans = 0
    while len(change) > 0:
        # print("change", change)
        # print("indices", indices)
        new_change = []
        ans += 1
        for c in change:
            # print("変更", c)
            if indices[c] == N-1:
                continue
            E[c] = A[c][indices[c]]
            if E[E[c]] == c:
                # 勝負成立
                # print("勝負成立, ", c, " vs ", E[c])
                # print(indices)
                new_change.append(c)
                new_change.append(E[c])
                indices[c] += 1
                indices[E[c]] += 1
        change = new_change

    flag = True
    for i in range(N):
        if indices[i] != N-1:
            flag = False
            break
    if flag is False:
        # print(indices)
        print(-1)
        return
    print(ans)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 53980
//https://atcoder.jp/contests/abc153/tasks/abc153_a
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long h , a ;
    cin >> h >> a ;
    if( h % a == 0 ) cout << h / a << endl ;
    if( h % a != 0 ) cout << (h / a) + 1 << endl ;
}

Measured memory_bytes: 256
use whiteread::parse_line;

fn main() {
    let n: f64 = parse_line().unwrap();
    let tax: f64 = 1.08;
    let x: f64 = (n / tax).ceil();
    if (x * tax).floor() == n {
        println!("{}", x);
    } else {
        println!(":(");
    }
}


Measured memory_bytes: 2668
// Problem Link: 
// Tutorial Link: 

#include<bits/stdc++.h>
 
using namespace std;
 
#define LL long long
#define pb push_back
#define pLL pair<LL,LL>
#define ff first
#define ss second
#define rep(i,a,b) for(LL i=a;i<=b;++i)
#define repb(i,a,b) for(LL i=a;i>=b;--i)
#define ld double
#define mp make_pair
#define vLL vector<LL>
#define vpLL vector<pLL>
#define vld vector<ld>
#define pld pair<ld,ld>
#define vpld vector<pld>
#define SLL set<LL>
#define SpLL set<pLL>
#define FIO ios::sync_with_stdio(false)
#define mod 1000000007

LL N;

int main()
{
	FIO;
	cin >> N;
	cout << (1000 - (N%1000))%1000 << endl;
}

Measured memory_bytes: 3580
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

ll N,M,L;
ll K[2000],S[100001],dp[2000][2000];


ll calc(int left,int right){
	return (S[right]-S[left-1])/L;
}

ll recursive(int tail_A,int tail_B){

	if(dp[tail_A][tail_B] != 999999999999)return dp[tail_A][tail_B];

	int next = max(tail_A,tail_B)+1;

	if(next == N-1){
		return calc(K[tail_A],K[N-1])+calc(K[tail_B],K[N-1]);
	}

	ll ret_A = recursive(next,tail_B) + calc(K[tail_A],K[next]);
	ll ret_B = recursive(tail_A,next) + calc(K[tail_B],K[next]);

	return dp[tail_A][tail_B] = min(ret_A,ret_B);
}


int main(){

	scanf("%lld %lld %lld",&N,&M,&L);

	for(int i = 0; i < N; i++)scanf("%lld",&K[i]);
	sort(K,K+N);

	S[0] = 0;
	for(int i = 1; i <= M; i++){
		scanf("%lld",&S[i]);
		S[i] += S[i-1];
	}

	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++)dp[i][k] = 999999999999;
	}

	printf("%lld\n",recursive(0,0));

	return 0;

}

Measured memory_bytes: 35436
#include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    string t, h;
    int ts = 0, hs = 0;

    for(int i = 0; i < n; i++){
        cin >> t >> h;
        if(t == h){
            ts++;
            hs++;
            continue;
        }
        for(int j = 0;; j++){
            if(t[j] > h[j]){
                ts += 3;
                break;
            }
            else if(t[j] < h[j]){
                hs += 3;
                break;
            }
        }
    }
    cout << ts << " " << hs << endl;
    return 0;
}



Measured memory_bytes: 3152
import string

s=list(input())
k=int(input())

str=string.ascii_lowercase
abc=str+str

s_len=len(s)
for i in range(s_len):
  si_inx=abc.index(s[i])

  if i==s_len-1:
    k%=26
    s[i]=abc[si_inx+k]
    break

  if s[i]=='a':
    continue

  if k>=26-si_inx:
    k-=26-si_inx
    s[i]='a'
  else:
    continue

print(''.join(s))

Measured memory_bytes: 4792
from collections import Counter
s = input()
dic = dict(Counter(s))
if len(dic)==1:
    for v in dic.values():
        if v==1:
            print('YES')
        else:
            print('NO')
elif len(dic)==2:
    for v in dic.values():
        if v>=2:
            print('NO')
            break
    else:
        print('YES')
else:
    a = dic['a']
    b = dic['b']
    c = dic['c']
    if a==b==c:
        print('YES')
    elif a==b and abs(b-c)<=1:
        print('YES')
    elif b==c and abs(c-a)<=1:
        print('YES')
    elif c==a and abs(a-b)<=1:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
//cin.ignore();	// better to use 2 times getline(cin,s);
// g++ iterator.cpp -std=c++17
//cout << (A + B == C ? "YES" : "NO") << endl;
#define pb push_back
#define mk make_pair
#define vll vector<ll>
#define mll map<ll,ll >
#define mlli map<ll,ll>::iterator
#define size size()
#define endl "\n"
#define ll long long int
#define ld long double
void fast(){
   	ios_base::sync_with_stdio(false);
   	cin.tie(NULL);
   	cout.tie(NULL);}


int main(void)
{
	fast();
	int a,b;
	cin>>a>>b;
	int flag=-1;
	for(int i=1;i<=1250;i++)
	{
		if(trunc(i*0.08)==a && trunc(i*0.1)==b)
		{
			flag=1;
			cout<<i<<endl;
			break;
		}
	}
	if(flag==-1)
	{
		cout<<-1<<endl;
	}
}

Measured memory_bytes: 256
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

N = int(input())
md = make_divisors(N)
mdd = make_divisors(N-1)
se = set(md + mdd)
li = list(se)
ans = 0
for i in li:
  if i != 1:
    n = N
    while n >= i:
      if n % i == 0:
        n = n // i
      else:
        n = n % i
    if n == 1:
      ans += 1
print(ans)

Measured memory_bytes: 3956
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;

void main() {
  auto l = readln.chomp.split.map!(to!int).array;
  int n = l[0], c = l[1];
  long[][] cc = new long[][](31, 200010);
  long[] imos = new long[](200010);
  

  for (int i = 0; i < n; ++i) {
    auto m = readln.chomp.split.map!(to!int).array;
    cc[m[2] - 1][2 * m[0] - 1] += 1;
    cc[m[2] - 1][2 * m[1]] -= 1;
  }

  for (int i = 0; i < c; ++i) {
    for (int j = 1; j <= 200000; ++j) {
      cc[i][j] += cc[i][j - 1];
      if (cc[i][j - 1] == 0 && cc[i][j] > 0) {
        imos[j] += 1;
      }
      else if (cc[i][j] == 0 && cc[i][j - 1] > 0) {
        imos[j] -= 1;
      }
    }
  }

  long ans;

  for (int i = 1; i <= 200000; ++i) {
    imos[i] += imos[i - 1];
    if (ans < imos[i]) ans = imos[i];
  }

  ans.writeln;
}

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

int main(){
    int a, b;
    cin >> a >> b;
    if(a == b){
        cout << "Draw\n";
        return 0;
    }
    vector<int> table = {2,3,4,5,6,7,8,9,10,11,12,13,1};
    int i = 0, j = 0;
    while(table[i] != a) i++;
    while(table[j] != b) j++;
    cout << (i < j ? "Bob\n" : "Alice\n");
}


Measured memory_bytes: 256
///
// File:  a.go
// Author: ymiyamoto
//
// Created on Thu Apr  5 20:29:45 2018
//
package main

import (
	"fmt"
)

var A, B, C int

func main() {
	fmt.Scan(&A, &B, &C)
	if A%2 == 0 && A == B && B == C {
		fmt.Println(-1)
		return
	}

	count := 0
	for {
		if A%2 == 1 || B%2 == 1 || C%2 == 1 {
			break
		}
		A, B, C = B/2+C/2, A/2+C/2, A/2+B/2
		count++
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MAX_N = 100010;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
using Graph = vector<vector<int>>;
Graph G;
/*------------------------------------------------------------------*/
int main(){
    ll n; cin >> n;
    string ans = "";

    while(n > 0){
        n--;
        ans += (char)(n % 26 + 'a');
        n /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}

Measured memory_bytes: 3632
import java.util.*;

import static java.lang.System.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        Set<Integer> candidates = new TreeSet<>();

        long tmp = 1;
        while (tmp <= N) {
            candidates.add((int) tmp);
            tmp *= 6;
        }

        tmp = 1;
        while (tmp <= N) {
            candidates.add((int) tmp);
            tmp *= 9;
        }

        int INF = 1_000_000;
        int dp[] = new int[N + 1];
        Arrays.fill(dp, INF);
        dp[0] = 0;
        for (int i = 1; i <= N; i++) {
            for (int n : candidates) {
                if (i >= n) {
                    dp[i] = Math.min(dp[i], dp[i - n] + 1);
                }
            }
        }

        out.println(dp[N]);
    }
}

Measured memory_bytes: 26068
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - '0';}
char myitoc(int N) {return '0' + N;}

signed main()
{
  int H, W;
  cin >> H >> W;
  vector<vector<int>> T(H, vector<int>(W));
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      char c;
      cin >> c;
      T.at(i).at(j) = ((c == '#') ? 3 - (i + j) % 2 : (i + j) % 2);
      //cerr << T.at(i).at(j) << " ";
    }
    //cerr << endl;
  }

  set<pair<int, int>> S;
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      S.emplace(make_pair(i, j));
    }
  }

  int ans = 0;
  queue<pair<int, int>> Q;
  vector<vector<int>> d = {{0, -1}, {0, 1}, {-1, 0}, {1, 0}};
  while (!S.empty())
  {
    int b = 0, w = 0;
    Q.push(*S.begin());
    S.erase(S.begin());
    while (!Q.empty())
    {
      int y0 = Q.front().first, x0 = Q.front().second;
      //cerr << y0 << " " << x0 << endl;
      Q.pop();
      if (T.at(y0).at(x0) / 2 == 1)
        b++;
      else
        w++;
      
      for (int i = 0; i < 4; i++)
      {
        int y1 = y0 + d.at(i).at(0), x1 = x0 + d.at(i).at(1);
        //cerr << "! " << y1 << " " << x1 << " ";
        //if (0 <= y1 && y1 < H && 0 <= x1 && x1 < W)
          //cerr << T.at(y1).at(x1) << " ";
        pair<int, int> p = make_pair(y1, x1);
        //cerr << S.count(p) << endl;

        if (0 <= y1 && y1 < H && 0 <= x1 && x1 < W
            && T.at(y0).at(x0) % 2 == T.at(y1).at(x1) % 2
            && S.count(p) > 0)
        {
          Q.push(p);
          S.erase(p);
        }
      }
    }
    ans += b * w;
    //cerr << "* " << b << " " << w << endl;
  }

  cout << ans << endl;
}

Measured memory_bytes: 11520
#include<iostream>
#include<algorithm>

#define ll long long int

using namespace std;

int main(){
  ll n, W;
  cin>>n>>W;
  ll w[n+1], p[n+1];
  for(ll i=1; i<=n; i++)
    cin>>w[i]>>p[i];
  w[0] = 0;
  p[0] = 0;
  ll v[n+1][W+1];
  for(ll i=0; i<=W; i++)
    v[0][i] = 0;
  for(ll i=0; i<=n; i++)
    v[i][0] = 0;
  for(ll i=1; i<=n; i++){
    for(ll j=1; j<=W; j++){
      if(j-w[i] >= 0)
         v[i][j] = max(v[i-1][j], v[i-1][j-w[i]]+p[i]);
      else
      	 v[i][j] = v[i-1][j];
    }
  }
  cout<<v[n][W];
}


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

double abs_(double a)
{
	if (a > 0) return a;
	else return -a;
}

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		double x[4], y[4];
		double a, b;
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		a = (x[2] - x[3]) * (y[0] - y[1]);
		b = (x[0] - x[1]) * (y[2] - y[3]);
		bool h = abs_(a - b) < 0.0000000001;
		if (h)
		{
			cout << "YES" << endl;
		}
		else
			cout << "NO" << endl;
	}


	return 0;
}


Measured memory_bytes: 3160
#include<cmath>
#include<string>
#include<fstream>
#include<iostream>
#define MAX(a,b) (a>b? a:b)
#define MIN(a,b) (a>b? b:a)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

int main(){
	int N;
	int A[200];
	cin >> N;
	for(int i=0;i<N;i++) cin >> A[i];
	int cnt=0;
	int flag=0;
	do {
		for(int i=0;i<N;i++){
			if(A[i]%2==0) A[i]=A[i]/2;
			else {
				flag=1;
				break;
			}
		}
		if(flag) break;
		else cnt++;
	}while(1);
	cout << cnt << endl;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;
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 f(ll x) {
  ll ret = 0;
  while (x % 2 == 0) x /= 2, ret++;
  return ret;
}

int main() {
  ll n, m;
  cin >> n >> m;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n) a[i] /= 2;  // a->a'

  ll t = f(a[0]);

  rep(i, n) {
    if (f(a[i]) != t) {
      cout << 0 << endl;
      return 0;
    }
    a[i] >>= t;  // a[i] /=2^t
  }

  m >>= t;

  ll l = 1;
  rep(i, n) l = lcm(l, a[i]);
  if (l > m) {
    cout << 0 << endl;
    return 0;
  }

  m /= l;
  ll ans = (m + 1) / 2;

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

Measured memory_bytes: 1024
# ABC065 B:Trained?

N = int(input())
l = []
for _ in range(N):
    a = int(input())
    l.append(a-1)

step = 0
c = 0
while True:
    if step == 1:
        ans = c
        break
    if c > N:
        ans = -1
        break
    else:
        c += 1
        step = l[step]
print(ans)

Measured memory_bytes: 12984
#include<stdio.h>
#include<ctype.h>
main(){
	char number[1001];
	int num,sum;
	int i;

	while(1){
		scanf("%s",number);
//		printf("%s\n",number);
		if(!(strcmp(number,"0"))) break;

		i = 0;
		sum = 0;
		while(number[i] != '\0'){
			num = number[i] - '0';
//			printf("%d\n",num);
			sum = sum + num;
			i++;
		}
		printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 536