akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  string S;
  cin >> S;
  if (S == "ABC") {
    cout << "ARC" << endl;
  } else {
    cout << "ABC" << endl;
  }

  return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define ll long long
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
using namespace std;
ll lim=1e18;
int main() {
 fast
 int n;cin>>n;
 
 ll res=1;
 for(int i=0;i<n;i++){
     ll x;cin>>x;
     if(x==0)res=0;
     if(res!=0 && (x>lim/res || res*x>lim) )res=-1;
     if(res!=-1)res=res*x;
     }
   cout<<res;
 
   return 0;
}

Measured memory_bytes: 3656
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 20;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

string in1[100050];
int in2[100050];
int u[100050];
int main() {
	int N, i;
	scanf("%d", &N);
	for (i = 1; i <= N; i++) cin >> in1[i] >> in2[i];

	for (i = 1; i <= N; i++) u[i] = i;
	sort(u + 1, u + N + 1, [](int a, int b) {
		if (in1[a] != in1[b]) return in1[a] < in1[b];
		else return in2[a] > in2[b];
	});
	for (i = 1; i <= N; i++) printf("%d\n", u[i]);
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int n,t[100],m,p,x,sum;
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>t[i];
        sum+=t[i];
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>p>>x;
        cout<<sum-t[p-1]+x<<endl;
    }
}

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

namespace abc161
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int k = int.Parse(Console.ReadLine());
            int x = int.Parse(Console.ReadLine());
            int y = int.Parse(Console.ReadLine());
            int ans = 0;
            if (k > n)
            {
                ans = n * x;
                Console.WriteLine(ans);
            }
            else
            {
                ans = k * x + (n-k)*y;
                Console.WriteLine(ans);

            }
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll) x.size()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define ANS cout << ans << "\n"
#define RETURN(x)    \
  cout << x << "\n"; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << "\n"
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  ll N;
  cin >> N;
  if (N < 1200) {
    COUT("ABC");
  } else {
    COUT("ARC");
  }
  return 0;
}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int N,K;
    cin>>N>>K;
    int d=0;
    rep(i,N-1)d=d+d/(K-1)+1;
    cout<<d<<endl;
    return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

int N;
string S[210];
int dis[210][210];
int col[210];

bool dfs(int v, int c) {
    col[v] = c;
    REP (nv, N) if (S[v][nv] == '1') {
        if (col[nv] == 0) {
            if (!dfs(nv, -c)) return false;
        } else if (col[nv] == c) {
            return false;
        }
    }
    return true;
}

void _main() {
    cin >> N;
    REP (i, N) cin >> S[i];
    REP (i, N) {
        REP (j, N) dis[i][j] = 1LL << 30;
        dis[i][i] = 0;
    }
    REP (i, N) REP (j, N) if (S[i][j] == '1') {
        dis[i][j] = 1;
    }
    REP (k, N) REP (i, N) REP (j, N) {
        dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
    }
    if (!dfs(0, 1)) {
        cout << -1 << endl;
        return;
    }
    int ans = 0;
    REP (i, N) REP (j, N) ans = max(ans, dis[i][j]);
    cout << ans + 1 << endl;
}

signed main(signed argc, char **argv) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 4068
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;


struct TEAM{
	long long int id,pena,ac;
};

bool cmp(TEAM x,TEAM y){
	if(x.ac!=y.ac){return x.ac>y.ac;}
	else if(x.pena!=y.pena){return x.pena<y.pena;}
	else{return x.id<y.id;}
}

long long int T,P,R;

int main() {
	
	cout << fixed << setprecision(18);
	cin>>T>>P>>R;
	while(T!=0){
		long long int tID[505],pID[505],tim[505],teampena[55][55]={};
		string str[505];
		TEAM team[55]={};
		
		for(int i=1;i<=T;i++){
			team[i].id=i;
		}
		for(int i=0;i<R;i++){
			cin>>tID[i]>>pID[i]>>tim[i]>>str[i];
			if(str[i]=="CORRECT"){team[tID[i]].ac++;team[tID[i]].pena+=teampena[tID[i]][pID[i]]+tim[i];}
			else{teampena[tID[i]][pID[i]]+=1200;}
		}

		sort(team+1,team+T+1,cmp);
		for(int i=1;i<=T;i++){
			cout<<team[i].id<<" "<<team[i].ac<<" "<<team[i].pena<<endl;
		}

		cin>>T>>P>>R;
	}
	
	
} 


Measured memory_bytes: 3280
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>

int main() {
	string s;
	cin >> s;
	int c(7);
	string a[] = { "SUN","MON","TUE","WED","THU","FRI","SAT" };
	rep(i, 7) {
		if (s == a[i]) {
			cout << c;
		}
		--c;
	}
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,c,d,f,i,j,m,tal[1000];
	scanf("%d",&a);
	scanf("%d",&b);
	m=a%2;
	c=a/2;
	if(m == 1){
		c=a+1;
		c=c/2;
	}
	for(i=0;i<b;i++){
		scanf("%d %d",&d,&f);
		if(c<d){
			d=a%d+1;
		}
		if(c<f){
			f=a%f+1;
		}
		if(d<=f){
			tal[i]=d%3;
			if(tal[i]==0){
				tal[i]=3;
			}
		}
		else{
			tal[i]=f%3;
			if(tal[i]==0){
				tal[i]=3;
			}
		}
	}
	for(i=0;i<b;i++){
		printf("%d\n",tal[i]);
	}
	return 0;
}

Measured memory_bytes: 2688
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]){
    int now = 0, a, b, ax = 0, bx = 0;
    
    cin >> a >> b;
    rep(i, 1, b-a ){
        now += i;
    }
    cout << now - a << endl;
}



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


int main(){
	int n,m;
	cin>>n>>m;
	ll ans=0,sum=0;
	map<ll,ll>s;
	s[sum]++;
	rep(i,n){
		ll a;
		cin>>a;
		sum=(sum+a)%m;
		s[sum]++;
	}

	for(auto i:s){
		ans+=i.second*(i.second-1)/2;
	}

	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4224
n=int(input())
paths=[[] for i in range(n)]
colors=[0]*(n-1)
for i in range(n-1):
    a,b=map(int,input().split())
    paths[a-1].append(i)
    paths[b-1].append(i)
m=0
for i in range(n):
    m=max(m,len(paths[i]))
print(m)
#print(paths)
for i in range(n):
    cand1,cand2=set(),[]
    #print(paths[i])
    for j in paths[i]:
        if colors[j]!=0:
            cand1.add(colors[j])
        else:
            cand2.append(j)
    now=1
    for j in cand2:
        while now in cand1:
            now+=1
        colors[j]=now
        now+=1
for i in range(n-1):
    print(colors[i])

Measured memory_bytes: 88688
#include <iostream>
#include <algorithm>

using namespace std;

void solve() {
    int n, ans =0;
    cin >> n;
    for (int i=0; i<n; ++i) {
        int li, ri;
        cin >> li >> ri;
        ans += ri-li+1;
    }
    cout << ans;
}

int main() {

	solve();
    return 0;
}


Measured memory_bytes: 3132
import sys
read = sys.stdin.read

n = int(input())
ss = read().split()

cnt_p = []
cnt_m = []
for i in range(n):
    left = 0
    right = 0
    for s in ss[i]:
        if(s == '('):
            left += 1
        elif(s == ')'):
            if(left > 0):
                left -= 1
            else:
                right += 1
    if(left-right > 0):
        cnt_p.append((right,left))
    else:
        cnt_m.append((right,left))


cnt_p = sorted(cnt_p, key=lambda x: (x[0]))
cnt_m = sorted(cnt_m, key=lambda x: (x[1]*-1))
cnt = cnt_p + cnt_m
num = 0
for right,left in cnt:
    num -= right
    if(num < 0):
        print('No')
        exit()
    num += left

if(num==0):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 229468
N = int(input())
X = list(map(int, input().split()))
sortX = sorted(X)
left = sortX[N//2 - 1]
right = sortX[N//2]
for i in X:
    if i <= left:
        print(sortX[N//2])
    else:
        print(sortX[N//2 - 1])


Measured memory_bytes: 25228
n,x = map(int,input().split())
A = list(map(int,input().split()))
inf = float('inf')
ans = inf
dp = [[inf]*n for i in range(n)]
for i in range(n):
    cnt = x*i
    for j in range(n):
        if i == 0:
            dp[i][j] = A[j]
        cnt += dp[i][j]
        if i != n-1:
            dp[i+1][(j+1)%n] = min(dp[i+1][(j+1)%n],dp[i][j])
            dp[i+1][j] = min(dp[i+1][j],dp[i][j])
    ans = min(ans,cnt)
print(ans)


Measured memory_bytes: 133468
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class BMinorChange {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        string s, t;
        cin >> s >> t;
        int res = 0;
        REP(i, s.size()) {
            if (s[i] != t[i]) res++;
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    BMinorChange solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3788
#include <iostream>

using namespace std;

int main(void){

    char a;

    cin >> a;

    if(a == 'A'){
        cout << 'T';
    }else if(a == 'T'){
        cout << 'A';
    }else if(a == 'C'){
        cout << 'G';
    }else if(a == 'G'){
        cout << 'C';
    }
    
    cout <<  endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>

using namespace std;

int main()
{
    int A, B, C;

    cin >> A >> B >> C;

    int count = 0;
    if (A == B) count++;
    if (A == C) count++;
    if (B == C) count++;

    string ans = "No";

    if (count == 1) ans = "Yes";

    // 出力
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename T>
struct weighted_unionfind{
	vector<int> p;
	vector<T> d;
	weighted_unionfind(int N){
		p = vector<int>(N, -1);
		d = vector<T>(N, 0);
	}
	int root(int x){
		if (p[x] == -1){
			return x;
		} else {
			root(p[x]);
			d[x] = d[x] + d[p[x]];
			p[x] = root(p[x]);
			return p[x];
		}
	}
	bool same(int x, int y){
		x = root(x);
		y = root(y);
		return x == y;
	}
	void unite(int x, int y, T t){
		root(x);
		root(y);
		t = t + d[y] - d[x];
		x = root(x);
		y = root(y);
		if (x != y){
			p[x] = y;
			d[x] = t;
		}
		return;
	}
};
int main(){
  int n, q;
  cin >> n >> q;
  weighted_unionfind<long long> UF(n);
  for (int i = 0; i < q; i++){
    int t;
    cin >> t;
    if (t == 0){
      int x, y;
      long long z;
      cin >> x >> y >> z;
      if (!UF.same(x, y)){
        UF.unite(x, y, z);
      }
    }
    if (t == 1){
      int x, y;
      cin >> x >> y;
      if (UF.same(x, y)){
        cout << UF.d[x] - UF.d[y] << endl;
      } else {
        cout << '?' << endl;
      }
    }
  }
}


Measured memory_bytes: 5216
#include <stdio.h>


int main()
{
    int n;
    const int largeN = 1000000000 + 7;
    
    scanf("%d", &n);

    long int ans = 1;
    for (int i = 1; i <= n; i++)
    {
	ans = ans * i;
	ans = ans % largeN;
    }

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

    return 0;
}


Measured memory_bytes: 128
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
n = int(input())
a = list(map(int,input().split()))
h = Decimal(str(sum(a)/n)).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
a = list(map(lambda x:(x-h)**2,a))
print(sum(a))

Measured memory_bytes: 5076
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define ll long long
int main()
{
	int k[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int n;
	cin>>n;
	cout<<k[n-1];
	return 0;
}

Measured memory_bytes: 256
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  vector<int>a(n);
  int flag=0;
  rep(i,n) cin >> a.at(i);
  int count=0;
//  a.at(0) /= 2;
//  cout << a.at(0) <<endl;
  for(;;){ 
	  rep(i,n){
	    if(a.at(i)%2 ==0) a.at(i)/=2;
        else{
          flag = 1;
          break;
        }
      }
    if(flag==1)break;
    count ++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;


int main(){
    ll n, m;
    cin >> n >> m;
    vector<vector<ll>> to(n);
    REP(i, m){
        ll ai, bi;
        cin >> ai >> bi;
        ai--; bi--;
        to.at(ai).push_back(bi);
        to.at(bi).push_back(ai);
    }

    vector<bool> vis(n, false);
    deque<ll> path;
    path.push_front(0);
    path.push_back(to.at(0).back());
    to.at(0).pop_back();
    vis.at(0) = true;
    vis.at(path.back()) = true;
    while(to.at(path.front()).size()){
        if(vis.at(to.at(path.front()).back())){
            to.at(path.front()).pop_back();
        }else{
            vis.at(to.at(path.front()).back()) = true;
            path.push_front(to.at(path.front()).back());
        }
    }
    while(to.at(path.back()).size()){
        if(vis.at(to.at(path.back()).back())){
            to.at(path.back()).pop_back();
        }else{
            vis.at(to.at(path.back()).back()) = true;
            path.push_back(to.at(path.back()).back());
        }
    }

    cout << path.size() << endl;
    while(!path.empty()){
        cout << path.front() + 1;
        path.pop_front();
        if(path.empty()){
            cout << endl;
        }else{
            cout << ' ';
        }
    }
    return 0;
}


Measured memory_bytes: 9396
/**
 *    author:  tourist
 *    created: 18.01.2020 23:20:51       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, l;
  cin >> n >> l;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n - 1; i++) {
    if (a[i] + a[i + 1] >= l) {
      cout << "Possible" << '\n';
      for (int j = 0; j < i; j++) {
        cout << j + 1 << '\n';
      }
      for (int j = n - 2; j >= i; j--) {
        cout << j + 1 << '\n';
      }
      return 0;
    }
  }
  cout << "Impossible" << '\n';
  return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() 
{
    int long long n;
    int long long ans;
    cin>>n;
    
    int long long k = n/500;
    n = n%500;
    int long long l = n/5;
    ans = 1000*k + 5*l;
    cout<<ans;
	return 0;
}


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

int main()
{
    int h,n;
    cin >> h >> n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin >> a[i];
        h = h-a[i];
    }
    if(h<=0)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}


Measured memory_bytes: 640
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	ll N, D;
	cin >> N >> D;

	int kotae = 0;
	rep(i, N) {
		ll D2 = D * D;
		ll X, Y;
		cin >> X >> Y;
		if (D2 >= X * X + Y * Y) {
			kotae++;
		}
	}
	co(kotae);


	Would you please return 0;
}

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

int main() {

    int N, M;
    cin >> N >> M;

    vector<int> A(N);

    int S = 0;

    rep(i, N) {
        cin >> A[i];
        S += A[i];
    }

    int ans = 0;

    for(int x : A) {
        if (x >= float(S) / (4*float(M))) {
            ans++;
        }
    }

    if (ans >= M) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

int main(){
  string a,b;
  cin>>a>>b;
  int ans=0,n=a.size(),m=b.size();

  for(int i=1;i<=n;i++){
    set<vector<int> > S;
    vector<int> v(26,0);
    for(int j=0;j<n;j++){
      v[a[j]-'a']++;
      if(j>=i) {
	v[a[j-i]-'a']--;
	S.insert(v);
      }
    }
    S.insert(v);
    v=vector<int>(26,0);
    for(int j=0;j<m;j++){
      if(i==j&&S.count(v))ans=i;
      v[b[j]-'a']++;
      if(j>=i){
	v[b[j-i]-'a']--;
	if(S.count(v))ans=i;
      }    
    }
    if(S.count(v))ans=i;
  }
  cout <<ans<<endl;
  return 0;
}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n;
signed main(){
    cin>>n;
    if(n==2)puts("-1");
    if(n==3)puts("aa.\n..a\n..a");
    if(n>=4){
        int y=n%4+4,x=(n-y)/4;
        char ans[1010][1010];
        vector<string>table[10];
        table[4]={"aabc","ddbc","bcaa","bcdd"};
        table[5]={"aabba","bcc.a","b..cb","a..cb","abbaa"};
        table[6]={"aabc..","ddbc..","..aabc","..ddbc","bc..aa","bc..dd"};
        table[7]={"aabbcc.","dd.dd.a","..d..da","..d..db","dd.dd.b","..d..dc","..d..dc"};
        rep(i,n){
            rep(j,n){
                ans[i][j]='.';
            }
        }
        rep(i,x){
            //4*i
            rep(j,4){
                rep(k,4){
                    ans[4*i+j][4*i+k]=table[4][j][k];
                }
            }
        }
        rep(i,y){
            rep(j,y){
                ans[4*x+i][4*x+j]=table[y][i][j];
            }
        }
        rep(i,n){
            rep(j,n){
                cout<<ans[i][j];
            }
            cout<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 2176
let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let ($) f g = fun x -> g (f x)

let s = read_line ()
  |> Str.global_replace (Str.regexp "A") "x"
  |> Str.global_replace (Str.regexp "BC") "y"
  |> Str.split (Str.regexp "[^xy]+")
  |> List.map (split_string $ List.rev)

let rec f pos x_cnt sum = function
  | "x" :: xs -> f (pos + 1) (x_cnt + 1) (sum + pos - x_cnt) xs
  | "y" :: ys -> f (pos + 1) x_cnt sum ys
  | _ -> sum

let () = List.map (f 0 0 0) s |> List.fold_left (+) 0 |> Printf.printf "%d\n"

Measured memory_bytes: 34352
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <queue>
using namespace std;

int main(){
    string s;
    cin >>s;
    char c[] = {'Y', 'A', 'K', 'I'};

    bool b = true;
    if(s.size() >= 4){
        for(int i = 0; i < 4; ++i){
            if(s.at(i) != c[i]){
                b = false;
                break;
            }
        }
    }else b = false;

    if(b) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
//const int MAX=;
const int MOD=1e9+7;

int adm(int a,int b){
	return (a+b)%MOD;
}

int main(){
	int H,W,K;
	cin>>H>>W>>K;
	K=K-1;
	if(W==1){
		cout<<1;
		return 0;
	}
	int ans[101][8]={};
	ans[0][0]=1;
	
	rep1(i,H){
		for(int j=0; j<(1<<(W-1)); ++j){
			int b[8]={};
			bool amida=true;
			rep(k,W-1)if(j&(1<<k))b[k]=1;
			rep(k,W-1)if(b[k]&&b[k+1])amida=false;
			if(amida){
				int c[8]={};
				rep(j,W)c[j]=j;
				rep(k,W-1)if(b[k]){
					c[k]=k+1;
					c[k+1]=k;
				}
				rep(j,W)ans[i][j]=adm(ans[i][j],ans[i-1][c[j]]);
			}
		}
	}
	cout<<ans[H][K];
}

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

#define ll long long int
#define pb push_back
#define mk make_pair
#define mod 1000000007
//map<int, int>::iterator itr; 

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;t=1;
    while(t--){
        int a,b;cin>>a>>b;
        if(b%2==0&&b>=2*a&&b<=4*a){
            cout<<"Yes";
        }
        else{
            cout<<"No";
        }
    }
    return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>

int FuncBubbleSortInt(int a[], int len);
void FuncShowArray(int array[], int head, int num);

int main(void)
{
	int n, num[128];
	int count;
	int i;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &num[i]);
	count = FuncBubbleSortInt(num, n);
	FuncShowArray(num, 0, n);
	printf("%d\n", count);

	return 0;
}

int FuncBubbleSortInt(int a[], int len)
{
	int count = 0;
	int temp;
	int i, j;

	for (i = 0; i < len; i++) {
		for (j = (len - 1); j > i; j--) {
			if (a[j] < a[j - 1]) {
				temp = a[j];
				a[j] = a[j-1];
				a[j-1] = temp;
				count++;
			}
		}
	}

	return (count);
}

void FuncShowArray(int array[], int head, int num)
{
  int i;

  for (i = head; i < num; i++){
	  if (i > head) putchar(' ');
      printf("%d", array[i]);
  }
  putchar('\n');
}

Measured memory_bytes: 604
import fractions

def solve():
    a,b,c,d = map(int,input().split())
    a_c = a // c
    b_c = b // c
    a_d = a // d
    b_d = b // d
    a_cd = a // (c * d // fractions.gcd(c,d))
    b_cd = b // (c * d // fractions.gcd(c,d))

    divc = b_c - a_c
    divd = b_d - a_d
    divcd = b_cd - a_cd
    
    if a % c == 0:
        divc += 1
    if a % d == 0:
        divd += 1
    if a % (c * d // fractions.gcd(c,d)) == 0:
        divcd += 1

    print(b-a+1 -(divc + divd - divcd))

    return 0
  
solve()

Measured memory_bytes: 5076
#include <cassert>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>

int Hash(std::string Text)
{
    int Hash = 0;
    for(std::size_t i = 0; i < Text.size(); ++i){
        if(i){
            Hash *= 5;
        }
        switch(Text[i]){
        case 'A':
            Hash += 1; break;
        case 'C':
            Hash += 2; break;
        case 'G':
            Hash += 3; break;
        case 'T':
            Hash += 4; break;
        default:
            assert(false);
        }
    }
    return Hash;
}
int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    std::vector<bool> dic(std::pow(5,12), false);
    int n;
    std::cin >> n;
    for(int i = 0; i < n; ++i){
        std::string command, str;
        std::cin >> command >> str;
        if(command[0] == 'i'){
            dic[Hash(str)] = true;
        }else
        if(command[0] == 'f'){
            std::cout << (dic[Hash(str)] ? "yes" : "no") << std::endl;
        }
    }
    return 0;
 }

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

int fact(int n){
    if(n == 0) return 1;
    return n * fact(n-1);
}

int main() {
    int n;
    cin >> n;
    double x[n], y[n];
    rep(i, n) cin >> x[i] >> y[i];
    double sum = 0;
    
    int p[n];
    rep(i, n) p[i] = i+1;
    do{
        rep(i, n-1){
            double x_dif = x[p[i+1]-1] - x[p[i]-1];
            double y_dif = y[p[i+1]-1] - y[p[i]-1];
            sum += sqrt(x_dif * x_dif + y_dif * y_dif);   
        }
    }while(next_permutation(p, p+n));
    
    sum /= fact(n);
    
    cout << fixed << setprecision(12) << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main(){
  char s;
  cin >> s;
  if(0 <= s-'A' && s-'A' <= 'Z'-'A'){
    cout << 'A' << endl;
  }
  if(0 <= s-'a' && s-'a' <= 'z'-'a'){
    cout << 'a' << endl;
  }
}

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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

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

    vector<int> abc ={a, b, c};

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

    int ans = 0;

    if(abc.at(0)%2!=abc.at(1)%2) { 
        abc.at(0) += 1;
        abc.at(2) += 1;
        ans++;
    }

    ans += (abc.at(2) - abc.at(0))/2;
    ans += (abc.at(2) - abc.at(1))/2;

    if(((abc.at(2) - max(abc.at(0), abc.at(1)))%2)==1) ans++;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import math
import os
import sys

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

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


def get_divisors(n):
    """
    n の約数をリストで返す
    :param int n:
    :rtype: list of int
    """
    ret = []
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0:
            ret.append(i)
            if n // i != i:
                ret.append(n // i)
    return ret


def get_factors(n):
    """
    素因数分解
    :param int n:
    :rtype: list of int
    """
    if n <= 1:
        return []

    ret = []
    while n > 2 and n % 2 == 0:
        ret.append(2)
        n //= 2
    i = 3
    while i <= math.sqrt(n):
        if n % i == 0:
            ret.append(i)
            n //= i
        else:
            i += 2
    ret.append(n)
    return ret


A, B = list(map(int, sys.stdin.readline().split()))

fa = set(get_factors(A))
fb = set(get_factors(B))
ans = len(fa & fb) + 1
print(ans)


Measured memory_bytes: 38768
using System;

class C {
    public static void Main() {
        var n = int.Parse(Console.ReadLine());
        long a1 = 1L, a2 = 1L;
        for (int i = 0; i < n; ++i) {
            var line = Console.ReadLine().Split();
            var b1 = int.Parse(line[0]);
            var b2 = int.Parse(line[1]);
            var k = Math.Max((a1 + b1 - 1) / b1, (a2 + b2 - 1) / b2);
            a1 = k * b1;
            a2 = k * b2;
        }
        Console.WriteLine(a1 + a2);
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

int main(void){
  int ans = 700;
  char str;
  while(cin >> str){
    if(str == 'o'){
      ans += 100;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let a: Vec<(usize, usize, usize)> = (0..n)
        .map(|_| {
            (
                itr.next().unwrap().parse().unwrap(),
                itr.next().unwrap().parse().unwrap(),
                itr.next().unwrap().parse().unwrap(),
            )
        })
        .collect();

    let mut dp: Vec<Vec<usize>> = vec![vec![0; 3]; n + 1];
    for i in 1..n + 1 {
        dp[i][0] = max(
            dp[i][0],
            max(dp[i - 1][1] + a[i - 1].0, dp[i - 1][2] + a[i - 1].0),
        );
        dp[i][1] = max(
            dp[i][1],
            max(dp[i - 1][0] + a[i - 1].1, dp[i - 1][2] + a[i - 1].1),
        );
        dp[i][2] = max(
            dp[i][2],
            max(dp[i - 1][0] + a[i - 1].2, dp[i - 1][1] + a[i - 1].2),
        );
    }

    println!("{}", max(dp[n][0], max(dp[n][1], dp[n][2])));
}


Measured memory_bytes: 16636
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	int x,out=0;cin>>x;
	out=(x/500)*1000+(x%500)/5*5;
	cout<<out<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m1,m2;
int mp[1000000],max1=-9999;
long long  min1=1000000001;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>mp[i];
        if(mp[i]>max1)
            max1=mp[i];
    }
    sort(mp+1,mp+n+1);
    if(max1%2==0)
    {
        int t=max1/2;
        for(int i=1;i<n;i++)
        {
            if(abs(t-mp[i])<min1)
            {
               min1=abs(t-mp[i]);
               m1=mp[i];
            }
        }
    }
   else
   {
       int tt=max1/2+1,tt2=max1-tt;
       for(int i=1;i<n;i++)
       {
           if(abs(mp[i]-tt)<min1)
           {
               min1=abs(mp[i]-tt);
               m1=mp[i];
           }
            if(abs(mp[i]-tt2)<min1)
           {
               min1=abs(mp[i]-tt2);
               m1=mp[i];
           }
       }
   }
    printf("%d %d",max1,m1);
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<limits>
using namespace std;
typedef long ll;
int main() { 
    ll n;
    cin >> n;
    vector<ll> nums(n);
    for(auto&e:nums)
        cin >> e;

    vector<ll> dp(n, numeric_limits<ll>::max());

    dp[0] = 0;

    for(ll i=0; i < n; i++) { 
        if(i < n - 1) { 
            dp[i+1] = min(dp[i+1], dp[i] + abs(nums[i]-nums[i+1]));
        }

        if(i < n - 2) { 
            dp[i+2] = min(dp[i+2], dp[i] + abs(nums[i]-nums[i+2]));
        }
    }
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 4396
def main():
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    #n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = [int(input()) for i in range(n)]
    #a = list(map(int, input().split()))
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0
    n, a, b = map(int, input().split())
    cnt = 0
    if a == 0:
        print(0)
        return 0
    div = n // (a+b)
    cnt = div * a
    n -= div * (a+b)
    while n > 0:
        cnt += min(n,a)
        n -= a
        n -= b
    print(cnt)

if __name__ == '__main__':
    main()



Measured memory_bytes: 38356
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cstdlib>
#include <string>
#include <numeric>


using namespace std;


void a(){

    int A,B,T; cin >> A >> B >> T;

    int c = T/A;

    cout << c*B;

}

void b(){

    int N; cin >> N;

    vector<int> V(N);
    vector<int> C(N);
    for(int i = 0; i < N; i++){
        cin >> V[i];
    }
    for(int i = 0; i < N; i++){
        cin >> C[i];
    }
    int profit = 0;
    for(int i = 0; i < N; i++){
        if (V[i] - C[i] > 0){
            profit += V[i] - C[i];
        }
    }

    cout << profit;

}

int gcd(int a, int b){

    if(a < b) gcd(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;

}

void c(){
    int N; cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    // left[i] == gcd of A[0,i]
    vector<int> left(N,A[0]);
    for (int i = 1; i < N; i++ ){
        left[i] = gcd(left[i - 1], A[i]);
    }

    vector<int> right(N, A[N-1]);
    for (int i = N -2; 0 <= i; i-- ){
        right[i] = gcd(A[i], right[i + 1]);
    }

    int max_gcd = 1;
    for(int i = 1; i < N - 1; i++){
        max_gcd = max( gcd(left[i -1], right[i+1]), max_gcd);
    }

    max_gcd = max( right[1], max_gcd);// i = 0
    max_gcd = max( left[N-2], max_gcd); // i = N -1

    cout << max_gcd;

}

int main(){

    c();
    return 0;
}

Measured memory_bytes: 1408
a, b, c = [int(i) for i in input().split()]

count = 0
while True:
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        print(count)
        exit()
    if a == b == c:
        print("-1")
        exit()
    _a = a
    _b = b
    _c = c
    a = int(_b / 2 + _c / 2)
    b = int(_c / 2 + _a / 2)
    c = int(_b / 2 + _c / 2)
    count += 1
    # print("a:{} b:{} c:{} count:{}".format(a, b, c, count))


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
        String s = scan.nextLine();
        int cnt = 0;
        for(int i=0; i<s.length(); i++){
            if(s.substring(i,i+1).equals("1")) cnt++;
        }
        
        scan.close();
        System.out.println(cnt);
    }
}

Measured memory_bytes: 23764
#pragma gcc optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, m; cin >> n >> m;
    vector<vector<int>> G(n + 1);
    vector<vector<ll>> pr(n + 1), sf(n + 1);
    for (int i = 0; i < n - 1; ++i) {
        int u, v; cin >> u >> v;
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }
    for (int i = 1; i <= n; ++i) {
        pr[i].assign(G[i].size(), 1);
        sf[i].assign(G[i].size(), 1);
    }
    vector<ll> ans(n + 1, 1), ans2(n + 1, 1);
    function<void(int, int)> dfs = [&] (int u, int p) {
        for (int i = 0; i < G[u].size(); ++i) {
            int v = G[u][i];
            if (v == p) continue;
            dfs(v, u);
            pr[u][i] = sf[u][i] = (ans[v] + 1) % m;
            ans[u] *= (ans[v] + 1) % m;
            ans[u] %= m;
        }
        for (int i = 1; i < G[u].size(); ++i) {
            pr[u][i] *= pr[u][i - 1];
            pr[u][i] %= m;
            sf[u][G[u].size() - 1 - i] *= sf[u][G[u].size() - i];
            sf[u][G[u].size() - 1 - i] %= m;
        }
    };
    function<void(int, int)> dfs2 = [&] (int u, int p) {
        for (int i = 0; i < G[u].size(); ++i) {
            int v = G[u][i];
            if (v == p) continue;
            ll tr = (!i ? 1 : pr[u][i - 1]) * (i + 1 == G[u].size() ? 1 : sf[u][i + 1]) % m;
            ans2[v] *= (ans2[u] * tr % m + 1) % m;
            ans2[v] %= m;
            dfs2(v, u);
        }
    };
    dfs(1, 0);
    dfs2(1, 0);
    for (int i = 1; i <= n; ++i) cout << ans[i] * ans2[i] % m << '\n';
}

Measured memory_bytes: 27712
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <string>

using namespace std;

int main(void)
{
    int n;
    cin >>n;

    int sum = 0;
    int prev = 0;
    for(int i = 0; i < n-1; i++){
        int tmp;
        cin >>tmp;
        if(i == 0){
            sum += tmp;
        }else{
            sum += min(prev, tmp);
        }
        if(i == n-2){
            sum += tmp;
        }
        prev = tmp;
    }
    printf("%d\n", sum);
    return 0;
}

Measured memory_bytes: 256
n = int(input())
ans = 1
x = 0
for i in range(1,n+1):
    cnt = 0
    m = i
    while m > 0:
        if m % 2 == 0:
            m = m // 2
            cnt += 1
        else:
            break
    if cnt > x:
        x = cnt
        ans = i
        

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dbg puts("It's Just Begining.Wait For The End!!!!!\n")
#define CHECK(x) cout << (#x) << " is " << (x) <<"\n";
#define endl printf("\n")
typedef pair<ll,ll> pii;
#define pb push_back
#define ms(a,b) memset(a, b, sizeof(a))
#define in(x) scanf("%lld",&x)
#define out(x) printf("%lld",x)
#define X first
#define Y second
#define sps printf(" ")
#define dou(x) cout<<fixed<<setprecision(10)<<x
#define all(v) v.begin(),v.end()
#define dis(it,it1) distance(it,it1)+1
#define MAX 100005
#define pi acos(-1.0)
#define INF 9223372036854775807LL
#define MOD 1000000007
#define print(cs) printf("Case %lld: ",cs)
#define Yesno(ok) if(ok)puts("YES");else puts("NO")
#define yesno(ok) if(ok)puts("Yes");else puts("No")
ll lcm(ll a,ll b){return ((a*b)/__gcd(a,b));}
int main()
{
    ll i,j,k,l,n,m,h,s;
    in(n);in(s);in(h);in(m);
    double angle1=h*30+m*0.5,angle2=m*6;
    double angle=fabs(angle1-angle2)*pi;
    angle/=180.0;
    double ans=sqrt(n*n+s*s-2*n*s*cos(angle));
    dou(ans);endl;
}


Measured memory_bytes: 4268
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <unistd.h>
#include <fcntl.h>

int main()
{
        int fd = open("/dev/null", O_RDONLY);
        dup2(fd, 2);
        close(fd);

        int a;
        std::string s;

        std::cin >> a >> s;

        std::cerr << "hogehoge\n";

        if (a >= 3200)
                std::cout << s << "\n";
        else
                std::cout << "red\n";
}


Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll
const long double pi = 3.14159265358979323846;

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,x,m; cin >> n >> x >> m;
    n--;
    ll LOG = 40;
    vector table(LOG, vector<ll>(m + 1));
    vector data(LOG, vector<ll>(m + 1));
    
    rep(i,0,m+1){
        table[0][i] = i * i % m;
        data[0][i] = i * i % m;
    }

    rep(k,0,LOG-1){
        rep(i,0,m+1){
            table[k + 1][i] = table[k][table[k][i]];
            data[k + 1][i] = data[k][i] + data[k][table[k][i]];
        }
    }

    ll ans = x;
    rrep(i, LOG, 0) {
        if((n >> i) & 1){
            ans += data[i][x];
            x = table[i][x];
            // debug(x, ans);
        }
    }

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

Measured memory_bytes: 66668
#include<stdio.h>
void trace(int A[],int N)
{
    int i ;
    for(i = 0 ;i <N;i++)
    {
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}
void insertionSort(int A[],int N)
{
    int j,i,v;
    for(i = 1;i<N;i++)
    {
        v=A[i];
        j = i-1;
        while(j>=0 && A[j]>v)
        {
            A[j+1] =A[j];
            j--;
        }
        A[j+1] =v;
        trace(A,N);
    }
}
int main()
{
    int N,i,j;
    int A[100];
    scanf("%d",&N);
    for(i = 0 ;i<N;i++){
        scanf("%d",&A[i]);
    }
    trace(A,N);
    insertionSort(A,N);
    return 0;
}


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

bool isPrime(int n)
{
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0) {
			return false;
		} 
	}
	return true;
}
// nより大きく2nより小さい素数を数える
int count(int n)
{
	int sum = 0;
	for (int i = n+1; i <= 2 * n; i++) {
		if (isPrime(i)) {
			sum++;
		}
	}
	return sum;
}

int main()
{
	int n, m;
	vector<int> t;
	
/*
* どちらかが√x以下であることが明らかなので！
*/
	while (cin >> n) {
		if (n == 0) {
			break;
		}

		// 入力の読み込み
		//t.clear();
		//t.resize(n);
		
		m = count(n);

		// 出力
		cout << m << endl;
	}

	return 0;
}

Measured memory_bytes: 1160