akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int N;
vector<int>D;

int main(void)
{
	cin >> N;
	for (int i = 0; i < N; ++i) {
		int d; cin >> d;
		D.push_back(d);
	}
	D.push_back(0);
	N++;
	int a[13] = {};
	for (int i = 0; i < N; ++i) {
		a[D[i]]++;
	}
	for (int i = 0; i <= 12; ++i) {
		if (a[i] >= 3) {
			cout << "0\n";
			return 0;
		}
	}
	int ans = 0;
	for (int B = 0; B < (1 << 13); ++B) {
		vector<int>vec;
		for (int i = 0; i <= 12; ++i) {
			if (a[i] == 0) {
				continue;
			}
			if (a[i] == 1) {
				int day = i;
				if (B & (1 << i))day = 24 - i;
				day %= 24;
				vec.push_back(day);
			}
			else {
				vec.push_back(i);
				vec.push_back((24 - i) % 24);
			}
		}
		sort(vec.begin(), vec.end());
		vec.push_back(vec[0] + 24);
		int small = 114514;
		for (int i = 1; i < vec.size(); ++i) {
			small = min(small,
				abs(vec[i] - vec[i - 1]));
		}
		ans = max(ans, small);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import math
def isPrime(n):
  if n<2:
    return False
  if n == 2:
    return True
  if n % 2 == 0:
    return False
  m = math.floor(math.sqrt(n))
  for p in range(3,n+1,2):
      if n % p == 0:
        return False
      if p > m:
        # 素数がnの平方根を超えたら終了
        break
  return True
N=int(input())
if isPrime(N):
    print(1)
else:
    n=N
    count=0
    s=0
    S=0
    for i in range(2,N+1):
        if n<i:
            break
        s=1
        count=0
        while 1:
            if n%i!=0:
                break
            count+=1
            n=int(n/i)
        while 1:
            if count<int(s*(s+1)/2):
                S+=s-1
                break
            s+=1
        if i==10000:
            if isPrime(n):
                S+=1
                break
    print(S)
            









Measured memory_bytes: 65304
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    long long solve(int N) {
        long long res = (N - 1) * 1LL * N / 2;
        return res; 
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    Solution sol;
    cout << sol.solve(N) << "\n";

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
string a;
int main()
{
	cin>>a;
	int lena=a.length();
	if(a[0]==a[lena-1])
	{
		if(lena%2==0) cout<<"First";
		else cout<<"Second";
	}
	else
	{
		if(lena%2==0) cout<<"Second";
		else cout<<"First";
	}
	return 0;
 } 

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
ll mod = 1e9 + 7;

using namespace std;



int main()

{
	string N;

	cin >> N;
	int size = N.length();
	int ans = 0;

	for (int i = 0; i < size-1; i++)
	{
		char c = N[i];
		if (N[i] != N[i + 1])
		{
			ans++;
		}
	}


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

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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)

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

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

struct UnionFind{
    vector<int> parents;
    vector<int> rank;
    UnionFind(int n){
        parents.resize(n);
        rank.assign(n, 1);
        REP(i, n){
            parents[i] = i;
        }
    }
    int find(int x){
        if(parents[x] == x) return x;
        return parents[x] = find(parents[x]);
    }
    
    int unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return -1;
        if(rank[x] > rank[y]) parents[y] = x;
        else{
            parents[x] = y;
            if(rank[x]==rank[y]) rank[y]++;
        }
        return 0;
    }
    
    bool same(int x, int y){
        return find(x) == find(y);
    }
};

int N;
int main(){
    ios::sync_with_stdio(false);
    cin >> N;
    vector<pair<ll, int> > x(N);
    vector<pair<ll, int> > y(N);
    REP(i, N) {
        int tx, ty;
        cin >> tx >> ty;
        x[i] = make_pair(tx, (int)i);
        y[i] = make_pair(ty, (int)i);
    }
    sort(all(x));
    sort(all(y));
    priority_queue<tuple<ll, int, int>, vector<tuple<ll, int, int> >, greater<tuple<ll, int, int> > > que;
    REP(i, N-1) {
        que.push(make_tuple(x[i+1].first - x[i].first, x[i+1].second, x[i].second));
        que.push(make_tuple(y[i+1].first - y[i].first, y[i+1].second, y[i].second));
    }
    
    UnionFind uf(N);
    ll ans = 0;
    while(que.size() > 1) {
        tuple<ll, int, int> t = que.top();que.pop();
        if (! uf.same(get<1>(t), get<2>(t))) {
            ans += get<0>(t);
            uf.unite(get<1>(t), get<2>(t));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9328
#include<bits/stdc++.h>
#define int long long
#define REP(i,a,n) for(int i=a;i<(n);i++)
#define RE return
#define FILL(a,b) memset(a,b,sizeof(a))
#define SO(a) sort(all(a))
#define pb push_back
#define sz(a) a.size()
#define V vector
#define ld long double
#define viit(a) vector<int>::iterator a
#define IT iterater
#define FOR(i,a,n) for(int i=a;i<=(n);i++)
#define B(s) s.back()
#define all(a) a.begin(),a.end()
#define ER1(a) a.erase(a.begin())
#define ER0(a) a.erase(a.end())
#define pii pair<int,int>
#define pause system("PAUSE")
#define cls system("CLS")
using namespace std;
int end(int x){
	cout<<x<<endl;
	exit(0);
}
signed main()
{
	int x,k;
	cin>>k;
	if(k%2==0||k%5==0)end(-1);
	x=0;
	for(int i=1;i<=1e6;i++){
		x=(x*10+7)%k;
		if(!x)end(i);
	}
	end(-1);
    return 0;
}


Measured memory_bytes: 3524
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int n;
    long z, w;
    scanf("%d %ld %ld", &n, &z, &w);
    int i;
    long a[n];
    for (i = 0; i < n; i++)
        scanf("%ld", &a[i]);

    if (n == 1)
        printf("%ld\n", labs(a[0] - w));
    else {
        if (labs(a[n - 1] - w) > labs(a[n - 2] - a[n - 1]))
            printf("%ld\n", labs(a[n - 1] - w));
        else
            printf("%ld\n", labs(a[n - 2] - a[n - 1]));
    }

    return 0;
}

Measured memory_bytes: 128
N = gets.chomp.to_i
i = N
f = 0
while f == 0
    j = 2
    k = Math.sqrt(i).floor
    g = 1
    while j <= k
        if i%j == 0
            g = 0
        end
        j += 1
    end
    if g == 1
        f = 1
    end
    i += 1
end
i -= 1
puts i

Measured memory_bytes: 1788
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>



using namespace std;

int64_t mpow(int64_t a, int64_t b) {
	int64_t mod = pow(10, 9) + 7;
	int64_t res = 1;
	while (b > 0) {
		if (b & 1) res = res * a % mod;
		a = a * a % mod;
		b /= 2;
	}
	return res;
}

int64_t combination(int64_t n, int64_t k) {
	int64_t mod = pow(10, 9) + 7;
	if (k > n / 2)k = n - k;
	int64_t bunbo=1,bunsi=1;
	if (k == 0) {
		return 1;
	}
	int64_t i = 0;
	
	while (k != 0) {

		bunbo *=  k;
		bunsi *= n - i;
		bunbo %= mod;
		bunsi %= mod;
		i++;
		k--;
	}
	
	
	return (bunsi*mpow(bunbo,mod-2))%mod;
}

int main() {

	int64_t mod = pow(10, 9) + 7;
	int64_t n, a, b;
	cin >> n>>a>>b;
	int64_t ans;
	ans = mpow(2, n)-1;

	ans -= combination(n, a) + combination(n, b);

	while (ans < 0) {
		ans += mod;
	}
	cout << ans;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int main()
{
	ios::sync_with_stdio(0);
	cin>>n;int a1=0,a2=0,a4=0;
	for(int i=1;i<=n;i++){
		int x;cin>>x;
		if(x%4==0)a4++;
		else if(x%2==0)a2++;
		else a1++;
	}
	if(a2==0&&a4>=a1-1)puts("Yes");
	else{
		if(a4>=a1)puts("Yes");
		else puts("No");
	}
	return 0;
}

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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

template<typename T>
using reversed_priority_queue = \
    std::priority_queue<T, std::vector<T>, std::greater<T> >;

signed main() {
    ll Q;
    cin>>Q;

    ll suma = 0;
    ll sumb = 0;
    priority_queue<ll> ql; // 中央値の左側部分
    reversed_priority_queue<ll> qr; // 中央値の右側部分

    ql.push(-3000000000);
    qr.push(3000000000);

    rep(i,0,Q){
        ll q;
        cin>>q;
        if (q == 1) {
            // 更新クエリ
            ll a, b;
            cin>>a>>b;
            sumb+=b;
            if (ql.size() == qr.size()) {
                // 奇数個目の追加
                if (ql.top() <= a && a <= qr.top()) {
                    ; // 最小区間内への追加なのでsumaの増分はなし
                } else {
                    // 最小区間外への追加なので、sumaは近いほうとの差分を追加
                    suma += min(abs(ql.top()-a), abs(qr.top()-a));
                }
            } else {
                // 偶数個目の追加
                // 単純に中央値との差分
                suma += abs(ql.top() - a);
            }

            if (a <= ql.top()) {
                ql.push(a); 
            } else {
                qr.push(a); 
            }
            // cout<<"hoge: "<<suma<<endl;

            if (!( ql.size() == qr.size() || ql.size() == qr.size() + 1)) {
                // キューを整理
                if (qr.size() > ql.size()) {
                    // 右側に追加しすぎ
                    // ql.size() + 1 == qr.size() になってしまっている
                    ql.push(qr.top());
                    qr.pop();
                } else {
                    // 左側に追加しすぎ
                    qr.push(ql.top());
                    ql.pop();
                }
            }
        } else {
            // 求値クエリ
            cout<<ql.top()<<" "<<suma+sumb<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3828
N,Q = gets.split.map(&:to_i)
STX = N.times.map{
	s,t,x = gets.split.map(&:to_i)
	next s-x,t-x,x
}.sort_by!{|s,| s }
D = Q.times.map{ gets.to_i }

min = []

puts D.map{|d|
	while ! STX.empty? && STX[0][0] <= d
		_,t,x  = STX.shift
		i = min.bsearch_index{|_,xm| x<xm }||min.size
		j = min.bsearch_index{|tm,| t<tm }||min.size
		min[i...j] = i<=j ? [[t,x]] : []
	end
	min.shift(min.bsearch_index{|tm,| d<tm }||min.size)
	next min.empty? ? -1 : min[0][1]
}


Measured memory_bytes: 35320
def sort(a,b,c):
    l=[a,b,c]
    l.sort()
    return l

n=int(input())
s=input()
r=s.count('R')
g=s.count('G')
b=s.count('B')
sum=r*g*b
for i in range(n-2):
    for j in range(i+1,n-1):
        k=2*j-i
        if k<n and s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]:
            sum-=1
print(sum)

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define int long long 
#define float long double 
#define el '\n'
#define all(a) (a).begin(),(a).end()
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
        enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
        ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
        *this << "[";
        for (auto it = d.b; it != d.e; ++it)
                *this << ", " + 2 * (it == d.b) << *it;
        ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int dp[3001][3001];

signed main(){
        IOS;
        string s,t;
        cin >> s >> t ;
        int n = (int)s.size() , m = (int)t.size() ; 

        for(int i=1;i<=n;i++){
                for(int j=1;j<=m;j++){
                        if(s[i-1] == t[j-1]){
                                dp[i][j] = dp[i-1][j-1] + 1;
                        }
                        dp[i][j] = max({dp[i][j],dp[i-1][j],dp[i][j-1]});
                }
        }

        for(int i=0;i<=n;i++){
                debug() << imie(range(dp[i],dp[i]+m+1));
        }
        string ans = "" ;
        int i = n , j = m ;
        while(i > 0 and j > 0){
                if(s[i-1] == t[j-1]){
                        ans+=s[i-1];
                        i--;
                        j--;
                }else if( dp[i-1][j] > dp[i][j-1] ){
                        i--;
                }else{
                        j--;
                }
        }
        reverse(all(ans));
        cout << ans << endl ;
        return 0;
}

Measured memory_bytes: 70656
import numpy as np
arr = np.zeros((3,3), dtype=np.int8)

a = [int(i) for i in input().split(' ') ]
b = [int(i) for i in input().split(' ') ]
c = [int(i) for i in input().split(' ') ]

for ii in range(3):
  arr[ii] = [a,b,c][ii]

n = int(input())

ca = []
for nn in range(n):
  aaa = int(input())
  for i in range(3):
    for j in range(3):    
      if arr[i,j]==aaa:
        ca.append((i,j))

if (0, 0) in ca and (1,1) in ca and (2,2) in ca:
  print('Yes')

elif (0, 2) in ca and (1,1) in ca and (2,0) in ca:
  print('Yes')

elif (0, 0) in ca and (0,1) in ca and (0,2) in ca:
  print('Yes')
  
elif (1, 0) in ca and (1,1) in ca and (1,2) in ca:
  print('Yes')
  
elif (2, 0) in ca and (2,1) in ca and (2,2) in ca:
  print('Yes')
  
elif (0, 0) in ca and (1,0) in ca and (2,0) in ca:
  print('Yes')
  
elif (0, 1) in ca and (1,1) in ca and (2,1) in ca:
  print('Yes')
  
elif (0, 2) in ca and (1,2) in ca and (2,2) in ca:
  print('Yes')
  
else:
  print('No')



Measured memory_bytes: 12056
#include<stdio.h>
#define min(a,b) (a<b?a:b)
int main( )
{
	int i,N,X,m,Min=200000,Sum=0;
	scanf("%d%d",&N,&X);
	for(i=1;i<=N;i++)
	{
		scanf("%d",&m);
		Min=min(Min,m);
		Sum+=m;
	}
	printf("%d",N+(X-Sum)/Min);
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <complex>
#include <cmath>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;


typedef complex<double> point;
typedef const point &refpoint;
typedef pair<double,point> pdp;


inline vector<point> intersect(refpoint p1, double r1, refpoint p2, double r2){
	double d = abs(p2 - p1);
	double phi = arg(p2 - p1);
	
	vector<point> ret;
	
	double costheta = (d * d + r1 * r1 - r2 * r2) / (2.0 * d * r1);
	if( abs(costheta) > 1.0 ){	return ret;	}	//交点なし
	
	double theta = acos(costheta);

	ret.resize(2);
	ret[0] = p1 + polar(r1, phi + theta);
	ret[1] = p1 + polar(r1, phi - theta);

	if( ret[0] == ret[1] ) ret.resize(1);
	
	return ret;
}


int main(){
	const double pi = acos(-1.0);
	const double EPS = 1e-7;

	int n;
	for(; scanf("%d", &n), n != 0;){
		vector<point> pt(n);
		vector<double> r(n);
		double x, y;
		
		for(int i = 0; i < n; ++i){
			scanf("%lf%lf%lf", &x, &y, &r[i]);
			pt[i] = point(x, y);
		}

		vector<vector<double> > intrs(n);
		for(int i = 0; i < n; ++i){
			for(int j = i + 1; j < n; ++j){
				vector<point> ret = intersect(pt[i], r[i], pt[j], r[j]);
				if(ret.size() == 2){
					for(int k = 0; k < 2; ++k){
						intrs[i].push_back( arg(ret[k] - pt[i]) );
						intrs[j].push_back( arg(ret[k] - pt[j]) );
					}
				}
			}
		}
		
		double sum = 0.0;
		for(int i = 0; i < n; ++i){
			vector<double> &ci = intrs[i];

			if( ci.size() == 0 ){
				int cnt = 0;
				point check = pt[i] + (r[i] - EPS);

				for(int j = 0; j < n; ++j){
					if( norm(pt[j] - check) < r[j] * r[j]){
						++cnt;
					}
				}
				if( cnt <= 1 ){
					sum += 2.0 * pi * r[i];
				}
			}
			else{
				sort(ci.begin(), ci.end());

				for(int cur = 0; cur < ci.size(); ++cur){
					point check;
					double len;

					if(cur + 1 != ci.size()){
						check = pt[i] + polar(r[i] - EPS, (ci[cur] + ci[cur+1]) * 0.5);
						len = r[i] * (ci[cur+1] - ci[cur]);
					}
					else{
						check = pt[i] + polar(r[i] - EPS, (ci[cur] + ci[0]) * 0.5 + pi);
						len = r[i] * (ci[0] + 2.0 * pi - ci[cur]);
					}
					
					int cnt = 0;
					for(int j = 0; j < n; ++j){
						if( norm(check - pt[j]) < r[j] * r[j] ){
							++cnt;
						}
					}
					if( cnt <= 1 ){
						sum += len;
					}
				}
			}
		}
		
		printf("%.10f\n", sum);
	}
}

Measured memory_bytes: 1224
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

int main()
{
	long long X;
	cin>>X;
	long long ans = 0;
	long long n = X / 11;
	ans = 2*n;
	long long res = X % 11;
	if(res == 0){
		// do nothing
	}else if(res <= 6){
		ans += 1;
	}else{
		ans += 2;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int a;
  scanf("%d",&a);
  int x[a];
  int i;
  i = 0;
  while (i < a)
  {
    scanf("%d",&x[i]);
    i++;
  }
  i = 0;
  int t;
  t = a;
  int b;
  while (i < a)
  {
    if (t != a && i + 1 != x[i])
    {
      //printf("a%d%d\n",t,i+1);
      b = x[t];
      x[t] = x[i];
      x[i] = b;
      break;
    }
    if (i + 1 != x[i] && t == a)
    {
      //printf("t%d",i);
      t = i;
    }
    i++;
  }
  i = 0;
  while (i + 1 < a)
  {
    //printf("%d%d\n",x[i],x[i + 1]);
    if (x[i] > x[i + 1])
    {
      printf("NO");
      return(0);
    }
    i++;
  }
  printf("YES");
}

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

#define pb            push_back
#define mp            make_pair
#define all(x)        x.begin(),x.end()
#define debug(X)      { cerr<<'\n'<<(#X)<<" = "<<(X)<<'\n'; }
//#define cerr if(0)cerr

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;


int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    ll n,r=0;
    cin>>n;
    
    for (ll i=1; i<=n; ++i)
        r += i*(i%3&&i%5);
    cout<<r<<endl;
    
    
}



Measured memory_bytes: 3652
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		int n = int.Parse(Console.ReadLine());
		double[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),double.Parse);
    double sum = 0;
    for(int i = 0; i < n; i++)
    {
      sum += 1/nums[i];
    }

		Console.WriteLine(1/sum);
	}
}

Measured memory_bytes: 13268
#![allow(non_snake_case)]
#[allow(unused_imports)]
use std::io::{self, Write};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
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)*}
    };
}
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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, char) => {
        read_value!($next, String).chars().collect::<Vec<char>>()[0]
     };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
     };
    ($next:expr, isize1) => {
        read_value!($next, isize) - 1
    };
     ($next:expr, $t:ty) => {
         $next().parse::<$t>().expect("Parse error")
    };
}
macro_rules! printvec {
    ( $item:expr ) => {
        for &i in &$item {
            print!("{} ", i);
        }
        println!("");
    }
}
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}
#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);
impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}
impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}
#[derive(PartialEq, PartialOrd, Clone, Debug)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}
#[allow(dead_code)]
const MOD: usize = 1000000007;


fn main() {
    input!{
        N: usize,
        A: [usize; N],
    }

    let mut ans: Vec<(usize, usize)> = A.into_iter().enumerate().map(|(i, ai)| (i, ai)).collect();
    ans.sort_by_key(|k| k.1);

    for (i, ai) in ans {
        print!("{} ", i + 1);
    }
    println!("");

}

Measured memory_bytes: 8956
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			sc.next();// AtCoderは読み捨て
			String s = sc.next();
			sc.next();// Contestは読み捨て

			System.out.println("A" + s.substring(0, 1) + "C");

		} finally {
			sc.close();
		}
	}
}

Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

// GF(2)の行列
template<int width=64>
struct matrix {
    int h, w;
    vector<bitset<width>> dat;
    matrix() {}
    matrix(int h) : h(h), w(width), dat(h) {}

    matrix& operator+=(const matrix& r) {
        assert(h==r.h && w==r.w);
        REP(i, h) dat[i] ^= r.dat[i];
        return *this;
    }
    matrix& operator-=(const matrix& r) {
        assert(h==r.h && w==r.w);
        REP(i, h) dat[i] ^= r.dat[i];
        return *this;
    }
    matrix& operator*=(const matrix& r) {
        assert(w==r.h);
        matrix ret(h, w);
        REP(i, h) REP(j, r.w) REP(k, w) {
            ret.dat[i][j] ^= dat[i][k] & r.dat[k][j];
        }
        return (*this) = ret;
    }
    matrix operator+(const matrix& r) { return matrix(*this) += r; }
    matrix operator-(const matrix& r) { return matrix(*this) -= r; }
    matrix operator*(const matrix& r) { return matrix(*this) *= r; }
    bool operator==(const matrix& a) { return dat==a.dat; }
    bool operator!=(const matrix& a) { return dat!=a.dat; }

    friend matrix pow(matrix p, ll n) {
        matrix ret(p.h, p.w);
        REP(i, p.h) ret.dat[i][i] = 1;
        while(n > 0) {
            if(n&1) {ret *= p; n--;}
            else {p *= p; n >>= 1;}
        }
        return ret;
    }
    // 階段行列を求める O(HW^2)
    friend int gauss_jordan(matrix &a) {
        int rank = 0;
        for(ll i=a.w-1; i>=0; i--) {
            int pivot = -1;
            FOR(j, rank, a.h) if(a.dat[j][i] != 0) { pivot = j; break; }
            if(pivot == -1) continue;
            swap(a.dat[rank], a.dat[pivot]);
            REP(j, a.h) if(j != rank && a.dat[j][i] != 0) {
                a.dat[j] ^= a.dat[rank];
            }
            rank++;
        }
        return rank;
    }

    friend ostream &operator<<(ostream& os, matrix a) {
        REP(i, a.h) {
            REP(j, a.w) os << a.dat[i][j] << " ";
            os << endl;
        }
        return os;
    }
};

int main(void) {
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];

    ll x = 0;
    REP(i, n) x ^= a[i];

    // xで0の桁のみ大事
    matrix<64> mat(n);
    REP(i, n) mat.dat[i] = a[i]&(~x);
    gauss_jordan(mat);

    // xで0の桁の分を計算
    ll ans = 0;
    REP(i, n) {
        ll val = mat.dat[i].to_ulong();
        if((ans ^ val) > ans) ans ^= val;
    }
    ans *= 2;
    // xで1の桁はどう分割しても1
    REP(i, 60) if(x&1LL<<i) ans += 1LL<<i;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		int d=Math.abs(a+b-c);
		int e=Math.abs(b-a-c);
		if(c>=b&&c<=b+a||c+a>=b&&c+a<=b+a) {
			System.out.println(0);
		}
		else {
			System.out.println(d<=e?d:e);
		}
		}
	}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  ll K = nextInt();
  ll A = nextInt();
  ll B = nextInt();
  if (B - A <= 2) {
    ll ans = 1 + K;
    cout << ans << endl;
    return 0;
  }

  ll k = min(A-1, K);
  K -= k;
  ll have = A;
  have += (B-A)*(K/2);
  if (K % 2 == 1) have++;
  cout << have << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 100010
using namespace std;
struct no{
    int v;//value
    int l;//left
    int r;//right
}t[N*4];//存储的是变化值
int n, m;
void build(int i, int l, int r){
    t[i] = {0, l, r};
    if(l == r)return;;
    int mid = (l+r)/2;
    build(2*i, l, mid);
    build(2*i+1, mid+1, r);
}
void pls(int i, int l, int r, int k){
    if(l <= t[i].l && t[i].r <= r){
        t[i].v += k;
        return ;
    }
    if(l <= t[2*i].r){
        pls(2*i, l ,r, k);
    }
    if(t[2*i+1].l <= r){
        pls(2*i+1, l, r, k);
    }
}
int ans = 0;
void query(int i, int p){
    ans += t[i].v;
    if(t[i].l == t[i].r) return ;
    if(p <= t[2*i].r){
        query(2*i, p);
    }
    if(t[2*i+1].l <= p){
        query(2*i+1, p);
    }
}
int main() {
    scanf("%d %d", &n, &m);
    build(1, 1, n);
    for(int i = 0; i < m; i++){
        int op;
        scanf("%d", &op);
        if(op == 0){//区间加
            int b, c, k;
            scanf("%d %d %d", &b, &c, &k);
            pls(1, b, c, k);
        }else if(op == 1){//单点查
            int p;
            scanf("%d", &p);
            ans = 0;
            query(1, p);
            printf("%d\n", ans);
        }
    }
    return 0;
}


Measured memory_bytes: 6260
#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)
vector<lint> v[5];
lint a[110],sum[5][110];
int main()
{
	int n,b;lint w,out=0;
	cin>>n>>w;
	rep(i,n){
		cin>>a[i]>>b;v[a[i]-a[0]].pb(b);
	}
	rep(i,4){
		if(v[i].size()>0){
			sort(All(v[i]));reverse(All(v[i]));
		}
		sum[i][0]=0;
		rep(j,v[i].size()) sum[i][j+1]=sum[i][j]+v[i][j];
	}
	rep(i,v[0].size()+1) rep(j,v[1].size()+1) rep(k,v[2].size()+1) rep(l,v[3].size()+1){
		if(a[0]*i+(a[0]+1)*j+(a[0]+2)*k+(a[0]+3)*l>w) continue;
		//cout<<i<<j<<k<<l<<endl;
		out=max(out,sum[0][i]+sum[1][j]+sum[2][k]+sum[3][l]);
	}
	cout<<out<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);

    REP(i, n){
        int tmp;
        cin >> tmp;
        a[i] = tmp - 1;
    }

    int now = 0, cnt = 0;

    while(true){
        if(now == 1) break;
        if(cnt >= n){
            cout << -1 << endl;
            return 0;
        }
        ++cnt;
        now = a[now];
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 640
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	for c := 'a'; c <= 'z'; c++ {
		if strings.Contains(s, string(c)) {
			continue
		}
		fmt.Println(string(c))
		return
	}
	fmt.Println("None")
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdlib>
#include <thread>
#include <chrono>

using namespace std;

int main(void){
	int n, i;
	cin >> n >> i;
	cout << n - i + 1 << endl;
	return 0;
}


Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)
list = Array.new( N ){ gets.split.map(&:to_i) }

list.sort!
ans = 0
m = M
list.each do |l|
  
  l[1] = m if l[1] > m  
  
  ans += l[0] * l[1]
  
  m -= l[1] 
  
  break if m <= 0
  
end

puts ans

Measured memory_bytes: 10360
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;

vector<int> e[10];
int n,m,sum;
int b[10];

void dfs(int x)
{
    int i,f = 1;
    for(i=1;i<=n;i++)
    {
        if(b[i] == 0)
            f = 0;
    }
    if(f == 1)
    {
        sum++;
        return;
    }
    for(i=0;i<e[x].size();i++)
    {
        int xx = e[x][i];
        if(b[xx] || x == xx)
            continue;
        b[xx] = 1;
        dfs(xx);
        b[xx] = 0;
    }
}
int main(void)
{
    int i,j;
    while(scanf("%d%d",&n,&m)==2)
    {
        int x,y;
        for(i=0;i<=n;i++)
            e[i].clear();
        for(i=0;i<m;i++)
        {
            scanf("%d%d",&x,&y);
            e[x].push_back(y);
            e[y].push_back(x);
        }
        sum = 0;
        memset(b,0,sizeof(b));
        b[1] = 1;
        dfs(1);
        printf("%d\n",sum);
    }


    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
    {
        static void Main(string[] args)
        {
            string[] s1 = Console.ReadLine().Split(' ');
            int n = int.Parse(s1[0]), m = int.Parse(s1[1]);
            int l = 0, r = n;
            for (int i=0; i<m; i++)
            {
                string[] s2 = Console.ReadLine().Split(' ');
                int li = int.Parse(s2[0]), ri = int.Parse(s2[1]);
                l = Math.Max(l, li);
                r = Math.Min(r, ri);
            }
            Console.WriteLine (Math.Max(0, r - l + 1));
            
            
        }
    }
    //mcs Main.cs
    //mono Main.exe

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

using namespace std;

int main(){
	int N;
	while(cin >> N){
		vector<long long> a(N);
		for(auto& t : a) cin >> t;
		long long res = 0;
		while(true){
			bool update = false;
			for(int i=0;i<N;i++){
				if(a[i] <= N-1) continue;
				long long dec = a[i]/N;
				a[i] -= N * dec;
				for(int j=0;j<N;j++) if(i != j) a[j] += dec;
				res += dec;
				update = true;
			}
			if(!update) break;
		}
		cout << res << endl;
	}
}


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

int main(){
  int n;
  int max, min; long sum;

  cin >> n;
  long a[n];
  
  for(int i = 0; i < n; i++) cin >> a[i];

  max = -1000000; min = 1000000; sum = 0;
  for (int i = 0; i < n; i++) {
    if(a[i] > max) max = a[i];
    if(a[i] < min) min = a[i];
    sum += a[i];
  } 

  cout << min << " " << max << " " << sum << endl;
}

Measured memory_bytes: 1240
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#include <cstdlib>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1ll<<60;

using namespace std;
using ll = long long;
typedef pair<int, int> P;

int main(){
    int k; cin >> k;
    string s; cin >> s;
    if(s.size()<=k) out(s);
    else{
        rep(i, k) cout << s[i];
        cout<< "..." << endl;
    }
}

Measured memory_bytes: 3624
import math
ll = input().split()
f1 = int(ll[0])
f2 = int(ll[1])
H = int(ll[2])
M = int(ll[3])
theta = (360*(H*60+M)/720)-(360*M/60)
a = math.sqrt(f1**2 + f2**2 - 2*f1*f2*math.cos(math.radians(theta)))
print(a)

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

typedef long long ll;
const ll mod = 1000*1000*1000+7;

vector<int> Pr, pchk;
void getPrime() {
    pchk = vector<int>(1010, 0);
    for(int i = 2; i < 1010; i++) {
        if(pchk[i]) continue;
        Pr.push_back(i);
        int mul = 2;
        while(i * mul < 1010) {
            pchk[i * mul] = 1;
            mul++;
        }
    }
}

int N;

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

    ll ans = 1;

    for(int i = 0; i < Pr.size(); i++) {
        int p = Pr[i];
        int cnt = 0;
        while(p <= N) {
            cnt += N / p;
            p*=Pr[i];
        }
        ans *= cnt + 1;
        ans %= mod;
    }

    cout<<ans;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
    public static int[] A;
    public static int[] B;
    public static int[] C;
    public static int n;
    public static void main(String[] args) {
    int i,k=0;
    A = new int[2000001];
    B = new int[2000001];
    C = new int[2000001];
    try{
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        String str = buffer.readLine();
        n = Integer.parseInt(str);
        StringTokenizer st = new StringTokenizer(buffer.readLine());
        for(i=0;i<n;i++){
        A[i] = Integer.parseInt(st.nextToken());
        if(k<=A[i]){k = A[i];}
        }
    }catch(Exception e){
        System.out.println("error");
    }
    CountingSort(A,B,k);
    StringBuffer sb = new StringBuffer();
    for(i=1;i<n;i++){
        sb.append(B[i]+" ");
    }
    sb.append(B[i]);
    System.out.println(sb);
    }
 
    public static void CountingSort(int A[],int B[],int k){
    int i,j;
    for(i=0;i<k+1;i++){
        C[i] = 0;
    }
    for(j=0;j<n;j++){
        C[A[j]]++;
    }
    for(i=1;i<k+1;i++){
        C[i] = C[i] + C[i-1];
    }
    for(j=n-1;j>=0;j--){
        B[C[A[j]]] = A[j];
        C[A[j]]--;
    }
    }
 
}


Measured memory_bytes: 218868
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223372036854775807
#define INF 2147483647
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long a, b;
    scanf("%ld%ld", &a, &b);

    if(a%3==0 || b%3==0 || (a+b)%3==0) {
        printf("Possible\n");
    }
    else {
        printf("Impossible\n");
    }

    return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define REP(i, n) for(ll i = 0LL; i < (ll)(n); i++)
#define REPR(i, n) for(ll i = n-1; i >= 0LL; i--)
#define FOR(i, n, m) for(ll i = n; i < (ll)(m); i++)
#define PRINT(x) cout << x << endl
#define ALL(v) v.begin(), v.end()
#define INF (ll)1e18
#define INFD 1e18
#define PI 3.14159265358979
// #define MOD 1000000007
#define MOD 998244353
#define VL vector<ll>

vector<ll> dx = {-1, 1, 0, 0};
vector<ll> dy = {0, 0, 1, -1};

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


template<int mod>
struct ModInt{
	int x;
	ModInt():x(0){}
	ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
	ModInt &operator+=(const ModInt &p){
		if((x+=p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator-=(const ModInt &p){
		if((x+=mod-p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator*=(const ModInt &p){
		x=(int)(1LL*x*p.x%mod);
		return *this;
	}
	ModInt &operator/=(const ModInt &p){
		*this*=p.inverse();
		return *this;
	}
	ModInt &operator^=(long long p){
		ModInt res = 1;
		for (; p; p >>= 1) {
			if (p & 1) res *= *this;
			*this *= *this;
		}
		return *this = res;
	}
	ModInt operator-()const{return ModInt(-x);}
	ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
	ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
	ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
	ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
	ModInt operator^(long long p)const{return ModInt(*this)^=p;}
	bool operator==(const ModInt &p)const{return x==p.x;}
	bool operator!=(const ModInt &p)const{return x!=p.x;}
	explicit operator int() const { return x; }						   // added by QCFium
	ModInt operator=(const int p) {x = p; return ModInt(*this);} // added by QCFium
	ModInt inverse()const{
		int a=x,b=mod,u=1,v=0,t;
		while(b>0){
			t=a/b;
			a-=t*b;
			std::swap(a,b);
			u-=t*v;
			std::swap(u,v);
		}
		return ModInt(u);
	}
	friend std::ostream &operator<<(std::ostream &os,const ModInt<mod> &p){
		return os<<p.x;
	}
	friend std::istream &operator>>(std::istream &is,ModInt<mod> &a){
		long long x;
		is>>x;
		a=ModInt<mod>(x);
		return (is);
	}
};
typedef ModInt<MOD> mint;


struct MComb {
	std::vector<mint> fact;
	std::vector<mint> inversed;
	MComb(int n) { // O(n+log(mod))
		fact = std::vector<mint>(n+1,1);
		for (int i = 1; i <= n; i++) fact[i] = fact[i-1]*mint(i);
		inversed = std::vector<mint>(n+1);
		inversed[n] = fact[n] ^ (MOD-2);
		for (int i = n - 1; i >= 0; i--) inversed[i]=inversed[i+1]*mint(i+1);
	}
	mint ncr(int n, int r) {
		return (fact[n] * inversed[r] * inversed[n-r]);
	}
	mint npr(int n, int r) {
		return (fact[n] * inversed[n-r]);
	}
	mint nhr(int n, int r) {
		assert(n+r-1 < (int)fact.size());
		return ncr(n+r-1, r);
	}
};


int main()
{
	ll N, M, K;
	cin >> N >> M >> K;
	MComb mc(N);
	mint ans = 0;
	mint t = M;
	REP(i, N-1 - K) {
		t *= M-1;
	}
	REPR(k, K+1) {
		ans += mc.ncr(N-1, k) * t;
		t *= M-1;
	}
	PRINT(ans);
	return 0;
}


Measured memory_bytes: 4848
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;
// ------------------------------

int main() {
    ll N, M;
    cin >> N >> M;
    ll ans = 0;
    if (N >= M/2) {cout << M/2 << endl; return 0;}
    ans += N;
    M -= 2*N;
    cout << ans + M/4 << endl;
    return 0;
}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int k = scan.nextInt();
		int[] array = new int[k];

		int count = 0;

		for (int i = 0; i < k; i++) {
			array[i] = scan.nextInt();
			if (i % 2 == 0) {
				if (array[i] % 2 != 0) {
					count = count + 1;
				}
			}
		}

		System.out.println(count);
	}

}

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

int main(){
  int n, x;
  cin >> n;

  for(int i=1; i<=n; i++) {
    x = i*1.08;
    if(n==x) {
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

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

void solve(){
    ll N, M;
    cin >> N >> M;

    string S, T;
    cin >> S >> T;

    ll L;
    L = (N*M) / gcd(N,M);

    map<ll, char> mp;
    for (ll i = 0; i < N; i++) {
        mp[i*(L/N)] = S[i];
    }

    for (ll i = 0; i < M; i++) {
        if (mp.count(i*(L/M)) == 1) {
            if (mp[i*(L/M)] != T[i]) {
                cout << -1 << endl;
                return;
            }
        }
    }

    cout << L << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define debug(...)                                                             \
    { cerr << "# " << __VA_ARGS__ << "\n"; }
#else
#define debug(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 1e9 + 7;
class {
  public:
    void solve() {
        i64 n, a, b;
        cin >> n >> a >> b;
        i64 ans = pw(2, n) + MOD - 1;
        i64 p = 1, q = 1;
        for (int i = 1; i <= a; ++i) {
            (p *= n + 1 - i) %= MOD;
            (q *= i) %= MOD;
        }
        (p *= pw(q, MOD - 2)) %= MOD;
        ans = (ans + MOD - p) % MOD;
        p = 1, q = 1;
        for (int i = 1; i <= b; ++i) {
            (p *= n + 1 - i) %= MOD;
            (q *= i) %= MOD;
        }
        (p *= pw(q, MOD - 2)) %= MOD;
        ans = (ans + MOD - p) % MOD;
        ans = (ans % MOD + MOD) % MOD;
        cout << ans << '\n';
    }
    i64 pw(i64 a, i64 b) {
        i64 c = 1;
        while (b) {
            if (b & 1ll)
                c = c * a % MOD;
            a = a * a % MOD;
            b >>= 1;
        }
        return c;
    }
} NSPACE;
int main() {
    FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(Type, ...)  Type __VA_ARGS__; input(__VA_ARGS__)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
inline i64  sigma(i64 n)            { return (n * (n + 1) >> 1); }
inline i64  updiv(i64 a, i64 b)     { return (a + b - 1) / b; }
inline i64  sqr(i64 n)              { return n * n; }
inline string to_string(char c)     { return string(1, c); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}
template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void input() {}
template <class Head, class... Tail>
inline void input(Head &head, Tail&... tail) { cin >> head; input(tail...); }

inline void print() { cout << "\n"; }
template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

signed main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr);

    var(int, N);
    double sum = 0;

    rep(i, N) {
        var(int, a);
        sum += 1.0 / a;
    }

    cout << fixed << setprecision(9) << 1.0 / sum << endl;

    return 0;
}


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

int main(){
   int count=0,k,p;
   long int N;
   cin>>N;
   p=N;
  while(N>0){
       k=N%10;
      count+=k;
      N=N/10;
  }
    
   if(p%count==0){
   cout<<"Yes"<<endl;
   }else{
   cout<<"No"<<endl;
   }
   return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

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

    ll ans = (1LL+(n-1LL))*(n-1LL)/2LL;
    cout << ans << endl;
    return 0;
}

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

vector<int> adj[101000];
bool check[101000] = {};
int memo[101000];

int dfs(int pos) {
	if(adj[pos].empty()) {
		return memo[pos] = 0;
	} else if(memo[pos] != -1) {
		return memo[pos];
	} else {
		int maxx = 0;
		for(int i = 0; i < adj[pos].size(); i++) {
			maxx = max(maxx, dfs(adj[pos][i])+1);
		}
		return memo[pos] = maxx;
	}
}

int main() {
	memset(memo, -1, sizeof(memo));
	int n, m;
	scanf("%d %d", &n, &m);
	
	for(int j = 0; j < m; j++) {
		int temp1, temp2;
		scanf("%d %d", &temp1, &temp2);
		
		adj[temp1].push_back(temp2);
		check[temp2] = true;
	}
	
	int maxx = 0;
	for(int i = 1; i <= n; i++) {
		if(!check[i]) {
			maxx = max(maxx, dfs(i));
		}
	}
	
//	for(int i = 1; i <= n; i++) {
//		printf("%d ", memo[i]);
//	}
//	printf("\n");
	
	printf("%d\n", maxx);
	
}

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

struct edge { int to, cost; };
typedef pair<int, int> P;
typedef pair<string, int> SP;
#define rep(i, n) for(int i = 0; i < n; ++i)

const int INF = 1e9 + 7;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;


int main(){
    int N, M;
    cin >> N >> M;
    vector<int> A(N);

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

    int cnt = 0;
    rep(i, N){
        if(A[i]*4*M >= sum){
            cnt++;
        }
    }

    if(cnt >= M){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int INF = 1e18;
const int MOD = 1e9+7;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define MP make_pair
#define pb(n) push_back(n)
using P = pair<int,int>;
#define MAX_N 100010

signed main(){
    char c[6];
    rep(i,6) cin >> c[i];
    if(c[0] == c[5] && c[2] == c[3] && c[1] == c[4]) cout << "YES\n";
    else cout << "NO\n";
}

Measured memory_bytes: 256