akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define reps(i, a, n) for (int i = (a); i < (n); ++i)
#define rep(i, n) reps(i, 0, n)
#define deps(i, a, n) for (int i = (a); i >= (n); --i)
#define dep(i, n) deps(i, n, 0)
#define inf 2147483647
#define int long long

int m[10000];

signed main(void)
{
	int n, m, ans = 0; cin >> n;
	for (int i = 2, m = n; i*i <= m; i++)
	{
		int j = i;
		while (n % j == 0) ans++, n /= j, j *= i;
		while (n % i == 0) n /= i;
	}
	cout << ans + (n != 1) << endl;
}


Measured memory_bytes: 3616
#include <stdio.h>

#define MAX 100
#define WHITE 0
#define BLACK 1
#define GRAY 2

void dfs();
void visit(int);

int num, time;
int graph[MAX][MAX];
int d[MAX];
int f[MAX];
int color[MAX];


int main(){

  int i, j, inum, jnum, line;

  scanf("%d", &num);

  for(i = 0; i < num; i++){

    for(j = 0; j < num; j++){

      graph[i][j] = 0;

    }

    scanf("%d %d", &inum, &jnum);

    for(j = 0; j < jnum; j++){

      scanf("%d", &line);

      graph[inum - 1][line - 1] = 1;

    }

  }

  dfs();
  
  for(i = 0; i < num; i++){

    printf("%d %d %d\n", (i + 1), d[i], f[i]);

  }

  return 0;

}

void dfs(){

  int u, k;

  for(u = 0; u < num; u++){
   
    color[u] = WHITE;
 
  }

  time = 0;

  for(u = 0; u < num; u++){
      
    if(color[u] == WHITE)
      visit(u);

  }
  
}

void visit(int u){
  
  int v;

  color[u] = GRAY;

  d[u] = ++time;

  for(v = 0; v < num; v++){

    if(graph[u][v] == 0)
      continue;

    if(color[v] == WHITE)
      visit(v);

  }

  color[u] = BLACK;

  f[u] = ++time;

}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
using VVI = vector<vector<int>>;
using VI  = vector<int>;
const static string el = "\n";

int main()
{
  char a;
  cin >> a;
  int n = a - 'Z';
  if (n > 0) {
    cout << 'a' << el;
  } else {
    cout << 'A' << el;
  }
  return 0;
}

Measured memory_bytes: 3612
def examA():
    S = SI()
    if S=="ARC":
        ans = "ABC"
    else:
        ans = "ARC"
    print(ans)
    return

def examB():
    N, K = LI()
    snuke = set(range(1,N+1))
    for _ in range(K):
        d = I()
        A = LI()
        for a in A:
            snuke.discard(a)
    ans = len(snuke)
    print(ans)
    return

def examC():
    N, M = LI()
    H = LI()
    good = set(range(1,N+1))
    for _ in range(M):
        a, b = LI()
        if H[a-1]>=H[b-1]:
            good.discard(b)
        if H[b-1]>=H[a-1]:
            good.discard(a)
    ans = len(good)
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int,readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 23524
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define fi first
#define se second

const int N = 4007;

int a, b, n, ans[N];
stack <int> st;
string s;

int ask(int x, int y){
	int ret = 0;
	#ifndef Dat
		x--, y--;
		cout << "? " << x << " " << y << endl;
		cin >> s;
		if(s[0] == 'Y') ret = 1;
		else ret = 0;
	#endif // Dat
	#ifdef Dat
		if(s[x - 1] == '1') ret = s[y - 1] - '0';
		else{
			ret = rand() % 2;
		}
	#endif // Dat
	return ret;
}

int main(){
	ios_base::sync_with_stdio(0);
	srand(time(NULL));
	cin >> a >> b;
	#ifdef Dat
		cin >> s;
	#endif // Dat
	if(a <= b) return cout << "Impossible" << endl, 0;
	n = a + b;
	for(int i = 1; i <= n; i++){
		if(st.empty()){
			st.push(i);
			continue;
		}
		int p = ask(st.top(), i);
		if(!p){
			st.pop();
		}
		else{
			st.push(i);
		}
	}
	int pos = st.top();
	for(int i = 1; i <= n; i++){
		ans[i] = ask(pos, i);
	}
	cout << "! ";
	for(int i = 1; i <= n; i++) cout << ans[i];
	cout << endl;
}


Measured memory_bytes: 724
#include <iostream>
#include <string>
#include <set>
#include <cstring>
using namespace std;
 
#define REP(i,x,n) for(int i = x; i < (int)(n); i++)
#define rep(i,n) REP(i,0,n)
 
static const int dx[] = {-1,-1,-1,0,0,1,1,1};
static const int dy[] = {-1,0,1,-1,1,-1,0,1};
 
int h,w;
char D[10][20];
set<string> spell;
 
string solve(){
  spell.clear();
  string ret = "0";
   
  rep(i,h) rep(j,w){
    int sx = i;
    int sy = j;
    rep(k,8){
      int x = i;
      int y = j;
      string tmp;
      tmp += D[x][y];
       
      while(true){
        x = (x + h + dx[k]) % h;
        y = (y + w + dy[k]) % w;
        if(x == sx && y == sy) break;
         
        tmp += D[x][y];
        if(spell.find(tmp) != spell.end()){
          if(ret.size() == tmp.size()) ret = (ret < tmp) ? ret : tmp;
          else ret = (ret.size() < tmp.size()) ? tmp : ret;
        }
        else spell.insert(tmp);
      }
    } 
  }
   
  return ret;
}
 
int main(){
  while(cin >> h >> w && (h | w)){
    rep(i,h) rep(j,w){
      cin >> D[i][j];
    }
    cout << solve() << endl;
  }
  return 0;
}

Measured memory_bytes: 33744
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int a[100];

int main()
{
	int n;
	ll ans=0;
	ll minc=1e15-1;
	
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	
	for(int i=-100;i<101;i++)
	{
		ll cost=0;
		for(int j=0;j<n;j++)
		{
			cost+=(i-a[j])*(i-a[j]);
		}
		if(cost<minc)
		{
			minc=cost;
			ans=a[i];
		}
	}
	cout<<minc<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h> 
#include <math.h>
#define pi 3.1415926535897932384626433832795028841971693
int main() {
  int a,b,h,m;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&h);
  scanf("%d",&m);
  long double theta = fabsl(h*60-11*m)/360;
  long double L;
  if (theta<=pi) L = sqrt(a*a+b*b-2*a*b*cos(theta*pi));
  else L = sqrt(a*a+b*b+2*a*b*cos(theta*pi));
  printf("%.10Lf\n",L);
  return 0;
}

Measured memory_bytes: 2600
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define mp make_pair
using namespace std;
int main(){
	string s;
	cin>>s;
	vector<pair<int,int> > e;
	int n=s.size();
	if(s[n-1]=='1'){
		cout<<-1<<endl;
		return 0;
	}
	if(s[0]=='0'){
		cout<<-1<<endl;
		return 0;
	}
	if(s[n-2]=='0'){
		cout<<-1<<endl;
		return 0;
	}
	int cc = 2, cp = 3;
	e.pb(mp(1,2));
	for(int i=2;i<=n-1;i++){
		if(s[i-1] != s[n-i-1]){
			cout<<-1<<endl;
			return 0;
		}
		if(s[i-1]=='0'){
			e.pb(mp(cc,cp));
			cp++;
		}
		else{
			e.pb(mp(cc,cp));
			cc = cp;
			cp++;
		}
	}
	for(int i=0;i<e.size();i++){
		cout<<e[i].first<<" "<<e[i].second<<endl;
	}
	return 0;
}

Measured memory_bytes: 2420
#include <iostream>
using namespace std;
int INF = 10000000;
int N;
int A[210];
int main(){
  cin >> N;
  for(int i = 0; i < N; ++i) cin >> A[i];
  int res = INF;
  for(int i = 0; i < N; ++i){
    int sum = 0;
    while(A[i]%2 == 0){
      A[i] /= 2;
      ++sum;
    }
    if(res > sum) res = sum;
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

int main(int argc, char const *argv[])
{
    int N,L;
    std::cin >> N >> L;
    std::vector <std::string> strings(N);
    for(int i = 0 ; i < N ; ++i){
        std::cin >> strings[i];
    }
    std::sort(strings.begin(), strings.end());
    for(int i = 0 ; i < N ; ++i){
        std::cout << strings[i];
    }
    return 0;
}


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

int main(void){
  long n,ans,minimum;
  vector<long> a(5);
  cin >> n;
  for(int i = 0; i < 5; i++)cin >> a[i];
  minimum = *min_element(a.begin(),a.end());
  ans = n / minimum;
  if(n % minimum != 0)ans++;
  ans += 4;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl; 



int main(){
    int a,b;
    cin >> a >> b;
    if(a==1) a=100;
    if(b==1) b=100;
    if(a < b) print("Bob");
    if( a > b) print("Alice");
    if(a==b) print("Draw");
}

Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

string f(int i){ 
	string h; 
	cout << i << endl; 
	cin>>h; 
	if ( h == "Vacant" ) exit(0); 
	return h; 
} 

inline void solve(){
    int  n, c=0; cin >> n ; 
    string  L = f(0); 
    int  l=0, r=n-1, m ; 
    while (l<=r){ 
    	string h = f(m = (l+r)/2) ; 
    	if ( ((m-l) % 2 ==0 and h != L) or ( (m-l) % 2 == 1 and h == L) )  r = m ; 
    	else  l = m ,L = h; 
    	if (r-l<=2)
    		for (int i=l;i<=r;i++) f(i); 
    } 
    // 1 0 1 0 _ 1 0
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3860
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#define int long long
#define INF 1000000007
using namespace std;
signed main(){
    string n;
    cin>>n;
     if(n[0]==n[1]||n[1]==n[2]||n[2]==n[3]){
cout<<"Bad"<<endl;
}else{
cout<<"Good"<<endl;
}
    return 0;
}




Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

N,K = map(int,readline().split())
LR = [tuple(map(int,readline().split())) for i in range(K)]
DIV = 998244353
dp = [0] * (N + 1)
dp[1] = 1
sdp = [0] * (N + 1)
sdp[1] = 1

for i in range(2, N + 1):
  for j in range(K):
    l_ind = i - LR[j][1] - 1
    r_ind = i - LR[j][0]
    if r_ind < 0:
      continue
    dp[i] += sdp[r_ind]
    if l_ind >= 0:
      dp[i] -= sdp[l_ind]
    dp[i] %= DIV
  sdp[i] = sdp[i - 1] + dp[i]
  sdp[i] %= DIV
  
print(dp[N])

Measured memory_bytes: 77024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a%b!=0)
	{
		cout<<a/b+1<<endl;
		return 0;
	}
	else
	cout<<a/b<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.awt.*;

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

    String s = sc.next();
    String t = sc.next();

    String ans = "Yes";

    for (char a = 'a'; a <= 'z'; a++) {
      char s_tmp = 'A';

      for (int i = 0; i < s.length(); i++) {
        if (s.charAt(i) == a) {
          if (s_tmp == 'A') {
            s_tmp = t.charAt(i);
          } else if (s_tmp == t.charAt(i)) {
            continue;
          } else {
            ans = "No";
            break;
          }
        }
      }

      char t_tmp = 'A';

      for (int i = 0; i < s.length(); i++) {
        if (t.charAt(i) == a) {
          if (t_tmp == 'A') {
            t_tmp = s.charAt(i);
          } else if (t_tmp == s.charAt(i)) {
            continue;
          } else {
            ans = "No";
            break;
          }
        }
      }
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 26244
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	int N;
	int[] r;
	double[] x;

	public void solve() {
		N = nextInt();
		r = new int[N];
		for(int i = 0;i < N;i++){
			r[i] = nextInt();
		}

		x = new double[N];

		for(int i = 0;i < N;i++){
			double max = r[i];
			for(int j = i - 1;j >= 0;j--){
				double a = r[i] - r[j];
				double b = r[i] + r[j];
				max = Math.max(max,x[j] + Math.sqrt(b * b - a * a));
			}
			x[i] = max;
		}
		double ans = 0;
		for(int i = 0;i < N;i++){
			ans = Math.max(ans,r[i] + x[i]);
		}
		out.println(String.format("%.08f",ans));
	}
	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	int l[1010], r[1010];
	int ans = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> l[i] >> r[i];
		ans += r[i] - l[i] + 1;
	}
	cout << ans << endl;
}

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

#define fastIO ios::sync_with_stdio(false);cout.tie(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define MP make_pair
#define inf INT_MAX
#define minf INT_MIN

typedef long long int lli;

ofstream outfile;
ifstream infile;

vector <int> leader;

int findleader(int a)
{
    if( a == leader[a])
        return a;

    leader[a] = findleader(leader[a]);
    return leader[a];
}
int main()
{
    infile.open("input.txt");
    outfile.open("output.txt");

    fastIO;
    int n, u, v, i, j, t1, t2;

    vector <pair <int, pair <int, int>> > storage;
    vector <bool> visited;
    vector <pair <int, int>> xcoords, ycoords;


    cin >> n;
    xcoords.pb(MP(0, 0));
    ycoords.pb(MP(0, 0));
    visited.pb(0);
    leader.pb(0);
    for(i = 1; i <= n; ++i)
    {
        cin >> u >> v;
        xcoords.pb(MP(u, i));
        ycoords.pb(MP(v, i));
        visited.pb(0);
        leader.pb(0);
    }

    sort(xcoords.begin(), xcoords.end());
    sort(ycoords.begin(), ycoords.end());

    for(i = 2; i < xcoords.size(); ++i)
    {
        storage.pb( MP ( xcoords[i].fi-xcoords[i-1].fi, MP(xcoords[i-1].se, xcoords[i].se) ));
        storage.pb( MP ( ycoords[i].fi-ycoords[i-1].fi, MP(ycoords[i-1].se, ycoords[i].se) ));
    }
    sort(storage.begin(), storage.end());

    long long sum =0;
    for(i = 0; i < storage.size(); ++i)
    {

        u = storage[i].se.fi;
        v = storage[i].se.se;
        if( !leader[u])
        {
            if( !leader[v] )
            {
                leader[u] = v;
                leader[v] = v;
            }
            else
            {
                leader[u] = v;
            }
            sum += storage[i].fi;
        }
        else if( !leader[v])
        {
            leader[v] = u;
            sum += storage[i].fi;
        }
        else
        {
            t1 = findleader(u);
            t2 = findleader(v);
            if( t1 != t2)
            {
                leader[t1] = t2;
                sum += storage[i].fi;
            }
        }
    }
    cout << sum ;

}


Measured memory_bytes: 7716
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<int, int> P;

//local変数のサイズ
int dp1[3010][3010] = {0};
int dp2[3010][3010] = {0};
int main()
{
    int n,t;
    cin >> n >> t;
    vector<P> ab;
    ab.push_back(P(0, 0)); //ラベル調整
    rep(i, n){ int tmp, tmp2; cin >> tmp >> tmp2; ab.push_back(P(tmp, tmp2));}

    //dp1 dp[i][j]: i番目の荷物までを用いて時間jまでに抑える

    rep1(i, n)rep1(j, t){
        if (j >= ab[i].first){
            dp1[i][j] = max(dp1[i-1][j], dp1[i-1][j - ab[i].first] + ab[i].second);
        } else {
            dp1[i][j] = dp1[i-1][j];
        }
    }

    //dp2 dp[i][j]: i~N番目の荷物までを用いて時間jまでに抑える

    for (int i = n; i >= 1; i--)
    {
        for (int j = 1; j <= t; j++)
        {
            if (j >= ab[i].first){
                dp2[i][j] = max(dp2[i+1][j], dp2[i+1][j - ab[i].first] + ab[i].second);
            } else {
                dp2[i][j] = dp2[i+1][j];
            }
        }
    }
    int ans = 0;
    rep1(i, n)rep1(j, t-1){
        //cout << dp1[i-1][j] << ":" << dp2[i+1][t-1-j] << ":" << ab[i].second << "::";
        //cout << dp1[i-1][j] + dp2[i+1][t-1-j] + ab[i].second << ":" << i <<":" <<j<<endl;
        ans = max(ans, dp1[i-1][j] + dp2[i+1][t-1-j] + ab[i].second);
    }
    cout << ans << endl;
}


Measured memory_bytes: 70912
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define INF 1000000000000
using namespace std;
using ll=long long;
using ld=long double;
using vs=vector<string>;


int main() {
    string s;
    int tmp_sum=0;
    int max_sum=0;
    cin>>s;
    rep(i,3){
        if(s[i]=='R'){
            tmp_sum++;
            max_sum=max(max_sum,tmp_sum);
        }
        else{
            tmp_sum=0;
        }
    }
    cout<<max_sum;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define pb  push_back
#define mod 1000000007
#define INF 1e18
#define MAX 1000007
typedef  long long ll;
int prime[MAX];
int main()
{
	
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	// memset(prime,1,sizeof(prime));
	for (int i = 0; i < MAX; ++i)
		prime[i]=1;
	// cout<<prime[0]<<" ";
	for (int i = 2; i < MAX; ++i)
	{
		for (int j = i; j <MAX ; j+=i)
		{
			prime[j]++;
		}
	}
	int n;
	cin>>n;
	ll ans=0;
	for (int i = 1; i <n; ++i)
	{
		ans+=prime[n-i];
	}
	cout<<ans;
	return 0;
}

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

int main(){
  int N;
  cin>>N;
  string S;
  cin >> S;
  
  int ans=0;
  for(int i=0; i<N-2; i++){
    if(S[i]=='A' &&S[i+1]=='B' && S[i+2]=='C'){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	string s;
	int n, k;
	cin >> n >> k >> s;
	k--;
	if (s[k] == 'A'){ s[k] = 'a'; }
	else if (s[k] == 'B'){ s[k] = 'b'; }
	else if (s[k] == 'C'){ s[k] = 'c'; }
	cout << s << endl;

	system("pause");
	return 0;
}


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

int main () {
  int residents[4][3][10]={ 0 };
  int n,b,f,r,v,buildings=4,floors=3,rooms=10;
  cin >> n;
  for (int i=0;i<n;++i) {
    cin >> b >> f >> r >> v;
	residents[b-1][f-1][r-1] = residents[b-1][f-1][r-1] + v;
  }

  for (int j=0;j<buildings;++j) {
    for (int k=0;k<floors;++k) {
	  for (int l=0;l<rooms;++l) {
	  cout << " " << residents[j][k][l];
      }
	  cout << endl;
    }
	if (j != buildings-1)cout << "####################" << endl;
  }
  return 0;
}

Measured memory_bytes: 2992
#include <algorithm>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<ll, ll> P;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define all(c) c.begin(), c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

int main() {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    vector<string> sl = {s1, s2, s3};

    rep(i, 3) { cout << toupper(sl[i][0], locale::classic()); }

    return 0;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
	N = INT()
	ab = [LIST() for _ in range(N-1)]

	graph = defaultdict(list)

	# edge = [[0]*N for _ in range(N)]
	edge = defaultdict(int)
	for a, b in ab:
		graph[a-1].append(b-1)
		graph[b-1].append(a-1)

	K = 0
	for v in graph.values():
		K = max(K, len(v))
	color = list(range(1, K+1))

	q = deque()
	q.append((0, None))

	while q:
		i, color_from = q.popleft()
		tmp = -1
		for node in graph[i]:
			str_ = "{},{}".format(i, node)
			if not edge[str_]:
				use_color = color[tmp]
				if use_color == color_from:
					use_color = color[tmp-1]
					tmp -= 1
				tmp -= 1
				edge[str_] = use_color
				edge["{},{}".format(node, i)] = use_color
				q.append((node, use_color))
	print(K)
	for a, b in ab:
		print(edge["{},{}".format(a-1, b-1)])


if __name__ == "__main__":
	main()


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

using int64 = long long;

int64 SolveCore(int64 h, int64 w) {
  if (h % 3 == 0)
    return 0;
  int64 r = w;
  int64 a[] = {(h / 3) * w, (h - h / 3) * (w / 2), (h - h / 3) * (w - w / 2)};
  sort(a, a + 3);
  r = min(r, a[2] - a[0]);
  int64 b[] = {(h / 3 + 1) * w, (h - h / 3 - 1) * (w / 2), (h - h / 3 - 1) * (w - w / 2)};
  sort(b, b + 3);
  return min(r, b[2] - b[0]);
}

int64 Solve(int64 h, int64 w) {
  return min(SolveCore(h, w), SolveCore(w, h));
}

int main() {
  int64 h, w;
  cin >> h >> w;
  cout << Solve(h, w) << "\n";
  return 0;
}


Measured memory_bytes: 256
def gcd(a, b):
    if a == 0 or b == 0:
        return max(a, b)
    return gcd(b, a % b)


N, X = [int(c) for c in raw_input().split()]
xs = [int(c) for c in raw_input().split()]

if len(xs) == 1:
    print abs(xs[0]-X)
else:
    xs.sort()
    d_min = xs[-1]-xs[0]

    if X < xs[0]:
        d_min = min(d_min, xs[0]-X)
    elif X > xs[-1]:
        d_min = min(d_min, X-xs[-1])

    for i in range(len(xs)-1):
        if xs[i] < X < xs[i+1]:
            d_min = gcd(d_min, X-xs[i])
            d_min = gcd(d_min, xs[i+1]-X)
            continue
        d_min = gcd(d_min, xs[i+1] - xs[i])
    print d_min

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

int main() {
  int A, B;
  cin >> A >> B;
  if(A+B == 2) {
    cout << "Impossible";
    return 0;
  }
  else if(A%3 == 0) {
    cout << "Possible";
    return 0;
  }
  else if(B%3 == 0) {
    cout << "Possible";
    return 0;
  }
  else if((A+B)%3 == 0) {
    cout << "Possible";
    return 0;
  }
  else {
    cout << "Impossible";
    return 0;
  }
}


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

#define mem(ar,a)       memset(ar,a,sizeof ar)
#define iOS           	ios_base::sync_with_stdio(false);cin.tie(NULL); 
#define pb(x)           push_back(x)
#define all(c)          c.begin(), c.end()
//#define int             long long
#define ff              first
#define ss              second
#define nl              '\n'

int main()
{
	iOS
	string s,t; cin>>s>>t;
	int n=s.size(),m=t.size();
	int res=m;
	if(s==t){
		cout<<"0"; return 0;
	}
	for(int i=0;i<n-m+1;i++){
		string a=s.substr(i,m);
		int x=0;
		for(int j=0;j<a.size();j++){
			if(a[j]==t[j]){
				x++;
			}
		}
		res=min(m-x,res);
	}	
	cout<<res;
}



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

using namespace std;

typedef long long ll;
const int maxn = (int) 1e5 + 1;

int n;
double x[maxn], y[maxn];
int p[maxn];
long double all; 

double get(int a, int b){
	return sqrt((x[a] - x[b]) * (x[a] - x[b]) + (y[a] - y[b]) * (y[a] - y[b]));
}

double f(int n){
	double res = 1;
	for(int i = 2; i <= n; i++){
		res *= i;
	}
	return res;
}

int main(){
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> x[i] >> y[i];
		p[i] = i;
	}
	do{
		for(int i = 2; i <= n; i++){
			all += get(p[i], p[i - 1]);
		}
	}while(next_permutation(p + 1, p + n + 1));
	cout <<fixed << setprecision(7) << all / (f(n));
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n,a,b,c,d,i,j,k,l,ba,bb,bc,bd,o,bo,s;
  cin >> n;
  while(n!=0){
    cin >> a >> b >> c >> d;
    o=100000;
    for(i=0;i<=a;i++){
      for(j=0;j<=b;j++){
	for(k=0;k<=c;k++){
	  for(l=0;l<=d;l++){
	    bo=a+b+c+d;
	    if(i*10+j*50+k*100+l*500>=n){
	      bo-=i+j+k+l;
	      s=(i*10+j*50+k*100+l*500)-n;
	      bo+=(s/500)+(s%500)/100+(s%100)/50+(s%50)/10;
	      if(bo<o){
		o=bo;ba=i;bb=j;bc=k;bd=l;
	      }
	    }
	  }
	}
      }
    }
    if(ba!=0) cout << 10 <<  " " << ba << endl;
    if(bb!=0) cout << 50 <<  " " << bb << endl;
    if(bc!=0) cout << 100 <<  " " << bc << endl;
    if(bd!=0) cout << 500 <<  " " << bd << endl;
    
    cin >> n;
    if(n!=0)cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1164
n=int(input())
x=[0,0,0]
ans="Yes"
for i in range(n):
  y=x
  x=list(map(int,input().split()))
  if x[0]-y[0]<abs(y[1]-x[1])+abs(y[2]-x[2]) or (x[1]+x[2])%2!=x[0]%2:
    ans="No"
    break
print(ans)


Measured memory_bytes: 74972
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>
#include <map>

using namespace std;
 
int main() {
	int a,b,c,ans;
	cin >> a >> b >> c;
	ans = c - (a - b);
	if(ans <= 0){
		ans = 0;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n, m = list(map(int, input().split()))

br = [list(map(int, input().split())) for _ in range(m)]

ans = []

def nc2(n):
    if n<2:
        return 0
    return n * (n-1) // 2


class UnionFind:

    def __init__(self, size):
        self.table = [-1 for _ in range(size+1)]
        self.size = [1 for _ in range(size+1)]

    def find(self, x):
        while self.table[x] >= 0:
            x = self.table[x]
        return x

    def union(self, x, y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 != s2:
            if self.table[s1] != self.table[s2]:
                if self.table[s1] < self.table[s2]:
                    self.table[s2] = s1
                    self.size[s1] += self.size[s2]
                    self.size[s2] = 0
                else:
                    self.table[s1] = s2
                    self.size[s2] += self.size[s1]
                    self.size[s1] = 0
            else:
                self.table[s1] += -1
                self.table[s2] = s1
                self.size[s1] += self.size[s2]
                self.size[s2] = 0

    def get_size(self, x):
        s1 = self.find(x)
        return self.size[s1]

    def check_same(self, x, y):
        return self.find(x) == self.find(y)

res = []
r = nc2(n)

uf = UnionFind(n)

for a, b in reversed(br):

    res.append(r)

    if not uf.check_same(a,b):
        r -= uf.get_size(a)*uf.get_size(b)

    uf.union(a,b)

for i in reversed(res):
    print(i)

Measured memory_bytes: 34204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll x;
	cin>>x;
	for(int i=-120;i<=120;i++){
		for(int j=-120;j<=120;j++){
			if(pow(i,5)-pow(j,5)==x){
				printf("%d %d\n",i,j);
				return 0;
			}
		}
	}
	return 0;
}

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

int main()
{
  	int a, b, c;
  	cin>>a>>b>>c;
  	bool flag = false;
  	int k = a;
  	for(int i = 0; i < b; i++)
    {
    	if(k % b == c)
        {
          	flag = true;
          	break;
        }
      	k += a;
    }
  	if(flag)
      	cout<<"YES";
  	else
      	cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>

using namespace std;

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

  int ans = 0;
  int tap = 1;

  a--;
  while(tap < b) {
    tap += a;
    ans++;
  }
  cout << ans << endl;
}

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

using namespace std;
using LL = long long;
using P = pair<int, int>;
using Tapris = tuple<int, int, int>;

#define REP(i, n) for(LL i = 0; i < n; ++i)
#define FOR(i, a, n) for(LL i = a; i < n; ++i)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

//#define int long long

/*************** using variables ***************/
int a, d, n;
vector<LL> sosuu_list;
/**********************************************/
bool isprime(LL x){
    if(x == 2) return true;
    if(x < 2 || x % 2 == 0) return false;
    LL i = 3;
    LL sqrtx = sqrt(x);
    while(i <= sqrtx){
        if(x % i == 0) return false;
        i += 2;
    }
    return true;
}
// maxまでの素数をvectorに入れて返す
vector<LL> eratos(LL max){
    vector<LL> primeVec;
    vector<bool> isprime;
    double sqrtmax = sqrt(max);
    isprime.resize(max + 1);
    isprime[0] = false; isprime[1] = false;
    FOR(i, 2, max + 1){
        isprime[i] = true;
    }
    FOR(i, 2, sqrtmax){
        if(isprime[i]){
            for(int j = 0; i * (j + 2) < max + 1; ++j){
                isprime[i * (j + 2)] = false;
            }
        }
    }
    REP(i, max + 1){
        if(isprime[i])  primeVec.pb(i);
    }
    return primeVec;
}
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(cin >> a >> d >> n, a != 0 && d != 0 && n != 0){
        int cnt = 0;
        while(1){
            if(isprime(a+d*cnt)) n--;
            if(n == 0) break;
            cnt++;
        }
        cout << a+d*cnt << endl;
    }
}



Measured memory_bytes: 3152
import scala.io.StdIn._
import scala.math._

object Main extends App with StdInHelper {
  val x = readLong

  var deposit = 100L
  var res = 0L
  while (deposit < x) {
    res += 1
    deposit += (deposit * 0.01).toLong
  }

  println(res)
}

trait StdInHelper {
  def readInts = readLine.split(" ").map(_.toInt)
  def readLongs = readLine.split(" ").map(_.toLong)
}


Measured memory_bytes: 54580
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0008
{
    class Program
    {
        static void Main(string[] args)
        {
            string n;

            while ((n = Console.ReadLine()) != null)
            {
                int count = 0;
                int number = int.Parse(n);
                if (number > 37)
                {
                    count = 0;
                }
                else
                {
                    for (int i = 0; i < 10; ++i)
                    {
                        for (int j = 0; j < 10; ++j)
                        {
                            for (int k = 0; k < 10; ++k)
                            {
                                for (int l = 0; l < 10; ++l)
                                {
                                    if (i + j + k + l == number)
                                    {
                                        count++;
                                    }
                                    else
                                    {
                                        count = count + 0;
                                    }
                                }
                            }
                        }
                    }
                }
                Console.WriteLine(count);
            }
        }
    }
}



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


using namespace std;


int main (){
  string s,t;
  int cn=0;
  
  
  
    cin>>s;
  	cin>>t;
  for(int i=0; i<s.size(); i++){
    if(s.at(i)==t.at(i))cn++;
    

}
  

  
  
  
  cout<<cn<<endl;
  
  
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


int main()
{
	int A,  B;
	char op;
	cin >> A >> op >> B;

	if (op == '+') {
		cout << A + B << endl;
	} else {
		cout << A - B << endl;
	}
}


Measured memory_bytes: 256
n = int(input())
list_t = list(map(int, input().split()))
list_v = list(map(int, input().split()))

list_v2 = [0 for i in range(n+1)]
list_t.append(0)
list_v.append(0)
for i in range(n-1)[::-1]:
  list_v2[i] = min(list_v[i], list_v[i+1], list_v2[i+1] + list_t[i+1])

dist = 0
v0 = 0
for i in range(n):
  t1 = min(list_v[i] - v0, (list_t[i] - (v0 - list_v2[i])) / 2, list_t[i])
  t2 = max(v0 + t1 - list_v2[i], 0)
  dist += (2*v0+t1)*t1/2 + (v0+t1)*(list_t[i]-t1-t2) + (2*(v0+t1)-t2)*t2/2
  v0 = v0 + t1 - t2
print(dist)

Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            int[] x = in.nextIntArray(n);

            long ans = 0;
            for (int i = 0; i < n; i++) {
                ans += 2 * Math.min(x[i], k - x[i]);
            }

            out.println(ans);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int main(){
	llong N;
	cin >> N;
	bool flag = true;
	llong remain = 0;
	string S = "";
	while(flag){
		remain = N % 26;
		N /= 26;
		if(remain == 0){
			remain = 26;
			--N;
		}
		char a = (char)('a' - 1 + remain);
		S = S + a;
		if(N==0) flag = false;
	}
	for(int i=0; i<S.length(); ++i) cout << S[S.length()-1-i];
	cout << endl;
}

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

int main()
{
    ll A,B,C,K;
    cin >> A >> B >> C >> K;
    ll count=0;
    if(A>=K){
        count=K;
    }else{
        count+=A;
        K-=A;
        if(B<K){
            K-=B;
            count-=K;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3636
# -*- coding: utf-8 -*-

from sys import stdin


############################################

#from sys import stdin
import numpy as np

# read data for n sequences.
data = stdin.readline().split()
data=str(data)
data2=[]
for a in data[2:-2]:
    data2.append(int(a))
data=data2

start = data[0]
count=0
for i, c in enumerate(data):
    # end
    if i == len(data)-1:
        break
    # startと3こ続いた
    if c==start and data[i+1]==start:
        count+=2
        
    # 同じのが三個続いた
    if i!=0:
        if c==data[i-1]==data[i+1]:
            count+=2
            start=c

count0=0
for i, c in enumerate(data):
    if c==0:
        count0+=1
count1=len(data)-count0

if count1>count0:
    print(len(data)-(count1-count0))
else:
    print(len(data)-(count0-count1))



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

using namespace std;


int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  vector<long long> v;
  cin >> n;
  for (int i = 0, t; i < n; ++i) {
    cin >> t;
    v.push_back(t - i - 1);
  }
  sort(v.begin(), v.end());
  long long mid = v[v.size() / 2];
  long long ans = 0;
  for (int i = 0; i < n ; ++i) {
    
    ans += abs(v[i] - mid);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2420
N = int(input())
vs = list(map(int, input().split()))

vs.sort()

if N == 2:
    print((vs[0] + vs[1]) / 2)
    exit()

x = (vs[0] + vs[1])/2
for i in range(2, N):
    x = (x + vs[i]) / 2

print(x)


Measured memory_bytes: 3060
from collections import deque
ans = deque()
V,E = map(int,input().split())
C = [[] for _ in range(V)]
for _ in range(E):
    tmp = list(map(int,input().split()))
    C[tmp[0]].append(tmp[1])

visited = [False]*V


def DFS(node):
    visited[node] = True
    for adj in C[node]:
        if not visited[adj]:
            DFS(adj)
    ans.appendleft(node)


for i in range(V):
    if not visited[i]:
        DFS(i)


for node in ans:
    print(node)


Measured memory_bytes: 9200
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)2e5 + 5;

string s;

string solve() {
	rep(i, 30) {
		for (auto& c : s) {
			if (isalpha(c)) {
				c++;
				if (c > 'z') c = 'a';
			}
		}
		stringstream ss(s);
		// dump(ss.str());
		string s2;
		while (ss >> s2) {
			if (s2 == "the" || s2 == "this" || s2 == "that") {
				return s;
			}
		}
	}
	return ""s;
}

int main() {
	int N;
	while (getline(cin,s)) {
		cout << solve() << endl;
	}
	return 0;
}

Measured memory_bytes: 3132
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>


using namespace std;
typedef long long int ll;


int main() {
    ll A,B,C,D;
    cin >> A >> B >> C >> D;
    if ((A+B) > (C+D)) {
    cout << "Left" << endl;
    }
    if ((A+B) < (C+D)) {
    cout << "Right" << endl;
    }
    if ((A+B) == (C+D)) {
    cout << "Balanced" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <utility>
#include <functional>

bool le(const std::vector<int> &A, intmax_t m) {
  for (size_t i=0; i<A.size(); ++i)
    m -= m % A[i];

  return m <= 2;
}

bool ge(const std::vector<int> &A, intmax_t m) {
  for (size_t i=0; i<A.size(); ++i)
    m -= m % A[i];

  return m >= 2;
}

int main() {
  size_t K;
  scanf("%zu", &K);

  std::vector<int> A(K);
  for (size_t i=0; i<K; ++i)
    scanf("%d", &A[i]);

  if (A.back() != 2)
    return !printf("-1\n");

  intmax_t lb=1, ub=1e18;
  while (ub-lb > 1) {
    intmax_t mid=(lb+ub)>>1;
    (le(A, mid)? lb:ub) = mid;
  }

  intmax_t max=lb;

  lb = 1;
  ub = 1e18;
  while (ub-lb > 1) {
    intmax_t mid=(lb+ub)>>1;
    (ge(A, mid)? ub:lb) = mid;
  }

  intmax_t min=ub;
  if (min > max || max < 2)
    return !printf("-1\n");

  printf("%jd %jd\n", min, max);
}


Measured memory_bytes: 640
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define pli pair<long long , int>
#define pil pair<int ,long long>
#define pi acos(-1)
#define pb push_back
#define mkp make_pair
#define all(a) a.begin(), a.end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define MAX 300005
#define INF 0x3f3f3f3f
template <class T> inline T bigmod(T p,T e,T M){ll ret = 1LL;for(; e > 0LL; e >>= 1LL){if(e & 1LL) ret = (ret * p) % M;p = (p * p) % M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}   // M is prime}

using namespace std;
using namespace __gnu_pbds;

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update>pref_trie;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;




int main(){
    IOS
    //freopen("output.txt","w",stdout);
    int a;
    cin>>a;
    string s;
    cin>>s;

    if(a<3200){
        cout<<"red\n";
    }
    else{
        cout<<s<<"\n";
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)

typedef long long ll;
typedef pair<int, int> pii;

void j_inverse(string &s)
{
	string buf = s;
	rep(i, s.size())
		buf[i] = s[(s.size()+i-1)%s.size()];
	s = buf;
}

void c_inverse(string &s)
{
	string buf = s;
	rep(i, s.size())
		buf[i] = s[(s.size()+i+1)%s.size()];
	s = buf;
}

void e_inverse(string &s)
{
	string left, right;
	if (s.size()%2==0) {
		left = s.substr(0, s.size()/2);
		right = s.substr(s.size()/2);
		s = right+left;
	} else {
		left = s.substr(0, (s.size()-1)/2);
		right = s.substr((s.size()+1)/2);
		s = right + s[s.size()/2] + left;
	}
}

void a_inverse(string &s)
{
	reverse(ALL(s));
}

void p_inverse(string &s)
{
	rep(i, s.size())
		if (isdigit(s[i]))
			s[i] = (s[i]=='0'?'9':s[i]-1);
}

void m_inverse(string &s)
{
	rep(i, s.size())
		if (isdigit(s[i]))
			s[i] = (s[i]=='9'?'0':s[i]+1);
}

int main(void)
{
	int n;

	cin >> n;
	rep(TTTT, n) {
		string order, str;
		cin >> order >> str;
		rep(i, order.size()) {
			switch(order[order.size()-1-i]) {
			case 'J': j_inverse(str); break;
			case 'C': c_inverse(str); break;
			case 'E': e_inverse(str); break;
			case 'A': a_inverse(str); break;
			case 'P': p_inverse(str); break;
			case 'M': m_inverse(str); break;
			}
		}
		cout << str << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
#define ll long long
#define vl vector
#define pb push_back
#define ff first
#define ss second
using namespace std;
int main()
{
    ll a,b,i,j,n,m;
    cin>>a>>b;
    if(a-(b*2)>0) cout<<a-(b*2);
    else cout<<"0";
}

Measured memory_bytes: 3684
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define SIZE 5
#define LL long long
#define MIN(a, b) ((a < b) ? a : b)

void solve1(LL *a, LL n, int size) {
    int i; LL min = a[0];
    for(i = 0; i < size; ++i) { min = MIN(min, a[i]); }
    LL x = (n % min != 0) ? n/min + 1 : n/min;
    printf("%lld\n", (LL)(size - 1) + x);
}

int main(void)
{
    int i; LL n;
    LL *a = (LL*)malloc((SIZE+1) * sizeof(LL));
    scanf("%lld", &n);
    for(i = 0; i < SIZE; ++i) { scanf("%lld", &a[i]); }
    solve1(a, n, SIZE);
    return 0;
}

Measured memory_bytes: 128