akhauriyash/Code-Regression huggingface dataset:
def solve(a):
    if a <= 1:
        return a
    if a % 2 == 0:
        return a ^ ((a // 2) % 2)
    return ((a + 1) // 2) % 2


def main():
    a, b = map(int, input().split())
    if a > 0:
        a -= 1
    print(solve(a) ^ solve(b))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
from collections import Counter
N = int(input())
V = [int(i) for i in input().split()]
Ki = []
Gu = []
switch = True
for i in range(N):
    if switch:
        Ki.append(V[i])
    else:
        Gu.append(V[i])
    switch = not switch

K = sorted(Counter(Ki).items(),key=lambda x:x[1],reverse=True)
G = sorted(Counter(Gu).items(),key=lambda x:x[1],reverse=True)
sk = len(K)
gk = len(G)
if sk==1 and gk==1:
    if G[0][0]==K[0][0]:
        print(N//2)
    else:
        print(0)
elif sk==1:
    if G[0][0]==K[0][0]:
        print(N-K[0][1]-G[1][1])
    else:
        print(N-K[0][1]-G[0][1])
elif gk == 1:
    if G[0][0]==K[0][0]:
        print(N-K[1][1]-G[0][1])
    else:
        print(N-K[0][1]-G[0][1])
else:
    if G[0][0] == K[0][0]:
        s1 = K[0][1]+G[1][1]
        s2 = K[1][1]+G[0][1]
        print(N-max(s1,s2))
    else:
        print(N-K[0][1]-G[0][1])

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

int main() {
  vector<int> a(4);
  cin >> a[0] >> a[1] >> a[2] >> a[3];
  sort(a.begin(),a.end());
  bool flag=false;
  if(a[0]==1&&a[1]==4&&a[2]==7&&a[3]==9) flag=true;
  if(flag) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
S=input()
x=set(S)
if len(x)%2==1:
  print('No')
else:
  if len(x)==4:
    print('Yes')
  else:
    if (('N' in S) and ('S' in S)) or (('E' in S) and ('W' in S)):
      print('Yes')
    else:
      print('No')

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
		public static void main(String[] args) {
			int a=scan.nextInt();
			int b=scan.nextInt();
			long c=a+2019<b?a+2019:b;
			long min=1145141919;
			for(long i=a;i<=c;i++) {
				for(long j=i+1;j<=c;j++) {
					long kore=i*j%2019;
					min=min<kore?min:kore;
				}
			}
			System.out.println(min);
		}
}


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int a,b,c;
	cin >>a >>b >>c;
	int ans =0;
	ans = max(ans, abs(a-b));
	ans = max(ans, abs(b-c));
	ans = max(ans, abs(a-c));
	
	cout << ans <<"\n";
	return 0;
}


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

int main()
 {
 	int a,b,i,j;
 	string s,g;
 	cin>>a>>b;
 	for(i=0;i<a;i++)
 		s+=(char)(b+'0');
 	for(i=0;i<b;i++)
 		g+=(char)(a+'0');
 	if(a<=b)
 		cout<<g<<endl;
 	else
	 	cout<<s<<endl;	
 }

Measured memory_bytes: 3548
import itertools 

N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))

arrayForPerm = []

for i in range(1,N+1):
  arrayForPerm.append(i)
  
perm = itertools.permutations(arrayForPerm)
newPerm = list(perm)

for i in range(len(newPerm)):
  if list(newPerm[i]) == P:
    A = i + 1
  if list(newPerm[i]) == Q:
    B = i + 1

result = A - B

print(abs(result))

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

int main()
{
    int A,B,C,X,ans=0;
    cin >> A >> B >> C >> X;
    for(int i=0; i<=A; i++){
        for(int j=0; j<=B; j++){
            for(int k=0; k<=C; k++){
                if(500*i+100*j+50*k == X){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

dp=[]
mat=[]
for _ in range(2):
  array=list(map(int,input().split()))
  mat.append(array)
  dp.append([0]*N)
#print(mat)

for j in range(N):
  dp[0][j]=mat[0][j]+dp[0][j-1]
for j in range(N):
  dp[1][j]=mat[1][j]+max(dp[1][j-1],dp[0][j])

print(dp[-1][-1])

Measured memory_bytes: 3064
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<math.h>
#include<list>
#include<complex>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define vtype(type) vector<type>
#define vvtype(type) vector<vector<type>>
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,x) unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;


ll const MOD = 1e9 + 7;
ll mod_p(ll x, ll y) {
	x %= MOD;
	y %= MOD;
	return (x + y + MOD) % MOD;
}

ll mod_m(ll x, ll y) {
	x %= MOD;
	y %= MOD;
	return x * y%MOD;
}

ll mod_pow(ll x, ll t) {
	x %= MOD;
	if (t == 0) {
		return 1;
	}
	else {
		ll v = mod_pow(x, t / 2);
		if (t % 2 == 0) {
			return v * v % MOD;
		}
		else {
			return v * v%MOD * x %MOD;
		}
	}
}

ll mod_inv(ll x) {
	return mod_pow(x, MOD - 2);
}

struct edge
{
	long long to; ll name;
	bool operator<(const edge& rhs) const {
		return name > rhs.name;
	}
};

ll const MAX = 1e5 + 5;
vvtype(edge) G(MAX);

int main() {
	ll t[6] = {};
	ll a, b;
	REP(i, 1, 3) {
		cin >> a >> b;
		t[a]++;
		t[b]++;
	}
	SORT(t, 4);
	if (t[1] == t[2] && t[1] == 1 && t[3] == t[4] && t[3] == 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 2560
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;

public class Main {

    public static void main(String[] args) {

        List<String> inputDataList = new LinkedList<String>();
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String input = null;

        try {
            while ((input = in.readLine()) != null) {
                inputDataList.add(input);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        for (String inputData : inputDataList) {

            double result = cast(inputData.split(" "));

            System.out.println(result);

        }

    }

    private static double cast(String[] formula) {

        Stack<Double> stack = new Stack<Double>();
        double num1;
        double num2;

        for (String data : formula) {

            if ("+".equals(data)) {

                num2 = stack.pop().doubleValue();
                num1 = stack.pop().doubleValue();
                stack.push(new Double(num1 + num2));

            } else if ("-".equals(data)) {

                num2 = stack.pop().doubleValue();
                num1 = stack.pop().doubleValue();
                stack.push(new Double(num1 - num2));

            } else if ("*".equals(data)) {

                num2 = stack.pop().doubleValue();
                num1 = stack.pop().doubleValue();
                stack.push(new Double(num1 * num2));

            } else if ("/".equals(data)) {

                num2 = stack.pop().doubleValue();
                num1 = stack.pop().doubleValue();
                stack.push(new Double(num1 / num2));

            } else {

                stack.push(Double.parseDouble(data));

            }
        }

        return stack.pop().doubleValue();
    }
}

Measured memory_bytes: 16952
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include<vector>

using namespace std;
typedef long long ll;

ll ans,mx,sum,mn=1e8,cnt;

int main(){
	ll n;
	cin>>n;
	n--;
	cout<<(n*(n+1))/2;	
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#define mid ((l+r)>>1)
using namespace std;
const int N = 1e5+5;
int a[N],n,ans,len,lef[N];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	 scanf("%d",&a[i]);
	lef[1]=1;
	for(int i=2;i<=n;i++)
	if(a[i]<=a[i-1]) lef[i]=lef[i-1];
	else lef[i]=i;
	for(int i=1;i<=n;i++)
	len=(i-lef[i]),ans=max(ans,len);
/*	f[1]=a[1]; len=1;
	for(int i=2;i<=n;i++)
	{
		if(a[i]<=f[len]) f[++len]=a[i];
		else
		{
			int l=1,r=len,ansp;
			while(l<=r)
			{
				if(f[mid]>=a[i]) ansp=mid,l=mid-1;
				else r=mid+1;
			}
			f[ansp+1]=max(f[ansp+1],a[i]);
		}
	}*/
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1024
S = input()

if len(S) == 2:
    if S[0] == S[1]:
        print(1, 2)
    else:
        print(-1, -1)
    exit()

for i in range(len(S)-3):
    s = list(S[i:i+3])
    if len(set(s)) <= 2:
        print(i+1, i+3)
        break
else:
    print(-1, -1)

Measured memory_bytes: 3188
#include <string>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stdlib.h>
#include <algorithm>
#include <list>
#include <math.h>
#include<string.h>
#define reps(i,j,k) for(int i=(j);i<(k);i++)
#define rep(i,j) reps(i,0,j)

//	rep(i,10)cout << i << endl;
using namespace std;
	int data[101];
	int cnt = 0;
	
	int n,m;
void func(int num,int sum)
{
	//cout << sum <<" "<<num <<" " << data[num] <<endl;
	if(num < n){
		func(num+1,sum*(data[num]-1));
		func(num+1,sum*data[num]);
		func(num+1,sum*(data[num]+1));
	}
	else if(sum%2 == 0) cnt++;
}

int main(void){
	cin >> n;
	rep(i,n) cin >> data[i];
	func(0,1);
	cout << cnt << endl;	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define GIO ios_base::sync_with_stdio(0);cin.tie(0);

int main()
{ GIO;
    ll n,sum=0,a;
    cin>>n;
    for(int i=0;i<n;i++)
    {   cin>>a;
        sum+=a;
    
    }
    cout<<(sum-n)<<endl;

    

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 1e9 + 7;
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
template <class T>
void chmin(T &a, T b) { a = min(a, b); }
template <class T>
void chmax(T &a, T b) { a = max(a, b); }
void debug() { cerr << "ok" << endl; }
template <class T>
void printv(const vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
}
template <class T>
void readv(vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int k, a, b;
    cin >> k >> a >> b;
    if (b / k > (a - 1) / k) {
        cout << "OK\n";
    } else {
        cout << "NG\n";
    }
}

Measured memory_bytes: 3664
n = int(input())
listA = list(map(int, input().split()))

index=0
count=0
plSum=0
miSum=0
miniO=10000000
while index < len(listA):
    if listA[index] < 0:
        count+=1
        miSum-=listA[index]
    else:
        plSum+=listA[index]
    if abs(listA[index]) < miniO:
        miniO = abs(listA[index])
    index+=1
if count%2==0:
    print(plSum+miSum)
else:
    print(plSum+miSum-2*miniO)

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

using namespace std;

#define loop(n) for(int lp=0; lp<(n); lp++)
#define ascent(i, a, b)  for(int (i)=(a); (i)<(b); (i)++)
#define descent(i, a, b) for(int (i)=(a); (i)<(b); (i)--)

pair<int, int> sq[210];

int main() {
  int N;
  while(cin >> N, N) {
    ascent(i, 0, 210) {
      sq[i] = make_pair(0, 0);
    }
    
    ascent(i, 1, N) {
      int n, d;
      cin >> n >> d;

      if(d == 0) {
	sq[i] = make_pair(sq[n].first - 1, sq[n].second);
      }
      else if(d == 1) {
	sq[i] = make_pair(sq[n].first, sq[n].second + 1);
      }
      else if(d == 2) {
	sq[i] = make_pair(sq[n].first + 1, sq[n].second);
      }
      else if(d == 3) {
	sq[i] = make_pair(sq[n].first, sq[n].second - 1);
      }
    }

    int x[2] = {0, 0};
    int y[2] = {0, 0};
    ascent(i, 0, N) {
      //      cout << " " << sq[i].first << "," << sq[i].second << endl;
      x[0] = min(x[0], sq[i].first);
      x[1] = max(x[1], sq[i].first);
      y[0] = min(y[0], sq[i].second);
      y[1] = max(y[1], sq[i].second);
    }

    cout << x[1]-x[0]+1 << " " << y[1]-y[0]+1 << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair<ll, ll>;
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;}
const long long LLINF = 1LL << 60;
using namespace std;


ll onenum[50];

ll tmptmp[50][2];

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

    int ma = 0;
    rep(i, N) {
        cin >> A[i];
        ll tmp = A[i];
        int b = 0;
        while (tmp > 0)
        {
            if (tmp&1) onenum[b]++;
            b++;
            tmp >>= 1;
        }
        ma = max(ma, b);
    }

    vector<int> kbit;
    ll tmp = K;
    while (tmp > 0)
    {
        if (tmp&1) kbit.push_back(1);
        else kbit.push_back(0);
        tmp >>= 1;
    }
    if (kbit.size() < ma) {
        int num = ma - kbit.size();
        rep(i, num) kbit.push_back(0);
    }
    reverse(kbit.begin(), kbit.end());

    tmp = 0;
    ll ans = 0, b = kbit.size()-1;
    rep(i, kbit.size())
    {
        int bit = kbit[i];
        if (bit)
        {
            ll tmptmp = onenum[b] * powl(2, b);
            for (int bb=b-1; bb>=0; --bb)
            {
                tmptmp += max(onenum[bb] * powl(2, bb), (N-onenum[bb]) * powl(2, bb));
            }
            ans = max(ans, tmp + tmptmp);
            tmp += (N - onenum[b]) * powl(2, b);
        }
        else
        {
            tmp += onenum[b] * powl(2, b);
        }
        b--;
    }
    ans = max(ans, tmp);
    cout << ans << endl;
}


Measured memory_bytes: 1024
N,M = map(int, input().split())
a   = list(map(int, input().split()))

count = 0

for i in range(N):
    bool_over = a[i] >= (sum(a)/(4*M))
    if(bool_over):
        count +=1

if(M <= count):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define MOD 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MAXX 9000000000000000000
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> > 
#define vvpi vector<vector<pair<int,int> > >


int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int n,i,j,x,y,ans=0;
	vi nos;
	map<int,int> nnl;
	cin >> n;
	for(i=0;i<n;i++)
	{
		cin >> x;
		nnl[x] += 1;
		nos.pb(x);
	}

	map<int,int> calc;

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

	if(nos[0] == 1)
	{
		if(nnl[1] == 1)
		{
			cout << 1;
		}
		else
		{
			cout << 0;
		}
		return 0;
	}

	for(auto it : nos)
	{
		x = it;
		int fl = 0;
		for(i=2*x;i<=nos[n-1];i+=x)
		{
			if(nnl[i])
			{
				calc[i] = 1;
			}
		}
		if(calc[x] == 0 && nnl[x] == 1)
		{
			ans++;
		}
	}
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 71236
//By Tushar Gautam
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define ln '\n'
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM=2e5+5,MOD=1e9+7;
int t,n,m,k,x,y,w;
// Include llmul if MOD*MOD overflow 
// Consider if ull (inverseull) required
inline ll powm(ll x,ll pw,ll Mod=MOD){ //return (x^pw)%Mod
	x%=Mod;
	ll res=1;
	while(pw){
		if(pw&1LL) res=((res*x))%Mod;
		pw>>=1;
		x=((x*x))%Mod;
	}
	return res;
}
// Use gcd if not prime
inline ll inv(ll x,ll Mod=MOD){
	return powm(x,Mod-2,Mod); 
}
ll fac[LIM],ifac[LIM],pw100[LIM],ipw100[LIM];
ll a,b,c;
void pre(){
	fac[0]=1;
	forsn(i,1,LIM) fac[i]=fac[i-1]*i%MOD;
	ifac[LIM-1]=inv(fac[LIM-1]);
	rforn(i,LIM-2) ifac[i]=(i+1)*ifac[i+1]%MOD;
	pw100[0]=1;
	forsn(i,1,LIM) pw100[i]=pw100[i-1]*(a+b)%MOD;
	ipw100[LIM-1]=inv(pw100[LIM-1]);
	rforn(i,LIM-2) ipw100[i]=(a+b)*ipw100[i+1]%MOD;
}
signed main(){
	fastio;
	cin>>n>>a>>b>>c;
	pre();
	ll ans=0;
	ll pa=1,pb=1,pwa=powm(a,n),pwb=powm(b,n);
	forsn(r,n,2*n){
		ll cur=fac[r]*ifac[r-n]%MOD;
		cur=cur*ipw100[r]%MOD;
		// dbg(cur,pwa,pwb,ipw100[r]);
		cur=cur*(pwa*pb%MOD+pwb*pa%MOD)%MOD;
		// dbg(cur);
		pa=pa*a%MOD;
		pb=pb*b%MOD;
		ans=(ans+cur)%MOD;
		// dbg(ans,cur);
	}
	ans=(ans*100)%MOD;
	ans=(ans*inv(a+b))%MOD;
	ans=(ans*ifac[n-1])%MOD;
	cout<<ans<<ln;
	return 0;
}

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


Sum=[]
Sub=[]
for _ in range(N):
    x,y = map(int,input().split())
    Sum.append(x+y)
    Sub.append(x-y)

Sum = sorted(Sum)
Sub=sorted(Sub)
ans=max(abs(Sum[-1]-Sum[0]),abs(Sub[-1]-Sub[0]))
print(ans)


Measured memory_bytes: 107936
#include<iostream>

using namespace std;


int main(){
	int N,count=0,max=0;
	cin >>N;
	long H[N];
	for(int i=0;i<N;i++){
		cin >>H[i];
	}
	for(int i=1;i<N;i++){
		if(H[i]<=H[i-1]){
			count++;
		}
		else{
			if(count>max) max=count;
			count=0;
		}
	}
	if(count>max) max=count;
	cout <<max<<endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{

	static final Scanner	s	=new Scanner(System.in);

	public static void main(String args[]){
		input();
		solve();
	}

	private static void input(){
	}

	private static void solve(){
		s.next();
		System.out.printf("A%cC\n",s.next().charAt(0));
	}
}


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

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

    int arr[n],p[n];

    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }

    p[0]=0;
    p[1]=abs(arr[1]-arr[0]);

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

        p[i]=min(abs(arr[i]-arr[i-1])+p[i-1],abs(arr[i]-arr[i-2])+p[i-2]);
    }

    cout<<p[n-1];
    return 0;
}





Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=100000000000000000;

int main() {
    int n;
    cin >> n;
    vector<vector<int>> a(n,vector<int>(n));
    rep(i,n) rep(j,n) cin >> a.at(i).at(j);
    ll dp[1 << n];
    rep(i,1<<n) dp[i]=0;
    vector<ll> s(1<<n,0);
    dp[(1<<n)-1]=1;
    queue<pp> q;
    q.push(mk((1<<n)-1,0));
    while (!q.empty()){
        ll t=q.front().first,c=q.front().second;
        q.pop();
        rep(i,n){
            if ((t>>i & 1)==1){
                ll r=t-(1<<i);
                if (a[c][i]==1){
                    (dp[r]+=dp[t])%=MOD;
                    if (s[r]==0){
                        s[r]=1;
                        q.push(mk(r,c+1));
                    }
                }
            }
        }
    }
    cout << dp[0] << endl;
}


Measured memory_bytes: 36224
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

signed main(){

  int h1, m1, h2, m2, k; cin >> h1 >> m1 >> h2 >> m2 >> k;

  int l = h2*60 + m2 - (h1*60 + m1);
  int ans = l - k;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	if (n == 25) {
		cout << "Christmas" << endl;
	}
	else if(n==24) {
		cout << "Christmas Eve" << endl;
	}
	else if (n == 23) {
		cout << "Christmas Eve Eve" << endl;
	}
	else if (n == 22) {
		cout << "Christmas Eve Eve Eve" << endl;
	}
}

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

const int MAX = 300001;

int main() {
	// make getuyou_doyou_suu_list
	int data[MAX];
	for(int i=0; i<MAX; i++) {
		if (i%7 == 6 || i%7 == 1)
			data[i] = 0;
		else data[i] = 1;
	}
	data[0]=1; data[1]=1;
	for(int i=0; i<MAX; i++) {
		if (!data[i]) {
			for (int j=i*2; j<MAX; j+=i)
				data[j] = 1;
		}
	}
	while (1){
		// input
		int n;
		scanf("%d", &n);
		if (n == 1) break;
		set<int> Ans;
		for(int i = 0; i < n+1; i++)
			if (!data[i] && n % i == 0) {
				Ans.insert(i);
			}
		// output
		set<int>::iterator S=Ans.begin();
		printf("%d:", n);
		while( S != Ans.end()) {
			printf(" %d", *S);
			S++;
		}
		printf("\n");
	}
}

Measured memory_bytes: 2360
use v5.18;
use warnings;
use utf8;
sub line { chomp(my $str = <>); $str; }
sub split_line { (split / /, line) }

my $n = line;
my @creatures = sort { $a <=> $b } split_line;
my @sums;
my $sum = 0;
for my $i (0 .. $#creatures) {
  $sum += $creatures[$i];
  $sums[$i] = $sum;
}
my $index = 0;
for my $i (0 .. $#creatures - 1) {
  if ($sums[$i] * 2 < $creatures[$i + 1]) {
    $index = $i + 1;
  }
}
say $n - $index;


Measured memory_bytes: 23956
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <tuple>
#include <cstdio>

using namespace std;

void mySwap(int &a, int &b) {
    int t;
    t = a;
    a = b;
    b = t;
}

int main() {
    int N;
    cin >> N;
    vector<int> p(N);
    for (int i = 0; i < N; i++) {
        cin >> p[i];
    }

    vector<int >sorted_p = p;
    sort(sorted_p.begin(), sorted_p.end());
    // reverse(sorted_p.begin(), sorted_p.end());
    // for (int i = 0; i < N; i++) {
    //     cout << sorted_p[i] << " ";
    // }
    // cout << endl;

    // mySwap(p[0], p[1]);
    // for (int i = 0; i < N; i++) {
    //     cout << p[i] << " ";
    // }
    // cout << endl;

    bool flg = false;
    if (sorted_p == p) {
        flg = true;
    } else {
        for (int i = 0; i < N; i++) {
            for (int j = i + 1; j < N; j++) {
                mySwap(p[i], p[j]);
                if (p == sorted_p) {
                    // cout << "i: " << i << "j: " << j << endl;
                    // cout << p[i] << " " << p[j] << endl;
                    flg = true;
                    break;
                } else {
                    mySwap(p[j], p[i]);
                }
            }
            if (flg) {
                break;
            }
        }
    }

    if (flg) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


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

const int INF = 1001001001;

int main() {
  int h, n;
  cin >> h >> n;
  vector<int> dp(h+1, INF);
  dp[0] = 0;
  for(int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    for(int j = 0; j < h; j++) {
      int nj = min(j+a, h);
      dp[nj] = min(dp[nj], dp[j] + b);
    }
  }
  cout << dp[h] << endl;
  return 0;
}

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

template <typename T>
using lim = numeric_limits<T>;

const int MOD = 1e9+7;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n, k; cin >> n >> k;

	ll ans = 0;
	for (ll i = k; i <= n+1; i++){
		ll min_val = ((i-1)*i)/2;
		ll max_val = ((n+1)*n)/2 - ((n-i)*(n-i+1))/2;

		ans = (ans + max_val-min_val+1)%MOD;
	}

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

Measured memory_bytes: 3652
H, W = map(int, input().split())
mp = ['#'*(W+2)]
for _ in range(H):
  mp.append('#'+input()+'#')
mp.append('#'*(W+2))

L = [[0]*(W+2) for _ in range(H+2)]
R = [[0]*(W+2) for _ in range(H+2)]
U = [[0]*(W+2) for _ in range(H+2)]
D = [[0]*(W+2) for _ in range(H+2)]

rlt = 0
for i in range(H+1):
  for j in range(W+1):
    if mp[i+1][j] == '#':
      D[i+1][j] = 0
    else:
      D[i+1][j] = D[i][j] + 1
    if mp[H-i][j] == '#':
      U[H-i][j] = 0
    else:
      U[H-i][j] = U[H-i+1][j] + 1 
    if mp[i][j+1] == '#':
      R[i][j+1] = 0
    else:
      R[i][j+1] = R[i][j] + 1
    if mp[i][W-j] == '#':
      L[i][W-j] = 0
    else:
      L[i][W-j] = L[i][W-j+1] + 1 

for i in range(1,H+1):
  for j in range(1,W+1):
    tmp = L[i][j]+R[i][j]+U[i][j]+D[i][j]-3
    if tmp > rlt:
      rlt = tmp
      
print(rlt)

Measured memory_bytes: 181252
public class Main {
	public static void main(String[] args) {
		java.util.Scanner in = new java.util.Scanner(System.in);
		int n = in.nextInt();
		int[][] tmp = new int[n][3];
		for (int i=0; i<n; i++) {
			for (int j=0; j<3; j++) {
				tmp[i][j] = in.nextInt();
			}
		}
		for (int i=0; i<3; i++) {
			for (int j=n-1; j>=0; j--) {
				int lanp = 0;
				for (int k=0; k<j; k++) {
					if (tmp[j][i] == tmp[k][i]) {
						tmp[k][i] = 0;
						lanp = 1;
					}
				}
				if (lanp == 1)
					tmp[j][i] = 0;
			}
		}
		for (int i=0; i<n; i++) {
			int sum = 0;
			for (int j=0; j<3; j++)
				sum += tmp[i][j];
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 20824
#include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define FI first
#define SE second
#define maxn 200000
#define mod 1000000007
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef double db;

int a[maxn+5];

bool cmp(int x,int y) {return abs(x)>abs(y);}

int main()
{
    int n,k; scanf("%d%d",&n,&k);
    rep(i,1,n) scanf("%d",&a[i]);
    sort(a+1,a+n+1,cmp);
    int pos=0,neg=0,ans=1;
    rep(i,1,k) 
    {
        ans=1ll*ans*a[i]%mod;
        if(a[i]<0) neg++;
        else pos++;
    }
    if(neg%2==0) printf("%d\n",(ans+mod)%mod);
    else
    {
        vi P,N;
        P.pb(0); N.pb(0);
        rep(i,1,n) if(a[i]>=0) P.pb(a[i]); else N.pb(a[i]);
        int p1=0,n1=0,ans1=1;
        rep(i,1,n) 
        {
            if(a[i]>=0 && p1<pos+1) ans1=1ll*ans1*a[i]%mod,p1++;
            if(a[i]<0 && n1<neg-1) ans1=1ll*ans1*a[i]%mod,n1++;
        }
        int p2=0,n2=0,ans2=1;
        rep(i,1,n) 
        {
            if(a[i]>=0 && p2<pos-1) ans2=1ll*ans2*a[i]%mod,p2++;
            if(a[i]<0 && n2<neg+1) ans2=1ll*ans2*a[i]%mod,n2++;
        }
        bool f1=(p1==pos+1 && n1==neg-1);
        bool f2=(p2==pos-1 && n2==neg+1);
        if(f1 && f2)
        {
            if(1ll*P[pos+1]*P[pos]>1ll*N[neg+1]*N[neg]) printf("%d\n",(ans1+mod)%mod);
            else printf("%d\n",(ans2+mod)%mod);
        }
        else if(f1) printf("%d\n",(ans1+mod)%mod);
        else if(f2) printf("%d\n",(ans2+mod)%mod);
        else
        {
            ans=1;
            rep(i,1,k) ans=1ll*ans*a[n-i+1]%mod;
            printf("%d\n",(ans+mod)%mod);
        }
    }
    return 0;
}

Measured memory_bytes: 5112
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

N, K, Q = map(int, input().split())
score = [0] * N

for i in range(Q):
    score[int(input()) -1 ] += +  1

for SCORE in score:
    if SCORE <= Q - K:
        print("No")
    else:
        print("Yes")

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

bool check(long long a[],long long mid,long long n,long long k)
{
  long long i,s=0;
  for(i=0;i<n;i++)
  {
    if(a[i]>0)
    {
      s+=lower_bound(a,a+n,(long double)mid/(a[i]))-a;
    }
    if(a[i]<0)
    {
      s+=n-(upper_bound(a,a+n,(long double)mid/(a[i]))-a);
    }
    if(a[i]==0)
    {
      s+=(mid>0)?n:0;
    }
    if(a[i]*a[i]<mid)
      s--;
  }
    if((s/2)<k)
      return true;
    else
      return false;
  
}

int main()
{

    ios_base::sync_with_stdio(false);
      cin.tie(NULL);cout.tie(NULL);
      long long n,k;
      cin>>n>>k;
      long long a[n],i;
      for(i=0;i<n;i++)
      {
        cin>>a[i];
      }
      sort(a,a+n);
      long long low=-2e18,high=2e18,mid;
      while(high-low>1)
      {
        long long mid=(low+high)/2;
        if(check(a,mid,n,k))
          low=mid;
        else
          high=mid;
      }
      if(check(a,low,n,k))
      cout<<low<<endl;
      else
        cout<<high<<endl;
}

Measured memory_bytes: 5180
#include <iostream>


int main(){
	int N;
	std::cin >> N;
	int A[N];
	for(int i = 0; i < N; i++){
		std::cin >> A[i];
	}
	for(int i = 0; i < N; i++){
		int v = A[i];
		int j = i-1;
		while(j >= 0 && A[j] > v){
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;
		std::cout << A[0];
		for(int k = 1; k < N; k++){
			std::cout << " " << A[k];
		}
		std::cout << std::endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=15;
const int maxa=1<<15;
const int inf=0x3f3f3f3f;
int n,m,f[maxn][maxa],g[maxa],e[maxn][maxn];
int main()
{
	scanf("%d%d",&n,&m);
	int x,y,w,sum=0;
	for(int i=0;i<m;i++)
		scanf("%d%d%d",&x,&y,&w),x--,y--,e[x][y]=e[y][x]=w,sum+=w;
	memset(g,inf,sizeof(g));
	g[0]=0;
	for(int i=0;i<n;i++)
		for(int j=0;j<(1<<n);j++)
			if(g[j]!=inf && !(j&(1<<i)))
			{
				int val=0;
				for(int k=0;k<n;k++)
					if(j&(1<<k)) val+=e[i][k];
				g[j|(1<<i)]=g[j]+val;
			}
	/*
	for(int i=0;i<n;i++)
		for(int j=0;j<(1<<n);j++)
			if(!(i&(1<<j)))
				for(int k=0;k<n;k++)
					if(i&(1<<k))
						h[i][j]=max(h[i][j],e[i][k]);
	*/
	memset(f,-1,sizeof(f));
	for(int i=0;i<(1<<n);i++)
		if(i&1) f[0][i]=g[i];
//	cout<<f[0][7]<<endl;
	for(int i=1;i<(1<<n);i++)
		for(int j=0;j<n;j++)
//		{   cout<<i<<' '<<j<<' '<<f[i][j]<<endl;
			if(i&(1<<j) && f[j][i]!=-1)
				for(int k=i^((1<<n)-1),t=k;k>=0;k=k?(k-1)&t:-1)
					for(int l=0;l<n;l++)
						if(!(i&(1<<l)) && (k&(1<<l)) && e[j][l])
							f[l][i|k]=max(f[l][i|k],f[j][i]+g[k]+e[j][l]);
//							}
	printf("%d\n",sum-f[n-1][(1<<n)-1]);
	return 0;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n, m;
    cin >> n;
    vector<string> sn(n);
    inc(i, 0, n) cin >> sn[i];
    cin >> m;
    vector<string> sm(m);
    inc(i, 0, m) cin >> sm[i];
    int ans = 0;
    inc(i, 0, n){
        int c = 0;
        inc(j, 0, n){
            if(sn[i] == sn[j]){
                c++;
            }
        }
        inc(j, 0, m){
            if(sn[i] == sm[j]){
                c--;
            }
        }
        ans = max(ans, c);
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  int dp[n+1][4][4][4] = {};
  dp[0][3][3][3] = 1;
  rep(l,n,0){
    rep(a,4,0){
      rep(b,4,0){
        rep(c,4,0){
          if(dp[l][a][b][c] == 0) continue;
          rep(d,4,0){
            if(b==0 && c==1 && d == 2) continue;
            if(b==1 && c==0 && d == 2) continue;
            if(b==0 && c==2 && d == 1) continue;            
            if(a==0 && b==1 && d == 2) continue;
            if(a==0 && c==1 && d == 2) continue;
            dp[l+1][b][c][d] += dp[l][a][b][c];
            dp[l+1][b][c][d] %= mod;
          }
        }
      }
    }
  }
  
  long long int ans = 0;
  rep(a,4,0){
    rep(b,4,0){
      rep(c,4,0){
        ans += dp[n][a][b][c];
        ans %= mod;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string s;
    cin >> s;
    if (s.at(2) == s.at(3) && s.at(4) == s.at(5)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-3;
int a[100010];
vector<int> G[100010];
int n,k,ans;
int dfs(int i){
	int dep=0;
	for(auto &e:G[i]){
		dep=max(dep,dfs(e));
	}
	dep++;
	if(dep>=k){
		ans++;
		return 0;
	}else{
		return dep;
	}
}
int main(){
	ans=0;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a[i];a[i]--;if(i!=0)G[a[i]].push_back(i);
	}
	if(a[0]!=0)ans++;
	for(int i=1;i<n;i++){
		if(a[i]==0){
			for(auto &e:G[i])dfs(e);
		}
	}
	cout<<ans<<endl;
    return 0;
}


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

int main() {
	int N,K;
	cin>>N>>K;
    vector<int> S(N);
    for (int i=0;i<N;i++) cin>>S[i];
    vector<bool>dp(K+1);
	for (int stones=0;stones<=K;stones++){
		for (int x:S){
			if(stones>=x and !dp[stones-x]){
				dp[stones]=true;
			}
		}
	}
	puts(dp[K]?"First":"Second");
    return 0; 
}


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

typedef long long ll;

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N, M;
  cin >> N >> M;
  map<ll, ll> mp;
  for(ll i=0; i<M; ++i){
    ll s, c;
    cin >> s >> c;
    s--;

    if(mp.find(s)==mp.end()){
      mp[s] = c;
    }else if(mp[s] != c){
      printf("-1\n");
      return 0;
    }
  }

  if(mp.find(0) == mp.end()){
    if(N==1) mp[0] = 0;
    else mp[0] = 1;
  }else if(mp[0] == 0){
    if(N==1){
      printf("0\n");
      return 0;
    }else{
      printf("-1\n");
      return 0;
    }
  }

  ll ans = 0;
  for(ll i=0; i<N; ++i){
    ans *= 10;
    ans += mp[i];
  }
  printf("%lld\n", ans);

  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
	static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
	public static long mod = (long) (1e9+7);
	public static long[] fac,inv;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader sc = new FastReader();
		int n = sc.next().length();
		for(int i=0;i<n;++i) out.print('x');
	    out.close();

	}
	

}


Measured memory_bytes: 21076
/**
*    created: 05.05.2020 08:34:48
**/

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int inf =1000000000;

int main() {
    int n;
    cin>>n;
    int x=0;
    rep(i,n+1){
        int a = 1.08 * i;
        if(n==a){
             x=i;
             break;
        }
    }
    if(x){
        cout << x << endl;
    }else{
        cout << ":(" << endl;
    }
}

Measured memory_bytes: 256
package main

import (
  "fmt"
  "strings"
  "sort"
)

func main() {

  var s string
  fmt.Scan(&s)
  
  slice := strings.Split(s, "")
  sort.Strings(slice)
  
  if slice[0] == slice[1] && slice[2] == slice[3] && (slice[0] != slice[2] && slice[0] != slice[3]){
    fmt.Print("Yes")
  } else {
    fmt.Print("No")
  }
}

Measured memory_bytes: 640
import scipy.fftpack as f;input();m=200003;t=[0]*m;a=[0.0]*2*m;s=0
for i in range(m):t[pow(2,i,m)]=i
for i in map(int,input().split()):
	if i:a[t[i]]+=1;s-=i*i%m
for i,j in enumerate(f.ifft(f.fft(a)**2)):s+=int(round(j.real))*pow(2,i,m)
print(s//2)

Measured memory_bytes: 150272
S = list(input())
T = input()
l = len(S)
s = S
for i in range(l):
    li = []
    li.append(s[-1])
    li.extend(s[0:-1])
    moji = ''.join(li)
    if moji == T:
        print('Yes')
        exit()
    s = moji
print('No')

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

namespace D14
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            string[] str = new string[n];
            str = Console.ReadLine().Split(' ');

            long[] longAry = Array.ConvertAll<string, long>(str, delegate (string value)
            {
                return int.Parse(value);
            });
            long min = longAry.Min();
            long max = longAry.Max();
            long sum = 0;
            for(long i = 0; i < longAry.Length; i++)
            {
                sum = sum + longAry[i];
            }
            Console.WriteLine("{0} {1} {2}", min, max, sum);
        }
    }
}

Measured memory_bytes: 10248
# ？？？？？？？？？？？？？？？？？？？？？？？？？？
# ケース12と13、完全にバグとしか思えないのですが?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

# もしかして：頂点1は必ず0？

n = int(input())
a = list(map(int, input().split()))
if a[0] != 0:
    print(0)
    exit()
a = sorted(a)
d = {}
for av in a:
    if av not in d:
        d[av] = 1
    else:
        d[av] += 1

if a[0] != 0 or d[0] != 1 or len(set(d.keys())) != a[-1] + 1:
    print(0)
    exit()
MOD = 998244353
ans = 1
for i in range(2, a[-1] + 1):
    ans *= pow(d[i - 1], d[i], MOD)
print(ans % MOD)

Measured memory_bytes: 27144
#include <cmath>
#include <cstdio>
#include <vector>
#include <iterator>
#include <iostream>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <map>
#include <stdio.h>
#include <functional>
#include <chrono>
#include <boost/version.hpp>
using namespace std;

#define rep(i,s,n) for(ll i=s;i<(n);++i)
using ll = long long;
using pll = pair<ll, ll>;
constexpr ll INF = (1LL << 60);
constexpr ll MAX_INF = 9223372036854775807;
constexpr ll MOD = (1e9 + 7);
//constexpr ll MOD = (998244353);

using vl = vector<ll>;
using vvl = vector<vector<ll>>;

template<class T>
vector<vector<T>> vvt(T init, ll m, ll n) {
	vector<vector<T>> ans = vector<vector<T>>(m, vector<T>(n, init));
	return move(ans);
}

template<class T>
vector<T> vt(T init, ll n) {
	vector<T> ans = vector<T>(n, init);
	return move(ans);
}

template<class T>
T maxVec(vector<T>& v) {
	T ans = -INF;
	rep(i, 0, v.size()) {
		ans = max(ans, v[i]);
	}
	return ans;
}

// 素数判定
bool judge(ll n) {
	for (ll i = 2; i * i <= n; i++) if (n %= i)return false;
	return true;
}


template <class C>
void print(const C & c, std::ostream & os = std::cout)
{
	std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, ", "));
	os << std::endl;
}
/*
ll count(ll n,ll r) {
	ll ans = 0,check = 1;
	rep(i,0, r) {
		if ((n & check) > 0) {
			ans++;
		}
		check = check << 1;
	}
	return ans;
}
*/
bool sortreverse(ll a, ll b) {
	return a > b;
}


ll kiriage(ll a, ll b) {
	if (a % b == 0)return a / b;
	return a / b + 1;
}

ll n, m, t, q, s,k,h,w,x,y;

void warshall_floyd(ll v_num,vector<vector<long long>> &d) {
	for (long long k = 0; k < v_num; k++) {       // 経由する頂点
		for (long long i = 0; i < v_num; i++) {    // 始点
			for (long long j = 0; j < v_num; j++) {  // 終点
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

vl stack;
vl data;

ll solv(ll idx, vl& data, ll a, ll b,ll c) {
	if (idx < 0) {
		vvl mono(4);
		vl length(4, 0), mihon = { a,b,c };
		rep(i, 0, data.size()) {
			mono[stack[i]].push_back(data[i]);
			length[stack[i]] += data[i];
		}
		ll cost = 0;
		
		rep(i, 0, 3) {
			if (mono[i].size() == 0)return INF;
			cost += ll(10 * (ll(mono[i].size()) - 1));
			cost += abs(mihon[i] - length[i]);
		}
		return cost;

	}
	ll ref = INF;
	rep(i, 0, 4) {
		stack[idx] = i;
		ref = min(ref,solv(idx-1, data,a,b,c));
	}
	return ref;
}

int main() {
	// ↓この２行が追加部分
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	ll f,a,b,c;
	cin >> n >> a >> b >> c;
	stack = vl(n);
	vl data(n);
	rep(i, 0, n) {
		cin >> data[i];
	}
	ll ans = solv(n - 1, data, a, b, c);
	printf("%lld\n", ans);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  cin >> n;
  string s;cin>>s;

  vi a(n),b(n);

  ll left=0;
  ll rigt=n-1;
	for(ll i=0;i<n;i++){
		for(;left<n;left++){
			if (s[left]=='W')break;
		}
		for(;rigt>=0;rigt--){
			if (s[rigt]=='R')break;
		}

		if ((s[left]=='W')&(s[rigt]=='R')){
			if (left<rigt){
				ans++;
				left++;
				rigt--;
			}
		}
		if (left>=rigt)break;
	}

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

Measured memory_bytes: 6732
R,G,B,N = map(int,input().split())

count = 0
for r in range(0,N // R + 1):
    for g in range(0,N // G + 1):
        left = (N - r * R - g * G)
        if left < 0:
            continue
        if left % B == 0:
            count += 1

print(count)


Measured memory_bytes: 40812
#include <stdio.h>
#define N 100
int main (){
  int n,i,j,k,key,a[N];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=1;i<n;i++){ 
    for(k=0;k<n;k++){
      printf("%d",a[k]);
     if(k<n-1){
     printf(" ");
     }
    }
    printf("\n");
    key=a[i];
    j=i-1;
    while(j>=0 && a[j]>key){
      a[j+1]=a[j];
      j--; 
    }
    a[j+1]=key;
  }
  for(k=0;k<n;k++){
   printf("%d",a[k]);
   if(k<n-1){
   printf(" ");
    }
   }
printf("\n");
  return 0;
}

Measured memory_bytes: 604
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	arr := make([]int, 0)
	sum := 0
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scan(&tmp)
		sum += tmp
		if tmp % 2 != 0 {
			arr = append(arr, tmp)
		}
	}
	sort.Sort(sort.IntSlice(arr))
	if sum % 10 != 0 {
		fmt.Println(sum)
	} else {
		if len(arr) != 0 {
			fmt.Println(sum - arr[0])
		} else {
			fmt.Println(0)
		}
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,x;
	cin >> n;
	for(int i=2;i<=n;i++){
		cin >> x;
		a[x]++;
	}
	for(int i=1;i<=n;i++){
		cout << a[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 4368
//ABC067C
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<long long int> a(n);
	long long int l = 0, r = 0;
	for(int i=0;i<n;i++){
		cin >> a.at(i);
		r += a.at(i);
	}
	l += a.at(0);
	r -= a.at(0);
	long long int ans = abs(r-l);
	for(int i=1;i<n-1;i++){
		l += a.at(i);
		r -= a.at(i);
		ans = min(ans,abs(l-r));
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
  int sum = 21;
  rep(i,4){
    int n;
    cin >>n;
    if(n==1 || n==9 || n==7 || n==4) sum -= n;
  }
  if(sum==0) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

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

namespace AtCoderBeginnerContest178
{
	class Program
	{
		static void Main(string[] args)
		{
			var inputs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			var a = inputs[0];
			var b = inputs[1];
			var c = inputs[2];
			var d = inputs[3];

			var result0 = a * c;
			var result1 = a * d;
			var result2 = b * c;
			var result3 = b * d;

			Console.WriteLine(Math.Max(Math.Max(result0, result1), Math.Max(result2, result3)));
		}
	}
}


Measured memory_bytes: 28236
using System;

namespace FreeWorks
{
    class Program
    {
        static void Main(string[] args)
        {

            int n = int.Parse(Console.ReadLine());
            string name = Console.ReadLine();
            int cnt = 0;
            for (int i = 0; i < n; i++)
            {
                string line = Console.ReadLine();
                if (Solve(name, line)) cnt++;
            }

            Console.WriteLine(cnt);       
        }

        static bool Solve(string pat, string txt)
        {
            int pl = pat.Length;
            int tl = txt.Length;

            for (int i = 0; i <= tl - pl; i++)
            {
                for (int d = 0; i + pl + (pl - 1) * d <= tl; d++)
                {
                    int k = 0;
                    while (k < pl)
                    {
                        if (pat[k] != txt[i + (d + 1) * k]) break;
                        k++;
                    }
                    if (k == pl) return true;
                }
            }

            return false;
        }
    }
}



Measured memory_bytes: 15908