akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>


int main(void)
{
	int num;
	char message[2][101];
	scanf("%d", &num);
	scanf("%s", message[0]);
	scanf("%s", message[1]);
	for (int i = 0; i < num; i++) {
		printf("%c", message[0][i]);
		printf("%c", message[1][i]);
	}
	printf("\n");

	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int D,N;
    cin >> D >> N;
    ll ans = 1;
    if(N == 100)ans = 101;
    else        ans = N;
    rep(i,0,D)ans *= 100;
    cout << ans << endl;
}

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

template<typename T, typename U> bool chmin(T &a, const U &b) {
	return (a > b ? a = b, true : false);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
	return (a < b ? a = b, true : false);
}

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;

ll numct[210000];
ll k[210000];
ll cnb[210000];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll N,A,B;
	cin>>N>>A>>B;

	ll AB = A+B;


	cout<<N/(AB)*A+min(N%AB,A)<<endl;

}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES 
#include <cmath>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<vector>
#define rep(i,start,n) for(int i=start;i<n;i++)
#define And &&
#define Or ||
#define Lb cout<<endl
using namespace std;

int main(void) {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, 0, n) {
		cin >> a.at(i);
	}
	rep(i, 0, n-1) {
		cout << a.at(n - i - 1)<<" ";
	}
	cout << a.at(0) << endl;
	return 0;
}

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

using namespace std;
long long ans[3005][3005][4];
long long val[3005][3005];
int main()
{
    long long n,m,K;
    cin>>n>>m>>K;
    for(long long i=0; i<K; i++){
        long long r,c,v;
        cin>>r>>c>>v;
        val[r-1][c-1]=v;
    }
    for(long long i=0; i<n; i++){
        for(long long j=0; j<m; j++){
            ans[i][j][0]=ans[i][j][1]=ans[i][j][2]=ans[i][j][3]=-1;
        }
    }
    ans[0][0][0]=0;
    ans[0][0][1]=val[0][0];
    for(long long i=0; i<n; i++){
        for(long long j=0; j<m; j++){
            for(long long k=0; k<4; k++){
                if(ans[i][j][k]==-1) continue;
                ans[i+1][j][0]=max(ans[i+1][j][0],ans[i][j][k]);
                ans[i+1][j][1]=max(ans[i+1][j][1],ans[i][j][k]+val[i+1][j]);
                ans[i][j+1][k]=max(ans[i][j+1][k],ans[i][j][k]);
                if(k!=3){
                    ans[i][j+1][k+1]=max(ans[i][j+1][k+1],ans[i][j][k]+val[i][j+1]);
                }
            }
        }
    }
    cout<<max(max(ans[n-1][m-1][0],ans[n-1][m-1][1]),max(ans[n-1][m-1][2],ans[n-1][m-1][3]));
}


Measured memory_bytes: 355556
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define reps(i, s, n) for(int i = (s); i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, s, n) for(int i = (n) - 1; i >= (s); i--)
#define INF ~(1 << 31)
#define INFL ~(1LL << 63)

int main()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    vector<ll> mul = {a * c, a * d, b * c, b * d};
    cout << *max_element(mul.begin(), mul.end()) << endl;
}

Measured memory_bytes: 3624
/*
created on 21/4/2020
*/
#include<bits/stdc++.h>
using namespace std;
#define Endl '\n'
typedef long long int lli;
void solve();
int main(int argc, char const *argv[]){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
}
int const mxval = (1e5) + 5;
lli v[105];
lli w[105];
int n, W;
lli memo[mxval][105];
lli findans(int val, int pos){
  if(val<= 0)
    return 0;
  if(pos == n)
    return 1e18;
  lli& ret = memo[val][pos];
  if(ret!=-1)
    return ret;
  return ret = min(findans(val-v[pos], pos+1) + w[pos], findans(val, pos+1));
}
void solve(){
  cin>>n>>W;
  for(int i=0;i<n;i++){
    cin>>w[i]>>v[i];
  }
  for(int i=0;i<mxval;i++){
    for(int j=0;j<105;j++){
      memo[i][j] = -1;
    }
  }
  int i;
  for(i=mxval-1;i>=0;i--){
    if(findans(i, 0)<=W)
      break;
  }
  cout<<i<<Endl;
}


Measured memory_bytes: 82304
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int a = s.length();
        String x = "";
        for(int i=0; i<a; i++) {
            x = x + "x";
        }
        System.out.println(x);
    }
}

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

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

  int n;
  string s;
  cin >> n >> s;

  int res = 0;
  for (int i = 0; i < n; ++i) {
    bool count_a[26] = {0};
    bool count_b[26] = {0};
    for (int j = 0; j < i; ++j) count_a[s[j] - 'a'] = true;
    for (int j = i; j < n; ++j) count_b[s[j] - 'a'] = true;

    int tmp = 0;
    for (int i = 0; i < 26; ++i) if (count_a[i] && count_b[i]) tmp++;
    res = max(res, tmp);
  }
  cout << res << "\n";

}


Measured memory_bytes: 3636
#include <stdio.h>
int main (){
	int L, R, d, num = 0;
	scanf ("%d %d %d", &L, &R, &d);
	for (int i = L; i <= R; i++){
		if (i % d == 0){
			num = num +1;
		}
		}
	printf ("%d",num);
	return 0;
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main( ){
    ll n,m;
    cin>>n>>m;
    vll a(n);
    ll sum=0;
    rep(i,0,n){cin>>a[i]; sum+=a[i];}
    sort(a.rbegin(),a.rend());
    double ka=sum/(double)(4*m);
    bool check=true;
    rep(i,0,m){
        if(ka<=a[i])continue;
        else check=false;
    }
    if(check)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
template<typename T> void chadd(T& a, T b) { a = a + b; }

namespace {  // 名前なし名前空間
	// gcd, lcm は C++17 でstdに標準入りしたので言語のバージョンに注意
	// 最大公約数
	ll gcd(ll a, ll b) {
		if (b == 0) return a;
		return gcd(b, a % b);
	}

	// 最小公倍数
	ll lcm(ll a, ll b) {
		return a / gcd(a, b) * b;
	}

#define MAX_V 200000

	vector<pair<ll, ll>> G[MAX_V];

	// ダイクストラ法
	vector<ll> dijkstra(ll start) {
		vector<ll> dist(MAX_V, infll);
		dist[start] = 0; // dist[i] := start->iまでの最短距離
		priority_queue < pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> que;
		que.push({ 0, start });
		while (!que.empty()) {
			ll cost, u; // 今までにかかった時間　現在の頂点
			cost = que.top().first, u = que.top().second;
			que.pop();
			if (dist[u] < cost) continue;
			for (auto tmp : G[u]) {
				ll v = tmp.first, time = tmp.second; // 隣接する頂点、その頂点まで行く時間
				if (dist[v] > dist[u] + time) {
					dist[v] = dist[u] + time;
					que.push({ dist[v], v });
				}
			}
		}
		return dist;
	}
}

int main() {

	ll n, m;
	std::cin >> n >> m;
	rep(i, m) {
		ll l, r, c;
		std::cin >> l >> r >> c;
		G[l - 1].push_back({ r - 1,c });
	}
	Rep(i, 1, n) {
		G[i].push_back({ i - 1, 0 });
	}

	auto dist = dijkstra(0);

	if (dist[n - 1] == infll) {
		std::cout << -1 << std::endl;
	}
	else std::cout << dist[n - 1] << std::endl;

	return 0;
}


Measured memory_bytes: 12540
N, K = map(int, input().split())

numbers = [tuple(map(int, input().split())) for _ in range(N)]

# bitwise-orがK以下になるには
# ある桁kが存在し，K & (1 << k) == 1 and n & (1 << k) == 0 かつ上位kビットのみでK以下

def isOk(k, n):
    maskK = (K >> k)
    maskN = (n >> k)

    if maskN % 2 == 1:
        return False

    if (maskK | maskN) == maskK:
        return True
    else:
        return False

ans = sum([a for n, a in numbers if (n | K) == K])
for k in range(30):
    if K & (1 << k):
        s = 0
        add = []
        for n, a in numbers:
            if isOk(k, n):
                s += a
                add.append(a)
        ans = max(ans, s)

print(ans)


Measured memory_bytes: 18636
#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;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

ii a[123];
int cnt[123];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,k; cin>>n>>k;
	for(int i=0;i<n;i++) 
	{
		cin>>a[i].fi; a[i].se=i;
	}
	sort(a,a+n);
	vi vec;
	for(int i=n-1;i>=0;i--)
	{
		vec.pb(a[i].se);
		a[i].fi--;
	}

	for(int i=n-1;i>=0;i--)
	{
		if(a[i].fi<0){cout<<-1<<'\n'; return 0;}
	}
	while(k>=2)
	{
		for(int i=n-1;i>=1;i--)
		{
			vec.pb(a[i].se);
			a[i].fi--;
		}
		int r=a[1].se;
		sort(a,a+n);
		for(int i=n-1;i>=0;i--)
		{
			if(a[i].se==r) continue;
			vec.pb(a[i].se);
			a[i].fi--;
		}
		k-=2;
		for(int i=n-1;i>=0;i--)
		{
			if(a[i].fi<0){cout<<-1<<'\n'; return 0;}
		}
		sort(a,a+n);
	}
	if(k>0)
	{
		for(int i=n-1;i>=1;i--)
		{
			vec.pb(a[i].se);
			a[i].fi--;
		}
		for(int i=n-1;i>=0;i--)
		{
			if(a[i].fi<0){cout<<-1<<'\n'; return 0;}
		}
	}
	cout<<vec.size()<<'\n';
	for(int i=0;i<vec.size();i++)
	{
		cout<<vec[i]+1;
		if(i+1<vec.size()) cout<<' ';
	}
	cout<<'\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < ll , ll >
#define F first
#define S second
#define int long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err(A) cout << #A << " = " << (A) << endl
using namespace std;
const int N=1e5+100,mod=1e9+7;

ll dp[N][3];
vector <int> g[N];
ll dfs(ll v,ll p){
    dp[v][1]=1;
    dp[v][2]=1;
    for (int i=0;i<g[v].size();i++){
        ll u=g[v][i];
        if (u==p){
            continue;
        }
       // if (u!=p){
            dfs(u,v);
        //}
        dp[v][1]*=dp[u][2];
        dp[v][1]%=mod;
        dp[v][2]*=dp[u][0];
        dp[v][2]%=mod;
    }
    dp[v][0]=dp[v][1]+dp[v][2];
    dp[v][0]%=mod;
    //cout << v << " " << dp[v][1] << " " << dp[v][2] << endl;

}
int32_t main(){
    ll n;
    cin >> n;
    for (int i=0;i<n-1;i++){
        ll u,v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    dfs(1,-1);
    cout << dp[1][0];
}
















Measured memory_bytes: 14976
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll A, B, C;
  cin >> A >> B >> C;

  cout << min(C, B / A) << endl;
}

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;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    int A[N]; rep(i, N) cin >> A[i];
    int dp[N]; rep(i, N) dp[i] = INF;
    int ans = 0;
    rep(i, N){
        int val = A[i];
        //A[i]をdpテーブルのどこに入れるか
        int ok = ans, ng = -1;
        int m = (ok+ng)/2;
        while(abs(ok-ng) > 1){
            if(val <= dp[m]) ok = m;
            else ng = m;
            m = (ok+ng)/2;
        }
        if(ok == ans) dp[ans++] = val;
        else dp[ok] = val;
    }
    //rep(i, N) cout << dp[i] << " "; cout << endl;
    cout << ans << endl;
    return 0;
}


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

int main() {
    int N; cin >> N;
    long long A[N];
    for (int i = 0; i < N; i++) cin >> A[i];
    long long ans = 1000;
    long long m = A[0];
    for (int i = 0; i < N-1; i++) {
        if (A[i] < A[i+1]) ans = ans / A[i] * A[i+1] + ans % A[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include<iostream>
int a,b,c,n,r;main(){while(std::cin>>a>>b>>c,a|b|c){a*=a;b*=b;c*=c;std::cin>>n;while(n--)std::cin>>r,r*=4*r,puts(a+b<r|b+c<r|c+a<r?"OK":"NA");}}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set>
using namespace std;
long long p  = 998244353;
//long long p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define rev(s) reverse(s.begin(),s.end())
#define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin()
#define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin()
int max_kai = 150000;
vel kai(max_kai, 1);
vel inv_kai;
int rui(int a, int n) {
	if (n == 0) { return 1; }
	int x = rui(a, n / 2);
	x *= x; x %= p;
	if (n % 2 == 1) { x *= a; x %= p; }
	return x;
}
int inv(int a) { return rui(a, p - 2); }
void make_kai() {
	for (int i = 1; i < max_kai; i++) { kai[i] = kai[i - 1] * i; kai[i] %= p; }
	inv_kai = kai;
	rep(i, max_kai) { inv_kai[i] = inv(kai[i]); }
}
int nCr(int n, int r) {
	int a = kai[n] * inv_kai[r]; a %= p;
	a *= inv_kai[n - r]; a %= p;
	return a;
}
vel pa;
int root(int x) {
	if (pa[x] == -1) { return x; }
	int ans = root(pa[x]); pa[x] = ans;
	return ans;
}
void marge(int x, int y) {
	x = root(x);
	y = root(y);
	if (x != y) {pa[x] = y;}
}
#define end_s(a) cout <<a<<endl;return 0
int sol(vel &next, veb &seen, int i) {
	seen[i] = true;
	i = next[i];
	int ret = 0;
	while (!seen[i]) {
		seen[i] = true;
		ret++;
		i = next[i];
	}
	return ret;
}
signed main(){
	int n; cin >> n;
	vvel a(3, vel(n));
	rep(i, 3) { rep(j, n) { cin >> a[i][j]; a[i][j]--; } }
	vel even, odd;
	int c_e=0, c_o=0;
	rep(i, n) {
		if (i % 2 == 0) {
			if (a[1][i] % 6 != 1) { end_s("No"); }
			if (abs(a[0][i] - a[1][i])*abs(a[2][i] - a[1][i]) == 1) {
				even.push_back(a[1][i] / 6);
				if (a[0][i] > a[2][i]) { c_e++; }
			}
			else { end_s("No"); }
		}
		else {
			if (a[1][i] % 6 != 4) { end_s("No"); }
			if (abs(a[0][i] - a[1][i])*abs(a[2][i] - a[1][i]) == 1) {
				odd.push_back(a[1][i] / 6);
				if (a[0][i] > a[2][i]) { c_o++; }
			}
			else { end_s("No"); }
		}
	}
	int r_e=0, r_o=0;
	int sz0 = even.size();
	veb seen(sz0, false);
	rep(i, sz0) {
		if (!seen[i]) {
			r_e += sol(even,seen, i);
		}
	}
	int sz1 = odd.size();
	seen=veb(sz1, false);
	rep(i, sz1) {
		if (!seen[i]) {
			r_o += sol(odd,seen, i);
		}
	}
	r_e %= 2; r_o %= 2; c_e %= 2; c_o %= 2;
	if ((r_e == c_o) && (r_o == c_e)) {
		end_s("Yes");
	}
	cout << "No" << endl;
	return 0;
}

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

int main(){
	int a, b, n;
	while(cin >> a >> b >> n){
		int ans = 0;
		while(n--){
			a %= b;
			a *= 10;
			ans += a/b;
		}
		cout << ans << endl;
	}
	
	return 0;
}
/*
2
9
0
*/

Measured memory_bytes: 2988
from collections import deque
S = deque()
tmp = input()
for i in range(len(tmp)):
  S.append(tmp[i])
Q = int(input())
flag = True
for i in range(Q):
  string = input().split()
  if string[0] == '1':
    flag = not flag
  elif flag ^ (string[1] == '1'):
      S.append(string[2])
  else:
      S.appendleft(string[2])
if not flag:
  S.reverse()
for s in S:
  print(s, end='')

Measured memory_bytes: 7664
#include<iostream>
#include<cstdio>
using namespace std;
#define N 500012
#define mod 998244353
inline int M(int x){return (x>=mod)?(x-mod):x;}
inline int M1(int x){return (x<0)?(x+mod):x;}
inline int ksm(int p,int k){int res=1;while(k){if(k&1)res=1ll*res*p%mod;k>>=1;p=1ll*p*p%mod;}return res;}
int n,m,fac[N],inv[N],P1[N],P2[N],ans=0;
inline int C(int n,int m){if(m>n)return 0;return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;}
int main(){
	fac[0]=1;for(int i=1;i<N;i++)fac[i]=1ll*fac[i-1]*i%mod;
	inv[N-1]=ksm(fac[N-1],mod-2);for(int i=N-2;i>=0;i--)inv[i]=1ll*inv[i+1]*(i+1)%mod;
	scanf("%d%d",&n,&m);int i;
	P1[0]=1;for(i=1;i<N;i++)P1[i]=1ll*P1[i-1]*(n+1)%mod;
	P2[0]=1;for(i=1;i<N;i++)P2[i]=1ll*P2[i-1]*(m+1)%mod;
	for(i=0;i<=min(n,m);i++)ans=(ans+1ll*((i&1)?(mod-1):1)*C(n,i)%mod*C(m,i)%mod*fac[i]%mod*P1[m-i]%mod*P2[n-i])%mod;printf("%d",ans);return 0;
}

Measured memory_bytes: 8064
#include<stdio.h>

int main(void)
{
	int sum=0;
	char s[200001];
	char t[200001];

	
	scanf("%s", &s);
	scanf("%s", &t);

	for(int i=0;s[i]!='\0';i++)
		if (s[i] != t[i]) {
			sum++;
		}
	printf("%d", sum);
	return 0;
}

Measured memory_bytes: 2108
#include <iostream>
#include <math.h>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define memset(v, h) memset((v), h, sizeof(v))
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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(){
    ll n, m;
    cin >> n >> m;
    ll a[n];
    ll v = 0;
    ll o[n];
    
    bool ac[n];
    rep(i,n)ac[i] = false;
    rep(i,n)o[i] = 0;

    rep(i,m){
        ll x;
        string q;
        cin >> x >> q;
        if(ac[x-1])
        {
            continue;
        }

        if(q == "AC")
        {
            ac[x-1] = true;
            v++;
        }
        else
        {
            o[x-1]++;
        } 
    }

    ll ko = 0;
    rep(i,n){
        if(ac[i])
        {
            ko+=o[i];
        }
    }
    
    cout << v << " " << ko << endl;

    return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int inN, inM;
        int[] vec;
        int[][] mat;
        int[] ans;
        Scanner scan = new Scanner(System.in);

        inN = Integer.parseInt(scan.next());
        inM = Integer.parseInt(scan.next());

        vec = new int[inM];
        ans = new int[inN];
        mat = new int[inN][inM];

        for (int i = 0; i < inN; i++) {
            for (int j = 0; j < inM; j++) {
                mat[i][j] = Integer.parseInt(scan.next());
            }
        }
        for (int i = 0; i < inM; i++) vec[i] = Integer.parseInt(scan.next());

        for (int i = 0; i < inN; i++) {
            int sum = 0;
            for (int j = 0; j < inM; j++) {
                sum += mat[i][j] * vec[j];
            }
            ans[i] = sum;
        }

        for (int i = 0; i < inN; i++) System.out.println(ans[i]);

    }
}



Measured memory_bytes: 38652
#include<iostream>
#include<cstdio>
#include<cstring>
#define N 3010
#define ll long long
#define mod 1000000007
using namespace std;
ll f[N][N][2];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	f[1][0][1]=1;
	for(int i=1;i<=n;i++) f[1][i][0]=1;
	for(int i=1;i<=m;i++)
	{
		for(int j=0;j<=n;j++)
		{
			if(j==1)
			{
				f[i+1][j-1][1]=((f[i+1][j-1][1]+f[i][j][1])%mod+f[i][j][0])%mod;
				f[i+1][j][1]=((f[i+1][j][1]+f[i][j][1])%mod+f[i][j][0])%mod;
			}
			else if(j!=0)
			{
				f[i+1][j-1][1]=(f[i+1][j-1][1]+f[i][j][1])%mod;
				f[i+1][j-1][0]=(f[i+1][j-1][0]+f[i][j][0])%mod;
				f[i+1][j][1]=(f[i+1][j][1]+f[i][j][1])%mod;
				f[i+1][j][0]=(f[i+1][j][0]+f[i][j][0])%mod;
			}
			if(j<n)
            {
				f[i+1][j+1][1]=(f[i+1][j+1][1]+f[i][j][1])%mod;
				f[i+1][j+1][0]=(f[i+1][j+1][0]+f[i][j][0])%mod;
				f[i+1][j][1]=(f[i+1][j][1]+f[i][j][1])%mod;
				f[i+1][j][0]=(f[i+1][j][0]+f[i][j][0])%mod;
            }
		}
	}
	ll ans=0;
    for(int i=0;i<=n;i++) ans=(ans+f[m+1][i][1])%mod;
    printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 141568
#include <iostream>
#include <vector>

int solve() {
  int n, m;
  std::cin >> n >> m;
  std::vector<char> vals(n, 0);
  for (int i = 0; i < m; ++i) {
  	int s;
    char c;
    std::cin >> s >> c;
    --s;
    if (vals[s] == c) { continue; }
    else if (vals[s] == 0) { vals[s] = c; }
    else {
      return -1;
    }
  }
  if (vals[0] == '0') {
    if (n == 1) {
      return 0;
    }
    else {
      return -1;
    }
  } else if (vals[0] == 0) {
    if (n == 1) {
      return 0;
    }
    else {
      vals[0] = '1';
    }
  }
  int ret = vals[0] - '0';
  for (int i = 1; i < n; ++i) {
    if (vals[i] == 0) {
      vals[i] = '0';
    }
    ret *= 10;
    ret += vals[i] - '0';
  }
  return ret;
}

int main() {
  std::cout << solve() << std::endl;
  return 0;
}

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

int main() {
  int A; int B; int C; int D;
  cin >> A >> B >> C >> D;
  int a = A + B;
  int b = C + D;
  
  if (a > b)
    cout << "Left" << endl;
  else if (a < b)
    cout << "Right" << endl;
  else
    cout << " Balanced" << endl;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        mut v: [(isize, isize); n]
    }
    v.sort_by_key(|x| x.0 + x.1);
    let mut ans = 0;
    let mut r = isize::min_value();
    for &(x, l) in &v {
        if x - l >= r {
            ans += 1;
            r = x + l;
        }
    }
    println!("{}", ans);
}


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

long long int N, M, X[111], Y[111];

int main(){
    scanf("%lld%lld%lld%lld", &N, &M, X, Y);
    for(int i = 1; i <= N; ++i)
        scanf("%lld", X + i);
    for(int i = 1; i <= M; ++i)
        scanf("%lld", Y + i);
    sort(X, X + N + 1);
    sort(Y, Y + M + 1);
    puts(&"No War"[(X[N] >= Y[0]) * 3]);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	char S[50];
	int N,K,i;

	scanf("%d %d", &N, &K);
	scanf("%s", S);

	for (i = 0; i < N; i++) {
		if (i+1 == K){
			if (S[i] == 'A') {
				S[i] = 'a';
			}
			if (S[i] == 'B') {
				S[i] = 'b';
			}
			if (S[i] == 'C') {
				S[i] = 'c';
			}
			}
		}
	printf("%s", S);
    return 0;
}



Measured memory_bytes: 128
def main():
    N = int(input())
    A = sorted([int(v) for v in input().split()])

    def lcm(a, b):
        m = a % b
        return b if m == 0 else lcm(b, m)

    v = A[0]
    for i in range(1, N):
        v = lcm(v, A[i])

    print(v)


main()

Measured memory_bytes: 14252
import java.util.*;

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

    while(true){
      String s = sc.next();
      if(s.equals(".")){
        break;
      }

      int cnt = 0;
      for(int P=0;P<3;P++){
        for(int Q=0;Q<3;Q++){
          for(int R=0;R<3;R++){
            String p = "" + P;
            String q = "" + Q;
            String r = "" + R;
            String ss = s.replaceAll("P",p).replaceAll("Q",q).replaceAll("R",r);

            while(ss.length() != 1){
              ss = ss.replaceAll("\\-0","2");
              ss = ss.replaceAll("\\-1","1");
              ss = ss.replaceAll("\\-2","0");

              ss = ss.replaceAll("(\\(0\\*0\\))|(\\(0\\*1\\))|(\\(0\\*2\\))|(\\(1\\*0\\))|(\\(2\\*0\\))","0");
              ss = ss.replaceAll("(\\(1\\*1\\))|(\\(1\\*2\\))|(\\(2\\*1\\))","1");
              ss = ss.replaceAll("(\\(2\\*2\\))","2");

              ss = ss.replaceAll("(\\(0\\+2\\))|(\\(1\\+2\\))|(\\(2\\+2\\))|(\\(2\\+1\\))|(\\(2\\+0\\))","2");
              ss = ss.replaceAll("(\\(0\\+1\\))|(\\(1\\+1\\))|(\\(1\\+0\\))","1");
              ss = ss.replaceAll("(\\(0\\+0\\))","0");
            }

            if(ss.equals("2")){
              cnt++;
            }
          }
        }
      }

      System.out.println(cnt);
    }
  }
}

Measured memory_bytes: 13000
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset> //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip> //do setprecision
#include <ctime>
#include <complex>
using namespace std;

int main(void){
	int n,a,b,c,max,min;
	cin >> a;
	cin >> b;
	cin >> c;
	if(a<b){
		min=a;
		max=b;
	}else{
		min=b;
		max=a;
	}
	if(c<min){
		min=c;
	}
	if(c>max){
		max=c;
	}
	cout << max-min << endl;

}

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

int main() {
  int n, t, a;
  cin >> n >> t >> a;
  int h;

  double diff = 1000000.0;
  double ave = 0.0;

  int ans = 0;
  for(int i=1; i<=n; i++) {
    cin >> h;
    ave = t - (h * 0.006);
    if(diff > abs(a - ave)) {
      ans = i;
      diff = abs(a - ave);
    }
  }

  cout << ans << endl;

  return 0;
}

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;
typedef long long int lli;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }	//最大公約数(Greatest Common Divisor)
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }			//最小公倍数(Least Common Multiple)

long long comb(long long m) {
	return (m * (m - 1)) / 2;
}


int main() {
	ll x;
	cin >> x;

	ll ans = 0;
	ll tmp = 100;
	while (tmp < x) {
		tmp *= 1.01;
		ans++;
	}
	

	cout << ans << endl;


}

Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <math.h>
#include <fstream>
#include <sstream>
#include <unordered_map>
using namespace std;

const unsigned long long BASE = (unsigned long long)(1e9 + 7);

#define FROM_0(i, n) for(int i = 0; i < (n); i++)
#define FROM_S(i, s, e) for(int i = (s); i < (e); i++)
#define ITER_BEGIN_END(iter, vec) for(auto iter = vec.begin(); iter < vec.end(); iter++)

int main()
{
    string n;
    cin >> n;
    int mod = 0;
    FROM_0(i, n.length())
    {
        mod = (mod + int(n[i] - '0')) % 9;
    }
    cout << (mod == 0 ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 3720
#include <stdio.h>

int main(void)
{
  int a, N;
  scanf("%d", &N);
  if(N%7 == 0 || N%4 == 0){
    printf("Yes\n");
  }
  else{
    a = N%7;
    if(a%4 == 0){
      printf("Yes\n");
    }
    else{
      a = N;
      while(a > 0){
        a = a-4;
        if(a%7 == 0){
          printf("Yes\n");
          break;
        }
      }
    }
    if(a < 0){
      printf("No\n");
    }
  }
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

#define mod 1000000007

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;

int main() { 
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, x;
	cin >> a >> b >> x;
	if (x >= a) {
		if (x < a + b) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int n = 0;
        for(int i = a; i <= b; i ++) {
        	if(c % i == 0) {
        		n ++;
        	}
        }
        System.out.println(n);
     }
}


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

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n,k;
	cin >> n >> k;
	
	int a[n+1];
	for (int i = 1; i <= n; i++)
	cin >> a[i];
	int dp[n+1];
	dp[1] = 0;
	dp[2] = abs(a[2]-a[1]);
	for (int i = 3; i <= n; i ++)
	{
		dp[i] = INT_MAX;
		for (int j = 1; j <= k && i - j > 0; j++)
		dp[i] = min(dp[i-j] + abs(a[i] - a[i-j]),dp[i] );
		
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
i=0
N=int(input())
#eH, W=input().split()
#S=input()
#T=input()
#S_list=list(S)
T_list=  list(map(int, input().split(" ")))
M=int(input())
drink_list = [list(map(int, input().split(" ")))for i in range(M)]
#print(T_list[1])
#H=int(H)
#W=int(W)
#C=int(C)
#K=int(K)
T_dummy_list=[]
pixel_list=[]
total=0
t=0
#センテンスを暗記するのではなく、まずinput()を書いて、膨らます感じで記述する。すると#思考の流れ通りに書ける。素晴らしい！
#for i in range(K):
# ID_list.append(i+1)
#print(ID_list)
#for i in range(H)
#この下の行が二次元リストの読み込
#intを消して記号を読み込めるようにしたしかしこれでは文字列から読み込んでいるのと同じ
#pixel_list =  [list(input())for i in range(H)]
#for i in range(H):
#  ppixel_list=list(input())
#  
#print(pixel_list)
i=0
j=0
#high_pixel_list =[['' for i in range(W)]for j in range(2*H)]
#print(high_pixel_list)
#print(pixel_list[0][1])#行　列の順番にかっこが並んでいる

#整数二次元配列を読み込む時のやり方
#gate_list =  [list(map(int, input().split(" ")))for i in range(M)]
#センテンスを暗記するのではなく、まずinput()を書いて、膨らます感じで記述する。すると#思考の流れ通りに書ける。素晴らしい！
for i in range(M):
 total=0
 T_dummy_list[:]=T_list[:]
 T_dummy_list[drink_list[i][0]-1]=drink_list[i][1]
 #print(T_dummy_list)
 for j in range(N):
    #print(T_dummy_list[j])
    t=T_dummy_list[j]
    total=total+t

 print(total)


Measured memory_bytes: 3064
using System;
using System.Linq;

namespace A___Three_letter_acronym
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split();

            Console.WriteLine(("" + s[0].First() + s[1].First() + s[2].First()).ToUpper());
        }
    }
}


Measured memory_bytes: 13268
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
bool ex[26];
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;cin>>s;
  FOR(i,0,s.length())ex[s[i]-'a']=true;
  if(s.length()==26){
    vector<char> v;
    FOR(i,0,26)v.push_back(s[i]);
    if(next_permutation(v.begin(),v.end())){
      FOR(i,0,26){
        cout<<v[i];
        if(s[i]!=v[i]){
          cout<<endl;
          return 0;
        }
      }
    }
    else cout<<-1<<endl;
  }else{
    FOR(i,0,26){
      if(!ex[i]){
        cout<<s<<char(i+'a')<<endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define mp make_pair
using namespace std;
ll used[100009][2];
int main(){
	ll n;
	cin>>n;
	vector<ll> a,b,c,ans;
	for(int i=0;i<n;i++){
		ll x,y;
		cin>>x>>y;
		a.pb(x);
		b.pb(y);
		c.pb(x+y);
	}
	ll a1 = 0, a2 = 0;
	for(int i=0;i<n;i++){
		a1 += a[i];
		a2 += b[i];
	}
	ans.pb(a1);
	ans.pb(a2);
	vector<pair<ll,ll> > as,bs;
	for(int i=0;i<n;i++){
		as.pb(mp(a[i],i));
		bs.pb(mp(b[i],i));
	}
	ll a3 = 0;
	sort(as.begin(),as.end());
	sort(bs.begin(),bs.end());
	as.pb(mp(mod,n));
	bs.pb(mp(mod,n));
	ll apos = 0,bpos = 0, f=0;
	for(int i=0;i<n;i++){
		if( as[apos].first <= bs[bpos].first){
			a3 += as[apos].first;
			used[as[apos].second][0]++;
			//cout<<as[apos].first<<" "<<as[apos].second<<endl;
			if(used[as[apos].second][1]>0){f=1;}
			apos++;
		}
		else{
			a3 += bs[bpos].first;
			used[bs[bpos].second][1]++;
			//cout<<bs[bpos].first<<" "<<bs[bpos].second<<endl;
			if(used[bs[bpos].second][0]>0){f=1;}
			bpos++;
		}
	}
	if(f==1){ans.pb(a3);}
	ll a4 = mod;
	a4 *= mod;
	vector< pair<ll,ll> > al;
	for(int i=0;i<n;i++){
		al.pb(mp(a[i],i));
		al.pb(mp(b[i],i));
	}
	sort(al.begin(),al.end());
	ll su=0;
	for(int i=0;i<n;i++){
		su+=al[i].first;
	}
	for(int i=0;i<n;i++){
		ll tsu = su;
		tsu -= min(a[i],b[i]);
		if(al[n].second != i)tsu += al[n].first;
		else tsu += al[n+1].first;
		if(tsu<a4){a4=tsu;}
	}
	if(f==0)ans.pb(a4);
	sort(ans.begin(),ans.end());
	cout<<ans[0]<<endl;
	return 0;
}

Measured memory_bytes: 13056
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
#define INF 10000000000
#define PI 3.141592653589793

int main() {
	int h, w, k, cnt, ans = 0;
	cin >> h >> w >> k;
	vector<vector<bool>> c(h, vector<bool>(w));
	vector<bool> h_table(h, false);
	vector<bool> w_table(w, false);
	string mark;
	for (int i = 0; i < h; i++) {
			cin >> mark;
		for (int j = 0; j < w; j++) {
			if (mark.substr(j, 1) == "#") c[i][j] = true;
		}
	}

	for (int hbit = 0; hbit < (1 << h); hbit++) {
		for (int x = 0; x < h; x++) {
			h_table[x] = false;
			if (hbit & (1 << x)) {
				h_table[x] = true;
			}
		}
		for (int wbit = 0; wbit < (1 << w); wbit++) {
			for (int y = 0; y < w; y++) {
				w_table[y] = false;
				if (wbit & (1 << y)) {
					w_table[y] = true;
				}
			}
			cnt = 0;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (h_table[i] && w_table[j]) {
						if (c[i][j]) cnt++;
					}
				}
			}
			if (cnt == k)ans++;
		}
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>

using namespace std;
int main(){
    int N;
    cin>>N;
    int a[N+3];
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    int sub=a[0];
    int ans=0;
    for(int i=0;i<N;i++){
       
         ans+=1;
        if(sub==2){
           cout<<ans<<endl;
            return 0;
        }
        sub=a[sub-1];
       
    }
    
        cout<<-1<<endl;
    
    return 0;
    
}


Measured memory_bytes: 640
# Intersection of Circles
import math

class Circle:
    def __init__(self, x, y, r):
        self.x = x
        self.y = y
        self.r = r

def Exchange(c1, c2):
    return list((c2, c1))

data = list(map(int, input("").split()))
c1 = Circle(data[0],data[1],data[2])

data = list(map(int, input("").split()))
c2 = Circle(data[0],data[1],data[2])

if c1.r < c2.r:
    [c1, c2] = Exchange(c1, c2)
 
d = math.sqrt((c1.x - c2.x)**2 + (c1.y - c2.y)**2)

if d > c1.r + c2.r:
    print(4)
elif d == c1.r + c2.r:
    print(3)
elif c1.r - c2.r < d and d < c1.r + c2.r:
    print(2)
elif d == c1.r - c2.r:
    print(1)
elif d < c1.r - c2.r:
    print(0)



Measured memory_bytes: 5676
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N);
	int res = 0;
	int mn = (int)1 << 60;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A.begin(), A.end());
	for (int i = 0; i < N - 1; i++) {
		if (mn > abs(2 * A[i] - A[N - 1])) {
			mn = abs(2 * A[i] - A[N - 1]);
			res = i;
		}
	}

	cout << A[N - 1] << " " << A[res] << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

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


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}

int main() {
	bool flg = false;
	vector<vll> A(3, vll(3));
	rep(i, 0, 3) {
		rep(j, 0, 3) {
			std::cin >> A[i][j];
		}
	}
	ll N, B;
	map<ll, bool> dic;
	std::cin >> N;
	rep(i, 0, N) {
		std::cin >> B;
		dic[B] = true;
	}


	rep(i, 0, 3) {
		if (dic[A[i][0]] && dic[A[i][1]] && dic[A[i][2]]) {
			flg = true;
		}
	}
	rep(i, 0, 3) {
		if (dic[A[0][i]] && dic[A[1][i]] && dic[A[2][i]]) {
			flg = true;
		}
	}

	if (dic[A[1][1]] && ((dic[A[0][0]] && dic[A[2][2]]) || (dic[A[0][2]] && dic[A[2][0]]))) {
		flg = true;
	}
	if (flg) {
		std::cout << "Yes" << endl;
	}
	else {
		std::cout << "No" << endl;
	}

	return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define me(a,x) memset(a,x,sizeof(a))
#define sc scanf
#define itn int
using namespace std;
const int N=1e6;
const long long mod=1e9+7;
const int oo=0x7fffffff;
const int sup=0x80000000;
typedef long long ll;
typedef unsigned long long ull;
template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}
template <typename it>
string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}
template <typename it>int o(it a){cout<<a<<endl;return 0;}
ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}
ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}
int main()
{
    int n,d;
    cin>>n>>d;
    int lldff=n/(d*2+1);
    if(n%(2*d+1))
        lldff++;
    cout<<lldff<<endl;
}


Measured memory_bytes: 256
import math

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

m = min(A, B, C, D, E)

s = (math.floor(N / m) if N % m != 0 else (math.floor(N/m) - 1)) + 5
print(s)


Measured memory_bytes: 3060
// AtCoder165 C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>
#include <ctype.h>

// qsortで用いる比較用関数．*a<*bならaが先になる．
int compare(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

int revcompare(const void* a, const void* b) {
    return *(int*)b- *(int*)a;
}

int main() {
    int i,j;
    int n;

    int k;
    char s[101];

    scanf("%d", &k);
    scanf("%s", s);

    if(strlen(s) <= k){
        printf("%s", s);
    }else{
        for(i=1;i<=k;i++){
            printf("%c", s[i-1]);
        }
        printf("...");
    }
    return 0;

}

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

int main(){
	int n, m;
	long long ans = LONG_LONG_MIN;
	cin >> n >> m;
	vector<long> x(n), y(n), z(n), sum(n);
	for(int i= 0; i<n; i++){
		cin >> x[i] >> y[i] >> z[i];
	}
	for(int i= -1; i<2; i+=2){
		for(int j= -1; j<2; j+=2){
			for(int k= -1; k<2; k+=2){
				for(int l= 0; l<n; l++){
					sum[l] = i*x[l] + j*y[l] + k*z[l];
				}
				sort(sum.begin(), sum.end());
				reverse(sum.begin(), sum.end());
				long long tmp = 0;
				for(int l = 0; l<m; l++){
					tmp += sum[l];
				}
				if(tmp > ans) ans = tmp;
			}
		}
	}
	cout << ans;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long

using namespace std;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

int N;

bool ok_triangle(int a, int b, int c) {
  return
    (a < (b + c)) && (b < (c + a)) && (c < (a + b));
}

int main () {
  vector<int> l;
  cin >> N;
  Rep(i, N) {
    int tmp;
    cin >> tmp;
    l.push_back(tmp);
  }
  sort(l.begin(), l.end());

  ll int ans = 0;

  for (int i=0;i<N;++i) {
    for (int j=i+2;j<N;++j) {

      //printf("%d %d %d %d\n", i, j, l[i], l[j]);

      int left = j;
      for (int k=i+1;k<j;++k) {
        if (l[k] > l[j] - l[i]) {
          left = k;
          break;
        }
      }
      if (left == j) {
        continue;
      }

      int right = i;
      for (int k=j-1;k>i;--k) {
        //printf("%d\n", k);
        if (l[k] < l[j] + l[i]) {
          //printf("%d\n", k);
          right = k;
          break;
        }
      }
      if (right == i) {
        continue;
      }

      if (left > right) {
        continue;
      }
      //printf("%d %d\n", left, right);

      ans += (right - left + 1);
    }
  } 

  cout << ans << "\n";
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

bool isPrime(ll n)
{
    if (n <= 1) return false;

    bool flag = true;
    for (ll i = 2; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            flag = false;
            break;
        }
    }

    return flag;
}

int main()
{
    ll Q;
    cin >> Q;
    vector<ll> l(Q), r(Q);
    REP(i, Q) cin >> l[i] >> r[i];

    const ll MAXN = 100000;
    map<ll, ll> countPrime;
    countPrime[1] = 0;
    for (ll i = 3; i <= MAXN; ++i)
    {
        if (i % 2 == 1)
        {
            if (isPrime(i) && isPrime((i + 1) / 2))
            {
                countPrime[i] = countPrime[i - 2] + 1;
            }
            else
            {
                countPrime[i] = countPrime[i - 2];
            }
        }
    }
    REP(i, Q)
    {
        ll ans = 0;
        ll left = l[i], right = r[i];
        if ((isPrime(left) && isPrime((left + 1) / 2)))
        {
            ans = countPrime[right] - countPrime[left] + 1;
        }
        else
        {
            ans = countPrime[right] - countPrime[left];
        }
        cout << ans << endl;
    }
}


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

int main(){
    long long k,n;
    cin >> k >> n;
    vector<long long> homes(n);
    for (long long i = 0; i < n; i++){
        cin >> homes.at(i);
    }
    
    long long longest = k + homes[0] - homes[n-1];
    for (long long i = 0; i < n - 1; i++){
        longest = max(longest,homes[i+1]-homes[i]);
        }
    
    cout << k - longest << endl;
}

Measured memory_bytes: 1792
def solve():
    ans = 0
    N = int(input())
    P = list(map(int, input().split()))
    lis = [0]*N
    for i in range(N):
        if i+1==P[i]:
            if lis[i-1]==0:
                lis[i]=1
    ans = sum(lis)
    return ans
print(solve())


Measured memory_bytes: 14008
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int main() {
    string s, t;
    cin >> s >> t;

    vector<bool> used(26, false);
    vector<int> con(26, -1);

    int n = s.size();
    bool ok = true;
    REP(i, n){
        if(con[s[i]-'a'] != -1)
            s[i] = con[s[i]-'a']+'a';
        else{
            if(used[t[i]-'a']){
                ok = false;
                break;
            }
            else{
                used[t[i]-'a'] = true;
                con[s[i]-'a'] = t[i]-'a';
                s[i] = t[i];
            }
        }
    }
    ok &= (s == t);

    cout << (ok ? "Yes": "No") << endl;

    return 0;
}

Measured memory_bytes: 776