akhauriyash/Code-Regression huggingface dataset:
#include <iostream>     // Cでいうstdio.h 標準入出力ライブラリ
#include <algorithm>    // ソート
#include <vector>       // 可変長配列
using namespace std;    // 名前空間
int main(void){

    // int変数定義
    int num1, num2;
    // コンソール入力
    cin >> num1, cin >> num2;

    // 配列定義
    vector<string> strvec(num1);

    //cout << "before:";
    // num1(N)の文だけループし、文字列(L)を標準入力で配列に格納
    for(int i = 0; i < num1; i++) {
        cin >> strvec[i];
        //cout << strvec[i];
    }
    
    // ソート
    sort(strvec.begin(), strvec.end());
    
    // ソート結果表示
    //cout << "\n" << "after:";
    for(int i = 0; i < num1; i++) {
        cout << strvec[i];
    }
}

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


def main():
    from decimal import Decimal
    import sys
    input = sys.stdin.readline

    a, b = input().split()
    a = int(a)
    b = Decimal(b)
    b *= 100
    ans = int((a * b) / 100)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 10068
/*
{By GWj
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define R(a) cin>>a
#define R2(a,b) cin>>a>>b
#define check_min(a,b) a=min(a,b)
#define check_max(a,b) a=max(a,b)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
/*}
*/
LL n;
LL exGcd(LL a,LL b,LL &x,LL &y)
{
    if(b==0)
    {
        x = 1;
        y = 0;
        return a;
    }
    LL r = exGcd(b,a%b,x,y);
    LL t = x; x = y;
    y = t-a/b*y;
    return r;
}
int main(){
	fastio;
	cin>>n;
	n<<=1;
	LL rest=n-1;
	for(LL i=1;i*i<=n;i++){
		LL a,b;
		if(n%i==0){
			a=i;
			b=n/i;
			if(__gcd(a,b)!=1) continue;
			LL x,y;
			exGcd(a,b,x,y);
//			cout<<a<<" "<<b<<" "<<x<<" "<<y<<endl;
//			if(y<=0){
//				LL t=((-y+a)/a);
//				y+=t*a;
//				x+=t*b;
//			}
//			if(x<=0){
//				LL t=((-x+b)/b);
//				y+=t*a;
//				x+=t*b;	
//			}
//			if(y>=a&&x>=b){
//				LL t=min((y-1)/a,(x-1)/a);
//				y-=t*a;
//				x-=t*a;
//			}
//			cout<<a<<" "<<b<<" "<<x<<" "<<y<<endl;
			if(x>=0){
				LL t=(-x+b)/b;
				x-=t*b;
				y+=t*a;
			}
			if(y<=0){
				LL t=(-y+a)/a;
				x-=t*b;
				y+=t*a;
			}
//			cout<<a<<" "<<b<<" "<<x<<" "<<y<<endl;if(a*x==-829848){
//				cout<<"!"<<endl;
//			}
			check_min(rest,-1ll*a*x);
			// a*x=b*y+1
			// min(a*x)
			swap(a,b);
			exGcd(a,b,x,y);
//			if(y<=0){
//				LL t=((-y+a)/a);
//				y+=t*a;
//				x+=t*b;
//			}
//			if(x<=0){
//				LL t=((-x+b)/b);
//				y+=t*a;
//				x+=t*b;
//			}
//			if(y>=a&&x>=b){
//				LL t=min((y-1)/a,(x-1)/a);
//				y-=t*a;
//				x-=t*a;
//			}
//			cout<<a<<" "<<b<<" "<<x<<" "<<y<<endl;
			if(x>=0){
				LL t=(-x+b)/b;
				x-=t*b;
				y+=t*a;
			}
			if(y<=0){
				LL t=(-y+a)/a;
				x-=t*b;
				y+=t*a;
			}
//			cout<<a<<" "<<b<<" "<<x<<" "<<y<<endl;
//			if(a*x==-829848){
//				cout<<"!"<<endl;
//			}
			check_min(rest,-1ll*a*x);
		}
	}
	cout<<rest<<endl;
	return 0;
}
/** 程序框架：
  *
  *
  *
  *
  **/


Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <bits/stdc++.h>
#include <algorithm>

using namespace std;



int main() {
    int N, C;
    scanf("%d %d", &N, &C);
    
    int s[N], t[N], c[N], max_t=0;
    int occupied[C+1][(int)pow(10, 6)+1];//channel & timetable
    //録画予定時間に1でマーク
    for (int i=0; i<N; i++) {
        scanf("%d %d %d", &s[i], &t[i], &c[i]);
        for (int j=s[i]; j<=t[i]; j++) occupied[c[i]][j]=1;
        max_t = max(max_t, t[i]);
    }

    int recorder=0, cnt=0;
    //同時間帯のチェック
    for (int i=1; i<=max_t; i++) {
        for (int j=1; j<=C; j++) {
            if (occupied[j][i]==1) cnt++;
        }
        recorder = max(recorder, cnt);
        cnt=0;
    }
    cout<<recorder<<endl;
}



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

int main(){

string S;
  cin >> S;
long long K, mi;
  cin >> K;
mi = S.size();  
mi = min(mi, K);
bool a = true;  
  
  for(int i = 0;i < mi;i++){
  if(S.at(i) != '1'){
  cout << S.at(i) << endl;
  a = false;  
  break;
  }
  }

if(a) cout << 1 << endl;  
return 0;
  
}

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

void swa(int &a,int i,int j)
{
	if ((a&(1<<i))&&!(a&(1<<j)))
	{
		a+=-(1<<i)+(1<<j);
	}
	else if (!(a&(1<<i))&&(a&(1<<j)))
	{
		a+=(1<<i)-(1<<j);
	}
}

vector<int> my(int n,int a,int b)
{
	if (n==1)
	{
		return {a,b};
	}
	int ex=n-1;
	while (!((a^b)&(1<<ex)))
	{
		--ex;
	}
	swa(a,n-1,ex);
	swa(b,n-1,ex);
	int na=a&~(1<<(n-1)),nb=b&~(1<<(n-1));
	auto l=my(n-1,na,na^1),r=my(n-1,na^1,nb);
	vector<int> ans;
	if (a&(1<<(n-1)))
	{
		for (auto v : l)
		{
			ans.push_back(v^(1<<(n-1)));
		}
		for (auto v : r)
		{
			ans.push_back(v);
		}
	}
	else
	{
		for (auto v : l)
		{
			ans.push_back(v);
		}
		for (auto v : r)
		{
			ans.push_back(v^(1<<(n-1)));
		}
	}
	for (auto &v : ans)
	{
		swa(v,n-1,ex);
	}
	return ans;
}

int main(int argc, char const *argv[])
{
	int n,a,b;
	cin>>n>>a>>b;
	int cnt=0;
	for (int i = 0; i < n; ++i)
	{
		if (a&(1<<i))
		{
			++cnt;
		}
		if (b&(1<<i))
		{
			++cnt;
		}
	}
	if (cnt%2==0)
	{
		cout<<"NO\n";
		return 0;
	}
	cout<<"YES\n";
	auto ans=my(n,a,b);
	cout<<ans.at(0);
	for (int i = 1; i < ans.size(); ++i)
	{
		cout<<" "<<ans.at(i);
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 1628
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int k, s;
	int x, y;
	int count = 0;

	cin >> k >> s;

	for(x = 0; x <= k; x++) {
		for(y = 0; y <= k && y + x <= s; y++) {
			if(x + y + k >= s) {
				count ++;
			}
		}
	}

	cout << count << endl;

	return 0; 
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <stdlib.h>
#include <cmath>
#include <iostream>
long long fact(long long n, long long d){
    long long res = 1;
    for (long long i = n; i > 0; i--){
        res = (res*i) % d;
    }
    return res;
}

int main(int argc, char** argv) {
    long long n;
    std::cin >> n;
    std::cout << fact(n, pow(10, 9) + 7) << std::endl;
    return 0;
}


Measured memory_bytes: 256
a, b, c, d = map(int, input().split())
x = [a, min(a+1, b), max(a, b-1), b]
y = [c, min(c+1, d), max(c, d-1), d]

ans = -int(1e19)
for i in x:
  for j in y:
    ans = max(ans, i*j)
print(ans)

Measured memory_bytes: 9144
def sum(list):
    r = 0
    for i in list:
        r += i
    return r

n = int(input())
list1 = list(map(int, input().split()))
max_result = max(list1)
min_result = min(list1)
sum_result = sum(list1)

print(min_result, max_result, sum_result)





Measured memory_bytes: 6596
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<pair<ll,ll>> suzu(N);
    ll sum = 0;
    ll free = 0;
    ll mx = 0;
    ll mn = inf;
    rep(i,N){
        cin >> suzu[i].first >> suzu[i].second;
        chmax(mx,suzu[i].first-suzu[i].second);
        if(suzu[i].first < suzu[i].second){
            free += suzu[i].second - suzu[i].first;
        }else if(suzu[i].first > suzu[i].second){
            chmin(mn,suzu[i].second);
        }
        sum += suzu[i].first;
    }
    if(mx == 0){
        cout << 0 << "\n";
        return 0;
    }
    cout << sum - mn << "\n";        
    return 0;
}

Measured memory_bytes: 640
#include<cstdio>
#define MAX 1000010

bool is_prime[MAX];

int sieve(int n) {
	for (int i = 0; i <= n; ++i) is_prime[i] = true;	
	is_prime[0] = is_prime[1] = false;
	int count = 0;
	for (int i = 2; i <= n; ++i) {
		if (is_prime[i]) {
			++count;
			for (int j = 2 * i; j <= n; j += i) {
				is_prime[j] = false;
			}
		}
	}
	return count;
}

int main()
{
	int n;
	while (scanf("%d", &n) == 1) {
		printf("%d\n", sieve(n));
	}
	return 0;
}

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

int main(){
    int a, b, d, r;
  double f;
    cin >> a >> b;
    d = a / b;
    r = a % b;
    f = (double) a / b;
    printf("%d %d %7.5f", d, r, f);
    
}


Measured memory_bytes: 3208
#include<bits/stdc++.h>                   // below comment for pbds
#include<ext/pb_ds/assoc_container.hpp>   // to use it make ordered_set
#include<ext/pb_ds/tree_policy.hpp>       // all set fnct + = 1. order_of_key(x); // number of 
#define ll long long                      //element strictly smaller than it;
#define ld long double                    // 2. find_by_order(x),pointer el at x pos after sort 
using namespace std;                      // use as s.f();
using namespace __gnu_pbds;



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.flush();
	ll t=1;
	//cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		ll a[100001];
		ll dp[100001];
		dp[0]=0;
		ll ans=0;
		for(ll i=1;i<=n;i++)
		{
		cin>>a[i];
		dp[i]=999999999999;
		}
		dp[1]=0;
		dp[2]=abs(a[1]-a[2]);
		dp[0]=0;
		for(ll i=3;i<=n;i++)
		{
		dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
									
		}
		ans=dp[n];
		cout<<ans<<endl;
	}
	
return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
const int MAXN = 501000;
int t1[MAXN],t2[MAXN],c[MAXN];
int n;
char a[MAXN];
bool cmp(int *r,int a,int b,int l)
{
    return r[a]==r[b]&&r[a+l]==r[b+l];
}
 
void da(int str[],int sa[],int ra[],int height[],int n,int m)
{
    n++;
    int i,j,p,*x=t1,*y=t2;
    for(i=0; i<m; i++)
        c[i]=0;
    for(i=0; i<n; i++)
        c[x[i]=str[i]]++;
    for(i=1; i<m; i++)
        c[i]+=c[i-1];
    for(i=n-1; i>=0; i--)
        sa[--c[x[i]]]=i;
    for(j=1; j<=n; j<<=1)
    {
        p=0;
        for(i=n-j; i<n; i++)
            y[p++]=i;
        for(i=0; i<n; i++)
            if(sa[i]>=j)
                y[p++]=sa[i]-j;
        for(i=0; i<m; i++)
            c[i]=0;
        for(i=0; i<n; i++)
            c[x[y[i]]]++;
        for(i=1; i<m; i++)
            c[i]+=c[i-1];
        for(i=n-1; i>=0; i--)
            sa[--c[x[y[i]]]]=y[i];
        swap(x,y);
        p=1;
        x[sa[0]]=0;
        for(i=1; i<n; i++)
            x[sa[i]]=cmp(y,sa[i-1],sa[i],j)?p-1:p++;
        if(p>=n)
            break;
        m=p;
    }
    int k=0;
    n--;
    for(i=0; i<=n; i++)
        ra[sa[i]]=i;
    for(i=0; i<n; i++)
    {
        if(k)
            k--;
        j=sa[ra[i]-1];
        while(str[i+k]==str[j+k])
            k++;
        height[ra[i]]=k;
    }
}
 
int ra[MAXN],height[MAXN];
int sa[MAXN],num[MAXN];
 
bool ok(int k)
{
    int ans=0;
    for(int i=1; i<=n; i++)
    {
        if(height[i]<k)
            continue;
        int maxx=max(sa[i-1],sa[i]),minn=min(sa[i-1],sa[i]);
        int j=i;
        while(height[j+1]>=k&&j<=n)
        {
            j++,maxx=max(maxx,sa[j]),minn=min(minn,sa[j]);
        }
        if(maxx-minn>=k)
            return 1;
    }
    return 0;
}
 
 
 
int main()
{
    scanf("%d",&n);
    scanf("%s",a);
    for(int i=0; a[i]!='\0'; i++)
        num[i]=a[i]-'a'+1;
    num[n]=0;
    da(num,sa,ra,height,n,27);
    int l=0,r=n;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        //printf("%d %d %d\n",mid,l,r);
        if(ok(mid))
            l=mid+1;
        else
            r=mid-1;
        //printf("%d %d %d\n",mid,l,r);
    }
    printf("%d",l-1 );
}

Measured memory_bytes: 10496
#include <iostream>
#include <vector>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <cstring>
#include <algorithm>
#include <set>
#include <climits>
#include <numeric>

//usings
using namespace std;

//type def
typedef long long int64;
typedef pair<int, int> ii;

//consts
const int mod = 1e9 + 7;

//methods
template<typename T>
bool chmax(T& source, const T& compare_to) {
    if(source < compare_to) {
        source = compare_to;
        return true;
    }
    return false;
}

int modpow(int64 base, int n) {
    int64 ret = 1;
    while(n) {
        if(n & 1) ret = ret * base % mod;
        base = base * base % mod;
        n >>= 1;
    }
    return ret;
}

class Solution {
private:
public:
    int64 solve(int64 n, int64 k) {
        auto temp = n % k;
        return min(temp, k - temp);
    }
};

int main() {
    int64 n, k;
    cin >> n >> k;
    Solution sol;
    auto ret = sol.solve(n, k);
    cout << ret << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static int n ;
    static long x;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = Integer.parseInt(sc.next());
        x = Long.parseLong(sc.next());
        System.out.println(dfs(x,n));
        sc.close();
    }

    public static long dfs(long remain,int level){
        if(level == 0){
            return 1;
        }else{
            if(remain==1){
                return 0;
            }else if(remain <=((1L<<(level+1))-2)){
                return dfs(remain-1,level-1);
            }else if(remain ==((1L<<(level+1))-1)){
                return 1L<<level;
            }else if(remain ==(1L<<(level+2))-3){
                return (1L<<(level+1))-1;
            }else {
                return (1L<<level) + dfs(remain-(1L<<(level+1))+1,level-1);
            }
        }
    }
}

Measured memory_bytes: 25300
n,m=map(int,input().split())
a=[]
b=[]

for i in range(n):
    tmp=list(map(int,input().split()))
    a.append(tmp)

for j in range(m):
    b.append(int(input()))

for k in range(n):
    r=0
    for l in range(m):
        r+=a[k][l]*b[l]
    print(r)    
    


Measured memory_bytes: 6008
N = int(input())

X = N // 1.08

if int(X * 1.08) == N:
    print(int(X))
    exit()
if int((X+1) * 1.08) == N:
    print(int(X+1))
    exit()
if int((X-1) * 1.08) == N:
    print(int(X-1))
    exit()
print(':(')


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

using namespace std;

int main() {
	int a, b, m = 0;
	cin >> a >> b;
	
	if (a > b) {
		m += a;
		a--;
	} else {
		m += b;
		b--;
	}
	
	if (a > b) {
		m += a;
		a--;
	} else {
		m += b;
		b--;
	}
	
	cout << m;
	
	return 0;
}

Measured memory_bytes: 256
import math
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))


INF=10**20
def main():
    N,K=mi()
    A=list(mi())

    A.sort(reverse=True)
    l = 0
    r = A[0]

    while r-l > 1:
        # print("l,r:",l,r)
        mid = (r+l)//2
        
        count = 0

        for i in range(N):
            if mid < A[i]:
                count += math.ceil(A[i]/mid)-1
        
        # print(mid,count)
        if count > K:
            l = mid
        else:
            r = mid
    
    print(r)

    

if __name__ == "__main__":
    main()

Measured memory_bytes: 94312
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int dp[1010][1<<12];
int takara[1010];

int main(){
    int n,m;
    cin>>n>>m;
    int a[m],b[m];
    rep(i,m){
        cin>>a[i]>>b[i];
        rep(j,b[i]){
            int c;
            cin>>c;
            c--;
            takara[i]|=1<<c;
        }  
    }

    rep(i,m+1) rep(msk,1<<n) dp[i][msk]=INF;
    dp[0][0]=0;

    rep(i,m) rep(msk,1<<n){
        dp[i+1][msk]=min(dp[i+1][msk],dp[i][msk]);
        dp[i+1][msk | takara[i]]=min(dp[i+1][msk | takara[i]],dp[i][msk]+a[i]);
    }

    int ans=dp[m][(1<<n)-1];
    if(ans==INF) ans=-1;
    cout<<ans<<endl;
}


Measured memory_bytes: 19584
a = 1
b = 1
 
n = STDIN.readline.to_i
n.times do
    ratio = STDIN.readline.split
    x = ratio[0].to_i
    y = ratio[1].to_i
    n1 = (a.to_r / x.to_r).ceil.to_i
    n2 = (b.to_r / y.to_r).ceil.to_i
    n = [n1, n2].max
    a = n * x;
    b = n * y;
end
 
puts (a+b).to_s

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int x, t;
    cin >> x >> t;
    if(x <= t) cout << 0 << endl;
    else cout << x - t << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

string t, d;
int N, Q;
string s;

int sim(int p)
{
    if (p <= 0)
    {
        return 1;
    }
    else if (p >= N + 1)
    {
        return 2;
    }
    for (int i = 0; i < Q;i++)
    {   
        if(t[i] == s[p-1])
        {
            p += d[i] == 'L' ? -1 : 1;
        }
        if (p <= 0)
        {
            return 1;
        }
        else if (p >= N + 1)
        {
            return 2;
        }
    }
    return 0;
}

int main()
{
    cin >> N >> Q >> s;
    for (int i = 0; i < Q; i++)
    {
        char a, b;
        cin >> a >> b;
        t += a;
        d += b;
    }
    int l = 0;
    int r = N + 1;
    int m;
    while (1)
    {
        int m = (l + r) / 2;
        int ret = sim(m);
        int pl = l;
        int pr = r;
        if (ret == 1)
        {
            l = m;
        }
        else
        {
            r = m;
        }
        if(pl == l && pr == r)
        {
            break;
        }
    }
    int al = l;
    l = 0;
    r = N + 1;
    while (1)
    {
        int m = (l + r) / 2;
        int ret = sim(m);
        int pl = l;
        int pr = r;
        if (ret == 2)
        {
            r = m;
        }
        else
        {
            l = m;
        }
        //cout << "l:" << l << endl;
        //cout << "r:" << r << endl;
        if (pl == l && pr == r)
        {
            break;
        }
    }
    int ar = r;
    //cout << "al:" << al << endl;
    //cout << "ar:" << ar << endl;
    cout << N - min(N, al + N + 1 - ar) << endl;
    return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;

int main() {
  int N; string s; cin>>N>>s;
  int r	= 0, b = 0;
  REP(i,N) {
    if(s[i] == 'R') r++;
    else b++;
  }
  cout << (r>b ? "Yes" : "No") << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
const ll INF = 100000000000000000;

int main(){
    char c;
    cin>>c;
    c = c + 1;
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

chomp (my ($n, $x) = split / /, <STDIN>);
chomp (my @z = split / /, <STDIN>);
my @y = map {abs($_ - $x)} @z;
my $d = max(@y, $x) - min(@y, $x);
my $gcd = sub {
  my ($x, $y) = @_;
  while ($y) {
    my $r = $x % $y;
    $r += $y if $r < 0;
    $x = $y;
    $y = $r;
  }
  return $x;
};
my $g = $y[0];
for my $i (1..$n-1) {
  $g = $gcd->($g, $y[$i]);
}
say $g;

Measured memory_bytes: 20644
import logging
import unittest

debug = logging.getLogger(__name__).debug


def input_ints():
    return list(map(int, input().strip().split()))


def _main():
    n, k = input_ints()
    if k == 1:
        print(0)
    else:
        print(n - k)


class Test(unittest.TestCase):
    def setUp(self):
        import run
        self._test = run

    def test_main(self):
        self._test.test_files(self, _main)


if __name__ == '__main__':
    _main()


Measured memory_bytes: 5644
#include<bits/stdc++.h>
#define fri(i,n) for(int i=0;i<n;i++)
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define ol(v) v.begin(),v.end()
#define forc(v) for(auto it:v)
#define se second
#define fi first
#define pb push_back
#define pf push_front
#define MX 1e18
#define MN -MX

using namespace std;
typedef long long ll;
typedef long double ld;

template <typename T> istream&operator>>(istream &inp, vector<T> &vec){
	fri(i,vec.size()) inp>>vec[i];
	return inp;
}

template <typename T> ostream&operator<<(ostream &oup, vector<T> vec){
	forc(vec) oup<<it<<" ";
	oup<<"\n";
	return oup;
}


int main(){
	ios::sync_with_stdio(false);
	#ifdef DBG
		freopen("in", "r", stdin);
	#endif
	int n;
	cin>>n;
	deque<ll> dq;
	bool bk = 1;
	fri(i, n){
		ll pp;
		cin>>pp;
		if(bk) dq.push_back(pp);
		else dq.push_front(pp);
		bk = !bk;
	}
	if(!bk){
		fri(i, n){
			cout<<dq.back()<<" ";
			dq.pop_back();
		}
	}
	else{
		fri(i, n){
			cout<<dq.front()<<" ";
			dq.pop_front();
		}
	}
	
	return 0;
}

Measured memory_bytes: 3840
li = list(map(int, input().split()))

ans = 10 ** 9
for bit_state in range(1 << 4):
    if bin(bit_state).count("1") == 2:
        tmp1 = 0
        tmp2 = 0
        for i in range(4):
            if bit_state & (1 << i):
                tmp1 += li[i]
            else:
                tmp2 += li[i]
        ans = min(ans, abs(tmp1 - tmp2))
print(ans)


Measured memory_bytes: 5596
a=int(input())
b=int(input())
c=int(input())
x=int(input())

count=0
for a1 in range(a+1):
  for b1 in range(b+1):
    for c1 in range(c+1):
      if x==500*a1+100*b1+50*c1:
        count+=1
print(count)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
int main() {
	int n; cin >> n;
	ll d[100][100];
	rep(i, n) {
		rep(j, n) {
			cin >> d[i][j];
		}
	}
	ll sum = 0;
	rep(i, n) {
		Rep(j,i+1,n) {
			sum += min(d[i][j], d[j][i]);
		}
	}
	cout << sum << endl;
	return 0;
}


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

int main(){
  int D,E;
  double ans=1000000000;
  for(;;){
    cin>>D>>E;
    if(D==0 && E==0) break;

    for(int i=0;i<=D;i++){
      double a = sqrt(i*i+(D-i)*(D-i));
      double b =abs(a-E);
      if(ans>b){
        ans=b;
      }
    }
    cout<< fixed<<setprecision(10)<<ans <<endl;
    ans=100000000;
  }
  
  return 0;
}

Measured memory_bytes: 3260
#include <stdio.h>
#include <string.h>

#pragma warning(disable:4996)

#

int main(void) {
	int A, B, T;

	scanf("%d %d %d", &A, &B, &T);
	int biscuit = T / A * B;

	printf("%d", biscuit);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

main(){

int all,i,j,num,card[4][13];

for(i=0;i<4;i++){
for(j=0;j<13;j++){
 card[i][j] = j+1;
}}

char ch1,ch2;

scanf("%d",&all);

for(i=0;i<all;i++){
 scanf("%c",&ch1);
 scanf("%c %d",&ch2,&num);

 if(ch2 == 'S'){
 card[0][num-1]=0; 
 }

 if(ch2 == 'H'){
  card[1][num-1]=0; 
 }

 if(ch2 == 'C'){
  card[2][num-1]=0; 
 }

 if(ch2 == 'D'){
  card[3][num-1]=0; 
 }
}

for(i=0;i<4;i++){
for(j=0;j<13;j++){

if(card[i][j] != 0){

 if(i == 0){
 printf("S %d\n",card[i][j]);
 }

 if(i == 1){
 printf("H %d\n",card[i][j]);
 }
 
 if(i == 2){
 printf("C %d\n",card[i][j]);
 }

 if(i == 3){
 printf("D %d\n",card[i][j]);
 }
}

}}

return 0;
}



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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b == c || a + c == b || b + c == a) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


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

#define FOR(i, j, k) for (int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;

  vi a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end());

  cout << (a[0] * a[1]) / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String args[]) throws Exception {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int k = sc.nextInt();
    Map<Integer, List<Integer>> friends = new HashMap<>();
    Map<Integer, List<Integer>> block = new HashMap<>();
    for(int i = 1; i <= n; i++) {
      friends.put(i, new ArrayList<>());
      block.put(i, new ArrayList<>());
    }

    int[] root = new int[n+1];
    int[] size = new int[n+1];
    for(int i = 1; i <= n; i++) {
      root[i] = i;
      size[i] = 1;
    }
    for(int i = 0; i < m; i++) {
      int v = sc.nextInt();
      int u = sc.nextInt();
      friends.get(v).add(u);
      friends.get(u).add(v);
      union(root, size, v, u);
    }
    for(int i = 1; i <= n; i++) {
      find(root, i);
    }
    for(int i = 0; i < k; i++) {
      int v = sc.nextInt();
      int u = sc.nextInt();
      block.get(v).add(u);
      block.get(u).add(v);
    }
    for(int i = 1; i <= n; i++) {
      int cycleSize = size[root[i]];
      int friendSize = friends.get(i).size();
      int blackCnt = 0;
      for(int b : block.get(i)) {
        if(root[b] == root[i])
          blackCnt++;
      }
      if(i == n)
        System.out.println(cycleSize - friendSize - 1 - blackCnt);
      else
        System.out.print(cycleSize - friendSize - 1 - blackCnt + " ");
    }
  }

  private static void union(int[] root, int[] size, int a, int b) {
    int rootA = find(root, a);
    int rootB = find(root, b);
    if(rootA == rootB) return;
    if(size[rootA] >= size[rootB]) {
      root[rootB] = rootA;
      size[rootA] += size[rootB];
    } else {
      root[rootA] = rootB;
      size[rootB] += size[rootA];
    }
  }

  private static int find(int[] root, int node) {
    if(root[node] != node) {
        root[node] = find(root, root[node]);
    }
    return root[node];
  }
}


Measured memory_bytes: 194592
/*
    Code written by Talant I.D.
*/

#include <bits/stdc++.h>

using namespace std;

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

#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);

inline bool isvowel(char ch){
    ch = tolower(ch);
    return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');
}

inline bool isprime(int n){
    if(n < 2 || (n%2 == 0 && n != 2)) return false;
    for(int i = 3; i*i <= n; i += 2)
        if(n%i == 0) return false;
    return true;
}

const int N = 103, W = 1e5+7;
ll dp[N][W];

int main(){
    do_not_disturb

    int n, cap, i, j;
    cin >> n >> cap;
    vector <ll> val(n+1), wei(n+1);

    for(i = 1; i <= n; i++){
        cin >> wei[i] >> val[i];
    }

    for(i = 1; i <= n; i++){
        for(j = 1; j <= cap; j++){
            if(wei[i] > j){
                dp[i][j] = dp[i-1][j];
            }
            else{
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-wei[i]]+val[i]);
            }
        }
    }

    cout << dp[n][cap];

    return 0;
}


Measured memory_bytes: 79360
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main() {
	
	double r;
	cin >> r;
	double a,b;
	a = M_PI*r*r;
	b = M_PI*r*2;
	printf ("%.6f", a );
	printf (" ");
	printf ("%.6f\n", b);
	return 0;
}


Measured memory_bytes: 3196
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    const N = readln.chomp.to!int;
    const tmp = readln.split.to!(int[]);
    const T = tmp[0], A = tmp[1];
    const hs = readln.split.to!(int[]);
    writeln(hs.map!(h => T - h * 0.006).map!(t => abs(A-t)).enumerate.reduce!((a,b) => a.value < b.value ? a : b).index + 1);
}



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

int main()
{
    // 入力
    string s;
    cin >> s;
    
    // '\'の位置を保存
    vector<int> v1;

    // 水たまりの面積を保存
    vector<pair<int,int>> v2;

    for(int i = 0; i < s.size(); i++)
    {
        // '\'の位置を保存
        if(s[i] == '\\') v1.push_back(i);

        // '/'と対になる'\'との差から面積を計算
        else if(s[i] == '/' && v1.size() > 0)
        {
            // '/'の位置iと対になる'\'の位置jを取り出す
            int j = v1.back();
            v1.pop_back();

            // '\'から'/'までの面積
            int a = i - j;

            // j～i間にある水たまりの統合
            while(v2.size() > 0 && v2.back().first > j)
            {
                a += v2.back().second;
                v2.pop_back();
            }

            // 一つの水たまりを保存
            v2.push_back(make_pair(j, a));
        }
    }

    // 面積の合計を出力
    int sum = 0;
    for(int i = 0; i < v2.size(); i++) sum += v2[i].second;
    cout << sum << endl;

    // 水たまりの個数を出力
    cout << v2.size();

    // 各水たまりの面積を出力
    for(int i = 0; i < v2.size(); i++)
    {
        cout << " " << v2[i].second;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3284
import numpy as np

N, M, C = map(int, input().split())
B = np.array([int(i) for i in input().split()])
A = np.array([[int(i) for i in input().split()] for _ in range(N)])
cnt = 0

for i in np.dot(A, B)+C:
    if i > 0:
        cnt += 1

print(cnt)

Measured memory_bytes: 13736
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

int main(){
	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int S[] = new int[n];
		int count = 0;
		
		for (int k = 0; k <= n - 1; k++) {
			int x = scanner.nextInt();
			S[k] = x;
		}
		
		int q = scanner.nextInt();
		int T[] = new int[q];
		
		for (int k = 0; k <= q - 1; k++) {
			int x = scanner.nextInt();
			T[k] = x;
		}//SとTを配列にいれる
		
		Arrays.sort(S);
		int mid = (n - 1) / 2;

		for (int i = 0; i <= q - 1; i++) {
			if (T[i] == S[mid]) {
				count += 1;
			} else if (T[i] <= S[mid]) {
				for (int j = 0; j <= mid; j++) {
					if (S[j] == T[i]) {
						count += 1;
						break;
			}
				}
			}else {
				for (int k = mid + 1; k <= n - 1; k++) {
					if (S[k] == T[i]) {
						count += 1;
						break;
				}
			}
		}
				}
		System.out.println (count);
}
}


Measured memory_bytes: 69024
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int line=0;
        for(int i = 1;input.hasNext();i++){
            line = input.nextInt();
            if(line!=0){
                System.out.println("Case "+i+": "+line);
            }else{
                break;
            }
        }
    }
}



Measured memory_bytes: 41888
#include <bits/stdc++.h>
#define mset(a,b) memset(a,b,sizeof a)
#define mcpy(a,b) memcpy(a,b,sizeof b)
#define lb(x) ((x)&(-(x)))
#define xx first
#define yy second
#define pb push_back
#define mp make_pair
#define pii pair<int,int> 
#define inf 0x3f3f3f3f
#define N 100010
using namespace std;
typedef long long ll;
int n,a,cnt[N];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)scanf("%d",&a),cnt[a]++;
	int ans=0;
	for(int i=1;i<=100000;i++)ans=max(ans,cnt[i-1]+cnt[i]+cnt[i+1]);
	cout<<ans;
	return 0;
}
/*
100
5
48 141 231 314 425
3
0 19
50 98
143 30
*/

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000000 + 7
#define PI 3.14159265359

const long long INF = 100000;
typedef pair<int,int> P;
typedef long long ll;

using Graph = vector<vector<int>>;

int main() {
	int A, B, H, M;
	cin >> A >> B >> H >> M;
	double delta = abs((6*M) % 360 - (30*H + 0.5*M));
	double ans = 0;

	ans = sqrt(A*A + B*B - 2*A*B*cos((PI / 180) * delta));

	cout << fixed << setprecision(15);
	cout << ans << endl;

}

Measured memory_bytes: 4188
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int I=X;I<Y;I++)
#define REP(I,X,Y) for(int I=Y-1;I>=X;I--)
#define INF 1000000007
using namespace std;

int main(){
  int H,W,N,a;
  cin >> H >> W >> N;
  vector<int> c;
  FOR(i,1,N+1){
    cin >> a;
    FOR(j,0,a)c.push_back(i);
  }
  FOR(i,0,H){
    if(i%2 == 0){
      FOR(j,0,W)cout << c[j] << " ";cout << endl;
    }
    else{
      REP(j,0,W)cout << c[j] << " ";cout << endl;
    }
    c.erase(c.begin(),c.begin()+W);
  }
}


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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll n;
	cin >> n;
	ll x[n];
	for(int i = 0; i < n; i++) {
		cin >> x[i];
	}
	ll sum = 0;
	for(int i = 0; i < n - 1; i++) {
		for(int j = i + 1; j < n; j++) {
			sum += x[i] * x[j];
		}
	}
	cout << sum << endl;
}

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

int main(){
  char c;
  cin >> c;
  
  string mother = "aiueo";
  int f=0,i;
  for(i=0;i<5;i++){
    if(c == mother[i])
      f=1;
  }
  if(f == 1)
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin>>N;
  vector<P> red, blue;
  rep(i, N) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    red.pb(P(a, b));
  }
  rep(i, N) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    blue.pb(P(a, b));
  }
  sort(all(red), greater<P>());
  int m = 0;
  for (P p1 : red) {
    int x = p1._1, y = p1._2;
    P cand = P(INF, INF);
    for (P p : blue) if (x < p._1 && y < p._2) cand = min(cand, P(p._2, p._1));
    if (cand._1 == INF) continue;
    blue.erase(find(all(blue), P(cand._2, cand._1)));
    m++;
  }
  cout << m << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);
inline void IO() {
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
}

int main(int argc, char const *argv[])
{
	//IO();
	FAST_IO
	
	char c; cin >> c;
	if(c >= 'A' && c <= 'Z') cout << 'A';
	else cout << 'a';		
	return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <map>
#include <deque>
#define MAX_N 100000
#define INF 1000000000000
typedef long long ll;
using namespace std;

int main(){
  int r,g;
  cin>>r>>g;
  cout<<2*g-r<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <queue>
using namespace std;
int main()
{
    priority_queue <int> q;
    priority_queue < int,vector<int>,greater<int> >Q;
    int n,t;
    long long s=0;
    cin>>n;
    for(int i=1;i<=n;++i)
    {
        cin>>t;
        if(t==1)
        {
            int a,b;
            cin>>a>>b;
            s+=b;
            q.push(a),Q.push(a);
            int x=q.top(),y=Q.top();
            if(x>y)
            {
                q.pop(),Q.pop();
                s=s+x-y;
                q.push(y),Q.push(x);
            }
        }
        else  cout<<q.top()<<" "<<s<<endl;
    }
    return 0;
}


Measured memory_bytes: 3828
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

vector <double> toCoor(int L, double deg) {
    vector <double> ret(2);

    ret[0] = cos(deg) * L;
    ret[1] = sin(deg) * L;

    return ret;
}

double getDist(vector<double>& A, vector<double>& B) {
    double dx = A[0] - B[0];
    double dy = A[1] - B[1];

    return sqrt(dx*dx + dy*dy);
}

int main() {
    int A;
    int B;
    int H;
    int M;

    cin >> A >> B >> H >> M;
    const double PI = acos(-1.0);

    double mDeg = M/60.0 * 2*PI;
    double hDeg = (H/12.0 + M/720.0) * 2*PI;

    vector <double> mCoor = toCoor(A, mDeg);
    vector <double> hCoor = toCoor(B, hDeg);

    cout << setprecision(12) << fixed << getDist(mCoor, hCoor) << endl;

    return 0;
}

Measured memory_bytes: 4112
import java.io.*;

class Main{
	public static void main(String args[]) throws IOException{
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		String[] str;
		int n,x;
		int num=0;

		while(true){
			str = buf.readLine().split(" ");
			n = Integer.parseInt(str[0]);
			x = Integer.parseInt(str[1]);
			if(n==0 && x==0)
				break;
			for(int i=1;i<=n;i++){
				for(int j=1;j<=n;j++){
					for(int k=1;k<=n;k++){
						if(i+j+k==x && i!=j && i!=k && j!=k){
							//System.out.printf("%d %d %d\n",i,j,k);
							num++;
						}
					}
				}
			}
			
			System.out.println(num/6);
			num = 0;
		}	

	}
}

Measured memory_bytes: 25064
import math
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
a = 0
b = 0
nn = sorted(p)
for i in range(n):
  a += (nn.index(p[i])-1) * math.factorial(n-i-1)
  nn.remove(p[i])

nnn = sorted(q)
for j in range(n):
  b += (nnn.index(q[j])-1) * math.factorial(n-j-1)
  nnn.remove(q[j])
print(abs(a-b))

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
//combination(Nが小さい時はこれを使う
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
long long COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

//繰り返し二乗法（Nが大きい時の場合のcombination)
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= (i % mod); res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
//UnionFind
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int dight(int n) {
	int ans = 1;
	while (n >= 10) {
		n /= 10;
		ans++;
	}
	return ans;
}
int dight_sum(int n) {
	int sum = 0;
	rep(i, 20)sum += (n % (int)pow(10, i + 1)) / (pow(10, i));
	return sum;
}
int dight_min(int n) {
	int ans = 9;
	while (n >= 10) {
		ans = min(ans, n % 10);
		n /= 10;
	}
	ans = min(ans, n);
	return ans;
}
int dight_max(int n) {
	int ans = 0;
	while (n >= 10) {
		ans = max(ans, n % 10);
		n /= 10;
	}
	ans = max(ans, n);
	return ans;
}
int x, y;
signed main() {
	cin >> x >> y;
	cout << gcd(x, y) << endl;
	ggr
}



Measured memory_bytes: 3120
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int area = a * b ;
        int length = 2 * (a + b) ;
        System.out.println(area + " " + length);
        sc.close(); 
    }
}


Measured memory_bytes: 26244
#include<stdio.h>

int main(void){
    int n, i, j;
    int matrix[100][100]={};
    scanf("%d\n", &n);

    
    for(i = 0; i < n; i++){
        int u, k, v;
        scanf("%d %d", &u, &k);
        for(j=0;j<k;j++){
            scanf(" %d", &v);
            matrix[u-1][v-1]=1;
        }
    }

    for(i = 0; i < n; i++)
    {
        for(j = 0; j < n; j++){
            printf("%d%c", matrix[i][j], ((j < n-1 ? ' ' : '\n')));
        }
    }
    return 0;
}


Measured memory_bytes: 2056
n = int(input())
l = list(map(int,input().split()))
half = n//2

ans = [0]*n
for i in range(half,n):
    if l[i] == 1:
        ans[i] = 1
for i in range(0,half):
    p = half-1-i
    s = 0
    qmax = n //(p+1)
    for j in range(1,qmax+1):
        s += ans[j*(p+1)-1]
    if s%2 != l[p]:
        ans[p] = 1
print(sum(ans))
for i in range(n):
    if ans[i] == 1:
        print(i+1,end=" ")

Measured memory_bytes: 64732
from bisect import *
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

a.sort()
c.sort()
res = 0
for i in b:
    temp_a = bisect_left(a, i)
    temp_c = n - bisect_right(c, i)
    res += temp_a*temp_c
print(res)

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


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

    string s, t; cin >> s >> t;
    int ans = 0;
    rep(i, 3) if(s[i] == t[i]) ans++;
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;


int main(){
  ll N;
  cin >> N;
  ll ga,sa,ba;
  ll gb,sb,bb;
  cin >> ga >> sa >> ba;
  cin >> gb >> sb >> bb;


  // A->B
  ll temp=N;
  for(int i=0; i<=N; i++){
    for(int j=0; j<=N; j++){
      if(i*ga+j*sa>N){
	break;
      }

      ll nokori = N-i*ga-j*sa;

      ll zobun=0;
      zobun += i*(gb-ga);
      zobun += j*(sb-sa);
      if(bb>ba){
	zobun+=(nokori/ba)*(bb-ba);
      }

      temp = max(temp,N+zobun);
    } 
  }
  N=temp;
  // B->A
  if(ga>gb && sa>sb && ba>bb){
    for(int i=0; i<=N; i++){
      for(int j=0; j<=N; j++){
	if(i*gb+j*sb>N){
	  break;
	}

	ll nokori = N-i*gb-j*sb;

	ll zobun=0;
	zobun += i*(ga-gb);
	zobun += j*(sa-sb);
	if(ba>bb){
	  zobun+=(nokori/bb)*(ba-bb);
	}

	temp = max(temp,N+zobun);
      } 
    }
    N=temp;
  }else if(ga>gb && sa>sb && ba<=bb){
    for(int i=0; i<=N; i++){
      if(i*gb>N){
	break;
      }

      ll nokori=N-i*gb;
      ll zobun =0;
      zobun = i*(ga-gb);

      if(sa>sb){
	zobun += (nokori/sb)*(sa-sb);
      }
      temp = max(temp,N+zobun);
    }
  }else if(ga>gb){
    for(int i=0; i<=N; i++){
      if(i*gb>N){
	break;
      }

      ll nokori=N-i*gb;
      ll zobun =0;
      zobun = i*(ga-gb);

      if(ba>bb){
	zobun += (nokori/bb)*(ba-bb);
      }
      temp = max(temp,N+zobun);
    }
  }else if(sa>sb){
    for(int i=0; i<=N; i++){
      if(i*sb>N){
	break;
      }

      ll nokori=N-i*sb;
      ll zobun =0;
      zobun = i*(sa-sb);

      if(ba>bb){
	zobun += (nokori/bb)*(ba-bb);
      }
      temp = max(temp,N+zobun);
    }
  }else{
    ll zobun = (N/bb)*(ba-bb);
    temp = max(temp,N+zobun);
  }

  N=temp;
    
  cout<<N<<endl;
  
  return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


int main(void)
{
  int n,i,x[1000],y[1000];
  double sum=0,max=0;
   
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
      scanf("%d",&x[i]);
  }

  for(i=0;i<n;i++)
  {
      scanf("%d",&y[i]);
  }
   
  for(i=0;i<n;i++)
  {
      sum+=abs(x[i]-y[i]);
  }

  printf("%f\n",sum);

  sum=0;
   
  for(i=0;i<n;i++)
  {
       sum+=abs(x[i]-y[i])*abs(x[i]-y[i]);
  }
  printf("%f\n",sqrt(sum));
  sum=0;
   
  for(i=0;i<n;i++)
  {
       sum+=abs(x[i]-y[i])*abs(x[i]-y[i])*abs(x[i]-y[i]);
  }

  printf("%f\n",pow(sum,1.0/3.0));
   
  for(i=0;i<n;i++)
  {
      if(max<abs(x[i]-y[i])) max=abs(x[i]-y[i]);
  }

  printf("%f\n",max);
   
  return 0;
}


Measured memory_bytes: 2108
#include <stdio.h>
int main(void);

int main(void){

  int a, b;
  char op;

  while(1){

    scanf("%d %c %d", &a, &op, &b);

    if(op == '?'){
      break;
    } else if(op == '+'){

            printf("%d\n", a + b);

    } else if(op == '-'){

            printf("%d\n", a - b);

    } else if(op == '*'){

            printf("%d\n", a * b);

    } else if(op == '/'){

            printf("%d\n", a / b);

    }
  }

  return 0;
}



Measured memory_bytes: 2032