akhauriyash/Code-Regression huggingface dataset:
MOD = 10 ** 9 + 7


def modpow(a, b, mod):
    ret = 1
    while b > 0:
        if b % 2 == 1:
            ret = ret * a % mod
        a = a * a % mod
        b //= 2
    return ret


X, Y = map(int, input().split())
if (2 * X - Y) % 3 != 0 or (2 * Y - X) % 3 != 0:
    print(0)
elif (2 * X - Y) // 3 < 0 or (2 * Y - X) // 3 < 0:
    print(0)
else:
    A, B = (2 * X - Y) // 3, (2 * Y - X) // 3
    ans = 1
    for n in range(A + B, A, -1):
        ans = ans * n % MOD
    for n in range(1, B + 1):
        ans = ans * modpow(n, MOD - 2, MOD) % MOD
    print(ans % MOD)


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

int main() {

    int x;
    cin >> x;

    int v;
    int res = 1;

    for (int i = 2; i <= x; i++) {

        v = i * i;

        while (v <= x) {

            if (res < v) {
                res = v;
            }

            v *= i;           
        }
    }

    cout << res << endl;

    return 0;

}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  string s;cin>>s;
  // vector<ll>a(s.size());
  // for(i=0;i<s.size();i++){

  // }
  bitset<9> a;
  for(i=0;i<(1<<(s.size()-1));i++){
    a=i;
    for(j=0;j<s.size();j++){
      l=j;
      while(!a[j]&&j<s.size()-1)j++;
      res+=stoll(s.substr(l,j-l+1));
    }
  }
  cout<<res<<endl;

  return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
template<class T,class Y>T LCM(T a,Y b){return (a*b)/GCD(a,b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

using vi=vector<int>;
using vii=vector<vi>;

#define REP(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()
#define decimal(x) fixed<<setprecision(x)


int main(){
    int A,B;
    double H,M;
    const double pi = 3.141592653589793;
    cin>>A>>B>>H>>M;
    H=H*30+0.5*M,M*=6;
    double dif=0.0;
    if(H>M)dif=H-M;
    else dif=M-H;
    //cout<<dif<<endl;
    double C=cos(dif*pi/180.0);
    //cout<<C<<endl;
    double ans=A*A+B*B-2*A*B*C;
    //cout<<ans<<endl;
    cout<<decimal(19)<<sqrt(ans)<<endl;
    return 0;
}

//a=97,z=122

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

#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define deb(x)	cout << #x << " " << x << endl;

typedef long long int ll;

unordered_map<ll, ll> all_five_pows;

void init() {
	ll n = 0, fn = 0;

	while (fn < 100000000000001) {
		fn = n * n * n * n * n;
		all_five_pows[fn] = n;
		n++;
	}
}

bool isPowFive(ll n) {
	return all_five_pows.find(n) != all_five_pows.end();
}

int main() {

	IOS

	init();
	// deb(isPowFive(0));

	// for (auto x: all_five_pows)
	// 	cout << x.first << " " << x.second << endl;

	ll x;
	cin >> x;

	ll a = 0, b, af, bf;

	while (true) {

		af = a * a * a * a * a;
		bf = af - x;

		// deb(af); deb(bf);

		if (isPowFive(abs(bf))) {
			b = all_five_pows[abs(bf)];
			if (bf < 0)
				b *= -1;
			break;
		}

		a++;
	}

	cout << a << " " << b;

	return 0;
}

Measured memory_bytes: 3668
package main

import "fmt"

func main() {
	var K, S int
	fmt.Scan(&K, &S)
	var ans int
	for x := 0; x <= K; x++ {
		for y := 0; y <= K; y++ {
			z := S - (x + y)
			if 0 <= z && z <= K {
				ans++
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
import sys
from collections import deque
from collections import defaultdict
from collections import Counter

def conn(n,m,e):
    d=dict(zip(range(1,n+1),range(-1,(-1)*n-1,-1)))
    td=defaultdict(lambda:deque([])) #tdは同値類がキーで中の元が値
    c=1
    for edge in e:
        a=edge[0]
        b=edge[1]
        da=d[a] #da,dbはa,bの含まれる同値流のラベル
        db=d[b]
        if da<0 and db<0:
            d[a]=c
            d[b]=c
            td[c].append(a)
            td[c].append(b)
            c+=1
        elif da>0 and db<0:
            d[b]=da
            td[d[a]].append(b)
        elif da<0 and db>0:
            d[a]=db
            td[d[b]].append(a)
        elif da>0 and db>0 and da!=db:
            for x in td[db]:
                d[x]=da
                td[da].append(x)

    return list(d.values())

def components(n,k,e):
    ed=defaultdict(lambda:deque())
    for edge in e:
        ed[edge[0]].append(edge[1])
        ed[edge[1]].append(edge[0])
    c=0
    s=[0]*n
    for i in range(1,n+1):
        if s[i-1]==0:
            c+=1
            stack=deque([i])
            while stack:
                w=stack.pop() 
                s[w-1]=c
                while ed[w]:
                    wn=ed[w].pop()
                    if s[wn-1]==0:
                        s[wn-1]=c
                        if ed[wn]:
                            stack.append(w)
                            w=wn
    return s
           
def main(n,k,l,e1,e2):
    d1=components(n,k,e1)
    d2=components(n,l,e2)
    p=tuple(zip(iter(d1),iter(d2)))
    d=Counter(p)
    # print(d1,d2,d,p)
    d[(k,l)]=1
    print(' '.join([str(d[x]) for x in p])) 

if __name__=='__main__':
    ssr=sys.stdin.readline
    n,k,l=map(int,ssr().strip().split())
    e1=[]
    e2=[]
    for _ in range(k):
        e1.append(tuple(map(int,ssr().strip().split())))
    for _ in range(l):
        e2.append(tuple(map(int,ssr().strip().split())))
    main(n,k,l,e1,e2)


Measured memory_bytes: 183956
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	int ar[n][3];
	int dp[n][3];
	for(int i=0;i<n;i++)
		for(int j=0;j<3;j++){
			cin>>ar[i][j];
			dp[i][j]=ar[i][j];
		}
	for(int i=1;i<n;i++){
		for(int j=0;j<3;j++){
			int m=0;
			for(int k=0;k<3;k++){
				if(j!=k)
					m=max(m,dp[i-1][k]);
			}
			dp[i][j]+=m;
		}
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 2560
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)

string solve(vector<string>& sv, int n) {
  string ret;
  vector<vector<int>> v(50, vector<int>(256));
  REP(i, n) {
    for (auto c : sv[i])
      ++v[i][c - '0'];
  }
  for (char c = 'a'; islower(c); ++c) {
    int cnt = (1 << 30);
    REP(i, n)
      cnt = min(cnt, v[i][c - '0']);
    for (int i = 0; i < cnt; ++i)
      ret += c;
  }
  return ret;
}

int main() {
  int n;
  cin >> n;
  vector<string> v(n);
  REP(i, n) cin >> v[i];
  cout << solve(v, n) << endl;
}


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

int N;
int dp[1001][8];
char S[1001];
int i,j;

int moji(char A){
	switch(A){
	case 'J':return 1;
	case 'O':return 2;
	case 'I':return 4;
	}
}

int sub(int i,int j,int B){
	int T,sol=0,k;
	if(!(moji(S[i]) & j)) return 0;
	if(!(B & j)) return 0;
	if(i==N) return dp[i][j]=1;
	if(dp[i][j]!=-1) return dp[i][j];
	B=j;
	for(k=1;k<8;k++){
		sol+=sub(i+1,k,B);
	}
	T=dp[i][j]=sol%10007;
	return T;
}

int main(void){
	scanf("%d",&N);
	for(i=1;i<=N;i++){
		scanf(" %c",&S[i]);
	}
	S[0]='J';
	memset(dp,-1,sizeof(dp));
	printf("%d\n",sub(0,1,1));
	return 0;
}

Measured memory_bytes: 696
function Main(input){
    var D = input;
    D = parseInt(D,10);

    switch(D){
        case 25:
            console.log('Christmas');
        break;
        case 24:
            console.log('Christmas Eve');
        break;
        case 23:
            console.log('Christmas Eve Eve');
        break;
        case 22:
            console.log('Christmas Eve Eve Eve');
        break;
    }


}
Main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
#include<iostream>
#include<cstring>
#include<cstdio>
#define MN 1000000
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
char s[MN+5],t[MN+5];
int last[MN+5][26],a[MN+5],n,ans=0;
int main()
{
	n=read();
	scanf("%s%s",s+1,t+1);
	for(int i=1;i<=n;++i) 
	{
		memcpy(last[i],last[i-1],sizeof(last[0]));
		last[i][s[i]-'a']=i;
	}
	for(int i=n,j=n,r=0,k=0;i;--i)
	{
		if(j>i) j=i;
		if(s[j]!=t[i])
		{
			if(!last[j][t[i]-'a']) return 0*puts("-1");
			j=last[j][t[i]-'a'];
			++r;++k;ans=max(ans,k);
			++a[j+r];
		}
		k-=a[i+r];a[i+r]=0;
	}
	cout<<ans;
	return 0;
}



Measured memory_bytes: 107648
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>

using namespace std;
using ll = long long;

const int MN = 200005;

ll a[MN];

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	ll tot=0;
	for(int i=0; i<n; ++i){
		cin>>a[i];
		tot+=a[i];
	}
	ll sum=0;
	ll res=tot;
	for(int i=0; i<n-1; ++i){
		sum+=a[i];
		res=min(res,abs((sum*(ll)2-tot)));
	}
	cout<<res<<endl;
	return 0;
}



Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	
	static int[] antena = new int[5];
	static int dist ;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		for(int i=0; i<5; i++) {
			antena[i] = Integer.parseInt(sc.nextLine());
		}
		dist = Integer.parseInt(sc.nextLine());
		
		int max = 0;
		
		for(int i=0; i<5; i++) {
			for(int j=4; j>i; j--) {
				if(Math.abs(antena[i] - antena[j]) > max) {
					max = Math.abs(antena[i] - antena[j]);
				}
			}
		}
		
		if(max > dist) {
			System.out.println(":(");
		} else {
			System.out.println("Yay!");
		}

	}
}

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

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILL(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};

int binary_search(vector<int> &v,int k){
  int left = -1,right = (int)v.size();
  while(right - left > 1){
    int mid = (left+right)/2;
    if(v[mid] >= k)right = mid;
    else left = mid;
  }
  return right;
}

int main(){

  int n,k;
  cin >> n >> k;
  vector<int> v(n);
  REP(i,n)cin >> v[i];
  sort(ALL(v));
  int l = binary_search(v,k);
  if(l != v.size())cout << (int)v.size() - l;
  else cout << 0;

  return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  for (int i=0; i<M; i++){
    cin >> A.at(i);
  }
  int sum = 0;
  for (int i=0; i<M; i++){
    sum += A.at(i);
  }
  int ans;
  if (N >= sum) {
  	cout << N-sum << endl;
  }
  else cout << -1 << endl;
}

Measured memory_bytes: 3600
N, X = map(int,input().split())
L = list(map(int,input().split()))

D = [0] * (N+1)
cnt = 1
for i in range(1, N+1):
  D[i] = D[i-1] + L[i-1]
  if D[i] <= X:
    cnt += 1
print(cnt)

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

int main(){
  string str[18]={"","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"};
  while(1){
  int unit[18]={},n,m;
  unit[0]=1;
  cin>>n>>m;
  if(n+m==0) break;
  for(int i=0;i<m;i++)
    for(int j=18;j>=0;j--){
      unit[j]*=n;
    if(unit[j]>=10000){
      unit[j+1]+=unit[j]/10000;
      unit[j]-=(unit[j]/10000)*10000;
    }
    }

  for(int i=17;i>=0;i--)if(unit[i]!=0) cout<<unit[i]<<str[i];
  cout<<endl;
  }
  return 0;
}
    

Measured memory_bytes: 1208
public class Main {
	public static void main(String[] age){
		String input = new java.util.Scanner(System.in).nextLine();
		String[] arrayinput = input.split(" ");
		int a = Integer.parseInt(arrayinput[0]);
		int b = Integer.parseInt(arrayinput[1]);
		if(a>b){
			System.out.println("a > b");
		}else if(a<b){
			System.out.println("a < b");
		}else{
			System.out.println("a == b");
		}
	}
}

Measured memory_bytes: 26056
#include<bits/stdc++.h>
#define pii pair<int,int>
#define f first
#define s second
#define p 1000000007
using namespace std;
string s,t;
int a[3000][3000];
int b[3000][3000];
int lcs(int i,int j){
    if(i==-1||j==-1)return 0;
    if(a[i][j]!=-1)return a[i][j];
    if(s[i]==t[j]){
        b[i][j]=1;
        return a[i][j]=lcs(i-1,j-1)+1;
    }
    if(lcs(i-1,j)>lcs(i,j-1)){
        b[i][j]=2;
        return a[i][j]=lcs(i-1,j);
    }
    b[i][j]=3;
    return a[i][j]=lcs(i,j-1);
}
int main(){
    
    cin>>s>>t;
    memset(a,-1,sizeof(a));
    lcs(s.size()-1,t.size()-1);
    string s1;
    int i=s.size()-1,j=t.size()-1;
    while(i>=0&&j>=0){
        if(b[i][j]==1){
            s1.push_back(s[i]);
            i--;j--;
        }
        else if(b[i][j]==2){
            i--;
        }
        else{
            j--;
        }
    }
    reverse(s1.begin(),s1.end());
    cout<<s1;
    return 0;
}

Measured memory_bytes: 71040
import sys

input = sys.stdin.readline


def main():
    H, W = [int(x) for x in input().split()]

    if H % 3 == 0 or W % 3 == 0:
        print(0)
        return

    if H % 2 == 0 and W % 2 == 0:
        print(min(H, W) // 2)
        return

    ans = min(H, W)
    ans2 = float("inf")
    for i in range(1, H // 2 + 2):
        a = i * W
        bc = H * W - a
        b = (W // 2) * (H - i)
        c = bc - b
        ma = max(a, b, c)
        mi = min(a, b, c)
        ans2 = min(ans2, ma - mi)

    for i in range(1, W // 2 + 2):
        a = i * H
        bc = H * W - a
        b = (H // 2) * (W - i)
        c = bc - b
        ma = max(a, b, c)
        mi = min(a, b, c)
        ans2 = min(ans2, ma - mi)

    print(min(ans, ans2))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int n=sc.nextInt();
			int k=sc.nextInt();
			int bort[][]=new int[k][];//bort[i]テ」ツ?ッiテァツ閉ェテァツ崢ョテ」ツ?ョテ」ツδ愿」ツδシテ」ツδ暗」ツ?ォテ」ツ?ェテ」ツつ凝」ツつヲテ」ツつオテ」ツつョ
			for(int i=0; i<k; i++){
				bort[i]=new int[sc.nextInt()];
				for(int j=0; j<bort[i].length; j++){
					bort[i][j]=sc.nextInt();
				}
			}
			int r=sc.nextInt();
			int p[][]=new int[r][2];
			for(int i=0;i<r;i++){
				p[i][0]=sc.nextInt();
				p[i][1]=sc.nextInt();
			}//テ」ツ?禿」ツ?禿」ツ?セテ」ツ?ァinput
			Set<Integer> bad=new TreeSet<Integer>();
			for(int i=0; i<k; i++){
				Set<Integer> s=new TreeSet<Integer>();
				for(int j=0; j<bort[i].length; j++){
					s.add(bort[i][j]);
				}
				//System.out.println("!"+s.size());
				for(int j=0;j<r;j++){
					if(s.contains(p[j][0]) && s.contains(p[j][1])){
						bad.add(p[j][0]);bad.add(p[j][1]);
					}
				}
			}
			System.out.println(bad.size());
		}

	}

}

Measured memory_bytes: 24356
#include<cstdio>
#include<cstring>
#define maxn 3005
int n,a[maxn],ans[maxn],cnt;
bool f[maxn];
struct node { int v; node *nxt; } edge[maxn*2],*head[maxn],*ncnt;
void addedge(int u,int v)
{
	ncnt++;
	ncnt->v=v,ncnt->nxt=head[u];
	head[u]=ncnt;
}
bool dfs(int u,int fa)
{
	for(node *p=head[u];p;p=p->nxt)
	{
		int v=p->v;
		if(a[v]<a[u]&&!dfs(v,u)) return f[u]=true;
	}
	return f[u]=false;
}
int main()
{
	ncnt=&edge[0];
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		addedge(u,v); addedge(v,u);
	}
	for(int i=1;i<=n;i++)
	{
		memset(f,0,sizeof(f));
		if(dfs(i,0)) ans[++cnt]=i;
	}
	for(int i=1;i<=cnt;i++) printf("%d ",ans[i]);
}


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

int main()
{
	/*#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
	#endif*/

	string s;
	cin >> s;

	int a = 0, b = 0;
	char a1 = ' ', b1 = ' ';

	for(int i = 0;i < 4;i++)
	{
		if(s[i] != a1 and a1 == ' ')
			a1 = s[i];
		else if(s[i] != b1 and b1 == ' ' and s[i] != a1)
			b1 = s[i];
		if(s[i] == a1)
			a++;
		if(s[i] == b1)
			b++;
	}

	if(a == 2 and b == 2)
		cout << "Yes";
	else
		cout << "No";



}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b, c, d = map(int, read().split())
if abs(a - c) <= d:
    print('Yes')
elif abs(a - b) <= d and abs(b - c) <= d:
    print('Yes')
else:
    print('No')


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

int main() {

    int a, b, c, r;
    while (cin >> a >> b >> c >> r and (a or b or c or r)) {

        if (a == b*c) {
            cout << 0 << endl;
            continue;
        }

        // (r0 + r*x) / (w0 + y) == c
        // r0 + r*x == c * (w0 + y)
        // r0 + r*x == c*w0 + c*y
        // c*y == r0 + r*x - c*w0

        for (int x=0; x<=100000; ++x) {
            double y = (a + r*x - c*b) / (c + 0.0);
            if (y >= 0) {
                cout << x << endl;
                break;
            }
        }


    }

}

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

using namespace std;

int main(){

  //最大値
  int maxvalu = 0;

  int N;
  cin >> N;
  string S;

  cin >> S;

  for(int i = 1; i < N; i++){
    int counter = 0;
    set<char> bef;//前半
    set<char> aft;//後半

    for(int j = 0; j < N; j++){
      if(j < i){
        bef.insert(S.at(j));
      }
      else{
        aft.insert(S.at(j));
      }
    }
    for(auto a : bef){
      if(aft.count(a)){
        counter++;
      }
    }

    if(maxvalu < counter){
      maxvalu = counter;
    }
  }

  cout << maxvalu << endl;
}


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

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var k = Input();
		Console.WriteLine(k[1] + k[0]);
	}

	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
int n,tot,a[N],b[N];
ll ans;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    int l=2,r=n-1,x=a[1],y=a[n];
    ans=a[n]-a[1];
    while(l<=r)
    {
        //cout<<"ANS: "<<ans<<endl;
        int t1=abs(x-a[l]),t2=abs(y-a[l]),t3=abs(x-a[r]),t4=abs(y-a[r]);
        if(t1>=t2&&t1>=t3&&t1>=t4)
        {
            ans+=t1;
            x=a[l++];
        }
        else if(t2>=t1&&t2>=t3&&t2>=t4)
        {
            ans+=t2;
            y=a[l++];
        }
        else if(t3>=t1&&t3>=t2&&t3>=t4)
        {
            ans+=t3;
            x=a[r--];
        }
        else
        {
            ans+=t4;
            y=a[r--];
        }
    }
    printf("%lld\n",ans);
}


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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int N;
    cin >> N;

    vi points;

    vi rx(N), ry(N);
    for (int i = 0; i < N; i++) {
        cin >> rx[i] >> ry[i];
        points.push_back(i);
    }

    vi bx(N), by(N);
    for (int i = 0; i < N; i++) {
        cin >> bx[i] >> by[i];
        points.push_back(N + i);
    }

    sort(all(points), [&](int i, int j) {
        return (i < N ? rx[i] : bx[i - N]) < (j < N ? rx[j] : bx[j - N]);
    });

    int ans = 0;
    set<pair<int, int>> redY;

    for (int i : points) {
        if (i < N) {
            redY.insert({ ry[i], i });
        } else {
            auto pr = redY.lower_bound({ by[i - N], -1 });
            if (pr != redY.begin()) {
                redY.erase(prev(pr));
                ans++;
            }
        }
    }

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



Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    string s;
    cin>>s;
    if(s=="Sunny") cout<<"Cloudy";
    if(s=="Cloudy") cout<<"Rainy";
    if(s=="Rainy") cout<<"Sunny";
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type unionFind struct {
	v []int
}

func (u *unionFind) Init(n int) {
	u.v = make([]int, n)
	for i := range u.v {
		u.v[i] = -1
	}
}

func (u *unionFind) find(x int) int {
	if u.v[x] < 0 {
		return x
	}
	u.v[x] = u.find(u.v[x])
	return u.v[x]
}

func (u *unionFind) Size(x int) int {
	return -u.v[u.find(x)]
}

func (u *unionFind) IsSame(x, y int) bool {
	return u.find(x) == u.find(y)
}

func (u *unionFind) Merge(x, y int) {
	x = u.find(x)
	y = u.find(y)
	if x == y {
		return
	}
	if -u.v[x] <= u.v[y] {
		x, y = y, x
	}
	u.v[x] += u.v[y]
	u.v[y] = x
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	a := make([]int, m)
	b := make([]int, m)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < m; i++ {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
		a[i]--
		sc.Scan()
		b[i], _ = strconv.Atoi(sc.Text())
		b[i]--
	}
	var uf unionFind
	uf.Init(n)
	ans := make([]int64, m)
	ans[m-1] = int64(n) * int64(n-1) / 2
	for i := m - 1; i > 0; i-- {
		if uf.IsSame(a[i], b[i]) {
			ans[i-1] = ans[i]
			continue
		}
		conv := int64(uf.Size(a[i])) * int64(uf.Size(b[i]))
		ans[i-1] = ans[i] - conv
		uf.Merge(a[i], b[i])
	}
	w := bufio.NewWriter(os.Stdout)
	for _, e := range ans {
		fmt.Fprintln(w, e)
	}
	w.Flush()
}


Measured memory_bytes: 9088
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define fast_io ios::sync_with_stdio(false);cin.tie(NULL);
#define input freopen("Test.txt","r",stdin)
#define output freopen("Output.txt","w",stdout);
#define what_is(x) cout<<#x<<" is "<<x<<endl;
#define pb push_back
#define eb emplace_back
#define inf 1000000000
const double pi = 3.141592653589793238460;

// #define BLOCK 707  ///This is for dividing the array into blocks like we do in sqrt decomposition so as to sort them according to the block number
///this is the reason it takes O(sqrt(N)*N) time complexity

int BLOCK;
const int maxn = 500010;
struct query
{
	int l;
	int r;
	int i;
};
query Q[maxn];
int arr[maxn], ans[maxn];
int fre[1000001];
int cnt = 0;

bool comp(query a, query b)
{
	if (a.l / BLOCK != b.l / BLOCK)
		return a.l / BLOCK < b.l / BLOCK;
	return a.r < b.r;
}

void add(int pos)
{
	fre[arr[pos]]++;
	if (fre[arr[pos]] == 1)
		cnt++;
}
void remove(int pos)
{
	fre[arr[pos]]--;
	if (fre[arr[pos]] == 0)
		cnt--;

}
int main()
{
	fast_io;
	//input;
	//output;
	int n, q;
	cin >> n >> q;
	BLOCK = sqrt(n)+1;
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	// cin >> q;
	for (int i = 0; i < q; i++)
	{
		cin >> Q[i].l >> Q[i].r;
		Q[i].i = i, Q[i].l--, Q[i].r--;
	}

	sort(Q, Q + q, comp);

	int ML = 0, MR = -1;
	for (int i = 0; i < q; i++)
	{
		int L = Q[i].l;
		int R = Q[i].r;

		while (ML > L)
			ML--, add(ML);
		while (MR < R)
			MR++, add(MR);
		while (ML < L)
			remove(ML), ML++;
		while (MR > R)
			remove(MR), MR--;
		ans[Q[i].i] = cnt;
	}

	for (int i = 0; i < q; i++)
		cout << ans[i] << endl;

	return 0;
}

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

typedef long long ll;

const ll MOD = 1000000007;
ll N;
string S1, S2;
vector<ll> A;
ll R = 1;

int main() {
  cin >> N >> S1 >> S2;
  for (ll i = 0; i < N;) {
    if (S1[i] == S2[i]) {
      A.push_back(1);
      i += 1;
    } else {
      A.push_back(2);
      i += 2;
    }
  }
  for (ll i = 0; i < A.size(); ++i) {
    if (A[i] == 1) {
      (R *= i == 0 ? 3 : A[i - 1] == 1 ? 2 : 1) %= MOD;
    } else {
      (R *= i == 0 ? 6 : A[i - 1] == 1 ? 2 : 3) %= MOD;
    }
  }
  cout << R << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; } /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; } /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b)
{
  return *(char *)a - *(char *)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b)
{
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main(void)
{
  char s[5];
  scanf("%s", s);

  int i, j;
  int count;
  rep(i, 4)
  {
    rep(j, 4)
    {
      if (i != j)
      {
        if (s[i] == s[j])
          count++;
      }
    }
  }
  printf(count == 4 ? "Yes\n" : "No\n");
  return 0;
}


Measured memory_bytes: 128
//#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
    int a,b;
    while(cin>>a>>b)
    {
        int sum=a+b,z=0;
        while(sum!=0)
        {
            z++;
            sum/=10;

        }
       cout<<z<<endl;
    }


    return 0;
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCorder
{
    public static class Program
    {
        static public void Main(string[] args)
        {
            int[] cnt1 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int[] cnt2 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int[] cnt3 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int[,] input = new int[,]
                {
                    { cnt1[0],cnt1[1],cnt1[2] },
                    { cnt2[0],cnt2[1],cnt2[2] },
                    { cnt3[0],cnt3[1],cnt3[2] }
                };

            int cnt = int.Parse(Console.ReadLine());

            for (int num = 0; num < cnt; num++)
            {
                int bingo = int.Parse(Console.ReadLine());
                for (int strt1 = 0; strt1 <= 2; strt1++)
                {
                    for (int strt2 = 0; strt2 <= 2; strt2++)
                    {
                        if (input[strt1, strt2] == bingo)
                        {
                            input[strt1, strt2] = 0;
                        }
                    }
                }
            }

            if ((input[0, 0] + input[0, 1] + input[0, 2] == 0) ||
                (input[1, 0] + input[1, 1] + input[1, 2] == 0) ||
                (input[2, 0] + input[2, 1] + input[2, 2] == 0) ||
                (input[0, 0] + input[1, 0] + input[2, 0] == 0) ||
                (input[0, 1] + input[1, 1] + input[2, 1] == 0) ||
                (input[0, 2] + input[1, 2] + input[2, 2] == 0) ||
                (input[0, 0] + input[1, 1] + input[2, 2] == 0) ||
                (input[0, 2] + input[1, 1] + input[2, 0] == 0))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
                        
        }
    }
}




Measured memory_bytes: 13396
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,a,n) for(int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> PLL;

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

    if((a*b) % 2 == 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}



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

template <typename T>
string to_string(const T &n)
{
    ostringstream stm;
    stm << n;
    return stm.str();
}

int main()
{
    int i = 1;
    while (1)
    {
        int x;
        cin >> x;
        if (x == 0)
            break;
        cout << "Case " + to_string(i) + ": " + to_string(x) << endl;
        i++;
    }
}


Measured memory_bytes: 3128
h, w = gets.split.map(&:to_i)
n = gets.to_i
color_num = gets.split.map(&:to_i)

field = Array.new(h) {Array.new(w, 0)}
color = 0
dir = 1
x = y = 0

loop do
  field[y][x] = color + 1
  x += dir
  case
  when x < 0
    x = 0
    y += 1
    dir = 1
  when x >= w
    x = w - 1
    y += 1
    dir = -1
  end
  color_num[color] -= 1
  if color_num[color].zero?
    color += 1
    break if color >= n
  end
end

puts field.map {|row| row.join(" ")}

Measured memory_bytes: 2428
// AOJ 3017: Piano
// 2017.12.27 bal4u@uu

#include <stdio.h>

char buf[12], *p;

int in()
{
	int n = 0;
	while (*p >= '0') n = 10*n + (*p++ & 0xf);
	return n;
}

int main()
{
	int n, a, a0, d, w, ans;

	fgets(p=buf, 12, stdin), n = in();
	ans = d = 0;
	fgets(p=buf, 12, stdin), a0 = in(), w = 1;
	while (--n) {
		fgets(p=buf, 12, stdin), a = in();
		if (a > a0) {
			if (d == 1) w++;
			else { if (w > ans) ans = w; w = 2, d = 1; }
		} else if (a < a0) {
			if (d == -1) w++;
			else { if (w > ans) ans = w; w = 2, d = -1;	}
		}
		a0 = a;
	}
	if (w > ans) ans = w;
	printf("%d\n", ans);
	return 0;
}

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

int main() {
	int n;
	scanf("%d", &n);
	deque<int> dq;
	for (int i=0; i<n; i++) {
		int a; scanf("%d", &a);
		if (i%2==0) dq.push_back(a);
		else dq.push_front(a);
	}
	for (int i=0; i<n; i++) printf("%d%c", dq[n%2==0 ? i : n-i-1], i==n-1 ? '\n' : ' ');
	
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N,K;
vector<int>G[2001];
bool used[2001];
//深さがkより大きい葉の数を計算
int dfs(int v,int k,int d){
   int ans=0;
   used[v]=true;
   if(d>k){
      ans++;
   }
   REP(i,G[v].size()){
       if(used[G[v][i]]==false){
          ans+=dfs(G[v][i],k,d+1);
       }
   }
   return ans;
}

int main(){
    cin>>N>>K;
    REP(i,N-1){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int ans=100000000;
    REP(i,N){
        REP(j,N){
            used[j]=false;
        }
        //K/2の場合
        used[i]=true;
        vector<int>v;
        REP(k,G[i].size()){
            int a=dfs(G[i][k],K/2,1);
            //cout<<G[i][k]<<" a "<<a<<endl;
            v.push_back(a);
        }
        //cout<<endl;
        
        
        //(K+1)/2の場合     
        REP(j,N){
            used[j]=false;
        }
        
        used[i]=true;
        vector<int>vv;
        REP(k,G[i].size()){
            int a=dfs(G[i][k],(K+1)/2,1);
            //cout<<G[i][k]<<" a "<<a<<endl;
            vv.push_back(a);
        }
        //cout<<endl;
        
        int t=0;
        REP(j,v.size()){
            t=max(v[j]-vv[j],t);
        }
        t=-t;
        REP(j,v.size()){
            t+=v[j];
        }
        ans=min(ans,t);
        //cout<<endl<<endl;
        
    }
    cout<<ans<<endl;
	return(0);
}

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

namespace ABC165
{
    class B
    {
        static void Main(string[] args)
        {
            var X = long.Parse(Console.ReadLine());
            //var AB = Console.ReadLine().Split().Select(long.Parse).ToArray();
            double a = 100;
            var count = 0;
            while (a < X)
            {
                a = Math.Truncate(a * 1.01);
                count++;

            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 27536
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000000
signed main()
{
   SPEED;
   int n;
   cin>>n;
   int a[n],dp[n+1][n+1],ans=0;
   memset(dp,0,sizeof(dp));
   vector <pair <int,int> > vec;
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
       vec.push_back(make_pair(a[i],i+1));
   }
   sort(vec.rbegin(),vec.rend());
   for(int i=1;i<=n;i++)
   {
       for(int j=0;j<=i;j++)
       {
           int l=i-j,r=j;
           if(l!=0)
           dp[l][r]=max(dp[l][r],dp[l-1][r]+vec[i-1].first*abs(vec[i-1].second-l));
           if(r!=0)
           dp[l][r]=max(dp[l][r],dp[l][r-1]+vec[i-1].first*abs(vec[i-1].second-(n-r+1)));
       }
   }
   for(int i=0;i<=n;i++)
   {
       ans=max(ans,dp[i][n-i]);
   }
   cout<<ans;
}

Measured memory_bytes: 34988
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
int N,M;
int P[100100];
ll A[100100],B[100100],C[100100];
ll imos[100100];
int main()
{
	scanf("%d %d",&N,&M);
	for(int i=0;i<M;i++)scanf("%d",&P[i]);
	for(int i=0;i<M;i++)P[i]--;
	for(int i=0;i<N-1;i++)scanf("%lld %lld %lld",&A[i],&B[i],&C[i]);
	for(int i=0;i<M-1;i++)
	{
		int start=P[i],end=P[i+1];
		if(start>end)swap(start,end);
		imos[start]++;
		imos[end]--;
	}
	for(int i=0;i<N;i++)imos[i+1]+=imos[i];
	ll ans = 0ll;
	for(int i=0;i<N-1;i++)
	{
		ll paper = A[i]*imos[i];
		ll IC = C[i]+B[i]*imos[i];
		ans += min(paper,IC);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4540
n = input()
x =map(int,raw_input().split())
y =map(int,raw_input().split())
sum_1,sum_2,sum_3  = [0,0,0]
sum_end = []
for i in range(n):
	if x[i] > y[i]:
		sum_1 += x[i]-y[i]
		sum_2 += (x[i]-y[i])**2
		sum_3 += (x[i]-y[i])**3
		sum_end.append(x[i]-y[i])
	else :
		sum_1 += y[i]-x[i]
		sum_2 += (y[i]-x[i])**2
		sum_3 += (y[i]-x[i])**3
		sum_end.append(y[i]-x[i])
print(sum_1)
print(pow(sum_2,0.5))
print(pow(sum_3,1.0/3.0))
sum_end.sort()
print(sum_end[len(sum_end)-1])

Measured memory_bytes: 6640
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = int64_t;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);


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

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

  int l = 0;
  int r = 0;
  int open = 0;

  rep(i, n) {
    if (s[i] == '(') open++;
    if (s[i] == ')') {
      if (open > 0) open--;
      else l++;
    }
  }

  cout << string(l, '(') << s << string(open, ')') << endl;

  return 0;
}


Measured memory_bytes: 384
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;


constexpr int32_t MAX_N = 200000;//頂点数
constexpr int32_t MAX_LOGN = 30;//log2頂点数
std::vector<int32_t> graph[MAX_N];//木

int32_t N;
void input_tree()
{
	in >> N;
	for (int32_t i = 0; i < N - 1; ++i)
	{
		int a, b;
		in >> a >> b; --a; --b;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
}

int32_t depth[200000];
void dfs(int v, int p, int d)
{
	depth[v] = d;
	for (auto& n : graph[v])
	{
		if (n == p) { continue; }
		dfs(n, v, d + 1);
	}
}

bool dp[200100];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	input_tree();
	dfs(0, -1, 0);
	auto max_v = std::max_element(depth, depth + N)- depth;
	dfs(max_v, -1, 0);
	auto max_v2 = std::max_element(depth, depth + N) - depth;

	dp[1] = true;
	dp[2] = false;
	for (size_t i = 3; i <= depth[max_v2] + 1; i++)
	{
		dp[i] = (!dp[i - 1]) || (!dp[i - 2]);
	}

	if (dp[(depth[max_v2]+1)]) {
		out << "First" << endl;
	}
	else {
		out << "Second" << endl;
	}

	return 0;
}
#endif


Measured memory_bytes: 21504
#include<stdio.h>
int main(void){
  int x,y,i,j,a,b,c;
  scanf("%d %d",&x,&y);
  if(x*4<y){
    printf("No\n");
    return 0;
  }
  a=0;
  b=x-a;
  for(i=0;i<=x;i++){
    if(a*4+b*2==y){
      printf("Yes\n");
      return 0;
    }
    a+=1;
    b-=1;
  }
  printf("No\n");
  return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin >> n;
    
    // CardData
    int card_num[100];
    for(int i=0;i<n;i++){
        cin >> card_num[i];
    }

    sort(card_num, card_num + n, greater<int>());

    int alice_pt = 0;
    int bob_pt   = 0;
    for(int j=0;j<n;j++){
        if(j % 2 == 0){
            alice_pt = alice_pt + card_num[j];
        } else {
            bob_pt = bob_pt + card_num[j];
        }
    }
    
    cout << (alice_pt - bob_pt) << endl;
    return 0;
}

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

int main(void){
	int cnt=0;
	char a[3]={};
	for(int i=0; i<3; i++){
		cin >> a[i];
		if(a[i]=='1'){
			cnt++;
		}
	}
	cout << cnt << endl;

	return 0;
}

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

int main() {
  ll n;
  cin >> n;
  ll a,b;
  ll ans=1e18;
  for(ll i=1;i*i<=n;i++){
    if (n%i==0){
      a=i;
      b=n/i;
      ans=min(a+b-2,ans);
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
// Date: 2020-03-08

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define FIO ios::sync_with_stdio(false);cin.tie(0)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(),(x).end()
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 998244353;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 10;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

int n;
pii a[N];

int main() {
    scanf("%d", &n);
    rep(i, 1, n) scanf("%d%d", &a[i].fi, &a[i].se);
    sort(a+1, a+1+n);
    LL ans = 1;
    vector<pii> v;
    v.pb(mk((int)2e9 + 1, 1));
    per(i, n, 1) {
        while(v.back().fi < a[i].fi + a[i].se) v.pop_back();
        ans = (ans + v.back().se) % mod;
        v.pb(mk(a[i].fi, ans));
    }
    printf("%lld\n", ans);

    return 0;
}

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

N = int(input())
a = 0

if N % 2 == 0:
    a = 1 / 2
    print(a)
    
else:
    s = N // 2
    a = (s + 1) / N 
    a = round(a, 10)
    print(a)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T,T MOD = 1000000007>
struct Mint{
  static constexpr T mod = MOD;
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(long long k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }

  static Mint add_identity(){return Mint(0);}
  static Mint mul_identity(){return Mint(1);}

  Mint inv(){return pow(MOD-2);}

  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}

  Mint operator+(Mint a) const{return Mint(v)+=a;};
  Mint operator-(Mint a) const{return Mint(v)-=a;};
  Mint operator*(Mint a) const{return Mint(v)*=a;};
  Mint operator/(Mint a) const{return Mint(v)/=a;};

  Mint operator-() const{return v?Mint(MOD-v):Mint(v);}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  bool operator <(const Mint a)const{return v <a.v;}
};
template<typename T,T MOD> constexpr T Mint<T, MOD>::mod;

//INSERT ABOVE HERE
signed main(){
  int n,m;
  cin>>n>>m;
  vector<int> a(m);
  for(int i=0;i<m;i++) cin>>a[i];

  vector<int> used(n+1,0);
  for(int x:a) used[x]=1;

  using M = Mint<int>;
  vector<M> dp(n+2,0);
  dp[0]=M(1);
  for(int i=0;i<n;i++){
    if(used[i]) dp[i]=M(0);
    dp[i+1]+=dp[i];
    dp[i+2]+=dp[i];
  }

  cout<<dp[n].v<<endl;
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double W, H, x, y;
  cin >> W >> H >> x >> y;
  cout << W * H / 2;
  if (x == W / 2 && y == H / 2) {
    cout << " 1";
  }
  else {
    cout << " 0";
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]) {
    	Scanner sc = new Scanner(System.in);
      	int[] arr = new int[5];
      	for( int i = 0 ; i<3 ; i++ )
        {
          String input = sc.nextLine();
          String inputs[] = input.split(" ");
          int a = Integer.valueOf(inputs[0]);
          int b = Integer.valueOf(inputs[1]);
          arr[a]++;
          arr[b]++;
        }
    	for( int i = 1 ; i<5; i++) 
        {
          	if(arr[i]>=3) {
            	System.out.println("NO");
              	return;
            }
        }
      	System.out.println("YES");
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;

ll comb(ll N_, ll C_) {
	const int NUM_ = 3000001;
	static ll fact[3000002], factr[3000002], inv[3000002];
	if (fact[0] == 0) {
		inv[1] = fact[0] = factr[0] = 1;
		for (int i = 2; i <= NUM_; ++i) inv[i] = inv[mod % i] * (mod - mod / i) % mod;
		for (int i = 1; i <= NUM_; ++i) fact[i] = fact[i - 1] * i%mod, factr[i] = factr[i - 1] * inv[i] % mod;
	}
	if (C_<0 || C_>N_) return 0;
	return factr[C_] * fact[N_] % mod*factr[N_ - C_] % mod;
}
ll modpow(ll a, ll n = mod - 2) {
	ll r = 1;
	while (n) r = r * ((n % 2) ? a : 1) % mod, a = a * a%mod, n >>= 1;
	return r;
}

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

	int N; cin >> N;
	VI cnt(N, -1);
	int A;
	REP(i, N + 1) {
		int a; cin >> a;
		a--;
		if (cnt[a] != -1)A = i - cnt[a] + 1;
		else cnt[a] = i;
	}
	
	//cout << A << endl;
	eFOR(i,1, N) {
		int ans = comb(N + 1, i) - comb(N - A + 1, i - 1);
		ans = (ans + mod) % mod;
		cout << ans << '\n';
	}
	cout << 1 << endl;
	return 0;
}



Measured memory_bytes: 74184
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();

		if (a<b) {
			System.out.println("a < b");
		}else if (a>b) {
			System.out.println("a > b");
		}else if (a==b) {
			System.out.println("a == b");
		}
		
	

	}

}



Measured memory_bytes: 26408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,cnt,ans;
string s,t;
int main(void){
	cin>>n>>s;
	for(int i=0;i<=9;i++){
		for(int j=0;j<=9;j++){
			for(int k=0;k<=9;k++){
				cnt=0;
				ll L[]={i,j,k};
				for(int i=0;i<n;i++){
					if(L[cnt]==s[i]-'0'){
						cnt++;
					}
					if(cnt==3){
						ans++;
						break;
					}
				}
			}
		}
	}
	cout<<ans<<endl;
}

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

class UnionFind {
	vector<int>par, sz;
public:
	UnionFind(int n) {
		par = sz = vector<int>(n);
		for (int i = 0; i < n; i++) {
			par[i] = i;
			sz[i] = 1;
		}
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (sz[x] > sz[y]) {
			par[y] = x;
			sz[x] += sz[y];
		}
		else {
			par[x] = y;
			sz[y] += sz[x];
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int size(int x) {
		return sz[find(x)];
	}
};
int a[10000],b[10000];
int main(){
	int n,m;cin>>n>>m;
	rep(i,m){
		cin>>a[i]>>b[i];a[i]--;b[i]--;
	}
	int cnt=0;
	rep(i,m){
		UnionFind uf(n);
		rep(j,m){
			if(i==j)continue;
			uf.unite(a[j],b[j]);
		}
		if(uf.size(0)!=n)cnt++;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f(i,a,b) for(register int i = a;i <= b; ++i)
const int N = 4005;
ll n,a[N],r,g,b;
ll ans;
char ch[N];
int main() {
	scanf("%lld\n",&n);
	scanf("%s",ch+1);
	f(i,1,n) if(ch[i]=='R')++r,a[i]=3; else if(ch[i]=='G') ++g,a[i]=1; else ++b,a[i]=2;
	ans = r * g * b;
	f(i,1,n-2) {
		f(j,i+1,n-1) {
			if(2*j-i>n) break;
			if(a[j]!=a[i]) ans-=((a[i]^a[j])==a[2*j-i]);
		}
	}
	printf("%lld",ans);
}

Measured memory_bytes: 3856