akhauriyash/Code-Regression huggingface dataset:
//
//  abc152_handstands.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>
#include <queue>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
ll INF = 1000000007;
#define PI 3.14159265

int firstDigit(int n)
{
    // Find total number of digits - 1
    int digits = (int)log10(n);

    // Find first digit
    n = (int)(n / pow(10, digits));

    // Return first digit
    return n;
}

int main() {
  int n;
  std::cin >> n;
  int c[10][10];

  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      c[i][j] = 0;
    }
  }

  ll sum = 0;
  for (int i = 1; i <= n; i++) {
    int firstD = firstDigit(i);
    int lastD = i % 10;
    c[firstD][lastD] += 1;
  }

  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      sum += c[i][j]*c[j][i];
    }
  }

  std::cout << sum << std::endl;
  return 0;
}

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

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

    int a, b, c;
    cin >> a >> b >> c;

    if(a==b) cout << c << endl;
    else if(a==c) cout << b << endl;
    else cout << a << endl;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    cnt = 0
    for i in range(n):
        if a[i] < b[i]:
            cnt += (b[i]-a[i])//2
        else:
            cnt += b[i]-a[i]
    if cnt >= 0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


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

int main(){
  ll N, M;
  cin >> N >> M;
  ll A[M];
  ll sum=0;
  for(ll i=0;i<M;++i) {
    cin >> A[i];
    sum += A[i];
  }
  if(N-sum<0) {
    cout << -1;
    return 0;
  }
  if(N-sum>=0) {
    cout << N-sum;
  }
}


Measured memory_bytes: 3644
// AOJ DPL_1_H Huge Knapsack Problem
// 2018.5.11 bal4u
 
#include <stdio.h>
#include <stdlib.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
 
int in()
{
    int n = 0, c = gc();
    do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
    return n;
}

long long inLL()
{
    long long n = 0, c = gc();
    do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
    return n;
}

#define MAX  ((1<<20)+5)

typedef struct { long long v, w; } TBL;
TBL a[42];
TBL a1[MAX]; int c1, c2;

long long binarysearch_upper(long long x)
{
	int m, l = 0, r = c2;

    while (l < r) {
        m = (l+r) >> 1;
		if (a1[m].w <= x) l = m + 1; else r = m;
    }
	return a1[l-1].v;
}

int cmp(TBL *a, TBL *b)
{
	if (a->w == b->w) {
		if (a->v > b->v) return -1;
		return (a->v < b->v);
	}
	if (a->w < b->w) return -1;
	return (a->w > b->w);
}

int main()
{
	int N, i, j, m1, m2, lim;
	long long W, x, y, t, ans;

	N = in(), W = inLL();

	for (i = 0; i < N; i++) a[i].v = inLL(), a[i].w = inLL();

	m1 = N / 2, lim = 1 << m1;
	c1 = 0; for (i = 0; i < lim; i++) {
		x = 0, y = 0;
		for (j = 0; j < m1; j++) {
			if ((i >> j) & 1) {
				x += a[j].v;
				y += a[j].w;
			}
		}
		if (y <= W) {
			a1[c1  ].v = x; 
			a1[c1++].w = y;
		}
	}

	qsort(a1, c1, sizeof(TBL), cmp);

	c2 = 1;
	for (i = 1; i < c1; i++) {
		if (a1[c2-1].v < a1[i].v) a1[c2++] = a1[i];
	}

	ans = 0;
	m2 = N - m1, lim = 1 << m2;
	for (i = 0; i < lim; i++) {
		x = 0, y = 0;
		for (j = 0; j < m2; j++) {
			if ((i >> j) & 1) {
				x += a[m1+j].v;
				y += a[m1+j].w;
			}
		}
		if (y <= W) {
			t = x + binarysearch_upper(W-y);
			if (t > ans) ans = t;
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 34484
import java.util.Scanner

fun main(args:Array<String>){

    val cin = Scanner(System.`in`)
    val n = cin.nextInt()
    val m = cin.nextInt()
    val l = cin.nextInt()

    val ma = Array(n,{ Array<Long>(m,{0}) })
    val mb = Array(m,{ Array<Long>(l,{0}) })
    val mc = Array(n,{ Array<Long>(l,{0}) })

    for(i in 0..n-1){
	    for(j in 0..m-1){
	        ma[i][j] = cin.nextLong()
	    }
    }

    for(i in 0..m-1){
	    for(j in 0..l-1){
	        mb[i][j] = cin.nextLong()
	    }
    }

    for(i in 0..n-1){
	    for(j in 0..l-1){
	        for(k in 0..m-1){
    		    mc[i][j] += ma[i][k] * mb[k][j]
	        }
	    }
    }

    for(i in 0..n-1){
	    for(j in 0..l-1){
	        if(j > 0) print(" ")
	        print(mc[i][j])
	    }
	    println()
    }
}




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

int main(){
  int n;
  cin>>n;
  n%=10;
  if(n==2||n==4||n==5||n==7||n==9)cout<<"hon"<<endl;
  else if(n==0||n==1||n==6||n==8)cout<<"pon"<<endl;
  else if(n==3)cout<<"bon"<<endl;
  return 0;
}

Measured memory_bytes: 3608
N,Y = [int(x) for x in input().split()]
for i in range(N+1):
  for j in range(N+1-i):
    k =N-i-j
    a = i*10000+j*5000+k*1000
    if a==Y:
      print(i,j,k)
      exit()
print(-1,-1,-1)

Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        long[] p = new long[a];
        long[] q = new long[b];
        long[] r = new long[c];
        for (int i = 0; i < a; i++) {
            p[i] = sc.nextLong();
        }
        for (int i = 0; i < b; i++) {
            q[i] = sc.nextLong();
        }
        for (int i = 0; i < c; i++) {
            r[i] = sc.nextLong();
        }

        Arrays.sort(p);
        Arrays.sort(q);
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < x; i++) {
            list.add(p[a - i - 1]);
        }
        for (int i = 0; i < y; i++) {
            list.add(q[b - i - 1]);
        }
        for (int i = 0; i < c; i++) {
            list.add(r[i]);
        }
        Collections.sort(list, Collections.reverseOrder());
        long ans = 0;
        for (int i = 0; i < x + y; i++) {
            ans += list.get(i);
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 68432
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

// 入力
int N, K;
int dp[1 << 21][22];
string S[1 << 18];

// 遷移
int LEN[1 << 21], BASE[1 << 21];
pair<int, int> G[1 << 21][22];
bool H[1 << 21][22];

void init() {
	for (int i = 0; i < 21; i++) {
		for (int j = (1 << i); j < (2 << i); j++) LEN[j] = i;
	}
	for (int i = 0; i < (1 << 21); i++) BASE[i] = i - (1 << LEN[i]);

	for (int i = 1; i < (2 << N); i++) {
		int bit[22], base = BASE[i];
		for (int j = 0; j < LEN[i]; j++) {
			if ((base & (1 << j)) == 0) bit[j] = 0;
			else bit[j] = 1;
		}

		// 部分消し
		for (int j = 0; j < LEN[i]; j++) {
			int lims = j;
			for (int k = j; k < LEN[i]; k++) { if (k + 1 == LEN[i] || bit[k] != bit[k + 1]) break; lims = k + 1; }

			int r1 = (base & ((1 << j) - 1));
			int r2 = (base >> (lims + 1));
			int cx = r1 + (r2 << j);
			int cp = j + (LEN[i] - lims - 1);
			G[i][j] = make_pair((1 << cp) + cx, min(cp, j + 1));
			if (lims + 1 == LEN[i]) H[i][j] = true;
		}
	}
}

int main() {
	cin >> N >> K;
	for (int i = 0; i <= N; i++) cin >> S[i];
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j < S[i].size(); j++) {
			if (S[i][j] == '1') dp[(1 << i) + j][0] = 1;
		}
	}
	/*string T; cin >> T;
	int r = 0;
	for (int i = 0; i < T.size(); i++) {
		if (T[T.size() - 1 - i] == '1') r += (1 << i);
	}
	dp[(1 << T.size()) + r][0] = 1;*/

	init();

	for (int i = (2 << N) - 1; i >= 1; i--) {
		int cv[22];
		for (int j = 0; j < N; j++) cv[j] = (1 << j) + (BASE[i] & ((1 << j) - 1));
		for (int j = 0; j < LEN[i]; j++) {
			if (dp[i][j] == 0) continue;
			for (int k = j; k < LEN[i]; k++) {
				dp[G[i][k].first][G[i][k].second] += dp[i][j];
				if (H[i][k] == false) dp[cv[k]][k] += dp[i][j];
			}
		}
	}

	for (int i = N; i >= 0; i--) {
		for (int j = (1 << i); j < (2 << i); j++) {
			int ret = 0;
			for (int k = 0; k <= N; k++) ret += dp[j][k];
			if (ret < K) continue;

			string str = "";
			for (int k = i - 1; k >= 0; k--) {
				if (((j - (1 << i)) / (1 << k)) % 2 == 1) str += "1";
				else str += "0";
			}
			cout << str << endl;
			return 0;
		}
	}
	cout << "-1" << endl;
	return 0;
}

Measured memory_bytes: 615768
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int n, m, x;

int main() {
  scanf("%d%d%d", &n, &m, &x);
  if(x < n || x > n + m) printf("NO\n");
  else printf("YES\n");
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <set>
using namespace std;
#define LL long long 
LL H[10];
LL dfs(int pos,int have){
    if (pos == 5){
      if (have == 3){
        return 1;
      }
      return 0;
    }
    LL ans = 0;
    ans += dfs(pos + 1,have + 1) * H[pos];
    ans += dfs(pos + 1,have);
    return ans;
}
int main()
{
  int n;
  scanf("%d",&n);
  for (int i = 0; i < n; i++){
      char ss[50];
      scanf("%s",ss);
      if (ss[0] == 'M') H[0]++;
      if (ss[0] == 'A') H[1]++;
      if (ss[0] == 'R') H[2]++;
      if (ss[0] == 'C') H[3]++;
      if (ss[0] == 'H') H[4]++;
  }
  cout<<dfs(0,0)<<endl;
}

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

int main()
{
    int n,k;
    cin>>n>>k;
    int arr[n+5];
    for(int i=0;i<n;i++)cin>>arr[i];
    sort(arr,arr+n);
    long long sum=0;
    for(int i=n-1;i>=0;i--)
    {
        if(k>0)k--;
        else sum+=arr[i];
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define eb emplace_back
#define ll long long
#define nl '\n'
#define in() ( { int a ; scanf("%d",&a); a; } )
 
const int N = 1e7 + 5;
const int mod = 1e9 + 7;
//int dx[]={1,0,-1,0,1,-1,-1,1};
//int dy[]={0,1,0,-1,1,1,-1,-1};

ll ar[N];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    ll n, i, ans = 0, mul, j;
    cin >> n;
    for(i = 1; i <= n; i++){
        j = 1;
        mul = i;
        while(mul <= n){
            ar[mul]++;
            j++;
            mul = i*j;
        }
    }
    for(i = 1; i <= n; i++){
        //cout << i << " " << ar[i] << nl;
        ans += (i*ar[i]);
    }
    cout << ans << nl;
}

Measured memory_bytes: 81724
#include <stdio.h>
int main(){
  
  int N, max, num;
  num = 1;
  
  scanf("%d", &N);
  
  int H[N];
  
  for(int i = 0; i < N; ++i){
    scanf("%d", &H[i]);
  }
  
  max = H[0];
  
  for(int i = 1; i < N; ++i){
    if(max < H[i - 1]){
      max = H[i - 1];
    }
    if(max <= H[i]){
      ++num;
    }
  }
  
  printf("%d\n", num);
  
  return 0;
}  

Measured memory_bytes: 128
#include<stdio.h>
int main()
{
	int a;
	scanf("%d",&a);
	if(a==1||a==2||a==3||a==4||a==5||a==6||a==7||a==8||a==9||a==10||a==12||a==14||a==16||a==18||a==15||a==21||a==24||a==27||a==20||a==28||a==32||a==36||a==25||a==30||a==35||a==40||a==45||a==42||a==48||a==54||a==56||a==63||a==49||a==64||a==72||a==81)
			printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 128
/************************************/
/* NoobM							*/
/* File Name : atjp.cpp				*/
/* Date : 05.07.2020 18:00:02 +06	*/
/************************************/

#include <bits/stdc++.h>

#define rr(i, b)    for (int i = 0; i < int(b); i++)
#define vi(n, a) vector <int> a(n); rr(i, n) cin >> a[i]
#define pvec(a) rr(i, a.size()) cout << a[i] << " "; cout << endl
#define bug(x) cout << #x << " " << x << endl
#define ll long long
#define vii vector <int>

using namespace std;

void solve() {
	int n;
	cin >> n;
	
	vector<string> ans {"AC", "WA", "TLE", "RE"};
	map<string, int> mp;
	
	rr(i, n) {
		string a;
		cin >> a;
		
		mp[a]++;
	}
	
	for(auto x : ans) {
		cout << x << " x " << mp[x] << endl;
	}
	
}
 
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
	
	int t = 1;
	//cin >> t;
	
	while (t--) {
		solve();
	}
    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <vector>
#include <queue>

typedef long long ll;
const ll LL_MAX (1LL<<60);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    ll n, k;
    cin >> n >> k;
    vector<ll> a(n), b(n);
    rep(i,0,n) cin >> a[i] >> b[i];

    vector<pair<ll,ll>> v(n);
    rep(i,0,n) v[i] = make_pair(a[i], b[i]);

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

    //rep(i,0,n)
    //    cout << v[i].first << ' ' << v[i].second << endl;

    ll pos=0, val=0;
    rep(i,0,n)
    {
        //cout << pos << ' ' << val << endl;
        if (pos>=k) break;
        pos+=v[i].second, val=v[i].first;
    }

    cout << val << endl;
        
    return 0;
}


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

int main(){
    int h, w;
    
    while(1){
        cin >> h >> w;
        
        if((h == 0) && (w == 0)) break;
        
        for(int i = 0;i < h ; i++){
            for(int j = 0;j < w ; j++){
                if(((i + j) % 2) == 0){
                    cout << "#";
                }
                else{
                    cout << ".";
                }
            }
            cout << endl;
        }
        
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3100
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>
using namespace std;

//#include<bits/stdc++.h>


int main() {
	int x;
	cin >> x;
	int y = x;
	int t = 0;
	while (x) {
		t += x % 10;
		x /= 10;
	}
	if (y%t)cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Random;
import java.util.Arrays;
import java.util.Comparator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.HashMap;

public class Main {
	
	public static void main(String[] args) {
		Scanner	sc = new Scanner(System.in);
		int f = sc.nextInt();
      	int n = f;
		int len = String.valueOf(n).length();
		int d = (int)Math.pow(10, len - 1);
		int sum = 0;
		
		for (int i = 0; i < len; i++) {
			sum += (n / d);
			n %= d;
			d /= 10;
		}
		
		if (f % sum == 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
		
}
	
	


Measured memory_bytes: 23252
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<stack> 
#include<queue>
#include<cmath>
#include<map>
#include<set>
#define LL long long
#define N 200100
#define MOD 1000000007
#define FOR(i,l,r) for (int i = (l); i <= (r); i ++)
#define CLR(a,x) memset(a,x,sizeof(a))
#define INF 0x7fffffff
#define pb push_back
#define X first
#define Y second
using namespace std;
int main(){
	char c1,c2;
	int res;
	scanf("%c %c",&c1,&c2);
	if (c1 == c2 && c1 == 'H') res = 1;
	else if (c1 == c2 && c1 == 'D') res = 1;
	else res = 0;
	if (res) printf("H\n");
	else printf("D\n");
}

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

using namespace std;



main(){

	ios::sync_with_stdio(false);
	// cin.tie(0); cout.tie(0);

	int n; cin >> n;

	vector <int> a(n);

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



	multiset <int> m;


	for(int i = 0; i < n; i++){
		auto it = m.lower_bound(a[i]);

			if(it == m.begin()){
				m.insert(a[i]);
			}else{
				m.erase(prev(it));
				m.insert(a[i]);
			}
	}

	// cout << " ---- " << endl;
	// for(auto it : m){
	// 	cout << it << endl;
	// }


	cout << m.size() << endl;

	return 0;
}

Measured memory_bytes: 5376
def bubblesort(A, n):
    flag = 1
    count = 0
    while flag:
        flag = 0
        for i in range(1,n):
            if A[n-i] < A[n-i-1]:
                A[n-i], A[n-i-1] = A[n-i-1], A[n-i]
                count = count + 1
                flag = 1
        
    A_str = [str(a) for a in A]
    A_str = " ".join(A_str)
    print(A_str)
    print(count)

n = int(input())
A = list(map(int, input().split()))
bubblesort(A, n)


Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(b<a){
        printf("0\n");
    }
    else{
        if(b/a>c){
            printf("%d\n",c);
        }
        else{
            printf("%d",b/a);
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9+7;
#define REP(i,j,n) for(int i=j;i<n;i++)
#define rep(i,n) REP(i,0,n)


// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,v,b,w,t;
    cin >> a >> v >> b >> w >> t;
    ll ans = (v-w) * t - abs(b-a);
    if (ans >= 0)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout <<"NO" << endl;
        /* code */
    }
    

}


Measured memory_bytes: 3652
#include <stdio.h>

int main(void)
{
        char s[4];
        scanf("%s",s);
        for(int i=0;i<3;i++){
                if(s[i]==s[i+1]){
                        printf("Bad\n");
                        return 0;
                }
        }
        printf("Good\n");
        return 0;
}


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

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n, a[3001];
  cin >> n;
  int sum = 0;
  rep(i, 0, n) cin >> a[i], sum += a[i] - 1;
  cout << sum << endl;
}


Measured memory_bytes: 256
x = input()
y = x.split()
for i in range(len(y)):
    op = y[i]
    if op == '+' or op == '-' or op == '*':
        k = i-1
        for j in range(2):
            while 1:
                tmp = y[k]
                if tmp != '' and tmp != '+' and tmp != '-' and tmp != '*':
                    if j == 0:
                        nop_2 = int(y[k])
                        y[k] = ""
                        break
                    else:
                        nop_1 = int(y[k])
                        y[k] = ""
                        break
                k -= 1
                
        if op == '+':
            xRst = nop_1 + nop_2
        elif op == '-':
            xRst = nop_1 - nop_2
        else:
            xRst = nop_1 * nop_2
        y[i] = xRst
print(xRst)



Measured memory_bytes: 5596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    ll n, a[5];
    cin >> n;

    ll mi = 1e18;
    REP(i, 5)
    cin >> a[i], mi = min(mi, a[i]);

    ll res = 5 + max((ll)0, (n - mi + (mi - 1))) / mi;

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
template<typename T>
T chmin(T& l, T r) {
    return l = min(l, r);
}
template<typename T>
T chmax(T& l, T r) {
    return l = max(l, r);
}
// ============ template finished ============

int main()
{
    string S;
    cin >> S;
    stack<char> st;
    for (char c : S) {
        if (st.empty() || st.top() == c)st.push(c);
        else st.pop();
    }
    cout << S.size() - st.size() << endl;
    return 0;
}


Measured memory_bytes: 512
//#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

#ifdef DEBUG
#else
    #define cerr if (false) cerr
#endif

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    forn (i, 0, n) {
        char c;
        cin >> c;
        a[i] = (c == 'W');
    }
    vector <int> pref(2), suf(2);
    forn (i, 0, n)
        suf[a[i]]++;
    int ans = 1e9;
    forn (i, 0, n) {
        chkmin(ans, pref[1] + suf[0]);
        int t = min(pref[1], suf[0]);
        chkmin(ans, pref[1] + suf[0] - t);
        pref[a[i]]++;
        suf[a[i]]--;
    }
    int t = min(pref[1], suf[0]);
    chkmin(ans, pref[1] + suf[0] - t);
    cout << ans;
    return 0;
}

// 0001111

Measured memory_bytes: 3988
#include <array>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, ans = 0;
    cin >> n;
    vector<vector<int>> a(2, vector<int>(n));
    for (int i = 0; i < n; i++) {
        cin >> a[0][i];
    }

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

    for (int i = 0; i < n; i++) {
        int sum = 0;
        for (int j = 0; j < n + 1; j++) {
            if (j < i) {
                sum += a[0][j];
            } else if (j == i) {
                sum += a[0][j];
            } else if (j + 1 == i) {
                sum += a[1][j - 1];
            } else if (j + 1 > i) {
                sum += a[1][j - 1];
            }
        }

        // cout << ans << ", " << sum << endl;
        ans = max(ans, sum);
    }

    cout << ans << endl;
}

Measured memory_bytes: 3612
#include <cstdlib>
#include <iostream>
#include <map>
using namespace std;
 
 
int main() {
    cin.tie(false);
    ios::sync_with_stdio(false);
 
    for(int n; cin >> n, n;) {
        char convert[256];
        for(int i = 0; i < 256; ++i)
            convert[i] = i;
 
        for(int i = 0; i < n; ++i) {
            char from, to;
            cin >> from >> to;
            convert[from] = to;
        }
 
        int m;
        cin >> m;
 
        for(int i = 0; i < m; ++i) {
            char in;
            cin >> in;
            cout << convert[in];
        }
 
        cout << endl;
    }
 
    return EXIT_SUCCESS;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
struct Pos {
  int x, y;
};

int main() {
  int n, m;
  cin >> n >> m;
  vector<Pos> st(n), ch(m);
  for (int i = 0; i < n; i++)
    cin >> st[i].x >> st[i].y;
  for (int i = 0; i < m; i++)
    cin >> ch[i].x >> ch[i].y;

  for (int i = 0; i < n; i++) {
    int ans = INF, num = 0;
    for (int j = 0; j < m; j++) {
      if (ans > abs(st[i].x - ch[j].x) + abs(st[i].y - ch[j].y)) {
        ans = min(ans, abs(st[i].x - ch[j].x) + abs(st[i].y - ch[j].y));
        num = j;
      }
    }
    cout << num + 1 << endl;
  }
}


Measured memory_bytes: 256
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue
from decimal import Decimal

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


class UnionFind:
    def __init__(self, N):
        self.tree = list(range(N))

    def root(self, N):
        if self.tree[N] == N:
            return N
        else:
            self.tree[N] = self.root(self.tree[N])
            return self.tree[N]

    def same(self, x, y):
        return self.root(self.tree[x]) == self.root(self.tree[y])

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.tree[x] = y


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

    N, M = il()
    XY = [il() for _ in range(M)]

    ret = 0
    for i in range(M):
        uf = UnionFind(N)
        for j in range(M):
            if i != j:
                x, y = XY[j]
                uf.unite(x - 1, y - 1)
        x, y = XY[i]
        if not uf.same(x - 1, y - 1):
            ret += 1
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 5032
num = list(map(int,input().split()))
for j in range(len(num)-1,0,-1):
    i = 0
    while i < j:
        if num[i] > num[i+1]:
            num[i],num[i+1] = num[i+1],num[i]
        i += 1
print(num[0],num[1],num[2])
    



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

typedef long long ll;

#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(a) a.begin(), a.end()

const int maxn = 200010;
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;
int n, m, a[maxn];
string s, ss;

void solve()
{
    double d, t, s;
    cin >> d >>t >> s;
    if(d/s<=t){cout << "Yes\n"; return;}
    cout << "No\n";
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t=1;
    //cin >> t;
    while(t--) solve();
}


Measured memory_bytes: 3728
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	srand(time(NULL));
	std::chrono::system_clock::time_point start = std::chrono::system_clock::now();
	int nowtime=0;
	int TIMEMAX=2950;
	nowtime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - start).count();
	int N,A[2000][2000];
	scan(N);
	rep(i,26){
		int c;
		scan(c);
	}
	rep(i,N) rep(j,26) scan(A[i][j]);
	rep(i,N) prin(1);
	/*

	scan(N);
	rep(i,N){
		rep(j,N){
			scan(A[i][j]);
		}
	}
	rep(i,N){
		rep(j,N){
			printf("%d ",A[i][j]);
		}
		kaigyo;
	}*/
	return 0;
}


Measured memory_bytes: 5144
#include <cstdio>
using namespace std;
typedef long long int ll;

int main(){
	int N;
	scanf("%d",&N);
	for(int i=1;i<=3500;i++){
		for(int j=1;j<=3500;j++){
			ll A=4LL*(ll) i*(ll) j-(ll) N*(ll) (i+j);
			ll B=(ll) N*(ll) i*(ll) j;
			if(A>0&&B%A==0){
				printf("%d %d %lld\n",i,j,B/A);
				return 0;
			}
		}
	}
 	return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
const int MAX = 50;
int main()
{
	while (true)
	{
		int n, p;
		cin >> n >> p;
		if (!n && !p)
			break;
		int pOfCan[MAX] = { 0 };
		
		int pOfBowl = p;
		int winIdx = -1;
		int idx = 0;
		while (true)
		{
			if (idx > n - 1)
				idx = 0;
			if (pOfBowl > 0)
			{
				pOfCan[idx]++;
				pOfBowl--;
			}
			else if (pOfBowl == 0)
			{
				if (pOfCan[idx] == p)
				{
					winIdx = idx;
					break;
				}
				pOfBowl = pOfCan[idx];
				pOfCan[idx] = 0;
			}
			idx++;
		}
		cout << winIdx << endl;
	}
}


Measured memory_bytes: 3100
#include<stdio.h>

int main(){
  int i;
  int a;
  int c;
  int coin[] = {500,100,50,10,5,1};

  while(1){
    scanf("%d ",&a);
    if(!a)break;

    c = 0;    
    a = 1000-a;
    for(i=0;i<6;i++){
      while(a>=coin[i]){
        a -= coin[i];
        c++;
      }
    }
    printf("%d\n",c);
  }
  return 0;
}

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

#define REP(i,n) for(int i=0; i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VC vector<char>
#define FOREACH(x,a) for(auto& (x) : (a) )
using namespace std;

int main() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	cout << a + b + c + max({ a,b,c })*(pow(2, k)-1) << endl;
	return 0;
}

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

int main(){
	int n,q,a[20],m[200],box[21][2001] = {1};
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	cin >> q;
	for(int i = 0; i < q; i++) cin >> m[i];

	for(int i = 0; i < n; i++){
		for(int j = 0; j <= 2000; j++){
			if(box[i][j] && j + a[i] <= 2000){
				box[i + 1][j + a[i]] = 1;
			}
			if(box[i][j]) box[i + 1][j] = 1;
		}
	}

	for(int i = 0; i < q; i++){
		if(box[n][m[i]])
			cout << "yes" << endl;
		else cout << "no" << endl;
	}
}

Measured memory_bytes: 1324
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
using vvll = vector<vector<ll>>;
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX*/                      int gcd(ll a,ll b){return b?gcd(b,a%b):a;}
/*"lcm"   MIN*/                      int lcm(ll a,ll b){return a*b/gcd(a,b);}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
int main(){
    vector<int>a={1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
    int z;
    cin >> z;
    cout << a.at(z-1)<<endl;
}
  

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll x;

int main(){
	cin >> x;
	ll height = 0;
	ll ans = 0;
	
	while(height < x){
		ans++;
		height += ans;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma warning(disable:4996)
//#define useCin
//#define useCout
using namespace std;
#ifdef useCin
struct cinacc { cinacc() { cin.tie(0); ios::sync_with_stdio(false); } }cinaccc;
#endif
#ifdef useCout
struct coutacc { coutacc() { cout.setf(ios::fixed); cout.precision(12); } }coutaccc;
#endif
#define rep(n) for(int i=0;i<(int)(n);i++)
#define rep_(n) for(int i=0;i<(int)(n-1);i++)
typedef long long lint;
#define SZ(x) ((int)(x).size())
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define MEMSET(v,h) memset((v),h,sizeof(h)
#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif
template<class T>bool chmax(T & a, const T & b) { if(a < b) { a = b; return 1; }return 0; }
template<class T>bool chmin(T& a, const T& b) { if(b < a) { a = b; return 1; }return 0; }
const int MOD = 1000000007;
#define endl "\n"
int getInt() { int i; scanf("%d", &i); return i; }
void getInt(int* i) { scanf("%d", i); }
double getDouble() { double d; scanf("%lf", &d); return d; }
void getDouble(double* d) { scanf("%lf", d); }
char getChar() { char c; scanf("%c ", &c); return c; }
void getChar(char* c) { scanf("%c ", c); }
string getStr() { string s; cin >> s; return s; }
void getStr(string* s) { cin >> *s; }

int main(void) {
	int n = getInt(), ans = 0;
	for(int i = 1; i <= n; i++) {
		if(to_string(i).length() % 2 == 1) {
			ans++;
		}
	}
	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 256
s = input()
l = len(s)
if l % 2 == 0:
    s_a = s[:l // 2]
    s_b = ''.join(list(reversed(s[l // 2:])))
else:
    s_a = s[:l // 2]
    s_b = ''.join(list(reversed(s[l // 2 + 1:])))

count = 0
for i in range(len(s_a)):
    if s_a[i] != s_b[i]:
        count += 1
print(count)

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main()
{
    int A , B , C , D ;
    cin >> A >> B >> C >> D ;
    if (( A * B ) > ( C * D ))
        cout << A * B ;
    else if (( A * B ) < ( C * D ))
    cout << C * D ;
    else
        cout << A * B ;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  int n = 0;
  cin >> A >> B;
  for(int i = 0; i < B - A + 1; i++){
    int k = A + i;
    if(k % 10 == k / 10000){
      if((k % 100) / 10 == ((k / 1000) % 10)){
        n += 1;
      }
    }
  }
      cout << n << endl;
}

Measured memory_bytes: 256
# ABC143D - Triangles
def binary_search(cur: int, upper_bound: int, lower_bound: int) -> int:
    ok, ng, ret = upper_bound, lower_bound, 0
    while abs(ok - ng) >= 1:
        if L[ok] + L[ng] > cur:
            ret += ok - ng
            ok -= 1
        else:
            ng += 1
    return ret


def main():
    # fix the longest edge -> binary search
    global L
    N, *L = map(int, open(0).read().split())
    L.sort()
    ans = sum(binary_search(L[i], i - 1, 0) for i in range(N - 1, 1, -1))
    print(ans)


if __name__ == "__main__":
    main()

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

string to_string(string s) { return '"' + s + '"'; }
string to_string(char c) { string s = "'"; s += c; return s + "'"; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } 
template <typename A>
string to_string(A v) {
    bool first = true; 
    string res = "{";
    for (const auto &x : v) {
        if (!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}"; 
    return res;
}
istream_iterator<string> eos;
void dbg_out(istream_iterator<string> it) { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(istream_iterator<string> it, Head H, Tail... T) {
    cerr << *it << " = " << to_string(H);
    if(++it != eos) cerr << ", ";
    dbg_out(it, T...);
}
#ifdef LOCAL
    #define dbg(...) { string _s = #__VA_ARGS__; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); dbg_out(_it, __VA_ARGS__); }
#else
    #define dbg(...)
#endif

#define int long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define MP make_pair
#define sz(v) ((int)(v).size())
#define fr(i, j, k) for(int i = j; i < k; i++)
#define nl "\n"
typedef pair<int, int> pii;
typedef vector <int> vi;

pii dir[8] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1}, {1, 1}, {-1, -1} , {-1, 1}, {1, -1} };

const int inf = (1LL << 60), mod = 1e9+7, nn = 2e5+5;

void solve(){
    double pi = 3.141592653589793238;
    int r;
    cin >> r;
    cout << fixed << setprecision(11) << 2 * pi * r << nl;
}

int32_t main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++){
        // cout << "Case #" << tc << ": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3844
#include <cstdio>
#include <cmath>
#include <algorithm>
#define N 100005
typedef long long ll;
using namespace std;
int n;
struct edge{
	int to,next;
}e[N<<1];
int head[N],cnt;
void add(int u,int v){
	e[++cnt]=(edge){v,head[u]};
	head[u]=cnt;
}
int son[N];
int path[N],len;
bool dfs(int x,int fa){
	bool p=x==n;
	for(int i=head[x];i;i=e[i].next){
		int v=e[i].to;
		if(v==fa)continue;
		p|=dfs(v,x);
	}
	son[fa]+=son[x]+1;
	if(p){
		path[++len]=x;
		return true;
	}
	return false;
}
int main(){
	scanf("%d",&n);
	for(int i=1,u,v;i<n;++i){
		scanf("%d%d",&u,&v);
		add(u,v);add(v,u);
	}
	dfs(1,0);
	int ans=0;
	for(int i=len;i>len/2;--i)
		ans+=son[path[i]]-son[path[i-1]];
	printf("%s\n",ans*2>n?"Fennec":"Snuke");
	return 0;
}

Measured memory_bytes: 7552
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int l = scan.nextInt();

		// ?????? A ??\???
		int[][] A;
		A = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				A[i][j] = scan.nextInt();
			}
		}
		// ?????? B ??\???
		int[][] B;
		B = new int[m][l];
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < l; j++) {
				B[i][j] = scan.nextInt();
			}
		}

		// ?????? C ??\???
		// long ?????????
		long[][] C;
		C = new long[n][l];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < l; j++) {
				for (int k = 0; k < m; k++) {
					C[i][j] = C[i][j] + A[i][k] * B[k][j];
				}
			}
		}

		// ?????? C ??????
		for (int i = 0; i < n; i++) {

			// C[i][j]???1???????????????????????????(" " + C[i][j])?????????
			int j = 0;
			System.out.print(C[i][j]);

			for (j = 1; j < l; j++) {
				System.out.print(" " + C[i][j]);
			}
			System.out.println();
		}

	}

}

Measured memory_bytes: 53876
#include<bits/stdc++.h>
using namespace std;
int main(){
int x, y;
string a;
cin >> x >>y;
if (x==y) {a="a == b";}
else if (x>y) {a="a > b";}
else
{a="a < b";}
	;
	cout<<a<<endl;
	return 0;
}


Measured memory_bytes: 3196
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
int main() {
    int a,b;
    cin >> a >> b;
    vector<string> grid(a);
    rep(i,a) cin >> grid[i];
    
    if(grid[0][0] == '#' && grid[0][1] == '.' && grid[1][0] == '.'){
        dunk("No");
        return 0;
    }
    if(grid[a-1][0] == '#' && grid[a-2][0] == '.' && grid[a-1][1] == '.'){
        dunk("No");
        return 0;
    }
    if(grid[a-1][b-1] == '#' && grid[a-1][b-2] == '.' && grid[a-2][b-1] == '.'){
        dunk("No");
        return 0;
    }
    if(grid[0][b-1] == '#' && grid[1][b-1] == '.' && grid[0][b-2] == '.'){
        dunk("No");
        return 0;
    }
    for(int i = 1; i < a-1; i++){
        if(grid[i][0] == '#' && grid[i-1][0] == '.' && grid[i+1][0] == '.' && grid[i][1] == '.'){
            dunk("No");
            return 0;
        }
        if(grid[i][b-1] == '#' && grid[i-1][b-1] == '.' && grid[i+1][b-1] == '.' && grid[i][b-2] == '.'){
            dunk("No");
            return 0;
        }
    }
    for(int j = 1; j < b-1; j++){
        if(grid[0][j] == '#' && grid[0][j-1] == '.' && grid[0][j+1] == '.' && grid[1][j] =='.'){
            dunk("No");
            return 0;
        }
        if(grid[a-1][j] == '#' && grid[a-1][j-1] == '.' && grid[a-1][j+1] == '.' && grid[a-2][j] =='.'){
            dunk("No");
            return 0;
        }
    }
    for(int i = 1; i < a-1; i++){
        for(int j = 1; j < b-1; j++){
            if(grid[i][j] == '#' && grid[i+1][j] == '.' && grid[i][j-1] == '.' && grid[i-1][j] == '.' && grid[i][j+1] == '.'){
                dunk("No");
                return 0;
            }
        }
    }
    dunk("Yes");
    return 0;
}

Measured memory_bytes: 256
# 2020/05/02
# AtCoder Beginner Contest 165 - A

# Input
k = int(input())
a, b = map(int,input().split())

# Calc
ans = 'NG'
for i in range(a, b+1):
    if i % k == 0:
        ans = 'OK'
        break

# Output
print(ans)


Measured memory_bytes: 9160
import numpy as np


def solve(s, t):
    u = np.array([0]*26)
    v = np.array([0]*26)

    for si in s:
        u[ord(si)-97] += 1
    for ti in t:
        v[ord(ti)-97] += 1
    u.sort()
    v.sort()
    for i in range(26):
        if u[i] - v[i] != 0:
            return False

    return True


if __name__ == '__main__':
    s = input()
    t = input()
    ans = 'Yes' if solve(s, t)else 'No'
    print(ans)


Measured memory_bytes: 13128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define INF 1000000000000000
#define fi first
#define se second
#define all(v) v.begin(),v.end()
typedef pair<int, int> P;
int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
struct edge { int to, cost; };
int n, k;
string s;
signed main() {
	cin >> n >> s >> k;
	rep(i, n) {
		if (s[k - 1] != s[i])cout << '*';
		else cout << s[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
k = gets.to_i
s = 10%k
t = 7%k
a = []
a[0] = t
i = 1
while i < k do
  a[i] = (s*a[i-1]+t)%k
  i += 1
end
i = 0
g = 0
while i < k do
  if a[i] == 0
    g = 1
    break
  end
  i += 1
end
if g == 1
  puts i+1
else
  puts "-1"
end

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

ll dps[100010][3];
vector<int> a(100010);
vector<int> b(100010);
vector<int> c(100010);

// n番目にkを選択した場合の最大値
int dp(int n, int k) {
  if (dps[n][k] > -1){
    return dps[n][k];
  }
  if (n == 0){
    switch(k){
      case 0:
        dps[n][k] = a[0];
        break;
      case 1:
        dps[n][k] = b[0];
        break;
      case 2:
        dps[n][k] = c[0];
        break;
    }
    return dps[n][k];
  }
  int maxValue = -1;
  switch(k){
    case 0:
      maxValue = max(dp(n-1, 1), dp(n-1, 2)) + a[n];
      break;
    case 1:
      maxValue = max(dp(n-1, 0), dp(n-1, 2)) + b[n];
      break;
    case 2:
      maxValue = max(dp(n-1, 0), dp(n-1, 1)) + c[n];
      break;
  }  
  dps[n][k] = maxValue;
  return dps[n][k];
}

int main() {
  int N;
  cin >> N;
  
  for (int i = 0; i < N; i++){
    cin >> a[i] >> b[i] >> c[i];
  }
  for (int i = 0; i < 100010; i++){
    for (int j = 0; j < 3; j++){
      dps[i][j] = -1;
    }
  }
  
  int maxA = dp(N-1, 0);
  int maxB = dp(N-1, 1);
  int maxC = dp(N-1, 2);
  int result = max(max(maxA, maxB), maxC);  
  cout << result << endl;
}


Measured memory_bytes: 8448
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>

#define rep(i,x,y) for (int i=x;i<=y;i++)
#define dep(i,y,x) for (int i=y;i>=x;i--)
#define sz(x) (int)(x.size())

using namespace std;

typedef long long LL;   
typedef unsigned long long uLL;

const int maxn=100+7;

int n,k,x,odd,eve;
LL C[maxn][maxn],ans,p[maxn];

int main()
{
    scanf("%d%d",&n,&k);
    rep(i,1,n)
    {
        scanf("%d",&x);
        if (x&1) ++odd; else ++eve;
    }

    rep(i,0,n) C[i][0]=C[i][i]=1;
    rep(i,1,n) rep(j,1,i-1) C[i][j]=C[i-1][j-1]+C[i-1][j];

    p[0]=1;
    rep(i,1,n) p[i]=p[i-1]*2;

    ans=0;
    for (int i=k;i<=n;i+=2)
    {
        ans+=C[odd][i]*p[eve];
    }

    printf("%lld\n",ans);

    // system("pause");
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int cont;
int kaisu[1000000] = {0};

int main()
{
	
	for(;;){
		string str;
		int n;
		int m;
		bool flg = true;
		int cont = 0;
		
		char temp = -1;
		
		cin >> n;
		
		
		if(n == 0){
			break;
		}
		
		cin >> m;
		cin >> str;
		
		
		for(int i = 0; i < m; i++){
			kaisu[i] = 0;
		}
		
		//ある位置から何回IOIを繰り返せるかを調べる
		/*
		for(int i = 0; i < m; i++){
			if(str[i] == 'I')
			{
				for(int j = i;; j++){
					if(str[j] == temp && temp != -1){
						break;
					}
					if(str[j] == 'O'){
						flg = true;
					}
					if(flg == true && str[j] == 'I' && temp != -1){
						flg = false;
						cont++;
					}
					temp = str[j];
	//				printf("%d文字目:今の文字:%c  続いている回数:%d\n",j,str[j], cont);
	//				getchar();
				}
				kaisu[i] = cont;
				flg = false;
				cont = 0;
				temp = -1;
			}
		}
		*/
		
		for(int i = m-1; i > 1; i--){
			if(str[i] == 'I' && str[i-1] == 'O' && str[i-2] == 'I'){
				kaisu[i-2] = kaisu[i]+1; 
			}
		}
		
		cont = 0;
		for(int i = 0; i < m; i++){
//			cout << kaisu[i] << endl;
			if(kaisu[i] >= n){
				cont++;
			}
		}
		
		cout << cont << endl;
	}
}

Measured memory_bytes: 6100
N = int(input())
h = list(map(int, input().split()))

dp = [0, abs(h[1]-h[0])]
for i in range(2,N):
    dp.append(min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2])))

print(dp[-1])


Measured memory_bytes: 20420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(int I=int(A);I<int(B);I++)
#define SORT(x) (sort(x.begin(),x.end()))
#define REV(x) (reverse(x.begin(),x.end()))


int main(){
  ll n,ans=0;
  
  cin >> n;
  //vector<ll> a(n);
  //FOR(i,0,n)cin >> a[i];
  //SORT(a);
  char b=9,c;
  FOR(i,0,n){
    cin >> c;
    if(b!=c){
      ans++;
      b = c;
    }
  }

  cout << ans << endl;
  
}


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

namespace ConsoleApp1
{
    class Program
    {
        public static void Main()
        {
            string[] NM = Console.ReadLine().Split(' ');
            int N = int.Parse(NM[0]);
            int M = int.Parse(NM[1]);
            int NN = N * (N - 1) / 2;
            int MM = M * (M - 1) / 2;
            int ans = NN + MM;

            Console.WriteLine(NN + MM);
        }
    }
}


Measured memory_bytes: 11092