akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;


public class Main {
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int l = scanner.nextInt();
		
		int[][] a = new int[n][m];
		int[][] b = new int[m][l];
		long[][] c = new long[n][l];
		
		for(int i=0; i<n; i++)
		{
			for(int j=0; j<m; j++)
			{
				a[i][j] = scanner.nextInt();
			}
			
			for(int j=0; j<l; j++)
			{
				c[i][j] = 0;
			}
		}
		
		for(int i=0; i<m; i++)
		{
			for(int j=0; j<l; j++)
			{
				b[i][j] = scanner.nextInt();
			}
		}
		
		for(int i=0; i<n; i++)
		{
			for(int j=0; j<l; j++)
			{
				for(int k=0; k<m; k++)
				{
					//c[j][i] += a[j][k]*b[k][i];
					c[i][j] += a[i][k]*b[k][j];
				}
			}
		}
		
		for(int i=0; i<n; i++)
		{			
			for(int j=0; j<l; j++)
			{
				System.out.print(c[i][j]+(j==l-1?"\n":" "));
			}
		}	
	}
}

Measured memory_bytes: 54292
import java.util.*;

public class Main{
    private static boolean isPrime(int x){
        if(x == 0 || x == 1) return false;
        for(int i = 2; i * i <= x; i++){
            if(x % i == 0){
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        while(true){
            int n = sc.nextInt();
            if(n == 0) break;

            for(int i = n; ; i--){
                if(isPrime(i) && isPrime(i - 2)){
                    System.out.println((i - 2) + " " + i);
                    break;
                }
            }
        }
    }
}

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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

ll INF=LLONG_MAX;

int const mxn=3e5+5;
ll a[mxn];

void add(ll &a, ll b){
	a%=MOD; b%=MOD; a+=b; a%=MOD;
	return;
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n; cin >> n;
	map<int,ii>mp;
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	for(int i=0; i<n; i++){
		for(int j=62; j>=0; j--){
			if(a[i]>>j&1)mp[j].se++;
			else mp[j].fi++;
		}
	}
	ll ans = 0; ll two = 1;
	for(int j=0; j<63; j++){
		add(ans,(((two*mp[j].fi)%MOD)*mp[j].se)%MOD);
		two*=2;
		two%=MOD;
	}
	cout << ans << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 2560
#include <stdio.h>

int main(){
  int n;
  long h[100005];
  int i;
  int count = 0;
  int answer = 0;
  
  scanf("%d", &n);
  for(i = 0; i < n; i++)
    scanf("%ld", &h[i]);
  
  for(i = 0; i < n - 1; i++){
    if(h[i] >= h[i + 1]){
      count++;
    }
    else{
      if(count > answer){
        answer = count;
      }
      count = 0;
    }
  }
    
    if(count > answer){
      answer = count;
    }
  
  printf("%d\n", answer);
  
  return 0;
}

Measured memory_bytes: 2488
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <iostream>
#include <climits>
#include <cfloat>


using namespace std;

double distance(double x1, double y1, double x2, double y2)
{
	double dx = x1-x2;
	double dy = y1-y2;
	return sqrt(dx*dx+dy*dy);
}

int main()
{
	double x[4], y[4];
	while (scanf("%lf %lf %lf %lf %lf %lf %lf %lf\n"
		, x, y, x+1, y+1, x+2, y+2, x+3, y+3) != EOF)
	{
		if (x[0] <= x[3] && x[1] >= x[2]
		&& y[0] <= y[3] && y[1] >= y[2])
			puts("YES");
		else
			puts("NO");
	}

	return 0;
}

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

using namespace std;


int main (void) 
{

  /* Variable_Proclamation */
  string s;
  int ans;  // output

  int i;    // subscript
  int end_z;
  int count;
  int max_size;

  int A_point, Z_point;


  /* Input, Array_Proclamation */
  cin >> s;


  /* Initialize */
  ans = 0;
  max_size = 0;


  /* Calculation */
  count = 0;
  A_point = -1;
  Z_point = -1;
  for(i=0; i<s.size(); i++)
  {
    
    if(s.at(i) == 'A' && A_point == -1)
    {
      // count = 1;
      A_point = i;
    }
    else if(s.at(i) == 'Z')
    {

      Z_point = i;

      // count++;
      // end_z = i+1;

      // while( end_z < s.size() )
      // {
      //   if( s.at(end_z) == 'Z' )
      //   {
      //     count++;
      //     end_z++;
      //   }
      //   else
      //   {
      //     break;
      //   }
      // }

      // if(max_size < count)
      // {
      //   max_size = count;
      // }
      // count = 0;

    }
    // else if(count >= 1)
    // {
    //   count++;
    // }

  }

  max_size = Z_point - A_point +1;

  /* Output */
  cout << max_size << endl;


  return 0;

}


Measured memory_bytes: 640
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    A, op, B = input().split()
    A, B = int(A), int(B)

    if op == "+":
        print(A + B)
    else:
        print(A - B)


if __name__ == '__main__':
    main()


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

int main(){
  int N,K;
  cin>>N>>K;
  int sum=0;
  for(int i=0;i<N;i++){
    int p;
    cin>>p;
    if(p>=K){
      sum+=(p-K)*2;
    }
    else if(K-p<=p){
      sum+=(K-p)*2;
    }
    else if(K-p>p){
      sum+=p*2;
    }
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)

int m, n, nx[1000], pr[1000];
string fizz[10000];

int main() {
	rep(i, 10000) {
		int k=i+1;
		ostringstream sout;
		if(k%3 && k%5) sout << k;
		if(k%3==0) sout << "Fizz";
		if(k%5==0) sout << "Buzz";
		fizz[i] = sout.str();
	}
	while(cin>>m>>n) {
		if(m==0) break;
		rep(i, m) nx[i]=(i+1)%m;
		rep(i, m) pr[i]=(i+m-1)%m;
		int cur=0;
		rep(i, n) {
			string s;
			cin >> s;
			if(cur==nx[cur]) continue;
			if(s!=fizz[i]) {
				nx[pr[cur]]=nx[cur];
				pr[nx[cur]]=pr[cur];
			}
			cur=nx[cur];
		}
		while(cur<nx[cur]) cur=nx[cur];
		for(int s=nx[cur]; s!=cur; s++) printf("%d ", s+1);
		printf("%d\n", cur+1);
	}
	return 0;
}

Measured memory_bytes: 1248
#include <stdio.h>

int main(void){
  char S[4];
  scanf("%s", S);

  if(S[0] == S[1] && S[1] == S[2]){
    printf("No\n");
    return 0;
  }
  if(S[0] == S[1] && S[2] == S[3]){
    printf("Yes\n");
    return 0;
  }
  if(S[1] == S[2] && S[0] == S[3]){
    printf("Yes\n");
    return 0;
  }
  if(S[0] == S[2] && S[1] == S[3]){
    printf("Yes\n");
    return 0;
  }
  if(S[0] == S[1] && S[2] == S[3]){
    printf("Yes\n");
    return 0;
  }

  printf("No\n");

  return 0;
}


Measured memory_bytes: 128
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>

using namespace std;

int main(void) {

    int N;
    cin >> N;
    int i;
    double sum;
    double A[N];

    for(i=0;i<N;i++)
        cin>>A[i];


    for(i=0;i<N;i++)
        sum +=1/A[i];

    cout<<fixed;
    cout<<setprecision(6)<<1/sum<<endl;
}





Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
using namespace std;

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

	auto result = 1000;
	for (auto i = 0; i < S.length() - 2; ++i)
	{
		auto num = (S[i] - '0') * 100 + (S[i + 1] - '0') * 10 + (S[i + 2] - '0');
		result = min(result, abs(num - 753));
	}
	cout << result << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
int MAX_NUM = 1000000;
main(){
    vector<int> V,W;
    for(int i = 1;i * (i + 1) * (i + 2) / 6 <= MAX_NUM;i++){
        int num = i * (i + 1) * (i + 2) / 6; 
        V.push_back(num);
        if(i % 4 == 1)W.push_back(num);
    }
    vector<int> t1(MAX_NUM,INF),t2(MAX_NUM,INF);
    t1[0] = t2[0] = 0;
    rep(i,0,V.size()){
        rep(j,0,MAX_NUM){
            if(j + V[i] > MAX_NUM)break;
            t1[j + V[i]] = min(t1[j + V[i]], t1[j] + 1);
        }
    }
    rep(i,0,W.size()){
        rep(j,0,MAX_NUM){
            if(j + W[i] > MAX_NUM)break;
            t2[j + W[i]] = min(t2[j + W[i]], t2[j] + 1);
        }
    }
    int N;
    cin >> N;
    while(N){
        cout << t1[N] << " " << t2[N] << endl;
        cin >> N;
    }
}


Measured memory_bytes: 10552
N, Y = gets.split.map(&:to_i)

for i in 0..N
  for j in 0..(N - i)
    if 10000 * i + 5000 * j + (N - i - j) * 1000 == Y
      puts "#{i} #{j} #{N - i - j}"
      exit
    end
  end
end
puts "-1 -1 -1"


Measured memory_bytes: 1788
#include <stdio.h>
int main(){
	int S,h,m,s;
	scanf("%d",&S);
	h=S/3600;
	m=S/60-h*60;
	s=S-h*3600-m*60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 592
#include <bits//stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
typedef long long int ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
ll sum, cnt, ans = -1e18, imax,k;
int main() {
    int n;cin >> n >> k; vector<ll>p(n),c(n),s;
    rep(i, n) cin >> p[i], p[i]--;// 0-indexed
    rep(i, n) cin >> c[i];
    rep(i, n) {
        sum = 0;// vector<ll> sは累積和
        int now = p[i];
        while (i != now) {
            sum += c[now];s.push_back(sum);
            now = p[now];
        }sum += c[i]; s.push_back(sum);
        // 一周するのにかかる回数がkより大きいときs[0]~s[k-1]までのmax
        if (k <= s.size()) chmax(ans, *max_element(s.begin(), s.begin() + k));
        // 一周するたびに小さくなるので一周目の時のmax
        else if (sum <= 0) chmax(ans, *max_element(ALL(s)));
        else {
            // 一周少なく回ったときを考えるときに注意！！
            ll ans1 = sum * ((k / s.size()) - 1);
            ans1 += *max_element(ALL(s));
            ll ans2 = sum * (k / s.size()),r = k %s.size();
            if (r != 0) {
                // s[0]~s[r-1] または0
                ans2 += max(0LL, *max_element(s.begin(), s.begin() + r));
            }chmax(ans, max(ans1, ans2));
        }s.clear();
    }cout << ans << endl;
}

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

using namespace std;
typedef long long ll;
#define MAX_N 100
#define INF 0x3f3f3f3f

int N;
int num[6];
char op[6];
bool DFS(int ans, int p);

int main()
{
	while (~scanf("%d", &N)) {
		for (int i = 3; i >= 0; i--) {
			num[i] = N % 10;
			N /= 10;
		}

		DFS(num[0], 1);
		printf("%d%c%d%c%d%c%d=7\n", num[0], op[1], num[1], op[2], num[2], op[3], num[3]);
	}
    return 0;
}

bool DFS(int ans, int p) {

	if (p == 3) {
		if (ans + num[p] == 7) 		op[p] = '+';
		else if (ans - num[p] == 7) op[p] = '-';
		else						op[p] = ' ';

		if (op[p] != ' ') return true;
		else return false;
	}
	if (DFS(ans + num[p], p+1)) 		op[p] = '+';
	else if (DFS(ans - num[p], p+1)) 	op[p] = '-';
	else 								op[p] = ' ';

	if (op[p] != ' ') return true;
	else return false;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int x,y;
    int a=0,b=0;
  
    scanf("%d%d",&x,&y);
    if((x==1)||(x==3)||(x==5)||(x==7)||(x==8)||(x==10)||(x==12))
      a++;
    if((y==1)||(y==3)||(y==5)||(y==7)||(y==8)||(y==10)||(y==12))
      b++;
    if((a==1)&&(b==1)) { printf("Yes\n"); return 0; }
    
      a=0; b=0;
    if((x==4)||(x==6)||(x==9)||(x==11))
      a++;
    if((y==4)||(y==6)||(y==9)||(y==11))
      b++;
    if((a==1)&&(b==1)) { printf("Yes\n"); return 0; }
    
    if((x==2)&&(y==2)) { printf("Yes\n"); return 0; }
  
    printf("No\n");
    
    return 0;
}

Measured memory_bytes: 1656
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 100010, P = 1000000007;

int b, w;
int pw[N * 2], ipw[N * 2], fac[N * 2], inv[N * 2];
int bb[N * 2], ww[N * 2];

int norm(int x) { return (x >= P) ? (x - P) : x; }
int binom(int n, int m) { return (n >= m && m >= 0) ? fac[n] * (ll)inv[m] % P * inv[n - m] % P : 0; }

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif

  scanf("%d%d", &b, &w);
  int n = b + w;
  pw[0] = 1;
  for (int i = 1; i <= n; ++i)
    pw[i] = norm(pw[i - 1] << 1);
  ipw[0] = 1;
  ipw[1] = (P + 1) / 2;
  for (int i = 2; i <= n; ++i)
    ipw[i] = ipw[i - 1] * (ll)ipw[1] % P;
  fac[0] = 1;
  for (int i = 1; i <= n; ++i)
    fac[i] = fac[i - 1] * (ll)i % P;
  inv[1] = 1;
  for (int i = 2; i <= n; ++i)
    inv[i] = -(P / i) * (ll)inv[P % i] % P + P;
  inv[0] = 1;
  for (int i = 1; i <= n; ++i)
    inv[i] = inv[i - 1] * (ll)inv[i] % P;
  for (int i = b; i; --i) {
    bb[i] = ((P + binom(n - i, w) - binom(n - i - 1, w)) * (ll)ipw[n - i] + bb[i + 1]) % P;
  }
  for (int i = w; i; --i) {
    ww[i] = ((P + binom(n - i, b) - binom(n - i - 1, b)) * (ll)ipw[n - i] + ww[i + 1]) % P;
  }
  for (int i = 1; i <= n; ++i) {
    int ans = 0;
    ans = (ans + bb[n - i + 1]) % P;
    ans = (ans + ((P + 1 - bb[n - i + 1] - ww[n - i + 1]) % P + P) % P * (ll)ipw[1]) % P;
    printf("%d\n", ans);
  }

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


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

int main(){
  int N, K;
  int R, S, P;
  
  cin >> N >> K;
  cin >> R >> S >> P;
  
  string s;
  cin >> s;
  
  string t;
  int score = 0;
  for (int i = 0; i<s.length() ; ++i){
    int tmp_score = 0;
    string tmp_t;
    if(s[i] == 'r'){
      tmp_score = P;
      tmp_t = 'p';
    }
    else if(s[i] == 's'){
      tmp_score = R;
      tmp_t = 'r';
    }
    if(s[i] == 'p'){
      tmp_score = S;
      tmp_t = 's';
    }
    if( t.length() + 1  >= K  && t[i - K ] == tmp_t[0]){
      t = t + ' ';
      continue;
    }
    t = t + tmp_t;
    score = score + tmp_score;
  }
  cout << score << endl;
  return 0;
  
}

Measured memory_bytes: 864
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include <sstream>
using namespace std;
int main(void){
    long a,b,tmp;
    while(cin >> a >> b){
        long ab = a * b;
        if(a<b){
            tmp = a;
            a = b;
            b = tmp;
        }
        long r = a % b;
        while(r!=0){
            a = b;
            b = r;
            r = a % b;
        }
        cout << b << " " << ab/b << endl;

    }
}

Measured memory_bytes: 3072
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main(){
    int h,w;
    cin>>h>>w;
    for(int i=0;i<h;i++){
        string s;
        cin>>s;
        cout<<s<<endl<<s<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  int n,i,cnt, j;
  int p[1000000] = {};

  p[0] = p[1] = 1;
  for(i=2;i*i<=1000000;i++){
    if(p[i] == 0){
      for(j=i+i;j<=1000000;j+=i){
	p[j] = 1;
      }
    }
  }

  while(scanf("%d",&n) != EOF){

    cnt = 0;
    for(i=2;i<=n;i++){
      if(p[i] == 0){
	cnt++;
      }
    }

    printf("%d\n", cnt); 
  }
  
  return 0;
}

Measured memory_bytes: 4508
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
const int maxn=1e5+5;
int a[maxn];
int main(){
    int n,count2=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    int i=1,count=1,ans=n;
    while(i<n){
        while(i<n&&a[i]==a[i-1]){
            i++;
            count++;
        }
        if(count%2==0){
            ans-=count-2;
            count2++;
        }else{
            ans-=count-1;
        }
        count=1;
        i++;
    }
    if(count2%2==0){
        ans-=count2;
    }else{
        ans-=count2+1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

vector<string> split(const string &s, char delim) {
  vector<string> elems;
  string item;
  for (char ch: s) {
    if (ch == delim) {
      if (!item.empty()) {
        elems.push_back(item);
      }
      item.clear();
    }
    else {
      item += ch;
    }
  }
  if (!item.empty()) {
    elems.push_back(item);
  }
  return elems;
}

string to_str_with_zero(int i, int w) {
  ostringstream sout;
  sout << std::setfill('0') << std::setw(w) << i;
  string s = sout.str();
  return s;
}

int letter_to_int(char c) {
  return tolower(c) - 'a';
}

int compare_array(vector<int> a1, vector<int>a2) {
  int n1 = a1.size();
  int n2 = a2.size();
  if (n1 != n2) {
    return n1 - n2;
  }
  for (int i=0; i<n1; i++) {
    if (a1.at(i) != a2.at(i)) {
      return a1.at(i) - a2.at(i);
    }
  }
  return 0;
}

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

char int_to_char(int a) {
  if (a == -1) {
    return 'z';
  }
  else {
    return 'a' + a;
  }
}

long nCr(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

int divide_count(int a, int divider) {
  int r = 0;
  while(a % divider == 0) {
    a /= divider;
    r++;
  }
  return r;
}

bool is_prime(int a) {
  int i = 2;
  while(i * i <= a) {
    if(a % i == 0) {
      return false;
    }
    i++;
  }
  return true;
}

vector<vector<int>> all_comb(int n, int k) {
  vector<vector<int>> combs(nCr(n, k), vector<int>(k));
  for(int i=0; i<k; i++) {
    combs[0][i] = i;
    combs[1][i] = i;
  }
  
  for(long i=1; i<nCr(n, k); i++) {
    int p = 1;
    while(combs[i][k - p] == n - p) {
      p++;
      if(p > k) {
        break;
      }
    }
    combs[i][k - p]++;
    int q = combs[i][k - p];
    for(int j=1; j<p; j++) {
      combs[i][k - p + j] = q + j;
    }

    if(i < nCr(n, k) - 1) {
      for(int j=0; j<k; j++) {
        combs[i + 1][j] = combs[i][j];
      }
    }
  }

  return combs;
}

template <typename TYPE> void co(TYPE a) {
  cout << a << endl;
}

template <typename TYPE> void co_2(TYPE a, TYPE b) {
  cout << a << ' ' << b << endl;
}

template <typename TYPE> void co_l(vector<TYPE> as) {
  int n = as.size();
  for(int i=0; i<n; i++) {
    cout << as[i] << endl;
  }
}

template <typename TYPE> void co_s(vector<TYPE> as) {
  int n = as.size();
  for(int i=0; i<n; i++) {
    if(i > 0) {
      cout << ' ';
    }
    cout << as[i];
  }
  cout << endl;
}

int main() {
  std::cout << std::setprecision(9);
  long mod = 1000000007;
  string n;
  cin >> n;
  vector<char> n_c(n.begin(), n.end());
  int size = n_c.size();

  int sum = 0;
  for(int i=0; i<size; i++) {
    sum += n_c[i] - '0';
  }
  if(sum % 9 == 0) {
    co("Yes");
  }
  else {
    co("No");
  }
}

Measured memory_bytes: 3832
package main

import (
	"fmt"
)

type point struct {
	y, x int
}
type queue []point

func (q *queue) push(p point) {
	*q = append(*q, p)
}

func (q *queue) pop() {
	if len(*q) == 0 {
		return
	}
	*q = (*q)[1:]
}

var h, w int
var move = []point{{-1, 0}, {0, 1}, {1, 0}, {0, -1}}

func main() {
	fmt.Scan(&h)
	fmt.Scan(&w)

	field := make([]string, h)
	for i := 0; i < h; i++ {
		fmt.Scan(&field[i])
	}

	var ans int
	dist := make([][]int, h)

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if string(field[i][j]) == "#" {
				continue
			}

			for di, _ := range dist {
				dist[di] = make([]int, w)
				for dj, _ := range dist[di] {
					dist[di][dj] = -1
				}
			}

			q := queue{}
			q.push(point{i, j})

			var update = func(y, x, v int) {
				if dist[y][x] != -1 {
					return
				}
				dist[y][x] = v
				q.push(point{y, x})
			}
			update(i, j, 0)

			for len(q) > 0 {
				x := q[0].x
				y := q[0].y
				q.pop()

				for _, m := range move {
					nx := x + m.x
					ny := y + m.y
					if nx < 0 || nx >= w || ny < 0 || ny >= h {
						continue
					}
					if string(field[ny][nx]) == "#" {
						continue
					}
					update(ny, nx, dist[y][x]+1)
				}
			}

			for di, _ := range dist {
				for _, v := range dist[di] {
					if ans < v {
						ans = v
					}
				}
			}
		}
	}
	fmt.Print(ans)
}


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

using namespace std;

int main()
{
    int N;
    cin>>N;
    long long mod = 1e9 + 7;
    long long a = 1, b = 1, c = 1; 
    for (int i=0; i<N; i++) {
        a *= 10ll;
        b *= 8ll;
        c *= 9ll;
        a %= mod;
        b %= mod;
        c %= mod;
    }
    long long res = a + b - 2ll * c;
    while (res < 0) res += mod;
    cout << res << '\n';
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>
#include <time.h>
#include <random>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
double Pi = 3.1415926535897932384626;
 
vector<ll> G[500005];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
 
ll mod = 1000000007;
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

 
//ll fact[800005],rfact[800005];
/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,ans,a,b,c,d,e,g,h,w,i,j,k,q;
char s[500005],t[500005];
 
int main(){

    cin >> a >> b;
    if(a / 2019 != b / 2019){
        p(0);
    }else{
        ans = 2019;
        for(i=a;i<=b;i++){
            for(j=i+1;j<=b;j++){
                ans = min(ans,(i%2019)*(j%2019)%2019);
            }
        }
        p(ans);
    }
    

    

    return 0;
}


Measured memory_bytes: 12032
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct _OMAZINAI_ { _OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } __omazinai_instance__;
#define INF (1LL<<61 + 1<<29)
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
void _INPUT_IMPL_() {};
template <class T, class... Args> void _INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; _INPUT_IMPL_(args...); }
void _OUTPUT_IMPL_() {};
template <class T, class... Args> void _OUTPUT_IMPL_(T dest, Args... args) { cout<< dest << (sizeof...(Args)?" ":""); _OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; _INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define out(...) _OUTPUT_IMPL_(__VA_ARGS__)

int main() {
	in(int, n, m);
	out((n - 1)*(m - 1));
}

Measured memory_bytes: 256
/*
auth - @sportykush
*/

#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
// using namespace __gnu_pbds;

typedef long long int ll;
typedef long double ld;

//#define mp make_pair
#define bug(v)                    cerr<<#v<<" = "<<(v)<<endl;
#define bug2(v1,v2)               cerr<<#v1<<" = "<<(v1)<< ' ' << #v2<<" = "<<(v2)<<endl;
#define ERASE(x)                  x.erase(unique(x.begin(),x.end()),x.end())
#define pb                        emplace_back
#define vii                       vector<int>
#define vll                       vector<ll>
#define vpll                      vector< pair <ll,ll> >
#define pll                       pair <ll,ll>
#define pii                       pair <int,int>
#define pq                        priority_queue< int >
#define khtm                      "\n"
#define F                         first
#define S                         second
#define fr(i,a,n)                 for(i=a;i<n;i++)
#define mem(arr,l)                memset(arr,l,sizeof arr)
#define ALL(x)                    x.begin(), x.end()
#define frr(i,a,n)                for(i=n-1;i>=a;i--)
#define fast                      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testcase                  ll T; cin>>T; while(T--)


const double pi = 3.14159265359;
const int MAX = 1e6 +2;
const ll inf =  1e18;
const int N = 1010;
//const ll mod = 998244353 ;
const ll mod = 1000000007;
inline ll add(ll a,ll b){a+=b;if(a>=mod)a-=mod;return a;}
inline ll mul(ll a,ll b){return (((a+mod)%mod)*(b+mod)%mod)%mod;}
inline ll power(ll a,ll b){ll rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline ll modInverse(ll n, ll p){ return power(n, p-2)%p; }

/*
important builtin functions
__gcd(value1, value2)
__builtin_ffs(x)
  Number of leading zeroes: __builtin_clz(x)
  Number of trailing zeroes : __builtin_ctz(x)
  Number of set bits: __builtin_popcount(x)
*/
 
void stArt()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
}
void eNd()
{
	#ifndef ONLINE_JUDGE
  	cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
  	#endif
}

//////////////////// start /////////////////////////////////
 

ll i,j,k,l,m,r,n;
ll a[MAX],b[MAX];

bool check(ll x)
{
	ll cnt = 0;
	fr(i,0,n)
	{
		cnt += (a[i]/x)-1;
		if(a[i]%x)
			cnt++;
	}
	return cnt<=k;
}

void bs()
{
	l=1,r=1e9;
	ll ans;
	while(l<=r)
	{
		ll mid = (l+r)/2;
		if(check(mid))
		{
			ans = mid;
			r = mid-1;
		}
		else
			l=mid+1;
	}
	cout << ans;
}

int main()
{
 
stArt();
fast
//cout << setprecision(15) << fixed;
	
	cin >> n >> k;
	fr(i,0,n)
		cin >> a[i];
	bs();
   
 eNd();
  return 0;
 
}

Measured memory_bytes: 5136
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << min(a, b) + min(c, d) << endl;
  return 0;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    use std::cmp::min;

    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();

    // input
    let h: usize = read(&mut stdin_lock, &mut buf, b' ');
    let n: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut abv = vec![(0usize, 0usize); n];
    for i in 0..n {
        abv[i].0 = read(&mut stdin_lock, &mut buf, b' ');
        abv[i].1 = read(&mut stdin_lock, &mut buf, b'\n');
    }

    abv.sort();

    // 体力減少が x 以上のうち最も魔力の消耗が少ないものを選ぶ
    let mut tbl = vec![0usize; h + 1]; // tbl[hp] = min_mp;
    for i in 1..h + 1 {
        let mut min_mp = usize::max_value();
        for j in 0..n {
            let (a, b) = abv[j];
            min_mp = min(min_mp, if i > a { tbl[i - a] + b } else { b });
        }
        tbl[i] = min_mp;
    }

    println!("{}", tbl[h]);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

//O(n^2 * 2^n)
ll hamilton(vector<vector<bool>> g){
    int n=g.size();
    ll dp[n][(1<<n)]={};

    //本当なら全点始点なのでこっち
    // rep(i,n) dp[i][(1<<i)]=1;
    // One-stroke Path は始点が1なのでこっち
    dp[0][1]=1;
    for(int bit=1;bit<(1<<n);bit++){
        for(int u=0;u<n;u++)if((bit>>u)&1){
            for(int v=0;v<n;v++){
                if(!((bit>>v)&1) and g[u][v]) dp[v][bit|(1<<v)]+=dp[u][bit];
            }
        }
    }
    ll ret=0;
    rep(i,n) ret+=dp[i][(1<<n)-1];
    return ret;
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int n,m;cin>>n>>m;
    vector<vector<bool>> g(n,vector<bool>(n,false));
    rep(i,m){
        int a,b;cin>>a>>b;a--,b--;
        g[a][b]=true;g[b][a]=true;
    }
    cout<<hamilton(g)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
bool binaryserch(char S[],char str,int l){
  int left=0,right=l-1;
  if(S[right]==str) return false;
  while(left<right){
    int mid=(left+right)/2;
    if(S[mid]==str) return false;
    else if(S[mid]<str) left=mid+1;
    else if(S[mid]>str) right=mid;
  }
  return true;
}
int main(){
  char S[100005];
  scanf("%s",&S);
  int l=strlen(S);
  sort(S,S+l);
  char str='a';
  for(;str<='z';str++){
    if(binaryserch(S,str,l)) {
      printf("%c\n",str);
      break;
    }
  }
  if(str=='z'+1) printf("None\n");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    ll l[2] = { 2, 1 };
    for (int i = 2; i <= n; i++) {
        l[i % 2] = l[0] + l[1];
    }
    cout << l[n % 2] << endl;
}

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

#define mx 3009
typedef pair<int,int> pii;
#define xx first
#define yy second
#define mk make_pair

#define inf mk(-1,-1)

int a,b,c,d,e,f;

pii dp[mx][mx]; //max water and sugar

pii cmp(pii a, pii b)
{
    if(a==inf)
        return b;
    else if(b==inf)
        return a;
    else if(a.xx && a.yy*b.xx>=b.yy*a.xx)
        return a;
    else
        return b;
}

pii func(int x, int y) //x size of solution, y =amount of sugar
{
    if(x>f || y*(e+100)>e*x)
        return inf;
    else if(~dp[x][y].first)
        return dp[x][y];

    pii p=mk(x,y);
    p=cmp(p,func(x+100*a,y));
    p=cmp(p,func(x+100*b,y));
    p=cmp(p,func(x+c,y+c));
    p=cmp(p,func(x+d,y+d));

    return dp[x][y]=p;
}


int main()
{
    pii res;

    int i,j;
    for(i=0;i<mx;i++)
        for(j=0;j<mx;j++)
            dp[i][j]=inf;

    scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);

    res=func(0,0);

    printf("%d %d\n",res.xx,res.yy);

    return 0;

}


Measured memory_bytes: 71040
// ConsoleApplication1.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
using namespace std;
#define rep(i, n) for(long i = 0; i < n; i++)
#define erep(i, n) for(long i = 1; i <= n; i++)
#define show(ans) cout << ans << endl
const long MOD = 1000000007;

int main() {
	long N;
	cin >> N;
	vector<long> l(N);
	rep(i, N) cin >> l[i];
	sort(l.begin(), l.end());
	reverse(l.begin(), l.end());
	long sum = 0;
	for (long i = 1; i <= N - 1; i++) {
		sum += l[i];
	}
	if (l[0] < sum) show("Yes");
	else show("No");

	return 0;

}
// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
using namespace std;
typedef long long ll;
typedef vector<int>VI;
typedef pair<int,int>P;
typedef pair<double,double>P_D;
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define reprev(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define ALL(a)  (a).begin(),(a).end()
#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define fi first
#define se second
#define MAX 100100//5
#define MAX_N 200100
#define MAX_B 1001001//6
#define MAX_S 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
#define MOD 1000000007
#define INF 1<<30
#define INFTY 1000000000000000001LL
#define MAX_INT INT_MAX

int main(){
    int n,m;cin>>n>>m;
    int k=(n+m)*(n+m-1)/2;
    int t=n*m;
    cout<<k-t<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
//26

deque<int> q;
int a[200000];
string str;
signed main(){
	int n;
	scanf("%lld", &n);
	rep(i,n)scanf("%lld", &a[i]);
	int b = 0;
	if(n%2 == 1)b = 1;
	rep(i,n){
		if(i%2 == b)q.push_back(a[i]);
		else q.push_front(a[i]);
	}
	rep(i,n){
		str += to_string(q.front());
		str.push_back(i == n-1 ? '\n' : ' ');
		q.pop_front();
	}
	cout << str;
	return 0;
}





Measured memory_bytes: 7428
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int dx[8]={-1,-1,-1,0,0,1,1,1},dy[8]={-1,0,1,-1,1,-1,0,1};
bool check(int n,int m,int x,int y){return x>=0&&x<n&&y>=0&&y<m;}

bool dp[1<<20];
int main() {
  int T,n=5,m=4;
  cin >> T;
  while(T--) {
    int d[20];
    for(int i=0; i<20; i++) cin >> d[i];
    memset(dp,0,sizeof(dp));
    dp[(1<<20)-1]=1;
    int ans=1<<29;
    for(int t=(1<<20)-1; t>=0; t--) {
      if(dp[t]) ans=min(ans,__builtin_popcount(t));
      else continue;
      P a[n][m];
      memset(a,-1,sizeof(a));
      for(int i=0,k=0; i<20; i++) {
	if(t&(1<<i)) {
	  a[k/m][k%m]=P(d[i],i);
	  k++;
	}
      }
      for(int i=0; i<n; i++) {
	for(int j=0; j<m; j++) {
	  if(a[i][j].first==-1) break;
	  for(int k=0; k<8; k++) {
	    int x=i+dx[k],y=j+dy[k];
	    if(!check(n,m,x,y)) continue;
	    if(a[i][j].first==a[x][y].first) {
	      dp[t^(1<<a[i][j].second)^(1<<a[x][y].second)]|=dp[t];
	    }
	  }
	}
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int sum = 0;
  for (int i = 0; i < 4; i++) {
    if (S.at(i) == '+') {
      sum++;
    }
    else {
      sum--;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;

int main() {
	int n;
	cin >> n;
	vector<int> a(4);
	rep(i, n) {
		string s;
		cin >> s;
		if (s == "AC") a[0]++;
		if (s == "WA") a[1]++;
		if (s == "TLE") a[2]++;
		if (s == "RE") a[3]++;
	}
	cout << "AC" << " " << "x" << " " << a[0] << endl;
	cout << "WA" << " " << "x" << " " << a[1] << endl;
	cout << "TLE" << " " << "x" << " " << a[2] << endl;
	cout << "RE" << " " << "x" << " " << a[3] << endl;
}


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

int INF = 1e9;

struct SegmentTree {
private:
    int n;
    vector<int> node;

public:
    // 元配列 v をセグメント木で表現する
    SegmentTree(vector<int> v) {
        // 最下段のノード数は元配列のサイズ以上になる最小の 2 冪 -> これを n とおく
        // セグメント木全体で必要なノード数は 2n-1 個である
        int sz = v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, INF);

        // 最下段に値を入れたあとに、下の段から順番に値を入れる
        // 値を入れるには、自分の子の 2 値を参照すれば良い
        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        //ここでminを使うことで区間の最小値となる、最大にすれば最大値
        for(int i=n-2; i>=0; i--) node[i] = min(node[2*i+1], node[2*i+2]);
    }

//x番目(0-indexed)の要素をvalにする
void update(int x, int val) {
    // 最下段のノードにアクセスする
    x += (n - 1);

    // 最下段のノードを更新したら、あとは親に上って更新していく
    node[x] = min(node[x], val);
    while(x > 0) {
        x = (x - 1) / 2;
        //ここでminを使うことで区間の最小値となる、最大にすれば最大値
        node[x] = min(node[2*x+1], node[2*x+2]);
    }
}

// 要求区間 [a, b) 中の要素の最小値を答える(つまりbは含まれない)
// k := 自分がいるノードのインデックス
// 対象区間は [l, r) にあたる

int getmin(int a, int b, int k = 0, int l = 0, int r = - 1) {
    // 最初に呼び出されたときの対象区間は [0, n)
    if(r < 0) r = n;

    // 要求区間と対象区間が交わらない -> 適当に返す(今回は最小値なので、結果に影響しないような大きい値を返しておく)
    if(r <= a || b <= l) return INF;

    // 要求区間が対象区間を完全に被覆 -> 対象区間を答えの計算に使う
    if(a <= l && r <= b) return node[k];

    // 要求区間が対象区間の一部を被覆 -> 子について探索を行う
    // 左側の子を vl ・ 右側の子を vr としている
    // 新しい対象区間は、現在の対象区間を半分に割ったもの
    int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
    int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
    return min(vl, vr);
}

};

int main(){
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    vector<int> dp(n + 1, INF);
    vector<int> z(n + 1, INF);
    SegmentTree seg(z);
    dp[n] = 0;
    seg.update(0, n);
    int now = 0;
    for (int i = n - 1; i >= 0; i--){
        if (s[i] == '1') continue;
        int a = seg.getmin(now, now + 1);
        if (a - i <= m){
            dp[i] = now + 1;
            seg.update(now + 1, i);
        }
        else {
            now++;
            a = seg.getmin(now, now + 1);
            if (a - i > m){
                cout << - 1 << endl;
                return 0;
            }
            dp[i] = now + 1;
            seg.update(now + 1, i);
        }
    }
    vector<int> ans;
    ans.push_back(0);
    for (int i = dp[0] - 1; i >= 0; i--){
        int a = seg.getmin(i, i + 1);
        ans.push_back(a);
    }
    for (int i = 1; i < ans.size(); i++){
        cout << ans[i] - ans[i - 1];
        if (i != ans.size() - 1) cout << " ";
        else cout << endl;
    }
}

Measured memory_bytes: 3320
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  while(cin>>s,s!="."){
    string s2;cin>>s2;
    if(s==s2){cout<<"IDENTICAL"<<endl;continue;}
    vector<string>ss;
    vector<string>ss2;
    vector<string>other1;
    vector<string>other2;
    bool flag=false;
    string tmp="";
    for(int i=0;i<s.size();i++){
      if(s[i]=='"'){
	if(flag==false){
	  other1.pb(tmp);
	  tmp="";
	  flag=true;
	}else{
	  ss.pb(tmp);
	  tmp="";
	  flag=false;
	}
      }else{
	tmp+=s[i];
      }
    }
    other1.pb(tmp);
    tmp="";
    flag=false;
    for(int i=0;i<s2.size();i++){
      if(s2[i]=='"'){
	if(flag==false){
	  other2.pb(tmp);
	  tmp="";
	  flag=true;
	}else{
	  ss2.pb(tmp);
	  tmp="";
	  flag=false;
	}
      }else{
	tmp+=s2[i];
      }
    }
    other2.pb(tmp);
    bool ans=true;
    if(other1.size()!=other2.size()){ans=false;}
    else{
      for(int i=0;i<other1.size();i++){
	//cout<<other1[i]<<" "<<other2[i]<<endl;
	if(other1[i]!=other2[i])ans=false;
      }
    }
    ll cnt=0;
    if(ss.size()!=ss2.size()){ans=false;}
    else{
      for(int i=0;i<ss.size();i++){
	//cout<<ss[i]<<" "<<ss2[i]<<endl;
	if(ss[i]!=ss2[i])cnt++;
      }
    }
    if(ans){
      //cout<<cnt<<endl;
      if(cnt<=1)cout<<"CLOSE"<<endl;
      else cout<<"DIFFERENT"<<endl;
    }else{cout<<"DIFFERENT"<<endl;}
  }
  return 0;
}



Measured memory_bytes: 3188
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] ws = W.split(" ");
		int A = Integer.parseInt(ws[0]);
		int B = Integer.parseInt(ws[1]);
		int C = Integer.parseInt(ws[2]);

		int x = A-B;
		int y = C-x;
		if(y<=0){
			y=0;
		}
		System.out.println(y);


	}

}


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

int main() {
  int D,N;
  cin>>D>>N;
  int mul;
  if(D==0) mul=1;
  if(D==1) mul=100;
  if(D==2) mul=100*100;

  if(N==100){
    cout<<mul*101<<endl;
  }
  else{
    cout<<mul*N<<endl;
  }

  }


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
int mod = (int) 1e9 + 7;

int main(){
    
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n,0);
    int a[12][12] = {};
    
    rep(i,n){
        cin >> c[i];
        rep(j,m) cin >> a[i][j];
    }
    
    vector<int> b(m,0);
    
    rep(i,n) rep(j,m){
        b[j] += a[i][j];
    }

    int b_min = 100000;
    rep(j,m) b_min = min(b_min, b[j]);
    
    if(b_min < x){
        cout << -1 << "\n";
        return 0;
    }
    
    int max = (int)pow(2,n);
    int ans = 10000000;
    
    for(int i = 1; i <= max; i++){
        
        int t = i, count = 0, aa[12] = {};
        
        rep(j,n){
            if(t % 2 > 0){
                count += c[j];
                rep(k,m) aa[k] += a[j][k];
            }
            t /= 2;
        }
        
        int aa_min = 10000000;
        rep(k,m) aa_min = min(aa_min, aa[k]);
        
        if(aa_min < x) continue;
        
        ans = min(ans, count);
                
    }
    
    cout << ans << "\n";
    
    return 0;
}


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

int main() {
    int n, A[220000];
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> A[i];
    }

    int premax = 0;
    int maxi;
    for (int i = 1; i <= n; i++) {
        if (A[i] > premax) {
            premax = A[i];
            maxi = i;
        }
    }

    A[maxi] = 0;
    int secondmax = 0;
    for (int i = 1; i <= n; i++) {
        if (A[i] > secondmax) {
            secondmax = A[i];
        }
    }

    for (int i = 1; i <= n; i++) {
        if (i == maxi) {
            cout << secondmax << endl;
        } else {
            cout << premax << endl;
        }
    }

    return 0;

}

Measured memory_bytes: 2432