akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
vector<int> Graph[110000];
vector<P> lis[110000];
vector<int> Depth[110000];
vector<int> Deep(110000);
vector<int> Parent(110000);
vector<int> child[110000];
vector<int> color(110000);
vector<int> ans(110000);
int root = 0;
void BFS() {
  for (int i = 0; i < (int)Deep.size(); i++) {
    Deep[i] = 999999;
  }
  queue<P> Q;
  Q.push(make_pair(0,root));
  Depth[0].push_back(root);
  Deep[root] = 0;
  while (!Q.empty()) {
    P p = Q.front();
    Q.pop();
    for (int i = 0; i < (int)Graph[p.S].size(); i++) {
      if (Deep[Graph[p.S][i]] > p.F + 1) {
        Q.push(make_pair(p.F+1,Graph[p.S][i]));
        Deep[Graph[p.S][i]] = p.F + 1;
        Depth[p.F+1].push_back(Graph[p.S][i]);
        Parent[Graph[p.S][i]] = p.S;
        child[p.S].push_back(Graph[p.S][i]);
      }
    }
  }
}
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N-1; i++) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    lis[a].emplace_back(b,i);
    lis[b].emplace_back(a,i);
    Graph[a].push_back(b);
    Graph[b].push_back(a);
  }

  BFS();
  
  color[0] = 0;
  for (int i = 0; i < N-1; i++) {
    for (int j = 0; j < (int)Depth[i].size(); j++) {
      int s = Depth[i][j];
      int num = 1;
      for (int k = 0; k < (int)child[s].size(); k++) {
        if (num == color[s]) num++;
        color[child[s][k]] = num;
        num++;
      }
    }
  }
  cout << *max_element(color.begin(),color.end()) << endl;
  for (int i = 1; i < N; i++) {
    for (int j = 0; j < (int)lis[i].size(); j++) {
      if (Deep[lis[i][j].F] < Deep[i]) {
        ans[lis[i][j].S] = color[i];
      }
    }
  }
  for (int i = 0; i < N-1; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 24204
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
typedef long long ll;
using namespace std;

vector<vector<pair<int, ll>>> vec;
int color[100000];

int main() {
    int n, u, v;
    ll w;
    cin >> n;
    vec.resize(n);
    for(int i=0; i<n-1; i++) {
        cin >> u >> v >> w;
        vec[u-1].push_back(make_pair(v-1, w));
        vec[v-1].push_back(make_pair(u-1, w));
    }

    for(int i=0; i<n; i++) color[i] = -1;
    color[0] = 0;

    queue<int> q;
    q.push(0);
    while(!q.empty()) {
        int now = q.front();
        q.pop();
        for(int i=0; i<vec[now].size(); i++) {
            int next = vec[now][i].first;
            int length = vec[now][i].second;
            if(color[next]!=-1) continue;
            else {
                if(length%2==1) color[next] = abs(color[now]-1);
                else color[next] = color[now];
                q.push(next);
            }
        }
    }

    for(int i=0; i<n; i++) cout << color[i] << endl;

    return 0;
}


Measured memory_bytes: 8320
//ProblemC.cpp

#include <iostream>

static std::istream & ip = std::cin;
static std::ostream & op = std::cout;

#if OJ_MYPC
#include <ojio.h>
#endif

#ifndef OPENOJIO
#define OPENOJIO
#endif

#if 1 || DEFINE
/***************************************************************/
typedef unsigned long long u64;
typedef long long s64;

typedef unsigned uint;

#define ABS(x) ((x) > 0 ? (x) : -(x))

#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))

#define MIN3(x, y, z) MIN(x, MIN(y, z))
#define MAX3(x, y, z) MAX(x, MAX(y, z))

#define FillZero(arr) memset(arr, 0, sizeof(arr));

/***************************************************************/
#endif //1 || DEFINE

#include <string>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <utility>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>

//001
//op << setfill('0') << setw(3) << setiosflags(ios::right) << 1;

//op << fixed << setprecision(20);

using namespace std;

//ProblemC.cpp

int main(int argc, char* argv[])
{
	OPENOJIO;

	int n;
	vector<pair<int, int>> cards;

	ip >> n;
	cards.resize(n);

	for (int i = 0; i < n; ++i) {
		ip >> cards[i].first;
		cards[i].second = i;
	}

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

	int c = 0;
	for (int i = 0; i < n; ++i) {
		if (i % 2 != cards[i].second % 2) {
			++c;
		}
	}

	op << c / 2 << endl;

	return 0;
}
/***************************************************************/


Measured memory_bytes: 1532
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(i=a; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define foreach(it,x) for(typeof(x.begin()) it=x.begin(); it!=x.end(); it++)


int gcd(int x, int y){ return y ? gcd(y,x%y) : x; }

int solve(int p, int q, int a, int c, int n, int prod){
    int i,j,res = 0;

    //printf("p = %d, q = %d, a = %d, c = %d, n = %d, prod = %d\n",p,q,a,c,n,prod);
    if( p == 0 ) return 1;
    if( n == 0 ) return 0;
    
    // c >= q / p
    //printf("%d/%d = %d, c = %d, prod = %d\n",q,p,q/p,c,prod);
    for(i=max(min(q/p,a),c); i*prod <= a; i++){
        if( p*i < q ) continue;

        int a1 = p*i - q;
        int b1 = i*q;
        //int x = gcd(a1, b1);

        /*
        if( a1 < 0 || b1 < 0 ){
            printf("%d,%d\n",a1,b1); exit(0);
        }

        if( x == 0 ||1) x = 1;
        */
        res += solve(a1, b1, a, i, n-1, prod*i);
    }

    return res;
}

/*
  NÂÈºi
  

  p/q - 1/b1 >= 0
  p*b1 / (b1*q) - { q / (q*b1) }
  p*b1 >= q@ªK{
  (p*b1 - q) / (b1 * q)
 */

int main(){
    int p,q,a,n;

    while( cin >> p >> q >> a >> n, p|q|a|n ){
        cout << solve(p,q,a,1,n,1) << endl;
    }

    return 0;
}

Measured memory_bytes: 868
import math
import os
import sys
from collections import defaultdict

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18

MOD = 10 ** 9 + 7
N, K = list(map(int, sys.stdin.readline().split()))

NM = []
prev = 0
for i in range(1, int(math.sqrt(N)) + 2):
    m = int(N // i)
    NM.append(N - m - prev)
    prev = N - m

cnt = N
nums = []
while cnt >= 1:
    nums.append(cnt)
    i = int(N // cnt)
    p = NM[i] if i < len(NM) else 1
    cnt -= p
nums.reverse()

# dp[k][n]: rec(n, k)
dp = defaultdict(lambda: defaultdict(int))
for n in nums:
    dp[1][n] = n
for k in range(2, K + 1):
    for n in nums:
        i = int(N // n)
        p = NM[i] if i < len(NM) else 1
        ret = dp[k - 1][i] * p % MOD
        cum = dp[k][n - p]
        dp[k][n] = (cum + ret) % MOD

ans = dp[K][N]
print(ans % MOD)

# ans = rec(N, K)
# print(ans % MOD)


Measured memory_bytes: 439620
//srinivas
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
// using namespace __gnu_pbds;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define fr(x,in,n,r) for(x=in;x<n;x+=r)
#define ifr(x,n) for(x=0;x<n;x++)
#define dfr(x,n) for(x=n-1;x>=0;x--)
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define pof(a) pop_front(a)
#define pob(a) pop_back(a)
#define eb(a) emplace_back(a)
#define ef(a) emplace_front(a)
typedef long long ll;
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007

struct chash{ 
    ll operator()(ll x) const {return hash<ll>{}(x);}
};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("input.txt","r",stdin);
    ll r,i,d,x;
	cin>>r>>d>>x;
	ifr(i,10){
		x=r*x-d;
		cout<<x<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;


int main()
{

    int n, k, r =1 ;
    cin >> n>>k ;
    for(int i =0 ;i < n  ; i++ )
        {
            if  (((2*r)-r)<k)
                {
                    r = 2 * r ;
                    continue ;
                }

                else {
                     r = r +k ;
                     continue ;
                }
        }
   cout << r ;
    return 0;

}


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

int main()
{
    int a,b;
    cin>>a>>b;
    if(a<0&&b<0)
    {
        if((abs(b-a)+1)%2==0)
            cout<<"Positive";
        else
            cout<<"Negative";
    }
    else if(a>0&&b>0)
    {
        cout<<"Positive";
    }
    else
        cout<<"Zero";
    return 0;
}



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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

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

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    LL ans = 0;
    for(int i=1;i<n+1;i++){
        if(i%3 == 0 && i%5 == 0) continue;
        if(i%3 == 0) continue;
        if(i%5 == 0) continue;
        ans += i;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3652
import fractions

A,B,C,D = map(int,input().split())

f = fractions.gcd(C,D)
f_1 = C*D//f

ans_1 = B-(B//C + B//D - B//f_1)
ans_2 = (A-1)-((A-1)//C + (A-1)//D - (A-1)//f_1)
print(ans_1-ans_2)


Measured memory_bytes: 5048
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
//#define mod 998244353ll
#define flagcount __builtin_popcount
#define flag(x) (1ll << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1ll << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return -1;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
template <typename T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b; // aをbで更新
        return true;
    }
    return false;
}
template <typename T>
bool chmin(T &a, const T &b)
{
    if (a > b)
    {
        a = b; // aをbで更新
        return true;
    }
    return false;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    ll N;
    cin >> N;
    vector<ll> A(N);
    loop(i, N) cin >> A[i];
    vector<ll> B = A;
    sort(all(B));
    map<ll, ll> AA;
    map<ll, ll> BB;
    loop(i, N) BB[B[i]] = i;
    ll ans = 0;
    loop(i, N)
    {
        ll c = abs(BB[A[i]] - i) % 2;
        ans += c;
    }
    ans /= 2;
    putout(ans);
    return 0;
}


Measured memory_bytes: 11164
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b)
{
  if(b==0)
    return a;
  else
    return gcd(b,a%b);
}
int main()
{
  long long int sum=0;
  long long int n;
  cin>>n;
  
  for(int i=1;i<=n;i++)
  {
    for(int j=1;j<=n;j++)
    {
      for(int k=1;k<=n;k++)
      {
        sum+=gcd(i,gcd(j,k));
      }
    }
  }
  
  cout<<sum<<"\n";
  
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include <bits/stdc++.h> 
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int n;
  cin >> n;
  ll a[n];
  rep(i,n)cin >> a[i];
  ll ans=a[0]-1;
  ll x=2;
  REP(i,1,n){
    if(a[i]==x){
      x=a[i]+1;
      continue;
    }
    ll kaisu=max((a[i]+x-1)/x-1,0LL);
    ans+=kaisu;
    ll nokori=a[i]-kaisu*x;
  }
  cout << ans << endl;
return 0;}

Measured memory_bytes: 1024
// ABC 161-B
// 2020.4.4 bal4u

#include <stdio.h>

int A[105];

int main()
{
	int i, N, M, S, f;

	scanf("%d%d", &N, &M);
	S = 0;
	for (i = 0; i < N; ++i) {
		scanf("%d", A+i);
		S += A[i];
	}
	f = 0;
	for (i = 0; i < N; ++i) {
		if (A[i]*4*M >= S) f++;
	}
	puts(f >= M? "Yes": "No");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}
 
int h,w;
long long dp[10][10];
long long a[200][200];

void solve(){
    for(int k = 0; k < 10; k++){
        for(int i = 0; i < 10; i++){
            for(int j = 0; j < 10; j++){
                dp[i][j] = min(dp[i][j], dp[i][k]+dp[k][j]);
            }
        }
    }
}

int main(){
    cin >> h >> w;
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            cin >> dp[i][j];
        }
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++)  cin >> a[i][j];
    }

    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            if(i != j)  solve();
        }
    }
    

    long long ans = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(a[i][j] != -1){
                ans += dp[a[i][j]][1];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
import java.util.*;
import java.util.Map.Entry;



public class Main{
	
	public int num;
	public int vol;

	
	//最大公約数・最小公倍数（セットで使う）
	public static long gcm(long a, long b) {
		long result = a;
		long k = 0;
		long n = b;
		do {
			k = result % n;
			result = n;
			n = k;
		} while(k != 0);
		return result;
	}
	
	public static long lcm(long a, long b) {
		long g;
		g = gcm(a, b);
		return a/g*b;
	}
	
	static long gcd (long a, long b) {
		long temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
	
	//等差数列
	static long tousasum(int n) {
		return (long)n*((long)n+1)/2;
	}



	//素数判定
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}


	//倍数判定（10進数以外のときに有用）
	static boolean isMultiple (String s, int base, int m) {
		int temp = 0;
		for (int i=0; i<s.length(); i++) {
			temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
		}
		if (temp==0) {return true;}
		return false;
	}


	//階乗
	static long factorial (int i) {
		if (i==1) {return 1;}
		else {return i*factorial(i-1);}
	}


	//進数変換
	static String toNbase (String sm, int m, int n) {
		return Long.toString(Long.parseLong(sm,m),n);
	}
	
	public static final long gcd_n(long[] param) {
	    final int len = param.length;
	    long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
	    for (int i = 1; i < len - 1; i++) {
	        g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
	    }
	    return g;
	}
	
	public static long lcm_n(long[] numbers) {
		long l;
		l = numbers[0];
		for (int i = 1; i < numbers.length; i++) {
			l = lcm(l, numbers[i]);
		}
		return l;
	}
	
	
 public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	 long L=sc.nextLong(),R=sc.nextLong();
	 long min=Long.MAX_VALUE;
	 
	 if(R-L<=2019) {
		 for(long i=L;i<=R-1;i++) {
			 for(long j=i+1;j<=R;j++) {
				 if(min>(i*j%2019)) {
					 min=i*j%2019;
					 //System.out.println(i+" "+j);
				 }
			 }
		 }
	 }else {
		 for(long i=L;i<=R;i++) {
			 if(i%2019==0) {
				 min = 0;
				 break;
			 }
		 }
	 }
     
     
     
     System.out.println(min);
	 
 }
	


}




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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    ll ans=0;
    FOR(i,1,n){
        if (!(i%3==0||i%5==0)){
            ans+=i;
        }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
string s;
 
int getarea(int a,int b){
  int res=0,h=0;
  stack<P> st;
  for(int i=a;i<=b;i++){
    if(s[i]=='\\')st.push(P(h,i)),h--;
    if(s[i]=='/'){
      h++;
      if(!st.size())continue;
      P t=st.top();
      if(t.first==h)res+=i-t.second,st.pop();
    }
  }
  return res;
}
 
int check(int x){
  int h=0;
  for(int i=x;i<s.size();i++){
    if(s[i]=='\\')h--;
    if(s[i]=='/'){
      h++;
      if(!h)return i;
    }
  }
  return -1;
}
 
int main(){
  int h=0,ans=0;
  vector<int> v;
  cin>>s;
  for(int i=0;i<s.size();i++)
    if(s[i]=='\\'){
      int r=check(i);
      if(r>=0){
    int area=getarea(i,r);
    v.push_back(area);
    ans+=area,i=r-1;
      }
    }
  cout<<ans<<endl;
  cout<<v.size();
  if(v.size())cout<<' ';
  for(int i=0;i<v.size();i++){
    if(i)cout<<' ';
    cout<<v[i];
  }
  cout<<endl;
  return 0;
}


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

using namespace std;

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

  otsuri = 1000 - N % 1000;
  if (otsuri == 1000) {
    otsuri = 0;
  }
  cout << otsuri << endl;

  return 0;
}

Measured memory_bytes: 3620
import java.math.BigInteger;
import java.util.Scanner;

public class Main 
{

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		BigInteger a = new BigInteger(sc.next());
		BigInteger b = new BigInteger(sc.next());
		
		a = a.divide(b);
		
		System.out.println(a);
	}

}



Measured memory_bytes: 26428
#include <cstdio>

using namespace std;

long long roundup(long long *x){
  (*x) += 999;
  (*x) /= 1000;
  (*x) *= 1000;
}

long long addinterest(long long *x){
  (*x) *= 1.05;
  roundup(x);
}

int main()
{
  long long debt = 100000;
  int n;
  scanf("%d", &n);
  while(n--)
    addinterest(&debt);

  printf("%lld\n", debt);
  return 0;
}

Measured memory_bytes: 1020
#include <stdio.h>

int main() {

int ret;
int n, d;
int r1, r2;

ret = scanf("%d %d", &n, &d);

r1 = n / (d*2 +1);
if ((n % (d*2+1)) !=0 ) {
    r1++;
}
printf("%d", r1);
return 0;

}

Measured memory_bytes: 128
C = input()
# A = list(map(int, input().split()))
c = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

n = c.index(C)
print(c[n+1])

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define sz(a)           (int)(a).size()
#define all(x)          (x).begin(), (x).end()
#define fore(i,a,b)     for(int i=a; i<b; i+=1)
#define forr(i,a)       for(int i=a; i>=0; i--)
#define F first
#define S second
 
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef pair<string, int> si;
typedef pair<int, string> is;
typedef vector<string> vs;
const int MAX=1e5+10;

 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n; cin>>n;
    int res=0;
    int gg=n/500;
    res+=(gg*1000);
    int yy=(n%500)/5;
    res+=(yy*5);
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int n;
void bubble(char c[100],char value[100])
{
  int i,j;
  char tmp;
  for(i=0;i<n;i++)
  {
    for(j=n-1;j>=i+1;j--)
    {
      if(value[j]<value[j-1])
      {
        tmp = c[j];
        c[j]=c[j-1];
        c[j-1]=tmp;
        tmp = value[j];
        value[j]=value[j-1];
        value[j-1]=tmp;
      }
    }
  }
}
void selection(char c[100],char value[100])
{
  int i,j,minj,tmp;
  for(i=0;i<n;i++)
  {
    minj=i;
    for(j=i;j<n;j++)
    {
      if(value[j]<value[minj])
      {
        minj=j;
      }
    }
    tmp=c[i];
    c[i]=c[minj];
    c[minj]=tmp;
    tmp = value[i];
    value[i]=value[minj];
    value[minj]=tmp;
  }
}
void print(char c[100],char value[100])
{
  int i;
  for(i=0;i<n;i++)
  {
    if(i>0)printf(" ");
    printf("%c%c",c[i],value[i]);
  }
  printf("\n");
}
int stable(char c1[100],char c2[100])
{
  int i;
  for(i=0;i<n;i++)
  {
    if(c1[i]!=c2[i])return -1;
  }
  return 1;
}
int main()
{
  char c1[100],c2[100],value1[100],value2[100],i;
  char ch[3];

  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
    scanf("%s",ch);
    c1[i]=ch[0];
    value1[i]=ch[1];
  }
  for(i=0;i<n;i++)
  {
    c2[i]=c1[i];
    value2[i]=value1[i];
  }
  bubble(c1,value1);
  selection(c2,value2);

  print(c1,value1);
  printf("Stable\n");
  print(c2,value2);
  if(stable(c1,c2)==1)printf("Stable\n");
  else printf("Not stable\n");

  return 0;
}



Measured memory_bytes: 2036
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#include <stdlib.h>
#include <time.h>
#include <chrono>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

ll d;
vector<ll> c(26 + 1, 0);
vector<vector<ll>> s(365 + 1, vector<ll>(26 + 1, 0));

ll scoring(vector<int> t)
{
    ll ans = 0;
    vector<ll> last(26 + 1, 0);

    for (int i = 1; i <= d; i++)
    {
        ans += s[i][t[i]];
        ans -= c[t[i]] * (i - last[t[i]]) * (i - last[t[i]] - 1) / 2;
        last[t[i]] = i;
    }

    for (int i = 1; i <= 26; i++)
    {

        ans -= c[i] * (d - last[i] + 1) * (d - last[i]) / 2;
    }

    return ans;
}

int main(void)
{
    srand(time(NULL));
    cin >> d;

    for (int i = 1; i <= 26; i++)
    {
        cin >> c[i];
    }

    for (int i = 1; i <= d; i++)
    {
        for (int j = 1; j <= 26; j++)
        {
            cin >> s[i][j];
        }
    }

    vector<int> BestT(d + 1, 1);

    for (int i = 1; i <= d; i++)
    {
        BestT[i] = rand() % 26 + 1;
    }

    double BestScore = scoring(BestT);
    double score;

    auto start = chrono::system_clock::now();
    vector<int> t(d + 1, 1);

    double T0 = 1e6;
    double T1 = 1e3;
    double TL = 1980;

    ll count = 0;

    while (1)
    {
        ll msec;

        msec = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count();

        if (msec >= TL)
        {
            break;
        }

        double T = powf(T0, 1 - msec / TL) * powf(T1, msec / TL);

        t = BestT;

        t[rand() % d + 1] = rand() % 26 + 1;

        score = scoring(t);

        double p = exp((score - BestScore) / T);

        if (p > 0.5)
        {
            BestT = t;
            BestScore = score;
        }

        count++;
    }

    for (int i = 1; i <= d; i++)
    {
        printf("%d\n", BestT[i]);
    }
}


Measured memory_bytes: 4468
// quest1.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main()
{
	int result[1000], suffix = 0;

	while (1) {
		int money, reverse, count = 0;

		scanf("%d", &money);
		if (money == 0) {
			break;
		}
		reverse = 1000 - money;

		while (reverse >= 500) {
			reverse -= 500;
			count++;
		}
		while (reverse >= 100) {
			reverse -= 100;
			count++;
		}
		while (reverse >= 50) {
			reverse -= 50;
			count++;
		}
		while (reverse >= 10) {
			reverse -= 10;
			count++;
		}
		while (reverse >= 5) {
			reverse -= 5;
			count++;
		}
		while (reverse >= 1) {
			reverse -= 1;
			count++;
		}

		result[suffix++] = count;
	}

	for (int i = 0; i < suffix; i++) {
		printf("%d\n", result[i]);
	}

    return 0;
}

Measured memory_bytes: 1028
def div_make(n):
    divisor =[]
    n=int(n)
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisor.append([i,n//i])
    return divisor

a=int(input())

lst=[]
for i in div_make(a):
    lst.append(i[0]+i[1])
ans=0
ans=min(lst)-2
print(ans)


Measured memory_bytes: 3688
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<vector>

using namespace std;

int main(){
    int w,a,b;
    cin>>w>>a>>b;

   if(a+w<b) {
       cout<<b-a-w<<endl;
   }else if(b+w<a){
       cout<<a-b-w<<endl;
   }else{
       cout<<0<<endl;
   }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P;

int main(void) {
  int N;
  cin >> N;
  vector<P> v;
  for (int i = 0; i < N; i++) {
    long long X, L;
    cin >> X >> L;
    v.push_back(P(X + L, X - L));
  }
  sort(v.begin(), v.end());
  int cnt = 0;
  long long last = LONG_LONG_MIN;
  for (int i = 0; i < N; i++) {
    if (last <= v[i].second) {
      cnt++;
      last = v[i].first;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 2420
n=int(input())
s=input()
ans=0
brute=[str(i)[1:] for i in range(1000,2000)]
for i in brute:
  flag=0
  for j in s:
    if j==i[0] and flag==0:
      flag+=1
      continue
    if flag==1 and j==i[1]:
      flag+=1
      continue
    if flag==2 and j==i[2]:
      ans+=1
      break
print(ans)

Measured memory_bytes: 43816
#include <stdio.h>

int main()
{
	int N,M,i,j;
	int sum=0;

	scanf("%d %d",&N,&M);
	
	if(N > 1)
	{
		for(i=N-1;i>0;i--)
			sum = sum + i;
	}
	if(M > 1)
	{
		for(j=M-1;j>0;j--)
			sum = sum + j;
	}
	printf("%d\n",sum);
	return 0;
}

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

typedef long long ll;
#define OO 1e9
using namespace std;
vector<vector<int>> adj;
vector<int> top;
vector<int> indegree;
vector<bool> done;
void topsort(int u){
  if(done[u])return;
  done[u] = 1;
  top.push_back(u);
  for(auto el : adj[u]){
    indegree[el]--;
    if(indegree[el] == 0)
      topsort(el);
  }
}

int main(){
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
  int n, m;
  cin >> n >> m;
  vector<string> grid(n);
  for(int i = 0;i < n;i++)
    cin >> grid[i];
  int dp[n + 1][m + 1];
  for(int i = 0;i <= m;i++)
    dp[n][i] = 0;
  for(int i = 0;i <= n;i++)
    dp[i][m] = 0;
    dp[n - 1][m - 1] = 1;
  for(int i = n - 1;i >= 0;i--){
    for(int j = m - 1;j >= 0;j--){
      if(i == n - 1 && j == m - 1)continue;
      if(grid[i][j] == '#')
        dp[i][j] = 0;
      else
        dp[i][j] = (dp[i + 1][j] + dp[i][j + 1]) % 1000000007;
    }
  }
  cout << dp[0][0];
}


Measured memory_bytes: 5248
import java.util.*
import kotlin.math.abs

fun main() {
    fun pow5(a: Long): Long {
        val pow2 = a * a
        return pow2 * pow2 * a
    }

    val sc = Scanner(System.`in`)

    val x = sc.nextInt().toLong()

    // https://www.wolframalpha.com/input/?i=1+%3C%3D+A%5E5-B%5E5+%3C%3D+10%5E9%2C+B+%3C+-abs%28A%29%2C+A%3D54&lang=ja
    // A = 54, B = -55
    // https://www.wolframalpha.com/input/?i=plot+%281+%3C%3D+A%5E5-B%5E5+%3C%3D+10%5E9+%2C+B+%3C+-abs%28A%29%29&lang=ja
    // https://www.wolframalpha.com/input/?i=plot+%281+%3C%3D+A%5E5-B%5E5+%3C%3D+10%5E9+%2C+A-110+%3C+B%2C+B+%3C+-abs%28A%29%29&lang=ja
    // https://www.wolframalpha.com/input/?i=1+%3C%3D+A%5E5-B%5E5+%3C%3D+10%5E9+%2C+B+%3C+-abs%28A%29%2C+A%3D-119%2C+B%3D%3F&lang=ja
    for (a in -118..54L) {
        var cnt = 0
        for (b in (a-110)..-abs(a)) {
            val res = pow5(a) - pow5(b)
            /*
            if (res in 1..1000000000) {
                println("$a $b")
                cnt++
            }
            // */
            //*
            if (res == x)
                return println("$a $b")
            // */
        }
    }
    while (true);
}



Measured memory_bytes: 36212
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
typedef long long int ll;

#define MOD 998244353

int main(){
    ll n;
    cin >> n;
    for (ll i=0;i<=n/4;i++){
        if ((n-(i*4))%7==0){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define pii pair<ll,ll > 
#define mod 1000000007

ll power(ll a,ll b){
    ll res=1;
    while(b>0){
        if(b%2!=0) res=res*a;
        a=a*a;
        b/=2;
    }
    return res;
}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string str;
    cin>>str;
    string prevstr="";
    prevstr+=str[0];
    int len=str.size(),cnt=1;
    for(int i=1;i<len;){
        string temp="";
        temp=str[i];
        if(i<len-1 && prevstr==temp){
            temp+=str[i+1];
            i+=2;
            cnt++;
        }
        else if(prevstr!=temp){
            i++;
            cnt++; 
        }
        //cout<<temp<<endl;
        else i++;
        prevstr=temp;
        
    }
    cout<<cnt;
    return 0;
}


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

def main():
    N = int(input())
    S = input()

    m = r = S[1:].count('E')
    for i in range(1, N):
        s = S[i - 1: i + 1]
        if s == 'EE':
            r -= 1
        elif s == 'WW':
            r += 1
        m = min(m, r)

    print(m)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3676
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    int n;
    vector<int> v;
    int a;
    
    int sum;
    
    //入力
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a;
        v.push_back(a);
    }
    
    //初期化
    sort(v.begin(), v.end());
    sum = 0;
    
    for (int i = 1; i < n; i++) {
        sum += (v[i] - v[i-1]);
    }
    cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    S=input()

    ans=0
    for i in range(n-2):
        ans+=S[i:i+3]=="ABC"

    print(ans)
resolve()

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
class Coupon{
public:
	int x;
	int y;
	int c;
};

int main(){
	int A, B, M;
	cin >> A >> B >> M;
	
	vector<int> a, b;
	for(int i = 0; i < A; i++){
		int tmp;
		cin >> tmp;
		a.push_back(tmp);
	}
	for(int i = 0; i < B; i++){
		int tmp;
		cin >> tmp;
		b.push_back(tmp);
	}
	vector<Coupon> vecCpn;
	for(int i = 0; i < M; i++){
		int x, y, c;
		cin >> x >> y >> c;
		Coupon tmp = {x, y, c};
		vecCpn.push_back(tmp);
	}
	
	int minValue = (int)pow(10.0, 10.0);
	for(int i = 0; i < M; i++){
		int value = a[vecCpn[i].x - 1] + b[vecCpn[i].y - 1] - vecCpn[i].c;
		if(minValue > value)	minValue = value;
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	if(a[0] + b[0] < minValue) minValue = a[0] + b[0];
	
	cout << minValue << endl;
}

Measured memory_bytes: 2932
#include <stdio.h>
#define MAX 101
void Search(int);
 
int number,G[MAX][MAX],d[MAX],count=0;
int F[MAX] = {0};
 
  
int main(void){
  int i,j,k,u,a;
   
  for(i = 0;i < number;i++){
    d[i] = 0;
  }
    
  scanf("%d",&number);
   
  for(i = 0;i < number + 1;i++){
    for(j = 0;j < number + 1;j++){
      G[i][j] = 0;
    }
  }
   
  for(i = 0;i < number;i++){
   
    scanf("%d %d ",&k,&u);
   
    for(j = 0;j < u;j++){
      scanf("%d",&a);
      G[k - 1][a - 1] = 1;
    }
  }
  
  for(i = 0;i < number;i++){
    if(d[i] == 0)
    Search (i);
  }
       
  for(i = 0;i < number;i++){
    printf("%d %d %d\n",i+1,d[i],F[i]);
  }
  
  return 0;
 }
 
 
void Search(int u){
  int v;
  count++;
  d[u] = count;
   
  for(v = 0;v < number;v++){
    if(G[u][v] == 1 && d[v] == 0 ){
      Search(v);
    }
  }
  count++;
  F[u] = count;
}



Measured memory_bytes: 2128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

string sa[110000];

P check(int a){
	if(sa[a]=="AB")return make_pair(0,1);
	if(sa[a]=="BC")return make_pair(1,2);
	if(sa[a]=="AC")return make_pair(0,2);
}

vector<int> vs;

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	int t[3];
	cin>>n;
	for(i=0;i<3;i++){
		cin>>t[i];
	}
	for(i=0;i<n;i++){
		cin>>sa[i];
	}
	for(i=0;i<n;i++){
		P pa=check(i);
		a=pa.first,b=pa.second;
		if(t[a]==0 && t[b]==0){
			cout<<"No"<<endl;
			return 0;
		}
		if(t[a]==1 && t[b]==1){
			if(i<n-1 && sa[i]!=sa[i+1]){
				P pb=check(i+1);
				c=a+b+pb.first+pb.second-3;
				if(a!=c)swap(a,b);
			}
			t[b]--,t[a]++;
			vs.push_back(a);
		}else{
			if(t[a]>t[b])swap(a,b);
			vs.push_back(a);
			t[a]++,t[b]--;
		}
	}
	cout<<"Yes"<<endl;
	for(i=0;i<n;i++){
		cout<<(char)((int)'A'+vs[i])<<endl;
	}
}

Measured memory_bytes: 7292
#include <iostream>
#include <algorithm>
#include <map>
#include <cstring>
using namespace std;
map <string,int> m;
int main() {
	
	int n;
	cin>>n;
	
	while(n--)
	{
		string s;
		cin>>s;
		m[s]++;
	}
	cout<<"AC x "<<m["AC"]<<endl;
	cout<<"WA x "<<m["WA"]<<endl;
	cout<<"TLE x "<<m["TLE"]<<endl;
	cout<<"RE x "<<m["RE"]<<endl;
	
	return 0;
}

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

int main() {
    int aStart, aEnd, bStart, bEnd;
    cin >> aStart >> aEnd >> bStart >> bEnd;

    // 数学的に解く場合
    // int bothSwitchesOnStart = max(aStart, bStart);
    // int bothSwitchesOnEnd = min(aEnd, bEnd);

    // int bothSwitchesOnTotalTime;

    // if(bothSwitchesOnEnd < bothSwitchesOnStart)
    //     bothSwitchesOnTotalTime = 0;
    // else
    //     bothSwitchesOnTotalTime = bothSwitchesOnEnd - bothSwitchesOnStart;

    // cout << bothSwitchesOnTotalTime << endl;
    
    // ゲームのUpdate()のように解く場合
    bool isAOn = false;
    bool isBOn = false;
    int bothSwitchesOnTotalTime = 0;
    for (int i = 0; i < 100; i++)
    {
        if(i == aStart)
            isAOn = true;
        
        if(i == bStart)
            isBOn = true;
        
        if(i == aEnd)
            isAOn = false;
        
        if(i == bEnd)
            isBOn = false;
        
        if(isAOn && isBOn)
            bothSwitchesOnTotalTime++;
    }
    cout << bothSwitchesOnTotalTime << endl;
}   

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

using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define fordebug int hoge;cin>>hoge;
#define DEKAI 1000000007;
#define INF (1<<28)
#define int long long
#define floot10 cout<<fixed<<setprecision(10)

signed main(){
  int n;
  cin>>n;
  int ans=-DEKAI;
  int mini=DEKAI;
  lp(i,n){
    int a;
    cin>>a;
    if(i!=0)
      ans=max(ans,a-mini);
    mini=min(a,mini);
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3100
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<cstdio>

using namespace std;
/*
int find(int x, vector<int> &p) {
if (p[x] == x)return x;
return p[x] = find(p[x], p);
}

void uni(int x, int y, vector<int> &p) {
x = find(x, p);
y = find(y, p);
p[x] = y;
}

int same(int x, int y, vector<int> p) {
if (find(x, p) == find(y, p))return 1;
return 0;
}
*/


int main()
{
	long long N, cnt = 0, tmp, ans = 0;
	string S;
	int w;

	cin >> S;
	cin >> w;

	for (int i = 0; i < S.size(); i+=w) {
		cout << S[i];
	}

	char qq;
	cin >> qq;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
   
int main() {
  int a, b;
  std::cin >> a >> b;

  if (a > b)
    std::cout << "a > b" << std::endl;
  else if (a == b)
    std::cout << "a == b" << std::endl;
  else
    std::cout << "a < b" << std::endl;

  return 0;
} 


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

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

using namespace std;
typedef long long ll;

const int N_MAX = 10000;
const ll INF = 1e18;

struct edge{
    int to;
    ll cap, cost;
    int rev;
};

int V;  // 頂点数
vector<edge> G[N_MAX];
ll dist[N_MAX];
int prevv[N_MAX], preve[N_MAX];

void add_edge(int from, int to, ll cap, ll cost){
    G[from].push_back((edge){to, cap, cost, G[to].size()});
    G[to].push_back((edge){from, 0, -cost, G[from].size()-1});
}

// Vを初期化してからつかうこと
ll min_cost_flow(int s, int t, int f){
    ll res = 0;
    while(f > 0){
        fill(dist, dist+V, INF);
        dist[s] = 0;
        bool update = true;
        while(update){
            update = false;
            for(int v = 0; v < V; v++){
                if(dist[v] == INF) continue;
                for(int i = 0; i < G[v].size(); i++){
                    edge &e = G[v][i];
                    if(e.cap > 0 && dist[e.to] > dist[v]+e.cost){
                        dist[e.to] = dist[v]+e.cost;
                        prevv[e.to] = v;
                        preve[e.to] = i;
                        update = true;
                    }
                }
            }
        }
        if(dist[t] == INF){
            return -1;
        }
        ll d = f;
        for(int v = t; v != s; v = prevv[v]){
            d = min(d, G[prevv[v]][preve[v]].cap);
        }
        f -= d;
        res += d*dist[t];
        for(int v = t; v != s; v = prevv[v]){
            edge &e = G[prevv[v]][preve[v]];
            e.cap -= d;
            G[v][e.rev].cap += d;
        }
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N, K;
    cin >> N >> K;
    V = (N+1)*(N+1)+2;
    ll ans = 0;
    for(int i = 1; i <= N; i++){
        add_edge(0, i, K, 0);
        add_edge(i*(N+1), (N+1)*(N+1)+1, K, 0);
        for(int j = 1; j <= N; j++){
            ll a; cin >> a;
            add_edge(i, i*(N+1)+j, 1, -a);
            add_edge(i*(N+1)+j, j*(N+1), 1, 0);
            ans += a;
        }
    }
    add_edge(0, V-1, N*K, 0);
    ll f = min_cost_flow(0, V-1, N*K);
    cout << -f << endl;
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= N; j++){
            int idx = i*(N+1)+j;
            int to = j*(N+1);
            bool used = false;
            for(auto e : G[idx]){
                if(e.to == to && e.cap == 0) used = true;
            }
            cout << (used ? 'X' : '.');
        }
        cout << endl;
    }
}

Measured memory_bytes: 4260
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	vector<int> nlist(11, 0);

	int A, B, C;
	cin >> A >> B >> C;

	nlist[A]++;
	nlist[B]++;
	nlist[C]++;

	if (nlist[5] == 2 && nlist[7] == 1)
	{
		cout << "YES";
	}
	else
	{
		cout << "NO";
	}
	
	return 0;
}

Measured memory_bytes: 256
s = input().strip()
a = int(s[0:2])
b = int(s[2:])
if 1<=a<=12 and 1<=b<=12:
  print("AMBIGUOUS")
elif 1<=a<=12:
  print("MMYY")
elif 1<=b<=12:
  print("YYMM")
else:
  print("NA")

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

const int SPQR = 20005;

vector<int> a, b, p;

int main(void) {
    int n;

    cin >> n;
    a.resize(n);
    b.resize(n);
    p.resize(n);

    for(auto &i: p) {
        cin >> i; --i; }

    for(int i = 0; i < n; ++i) {
        a[p[i]]+= i;
        a[i]+= (n + 1) * (i + 1);
        b[i]+= (n + 1) * (n - i); }

    for(auto i: a) cout << i << ' ';
    cout << '\n';
    for(auto i: b) cout << i << ' ';
    cout << '\n';

    return 0; }


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
	char s[200],t[200];
	scanf("%s%s",s,t);
	int ls=strlen(s),lt=strlen(t),i,j;
	sort(s,s+ls);
	sort(t,t+lt);
	for( i=0,j = lt-1 ; i < j ; i++,j--){
		 char temp = t[i];
		t[i] = t[j];
		t[j] = temp;
	}  
	if(strcmp(s,t)<0)printf("Yes");
	else printf("No");
	
	
}


Measured memory_bytes: 256
"use strict";
    
function getGcm(x, y) {
  x = Math.abs(x);
  y = Math.abs(y);
  while (y) {
    let t = y;
    y = x % y;
    x = t;
  }
  return x;
}

function getLcm(x, y) {
  return (!x || !y) ? 0 : Math.abs((x * y) / getGcm(x, y));
}

const main = arg => {
    arg = arg.trim().split("\n");
    
    const A = parseInt(arg[0].split(" ")[0]);
    const B = parseInt(arg[0].split(" ")[1]);
    
    console.log(getLcm(A, B));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21192
#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 llong long long
#define pb(a) push_back(a)
#define INF 1000000000000000000LL
#define MOD 1000000007
#define writeln(n) cout<<n<<endl
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

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

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};


int main()
{
int n;
cin>>n;
vector<llong> a(n,0);
REP(i,n) cin>>a[i];
sort(a.begin(),a.end());
llong ans=INF;
for(int j=a[0]; j<=a[n-1]; j++)
{
    llong cnt=0;
    for(int i=0; i<n; i++)
    {
        cnt+=(a[i]-j)*(a[i]-j);
    }
    ans=min(ans,cnt);
}
cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{    
            
    class Program
    {       
        
        static void Main(string[] args)
        {
            while (true)
            {

                string[] str = Console.ReadLine().Split(' ');

                int n = int.Parse(str[0]);
                int m = int.Parse(str[1]);

                int[] order = new int[n];
                int[] adv = new int[m];

                if (n == 0 && m == 0)
                {
                    break;
                }

                for(int i = 0; i < n; i++)
                {
                    order[i] = int.Parse(Console.ReadLine());
                }

                for(int i = 0; i < m; i++)
                {
                    adv[i] = int.Parse(Console.ReadLine());
                }

                int count = 0;
                int now = 0;
                int j = 0;

                while (true)
                {
                    count++;

                    now += adv[j];
                    j++;
                    
                    if(now >= n - 1)
                    {
                        break;
                    }
                    now += order[now];
                    
                    if (now >= n - 1)
                    {
                        break;
                    }

                }

                Console.WriteLine(count);

            }

         
        }
    }
}



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

using namespace std;

int balls[10];

int solve(int n, int a, int b) {
	if (n == 10) return 1;
	if (balls[n] < a && balls[n] < b) {
		return -1;
	}
	if (balls[n] < a) {
		return solve(n+1, a, balls[n]);
	}
	if (balls[n] < b) {
		return solve(n+1, balls[n], b);
	}
	int x = solve(n+1, balls[n], b),
		y = solve(n+1, a, balls[n]);
	if (x == -1 && y == -1) return -1;
	return 1;
}
int main() {
	int n; cin >> n;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < 10; ++j)
			cin >> balls[j];
		if (solve(0, 0, 0) == -1) cout << "NO" << endl;
		else cout << "YES" << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	//sc.Split(bufio.ScanWords)
	var a string
	ans := 0
	a = next()
	for i := 0; i < 3; i++ {
		if string(a[i]) == "1" {
			ans++
		}
	}
	out.Flush()
	fmt.Println(ans)
}
func next() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int {
	a, e := strconv.Atoi(next())
	if e != nil {
		panic(e)
	}
	return a
}


Measured memory_bytes: 640
/*
Look at the star
Look at the shine for U
*/ 

#include<bits/stdc++.h>
#define sl(x) scanf("%lld",&x)
using namespace std;
typedef long long ll;
const int N = 1e6+5;
const ll mod = 1e9+7;
const ll INF = 0x3f3f3f3f;
char s[N],t[N];

int main()
{
	int i,j,k;
	scanf("%s%s",s,t);
	int l1 = strlen(s);
	int l2 = strlen(t);
	if(l1 != l2)
	{
		puts("No");
		return 0;
	}
	int sum = 0;
	while(sum < l1)
	{
		char ch = s[0];
		for(i = 1;i < l1;i++)
		s[i-1] = s[i];
		
		s[l1-1] = ch;
		if(strcmp(s,t) == 0)
		{
			puts("Yes");
			return 0;
		 } 
		 sum++;
	}
	
	puts("No");
}

Measured memory_bytes: 256