akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int a[7], b[7];
    for(int i = 0; i< 7; i++){
        cin >> a[i] >> b[i];
        cout << a[i] - b[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int x = (a+d-1)/d, y = (c+b-1)/b;
    if(x >= y)cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3624
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int stack[100];
int s_pointer = 0;
int push(int);
int pop(void);

int main(void){
  int x;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      x = pop() + pop();
      push(x);
    } else if ( s[0] == '-' ){
      x = pop() - pop();
      x = x - x * 2;
     push(x);
    } else if ( s[0] == '*' ){
      x = pop() * pop();
      push(x);
    } else {
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n",stack[s_pointer]);
  return 0;
}

int push(int x){
  s_pointer++;
  stack[s_pointer] = x;
}

int pop(void){
  s_pointer--;
  return stack[s_pointer+1];
}

Measured memory_bytes: 0
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
C = 10**9+7

dp = [[0]*(K+1) for _ in range(N)]
dp[0] = [1]*(A[0]+1)+[0]*(K-A[0])
csum = [[0]*(K+2) for _ in range(N)]

# l=max(0,j[A[i]])のとき
# dp[i][j]=sum(dp[i][l,j+1])としたいがO(NK**2)で間に合わない
# ->和を取る操作を高速化するために累積和のテーブルを準備する

for i in range(1, N):
    for j in range(K+1):
        csum[i-1][j+1] = (csum[i-1][j]+dp[i-1][j]) % C
        l = max(0, j-A[i])
        dp[i][j] = (csum[i-1][j+1]-csum[i-1][l]) % C
print(dp[-1][-1])


Measured memory_bytes: 221436
using System;
class Program
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        int a = int.Parse(s[0]);
        int b = int.Parse(s[1]);
        int c = int.Parse(s[2]);
        if (a <= b&&a<=c)
        {
            if(b<=c)
                Console.WriteLine(a + " " + b+" "+c);
            else
                Console.WriteLine(a+" "+c+" "+b);
        }
        else if(a<=b&&a>=c)
        {
            Console.WriteLine(c+" "+a+" "+b);
        }
        else if(b<=a&&b<=c)
        {
            if(a<=c)
                Console.WriteLine(b+" "+a+" "+c);
            else
                Console.WriteLine(b+" "+c+" "+a);
        }
        else if(c<=a&&b<=a)
            Console.WriteLine(c+" "+b+" "+a);
    }
}

Measured memory_bytes: 9116
S = input()

ACGT = ('A', 'C', 'G', 'T')

def is_ACGT(string):
  for c in string:
    if c not in ACGT:
      return False
  return True


max_len = 0
for i in range(len(S)+1):
  for j in range(i+1, len(S)+1):
    sub = S[i:j]
    if is_ACGT(sub):
      max_len = max(max_len, len(sub))

print(max_len)

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


public class Main{
    static long [][] memo;
    static long [] pow = new long[33];
    static ArrayList <Integer> [] graph;
    static Integer [] d;
    static int [] dist;
    static boolean[][] visited;
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        // Start writing your solution here. -------------------------------------
        long MOD = 1000000007;
        //int t = sc.nextInt();
        int t = 1;
        while(t -- > 0)
        {
            int n = sc.nextInt();
            int m = sc.nextInt();
            //int k = sc.nextInt();
            if(n <= m)
            out.println("unsafe");
            else
                out.println("safe");
        }
        out.close();
    }
    public static void bfs(int source, int i, int g)
    {
        if(visited[i][g]) return;
        visited[i][g] = true;
        if(g == 0) graph[source].add(i);

        if(dist[i] <= g) bfs(source, i - 1, g - dist[i]);
        if(dist[i + 1] <= g) bfs(source, i + 1, g - dist[i + 1]);
    }
    public static long solve(long n){
        for(int i = 1; i < 33; i ++)
            if(n % pow[i] == 0)
                return n / pow[i];
        return -1;
    }
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    //--------------------------------------------------------
}


Measured memory_bytes: 32900
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han Elmuzaffer Daima
//Bismillahirrahmanirrahim

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define ort (bas+son)/2

const lo MAX = -1000000000000000000; 
const lo MIN = 1000000000000000000; 
const lo inf = 1000000000; 
const lo KOK = 100000; 
const lo LOG = 30; 
const lo li = 100005; 
const lo mod = 1000000007; 

int n,m,cev,b,a[li],k;
string s;
vector<int> v;

inline int solve(){
	scanf("%d %d %d",&n,&m,&k);
	if(k-m != m-n){printf("NO\n");return 0;}
	printf("YES\n");
	return 0;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
int32_t main(){
	if(fopen("input.txt", "r"))
	freopen("input.txt", "r", stdin),
	freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0),cin.tie(0);
	string s;
	cin >> s;
	int ok=1,n=s.size();
	string x=s.substr(0,(n-1)/2);
	string y=s.substr((n+1)/2,n);
	string z=x;
	reverse(z.begin(),z.end());
	if(x==y and y==z){
		cout << "Yes";
	}
	else cout << "No";
}

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

#define INF 1000000000

using namespace std;

typedef long long LL;

int main()
{
	char a,b,c;
	cin >> a >> b >> c;

	if ((a != b) && (a != c) &&  (b != c))
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 764
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
																								   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;																								   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra	   
																													   																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////


///////////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    k--;
    
    char c = s[k];
    char x = tolower(c);
    s[k] = x;
    
    cout << s << endl;
   
 
 
	
	
	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n,type) qsort(a,n,sizeof(type),cmp)
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(long long *)a-*(long long *)b;
}

int main(void){
	int n=in(),m=in(),k=in(),i,j;
	for(i=0;i<=n;++i){
		for(j=0;j<=m;++j){
			if(m*i-2*j*i+n*j==k){
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");
	return 0;
}


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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll n, h;

	cin >> n;

	vector<ll> v(n, 0);

	ll prev = -1;
	ll p = 0;

	REP(i, n) {
		cin >> h;

		if (prev >= h) {
			p++;
			v[i] += p;
		}
		else {
			p = 0;
			v[i] += p;
		}

		prev = h;
	}

	ll ans = 0;

	REP(i, n) {
		ans = max(ans, v[i]);
	}

	cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main(void)
{
  int N,K,X,Y;
  int sum;
  cin>>N>>K>>X>>Y;
  
  N>K ? sum=K*X+(N-K)*Y : sum=X*N;
  
  cout<<sum<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct chu
{
    char t[101];
}s[101];
int main()
{
      int a,b;
      while(~scanf("%d%d",&a,&b))
      {
         for(int i=1;i<=a;i++)
         {
                scanf("%s",s[i].t);
         }
         for(int j=1;j<=a;j++)
         {
             printf("%s\n",s[j].t);
             printf("%s\n",s[j].t);
         }
      }
    return 0;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};


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

int n;

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

	cin>>n;
	for(int i=n;i>0;i--) {
		double s=sqrt(i);
		if(floor(s)==ceil(s)) {
			cout<<i<<endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 256
//#include "stdafx.h"
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define e "\n"
#define MaRiaMa { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
#define fix(n) cout << fixed << setprecision(n);
using namespace std;
int main()
{
	MaRiaMa;
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	ll ru1 = a*b;
	ll ru2 = c*d;
	cout << max(ru1, ru2);
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + (ll)b) % mod
#define MUL(a, b) a = (a * (ll)b) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define rer(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<int, pi> ppi;
typedef vector<ll> vi;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest) { 
	cout << arg << " "; Debug(rest...); }
template<class T>ostream& operator<< (ostream& out, const vector<T>& v) {
	out << "[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<< ", ";out<<v.back();}out << "]";return out;}
template<class S, class T>ostream& operator<< (ostream& out, const pair<S, T>& v) {
	out << "(" << v.first << ", " << v.second << ")";return out;}
const int MAX_N = 200010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

vector<int> dep, tz;
vector<vector<int>> G;
vector<vector<int>> child;
vector<int> par;

int dfs(int v, int de = 0, int p = -1) {
	par[v] = p;
	dep[v] = de;
	ll res = 1;
	rep(i, 0, sz(G[v])) {
		int u = G[v][i];
		if(p == u) continue;
		child[v].push_back(u);
		res += dfs(u, de + 1, v);
	}
	return tz[v] = res;
}

void solve() {
	int N; cin >> N;
	dep.resize(N); tz.resize(N);
	G.resize(N);
	child.resize(N); par.resize(N);
	rep(i, 0, N - 1) {
		int a, b; cin >> a >> b; a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	dfs(0);
	int v = N - 1;
	int f = (dep[N - 1] + 2) / 2, g = (dep[N - 1] + 1) / 2;
	rep(i, 0, sz(child[N - 1])) {
		int u = child[N - 1][i];
		g += tz[u];
	}
	while(true) {
		int uv = par[v];
		if(uv == -1) break;
		ll tmp = 0;
		rep(i, 0, sz(child[uv])) {
			int u = child[uv][i];
			if(u == v) continue;
			tmp += tz[u];
		}
		if(dep[uv] > (dep[N - 1] + 2) / 2 - 1) g += tmp;
		else f += tmp;
		v = uv;
	}
	/*
	rep(i, 0, N) debug(child[i]);
	debug(dep); debug(tz);
	debug(f, g);
	*/
	if(f > g) cout << "Fennec" << "\n";
	else cout << "Snuke" << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(5);
#ifdef LOCAL
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}







Measured memory_bytes: 21760
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <iostream>
using namespace std;

int main()
{
	long long int a, b, max;

	cin >> a >> b;

	max = a + b;
	if (a - b > max)
		max = a - b;
	if (a * b > max)
		max = a * b;

	cout << max << endl;

	return 0;
}


Measured memory_bytes: 256
N, K = [int(i) for i in input().split()]
counts = [0] * N

for i in range(N):
    score = i+1
    j = 0
    while True:
        if score >= K:
            counts[i] = j
            break
        score *= 2
        j += 1
ans = sum([1 / (2 ** a) for a in counts]) / N
print(ans)


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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ":" << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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;
}

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

signed main() {
  int N;
  cin >> N;
  ;

  //ワーシャル-フロイド

  // d[from][to] は、fromとtoの間のコスト。初期値はMAX。
  vector<vector<ll>> d(N, vector<ll>(N, INF_LL));

  vector<vector<ll>> pr(N, vector<ll>(N, 0));

  //自分自身への移動はコストなし
  rep(i, N) { d[i][i] = 0; }
  rep(i, N) {
    rep(j, N) {
      cin >> d[i][j];
      pr[i][j] = d[i][j];
    }
  }

  rep(i, N) {
    rep(j, N) {
      rep(k, N) {
        if (chmin(d[j][k], d[j][i] + d[i][k])) {
          cout << -1 << endl;
          return 0;
        }
        if(d[j][k] == d[j][i]+d[i][k] && j !=i && i != k){
          pr[j][k] = 0;
        }
      }
    }
  }
  ll ans = 0;
  rep(i, N) {
    PRINT(i)
    rep(j, N) {
      PRINT(j)
      PRINT(pr[i][j]) ;
      ans += pr[i][j];
    }
  }

  cout << ans/2 << endl;

}


Measured memory_bytes: 1664
#include<iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

int prim() {
  int u, minv;
  int d[MAX], p[MAX], color[MAX];

  for ( int i = 0; i < n; i++ ) {
    d[i] = INFTY;
    p[i] = -1;
    color[i] = WHITE;
  }

  d[0] = 0;

  while ( 1 ) {
    minv = INFTY;
    u = -1;
    for ( int i = 0; i < n; i++ )
      if ( minv > d[i] && color[i] != BLACK ) {
        u = i;
        minv = d[i];
      }
    if ( u == -1 ) break;
    color[u] = BLACK;
    for ( int v = 0; v < n; v++ )
      if ( color[v] != BLACK && M[u][v] != INFTY )
        if ( d[v] > M[u][v] ) {
          d[v] = M[u][v];
          p[v] = u;
          color[v] = GRAY;
        }
  }
  int sum = 0;
  for ( int i = 0; i < n; i++ )
    if ( p[i] != -1 ) sum += M[i][p[i]];

  return sum;
}

int main() {
  cin >> n;

  for ( int i = 0; i < n; i++ )
    for ( int j = 0; j < n; j++ ) {
      int e; cin >> e;
      M[i][j] = (e == -1) ? INFTY : e;
    }

  cout << prim() << endl;

  return 0;
}


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

#define endl '\n'

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

    int n, a;
    cin >> n >> a;
    int res = n * n - a;
    if(res <= 0)
        cout << 0;
    else
        cout << res;

    return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[][] A = new int[2][N];
    for (int i = 0; i < N; i++) {
      A[0][i] = sc.nextInt();
    }
    for (int i = 0; i < N; i++) {
      A[1][i] = sc.nextInt();
    }
    int max = Integer.MIN_VALUE;
    for (int i = 0; i < N; i++) {
      int tmp = 0;
      for (int j = 0; j <= i; j++) {
        tmp += A[0][j];
      }
      tmp += A[1][i];
      for (int j = i + 1; j < N; j++) {
        tmp += A[1][j];
      }
      if (tmp > max) {
        max = tmp;
      }
    }
    System.out.println(max);
  }
}

Measured memory_bytes: 23124
n = int(input())
a = list(map(int,input().split()))

count = 0

b = []

for i in range(len(a)):
    b.append(a[i] % 2)
    
c = []

for i in range(len(a)):
    c.append(0)
    
while b == c:
    count = count + 1
    for i in range(len(a)):
        if a[i] % 2 ==1:
            break
        else:
            dd = a[i]
            a[i] = dd /2
    b.clear()
    for i in range(len(a)):
        b.append(a[i] % 2)
print(count)

Measured memory_bytes: 3064
s = input()
len_s = len(s)
ans = len_s // 2
center = ans
b = s[ans]
if len_s % 2:
  for i in range(center+1):
    if s[center-i] == s[center+i] == b:
      ans += 1
    else:
      break
else:
  for i in range(center):
    if s[center-1-i] == s[center+i] == b:
      ans += 1
    else:
      break
print(ans)
     

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

int main() {
  string s;
  int K;
  cin >> s >> K;

  vector<string> v;
  rep(i, s.size()) {
    for (int j = 1; j <= K; j++)
      v.push_back(s.substr(i, j));
  }

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

  cout << v[K - 1] << endl;
}

Measured memory_bytes: 1660
import java.io.*;
import static java.lang.Math.*;

public class Main {
  public static void main(String[] args) {
    new Main().run();
  }

  private void run() {
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out)) {

          String[] ln;
          int[] v = new int[5];
          for (int i = 0; i < 3; i++) {
            ln =  in.readLine().split(" ");
            int a = atoi(ln[0]);
            int b = atoi(ln[1]);
            v[a] += 1;
            v[b] += 1;
          }

          int res = 0;
          for (int i : v) {
            res = max(res, i);
          }
          
          String ans = res != 3 ? "YES" : "NO";
          System.out.println(ans);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }

  int  atoi(String s) { return Integer.parseInt(s); }
  long atol(String s) { return Long.parseLong(s);   }
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
#define ll long long int

using namespace std;

int main ()
{
	int a, b, c ,d;
	cin >> a >> b >> c >> d;
	if (a == 1 || a == 3 || a == 5 || a == 7 || a == 8 || a == 10 || a == 12){
		if (b == 31){
			cout << "1" << endl;
		}
		else {
			cout << "0" << endl;
		}
	}
	else if (a == 2){
		if (b == 28){
			cout << "1" << endl;
		}
		else {
			cout << "0" << endl;
		}
	}
	else {
		if (b == 30){
			cout << "1" << endl;
		}
		else {
			cout << "0" << endl;
		}
	}
}

Measured memory_bytes: 256
// Target Expert 

/*
 * Author    : raj1307 - Raj Singh
 * Institute : Jalpaiguri Government Engineering College
 * Date      : 28.07.19
 */

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <iomanip>
 #include <memory.h>
#include <assert.h>
using namespace std;

//#define DEBUG
#ifdef DEBUG
#define deb(...) cerr<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
#define debarr(a,n) cerr<<#a<<" : ";for(int i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define debmat(mat,row,col) cerr<<#mat<<" :\n";for(int i=0;i<row;i++) {for(int j=0;j<col;j++) cerr<<mat[i][j]<<" ";cerr<<endl;}
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cerr<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	const char *comma=strchr(names+1,',');
	cerr.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}

#else
#define deb(...) {}
#define debarr(a,n) {}
#define debmat(mat,row,col) {}
#define endl "\n"
#endif

#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define fr(i, a, b) for(int i = (a); i < (b); ++i)
#define fb(i, b, a) for(int i = (b); i > (a); --i)
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#define int long long
#define pb push_back
#define sz(x) ((int)x.size())
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a>b) return b; else return a;}

const int mod = 1000*1000*1000+7;

int powm(int a, int b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}


const int N = 1e5 + 5;

int n,k;

int cache[N];
int h[N];

int dp(int cur){

	if(cur>=n)
		return 1e15;

	else if(cur==n-1)
		return 0;
	else if(cache[cur]!=-1)
		return cache[cur];
	else{

		int ans;
		ans=min(abs(h[cur]-h[cur+1])+dp(cur+1),abs(h[cur]-h[cur+2])+dp(cur+2));
		cache[cur]=ans;
		return ans;






	}

	












}








void solve(){


	cin>>n;
	fr(i,0,n) cin>>h[i];
	

	memset(cache,-1,sizeof(cache));

	int ans;

	ans=min(abs(h[1]-h[0])+dp(1),abs(h[2]-h[0])+dp(2));
	
	cout<<ans;






	
	

}




signed main() {
	fio;
	
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	while(t--) {
		solve();
	}

	
	return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
int main() {
    string s; cin >> s;
    string t; t += s[0];
    t += s[1];
    t += s[2];
    t += s[3];
    int tt = stoi(t);
    if (tt <= 2018) {
        cout << "Heisei" << endl;
        return 0;
    } else if (tt >= 2020) {
        cout << "TBD" << endl;
        return 0;
    }
    t = "";
    if (s[5] != '0') t += s[5];
    t += s[6];
    tt = stoi(t);
    if (tt <= 4) {
        cout << "Heisei" << endl;
    } else {
        cout << "TBD" << endl;
    }
    
}




Measured memory_bytes: 256
#include<cstdio>
int n,a,b[200000];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a);
		while(a%2==0&&b[i]<2)a/=2,b[i]++;
	}
	int c[3]={0,0,0};
	for(int i=1;i<=n;i++)c[b[i]]++;
	c[1]&=1;
	puts(c[0]+c[1]>1+c[2]?"No":"Yes");
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5 + 5;
const ll mo = 998244353;
const int M = 100+50;
int main(){
	int h,w;
	cin>>h>>w;
	int n,m;
	cin>>n>>m;
	cout<<(h-n)*(w-m)<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

using P = pair<int, int>;

int main() {
  int N;
  while (cin >> N) {
    map<int, int> m0, m1;
    for (int i = 0; i < N; i++) {
      int x;
      cin >> x;
      if (i % 2 == 0) {
        ++m0[x];
      } else {
        ++m1[x];
      }
    }
    vector<P> a0, a1;
    for (auto& e : m0) a0.emplace_back(e.snd, e.fst);
    for (auto& e : m1) a1.emplace_back(e.snd, e.fst);
    a0.emplace_back(0, -1);
    a1.emplace_back(0, -2);
    sort(a0.rbegin(), a0.rend());
    sort(a1.rbegin(), a1.rend());
    int res = N;
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 2; j++) {
        if (a0[i].snd == a1[j].snd) continue;
        res = min(res, N - a0[i].fst - a1[j].fst);
      }
    }
    cout << res << endl;
  }
  return 0;
}


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

int main(void){
	int a,b,c,d;
	char str[10];
	cin >> str;
	a = str[0]-'0';
	b = str[1]-'0';
	c = str[2]-'0';
	d = str[3]-'0';
	if(a+b+c+d==7){
		printf("%d+%d+%d+%d=7\n",a,b,c,d);
	}else if(a+b+c-d==7){
		printf("%d+%d+%d-%d=7\n",a,b,c,d);
	}else if(a+b-c+d==7){
		printf("%d+%d-%d+%d=7\n",a,b,c,d);
	}else if(a+b-c-d==7){
		printf("%d+%d-%d-%d=7\n",a,b,c,d);
	}else if(a-b+c+d==7){
		printf("%d-%d+%d+%d=7\n",a,b,c,d);
	}else if(a-b+c-d==7){
		printf("%d-%d+%d-%d=7\n",a,b,c,d);
	}else if(a-b-c+d==7){
		printf("%d-%d-%d+%d=7\n",a,b,c,d);
	}else if(a-b-c-d==7){
		printf("%d-%d-%d-%d=7\n",a,b,c,d);
	}
	return 0;
}

Measured memory_bytes: 256
//by shubham_bitsg

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector <string> vs;

//#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define forl(i,a,b) for (int i = a; i < b; i++)
#define rfor(i,b,a) for (int i = b; i >= a; i--)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define srt(x) sort(x.begin(), x.end())
#define sumup(x) accumulate(x.begin(), x.end(), 0)
#define PI 3.141592653589793238

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin>>n;
    vi a(n);
    vi b(n);
    int xo = 0;
    forl(i,0,n) {
        cin>>a[i];
        xo ^= a[i];
    }
    forl(i,0,n) {
        b[i] = xo^a[i];
        cout<<b[i]<<" ";
    }    
}

Measured memory_bytes: 4704
#pragma GCC optimize ("O3")
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <utility>
#include <bitset>
#include <cstdio>

using namespace std;
using namespace std::placeholders;

// namespace { struct NoSync { NoSync() { cin.tie(0); ios::sync_with_stdio(false); } } nosync; }

using ll = long long;
#define float double

constexpr ll INF = 999999999;
constexpr ll MOD = 1e9 + 7;

#define y0 Y0
#define y1 Y1
#define j0 J0
#define j1 J1
#define prev PREV
#define next NEXT

#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i##_len = (n), i = (i##_len) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define permutations(v) sort(all(v));for(bool v##p = true; v##p; v##p=next_permutation(all(v)))
#define UNIQUE(v) (v).erase(unique(all(v)), (v).end())
#define REMOVE(v) (v).erase(remove(all(v)), (v).end())
#define ROTATE(v, n) rotate((v).begin(), (v).begin() + (n), (v).end())
#define TO_SUMS(v) partial_sum(all(v), (v).begin())
#define SUMS(srcv, dstv) partial_sum(all(srcv), (dstv).begin())
#define nth_bit(n) (1LL<<(n))

template <typename T> T high()  { return numeric_limits<T>::max(); }
template <typename T> T high(T) { return numeric_limits<T>::max(); }
template <typename T> T low()   { return numeric_limits<T>::lowest(); }
template <typename T> T low(T)  { return numeric_limits<T>::lowest(); }

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

// f には functional のオブジェクトが便利 (lambda 式も   [](int a){ return a / 2 }   みたいな)
template<class C, class F> inline C mapped(const C& c, F f){// mapっていうSTLがあるから...
    // ex: mapped(v, bind(plus<ll>(), _1, 2))   [v の各要素について x + 2]
    C r; r.reserve(c.size()); transform(all(c), back_inserter(r), f); return r;
}
template<class C, class F> inline C filtered(const C& c, F f){
    // ex: filtered(v, bind(equal_to<ll>(), bind(modulus<ll>(), _1, 2), 0)   [x mod 2 == 0 な x を取ってくる]
    C r; copy_if(all(c), back_inserter(r), f); return r;
}
template<class C, class I, class F> inline typename C::value_type foldl(const C& c, I i, F f){
    // ex: foldl(v, 1, multiplies<int>())   [v の総乗]
    return accumulate(all(c), static_cast<typename C::value_type>(i), f);
}


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

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

    return 0;
}



Measured memory_bytes: 3068
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18

long n, a, b;
long ans;

int main(){
    scanf("%ld%ld%ld", &n, &a, &b);
    ans += n / (a + b) * a;
    ans += std::min(n % (a+b), a);
    printf("%ld\n", ans);
}


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

int main(void)
{
    int n;
    cin >> n;
    if (n < 2) cout << 1 << endl;
    else if (n < 4) cout << 2 << endl;
    else if (n < 8) cout << 4 << endl;
    else if (n < 16) cout << 8 << endl;
    else if (n < 32) cout << 16 << endl;
    else if (n < 64) cout << 32 << endl;
    else if (n <= 100) cout << 64 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    int A, B, K;
    cin >> A >> B >> K;
    if (A - 1 + K < B + 1 - K) {
        for (int i = 0; i < K; i++) {
            cout << A + i << endl;
        }
        for (int i = 0; i < K; i++) {
            cout << B + 1 - K + i << endl;
        }
    } else {
        for (int i = A; i <= B; i++) {
            cout << i << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  Test
//
//  Created by Nag on 2017/08/18.
//  Copyright ?? 2017??´ Nag. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>

using namespace std;

int main(void) {
    int m, f, r;
    char grade = '\0';
    
    cin >> m >> f >> r;
    while( !(m==-1 && f==-1 && r==-1) ) {
        if( m==-1 || f==-1 ) grade = 'F';
        else if( m+f >= 80 ) grade = 'A';
        else if( m+f >= 65 ) grade = 'B';
        else if( m+f >= 50 ) grade = 'C';
        else if( m+f >= 30 && r >= 50 ) grade = 'C';
        else if( m+f >= 30 && r < 50 ) grade = 'D';
        else if( m+f < 30) grade = 'F';
        
        cout << grade << endl;
        
        cin >> m >> f >> r;
    }
    
    return 0;
}

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

int main()
{
  int A, B;

  cin >> A >> B;

  for (int i = 1; i < 1250; i++)
  {
    if (((int)(i * 0.08) == A) && ((int)(i * 0.10) == B))
    {
      cout << i << endl;
      return 0;
    }
  }

  cout << -1 << endl;
}


Measured memory_bytes: 3592
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    string s; cin >> s;
    int len = s.size();
    bool fg = false;
    if(s.substr(0, 7) == "keyence") fg = true;
    else if(s.substr(len-7, 7) == "keyence")fg = true;
    else if(s.substr(0, 1) == "k" && s.substr(len-6, 6) == "eyence") fg = true;
    else if(s.substr(0, 2) == "ke" && s.substr(len-5, 5) == "eyence") fg = true;
    else if(s.substr(0, 3) == "key" && s.substr(len-4, 4) == "ence") fg = true;
    else if(s.substr(0, 4) == "keye" && s.substr(len-3, 3) == "nce") fg = true; 
    else if(s.substr(0, 5) == "keyen" && s.substr(len-2, 2) == "ce") fg = true;
    else if(s.substr(0, 6) == "keyenc" && s.substr(len-1, 1) == "e") fg = true;  
    if(fg) cout << "YES" << ln;
    else cout << "NO" << ln; 
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
//#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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; }

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(void){

  string s;

  cin>>s;

  ll ans=0;
  ll tmp_a=0;
  //cout << s.size() << endl;
  rep(i,s.size()){  
    if(s[i] == 'A' || s[i] == 'T' || s[i] == 'C' || s[i] == 'G' ){
      tmp_a++;
    }
    else{
      tmp_a=0;
    }
    //cout << tmp_a << endl;
    if(ans < tmp_a){
      ans=tmp_a;
    }
  }

  cout << ans << endl;

  return 0;

}


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

int main() {
    int c,b;
    cin >> c >> b;
    int a[] = {0,1,3,1,2,1,2,1,1,2,1,2,1};
    if(a[c]==a[b]){
        cout << "Yes" << endl;
    }else{
        cout << "No" <<endl;
    }

    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
def linput():
    return list(map(int, input().split()))

def main():
    N = int(input())
    # N,M = linput()
    vA = [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]
    # vA = linput()
    # S = input()
    # mX = [linput() for _ in [0,]*N]

    # res = 0
    # res = -(-N//M)
    res = vA[N-1]

    print(res)

main()


Measured memory_bytes: 3060
// This file is a "Hello, world!" in Java language by OpenJDK for wandbox.
import java.util.*;
import java.io.*;
import java.math.BigInteger;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		long X = sc.nextLong();
		System.out.println(BigInteger.valueOf(X-1).nextProbablePrime());
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

// OpenJDK reference:
//   http://openjdk.java.net/

// Java language references:
//   http://docs.oracle.com/javase


Measured memory_bytes: 21972
#include <iostream>

int main()
{
    int H, W;

    while(std::cin >> H >> W) {
        long long int** arr;
        arr = new long long int* [H+1];
        for(int i = 0; i <= H; i++)
            arr[i] = new long long int [W+1];
        // long long int arr[H+1][W+1];
        // char map[H][W];
        char tmp;
        for(int i = 0; i < H; i++) {
            for(int j = 0; j < W; j++) {
                std::cin >> tmp;
                // std::cout << "a " << tmp << " ";
                if (tmp == '#')
                    arr[i+1][j+1] = 0;
                else
                    arr[i+1][j+1] = -1;
            }
        }
        for(int i = 1; i <= H; i++)
            arr[i][0] = 0;

        for(int i = 1; i <= W; i++)
            arr[0][i] = 0;

        arr[1][1] = 1;

        for(int i = 1; i <= H; i++) {
            for(int j = 1; j <= W; j++) {
                if (arr[i][j] == 0 || (i == 1 && j == 1)) {
                    // std::cout << arr[i][j] << " ";
                    continue;
                }
                arr[i][j] = (arr[i-1][j] + arr[i][j-1]) % 1000000007;
                // std:: cout << arr[i][j] << " ";
            }
            // std::cout << std::endl;
        }
        
        std::cout << arr[H][W] << std::endl;
    }



    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
    const int MAX =200002;
const int MOD = 1000000007;

     signed main(){
   int n;
   cin>>n;
   string s;
   cin>>s;
   int a=0;
   for(int i=0;i<n;i++)if(s[i]=='R')a++;
   int ans=0;
   for(int i=0;i<a;i++)if(s[i]=='W')ans++;
   cout<<ans<<endl;
     }


 


 






    





      

        


Measured memory_bytes: 3716
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

typedef long long ll;

using namespace std;

int main(int argc, const char * argv[]) {
  ll N;
  cin >> N;
  ll i;
  for(i=1;i<N;i++){
    if(i*i>N) break;
  }
  ll n = i-1;
  for(i = n; i>0;i--){
    if(N%i==0){
      cout << i + N/i - 2;
            return 0;
    }
  }
}

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

int main() {
 int N;
 cin >> N;
 vector<int> number(N-1);
  for(int i = 0; i < N-1; i++){
    cin >> number.at(i);
  }
 vector<int> buka(N,0);
  for(int i = 0; i < N-1; i++){
    buka[number[i]-1]++; 
  }
  for(int i = 0; i < N; i++){
    cout << buka[i] << endl;
  }
}


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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/c.in", "r", stdin);
//  freopen("../IO/c.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}


void solve(std::istream &in, std::ostream &out) {
  int n;
  in >> n;
  vector<int> a(n);
  for (int &i : a) {
    in >> i;
  }
  sort(a.rbegin(), a.rend());
  int64_t sum = 0;
  for (int i = 1; i < n; ++i) {
    sum += a[i / 2];
  }
  out << sum << '\n';
}

Measured memory_bytes: 3976
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)

lli n;
 
bool judge(lli a,lli b,lli c,lli d,lli i){
	lli target = b-a;
	lli plus = i;
	lli minus = n-i-1;
	if(c*plus - minus*d <= target && target <= d*plus - c*minus)return true;
	else return false;
}

signed main(){

	lli a,b,c,d;
	cin>>n>>a>>b>>c>>d;

	for(lli i=0;i<n;i++){
		if(judge(a,b,c,d,i)){
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int n,m;
    int seki;
    int i,j;
    int mata[100][100] = {};
    int matb[100][100] = {};
    scanf("%d %d",&n,&m);
    i = 0;
    j = 0;
    seki = 0;
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&mata[i][j]);
        }
    }
    for(j=0;j<m;j++){
        scanf("%d",&matb[0][j]);
    }

    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            seki = mata[i][j] * matb[0][j] + seki;
        }
            printf("%d\n",seki);
            seki = 0;
    }
    return(0);
}

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

int main(){
  int n;
  cin >>n;
  vector<int> v(n);
  rep(i,n) cin >>v[i];
  vector<int> c(n);
  rep(i,n) cin >>c[i];
  int ans = 0;
  rep(i,n){
    if(v[i]>c[i]){
      ans += v[i]-c[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int n;
    while (cin >> n) {
        if (n == 0) break;
        int ys[7];
        for (int i = 0; i < 7; i++) ys[i] = 0;
        for (int i = 0; i < n; i++) {
            int y; cin >> y;
            if (0  <= y && y <=  9) ys[0]++;
            if (10 <= y && y <= 19) ys[1]++;
            if (20 <= y && y <= 29) ys[2]++;
            if (30 <= y && y <= 39) ys[3]++;
            if (40 <= y && y <= 49) ys[4]++;
            if (50 <= y && y <= 59) ys[5]++;
            if (60 <= y)            ys[6]++;
        }
        for (int i = 0; i < 7; i++) {
            cout << ys[i] << endl;
        }
    }
    return 0;
}

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

int main() {
  int N, P; cin >> N >> P;
  string S; cin >> S;
  if (10 % P == 0) {
    long long ans = 0;
    for (int i = 0; i < N; i++) {
      if ((S.at(i) - '0') % P == 0) ans += i+1;
    }
    cout << ans << endl;
    return 0;
  }
  vector<int> A(N+1, 0);
  int ten = 1;
  for (int i = N-1; i >= 0; i--) {
    int tmp = (S.at(i) - '0') * ten % P;
    A.at(i) = (A.at(i+1) + tmp) % P;
    ten *= 10;
    ten %= P;
  }
  vector<int> cnt(P);
  long long ans = 0;
  for (int i = N; i >= 0; i--) {
    ans += cnt.at(A.at(i));
    cnt.at(A.at(i))++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1412