akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <set>

using namespace std;

int main()
{
    int x, y, z;
    cin >> x >> y >> z;

    int tmp;

    tmp = x;
    x = y;
    y = tmp;

    tmp = x;
    x = z;
    z = tmp;

    cout << x << " " << y << " " << z << endl;

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def fi(): return float(input())
def mfi(): return map(float, input().rstrip().split())
def lmfi(): return list(map(float, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(*args, sep=" ", end="\n"): print("debug:", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None
def exit(*arg): print(*arg); sys.exit()
# template


def main():
    a, b, c = mi()
    if a + b + c >= 22:
        print("bust")
    else:
        print("win")
    return


if __name__ == '__main__':
    main()


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

int main(){
  int ans=0;
  for(int i=0;i<3;i++){
    char c;
    cin>>c;
    ans+=c-'0';
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        int n = sc.nextInt();
        long k = sc.nextLong();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt()-1;
        }

        int now = 0;

        // 前回、残り何手のときに訪れたか
        long[] before = new long[n];
        Arrays.fill(before, -1);

        before[0] = k;
        while (true) {
            // 1手進める
            k--;
            now = a[now];

            // 既に訪れていたところであれば、そこから先はループなので、ショートカット
            if (before[now] != -1 && k > before[now] - k) {
                k = k % (before[now] - k);
            }
            before[now] = k;

            if (k == 0) {
                System.out.println(now+1);
                return;
            }
        }
    }
}



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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define debug(i) cout << i << endl;
#define debugarr(a) for(auto i : a) cout << i << " ";

#define lli long long
#define vi vector<int>
#define vli vector<li>
#define vlli vector<lli>
#define pi pair<int,int>
#define pli pair<li, li>
#define vpi vector<pi>

using namespace std;

int main() {

    ios_base::sync_with_stdio(false);

    int n, k;

    cin >> n >> k;

    if(k == 1) cout << 0 << endl;
    else {
        int ans = abs((k - n));
        cout << ans << endl;
    }

}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long 
#define F(n) for(int i = 0; i < n; ++i)
#define Debug cout<<endl<<"I AM IRONMAN"<<endl

int main ()
{
    fastio;
    int n,ceven=0,codd=0;
    cin >> n;
    F(n)
    {
        int a;
        cin >> a;
        if(a%2==0)
        {
            ceven++;
        }
        else
        {
            codd++;
        }
       
    }
     if(codd%2==0)
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
        

        
    return 0;
}

Measured memory_bytes: 3648
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    s = S()
    for i in range(3):
        if s[i] == s[i + 1]:
            print("Bad")
            return
    print("Good")
    return

#B
def B():
    n, l = LI()
    lis = [l + i for i in range(n)]
    s = sum(lis)
    a = inf
    for i in lis:
        if abs(a) > abs(i):
            a = i
    print(s-a)
    return

#C
def C():
    def gcd(a, b):
        a, b = max(a, b), min(a, b)
        while b:
            a, b = b, a % b
        return a
    def lcm(a, b):
        return a * b // gcd(a, b)
    a, b, c, d = LI()
    x = b // c - (a-1) // c
    y = b // d - (a-1) // d
    z = b // lcm(c , d) - (a-1) // lcm(c , d)
    print(b-a+1-(x+y-z))
    return

#D
def D():
    n = II()
    ab = LIR(n)
    ab.sort(key=lambda x: x[1])
    now = 0
    for a, b in ab:
        now += a
        if now <= b:
            continue
        print("No")
        return
    print("Yes")
    return

#E
def E():
    n, k = LI()
    if k > (n - 1) * (n - 2) / 2:
        print(-1)
        return
    d = (n - 1) * (n - 2) // 2 - k
    a = [[] for i in range(n)]
    for i in range(n):
        if i != 1:
            a[i].append(1)
            a[1].append(i)
    l = 0
    m = 2
    while d > 0:
        a[l].append(m)
        m += 1
        d -= 1
        if m == n:
            l += 1
            m = l + 1
            if l == 1:
                l = 2
                m = 3
    aa = 0
    ans = []
    for num,i in enumerate(a):
        for l in i:
            if num < l:
                aa += 1
                ans.append((num+1,l+1))
    print(aa)
    for x, y in ans:
        print(x, y)
    return

#F
def F():
    n = II()
    xy = LIR(n)
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    E()


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

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) break;
    vector<int> i(n), p(n), q(n), r(n);
    rep (j, n) cin >> i[j] >> p[j] >> q[j] >> r[j];
    int P, Q, R, C;
    cin >> P >> Q >> R >> C;
    bool ok = false;
    rep (j, n) {
      if (p[j] <= P && q[j] <= Q && r[j] <= R && p[j] * 4 + q[j] * 9 + r[j] * 4 <= C) {
	cout << i[j] << endl;
	ok = true;
      }
    }
    if (!ok) cout << "NA" << endl;
  }
  return 0;
}

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

int main(){
int n;
cin>>n;
int cnt=0;
vector<int> a(n);
vector<int> b(n);
rep(i,n){
  cin>>a[i];
  if (i%2==0)cnt+=a[i];
  else cnt-=a[i];
  //cout<<a[i]<<'k'<<endl;
}
b[0]=cnt;
cout<<b[0]<<' ';
for (int i=1;i<n;i++){
  b[i]=2*a[i-1]-b[i-1];
  cout<<b[i]<<' ';
}


}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  int* h=new int[n];
  for(int i=0;i<n;i++)
  cin>>h[i];
  
  int dp[n];
  dp[n-1]=0;
  dp[n-2]=abs(h[n-1]-h[n-2]);
  for(int i=n-3;i>=0;i--)
  {
    int m=2;
    dp[i]=abs(h[i]-h[i+1])+dp[i+1];
    while(m<=k&&i+m<n)
    {
      int r=abs(h[i]-h[i+m])+dp[i+m];
      if(r<dp[i])
        dp[i]=r;
        
        m++;
    }
  }
  cout<<dp[0];
  return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;

#define fill(a,x) memset(a,x,sizeof(a)) 
#define pb push_back
#define sz(x) (int)x.size() 
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
const ll INF = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+10; 

int main(){
  fast;
  ll n,m;
  string s;
  string t;
  cin>>n>>m;
  cin>>s;
  cin>>t;


  ll g = __gcd(n,m);
  ll ans = (m*n)/g;

  ll m1 = ans/n;
  ll n1 = ans/m;

  for(ll i=0;i<=n;i++)
  {
  	ll k1 = i*n1;
  	ll k2 = i*m1;

  	if(k1>n-1 or k2>m-1)
  		break;

  	if(s[k1]!=t[k2])
  	{
  		ans=-1;
  		break;
  	}
  }

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

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
const int MOD = 1000000007;
int main() {
    double d,t,s;
    cin>>d>>t>>s;
    if (d/s<=t)
    {
        /* code */
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    
    
    
}

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

int main() {
    int64_t a, b, x;

    cin >> a >> b >> x;
    int64_t a_q, a_r, b_q, b_r, ans;
    ans = (b / x) - (a / x);

    if (a % x == 0) {
        ans++;
    }

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


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

#define pb push_back
#define ll long long
#define maxn 300005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define bg begin()
#define ed end()
#define pii pair<int,int>

int main(){
	ll n;
	while(cin >> n){
		//ll ans = 0;
		//ll last= 0;
		set<ll>st;
		st.insert(n-1);
		for(ll i=2;i<=sqrt(n);i++){
			if(n%i==0){
				st.insert(i-1);
				st.insert(n/i-1);
			}
		}
		ll ans = 0;
		for(auto i:st){
			if(i==0)continue;
			if(n/i==n%i){
				ans += i;
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 512
from itertools import accumulate
import sys
sdin = sys.stdin.readline

n,m,q = map(int, sdin().split())

lr = []
for i in range(m):
    l,r = map(int, sdin().split())
    lr.append(tuple([l-1, r-1]))
        
pq = []
for _ in range(q):
    p,q = map(int, sdin().split())
    pq.append(tuple([p-1, q-1]))


# n×nフィールドを用意して各列車のl,r点をプロット
field = [[0 for _ in range(n)] for _ in range(n)]
for l, r in lr:
    field[l][r] += 1
    
# fieldのx方向の累積和を取る
field_cum = [list(accumulate(field[i])) for i in range(n)]    

# 各クエリに対し、rがpからqの間に入っているものを足し合わせる
for p,q in pq:
    ans = 0
    for i in range(p,q+1):
        ans += field_cum[i][q]
    print(ans)

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

using namespace std;
const int MAXN = 3005;
vector<pair<int,int>> v1[MAXN];
int dist[MAXN][MAXN];
int arr[MAXN][MAXN];
long long ans;
priority_queue<pair<pair<int,int>,int>> pq;
set<pair<int,int>> s1;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            cin>>arr[i][j];
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            bool ok = false;
            for(int k=1;k<=n;k++){
                if(i==j||i==k||j==k){
                    continue;
                }
                if(arr[i][j] > arr[i][k]+arr[k][j]){
                    cout<<-1<<endl;
                    return 0;
                    
                }
                if(arr[i][j] ==arr[i][k]+arr[k][j]){
                    ok = true;
                    break;
                }
            }
            if(!ok){
                ans+=arr[i][j];
            }
        }
    }
    cout<<ans/2<<endl;
    
}

Measured memory_bytes: 3328
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <bitset>
#include <utility>
#include <complex>
#include <assert.h>
#include <limits.h>
//#include <bits/stdc++.h>
using namespace std;
#define rank rankk
#define mp make_pair
#define pb push_back
#define xo(a,b) ((b)&1?(a):0)
#define tm tmp

//#define LL ll
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,int> pli;
typedef pair<int,ll>pil;
typedef pair<ll,ll> pll;
//const double INF=1e20;
const int INF=0x3f3f3f3f;
//const int INF= 0x7fffffff;
//const ll INF=0x3f3f3f3f3f3f3f3fll;
const ll INFF=0x3f3f3f3f3f3f3fll;
//const ll INFF=1e14+5;
const int MAX=5e5+5;
//const ll MAXN=2e8;
//const int MAX_N=MAX;
//const ll MOD=1e9+7;
const ll MOD=1e9+7;
//const long double pi=acos(-1.0);
//const double eps=0.00000001;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
//#define double long double
template<class T> inline
void read(T& num) {
    bool start=false,neg=false;
    char c;
    num=0;
    while((c=getchar())!=EOF) {
        if(c=='-') start=neg=true;
        else if(c>='0' && c<='9') {
            start=true;
            num=num*10+c-'0';
        } else if(start) break;
    }
    if(neg) num=-num;
}
inline ll powMM(ll a,ll b,ll M){
    ll ret=1;
    a%=M;
//    b%=M;
    while (b){
        if (b&1) ret=ret*a%M;
        b>>=1;
        a=a*a%M;
    }
    return ret;
}
//const long double eps=-1.0;
//clock_t t1 = clock();
//fprintf(stderr, "%ld ms\n", clock() - t1);
void open()
{
    freopen("in2.txt","r",stdin);
    freopen("out2.txt","w",stdout);
}

int q;
ll a,b,da;
bool check(ll len)
{
    ll x,y;
    for(ll i=len/2-10;i<=len/2+10&&i<=len;i++)
    {
        if(i<1)continue;
        x=(i>=a?i+1:i);
        ll tem=len+1-i;
        y=(tem>=b?tem+1:tem);
        if(x*y>=da)return false;
    }
    return 1;
}
ll solve()
{
    ll l=0,r=a+b,re=0,mid;
    while(l<=r)
    {
        mid=(l+r)>>1LL;
        if(check(mid))re=mid,l=mid+1;
        else r=mid-1;
    }
    return re;
}
int main()
{
    scanf("%d",&q);
    while(q--)
    {
        scanf("%lld%lld",&a,&b);
        da=a*b;
        printf("%lld\n",solve());
    }
}
/*

*/


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int a,b,c,ans=0;
    cin>>a>>b>>c;
    int idx1=a/c,idx2=b/c;
    if (a%c==0) ans++;
    ans+=idx2-idx1;
    cout<<ans;
    return 0;
}

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

int main() {
  int n; cin >> n;
  vector<int> s(n);
  int ans = 0;
  rep(i,n) {
    cin >> s[i];
    ans += s[i];
  }
  sort(s.begin(), s.end());
  rep(i,n) {
    if (ans%10!=0) {
      cout << ans << endl;
      return 0;
    } else {
      if (ans%10==0 && s[i]%10!=0) {
        ans -= s[i];
      } 
    }
  }
  if (ans%10==0) cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define nl '\n'
#define f(i, n) for (int i = 0; i < n; ++i)

using namespace std;
void solve() {
    string s;
    cin >> s;
    ll sum = 0;
    for (auto& e : s) {
        sum += (e - '0');
    }
    cout << ((sum % 9 == 0) ? "Yes" : "No") << nl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    solve();
}

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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
const int INF=1e9;

int N,M,K;
char A[800][800];
int dist[800][800];

vi dx={1, -1, 0, 0};
vi dy={0, 0, 1, -1};

int main(){
	cin>>N>>M>>K;
	int sx, sy;
	rep(i,N)rep(j,M){
		cin>>A[i][j];
		if(A[i][j]=='S'){
			sx=i;
			sy=j;
			A[i][j]='.';
		}
	}
	
	rep(i,N)rep(j,M)dist[i][j]=INF;
	queue<P> q;
	q.push(make_pair(sx, sy));
	dist[sx][sy]=0;
	while(!q.empty()){
		P p=q.front();
		q.pop();
		int x=p.first;
		int y=p.second;
		rep(k,4){
			int nx=x+dx[k];
			int ny=y+dy[k];
			if(0<=nx && nx<N && 0<=ny && ny<M)if(A[nx][ny]!='#' && dist[nx][ny]==INF){
				dist[nx][ny]=dist[x][y]+1;
				q.push(make_pair(nx,ny));
			}
		}
	}
  	int step=1000;
	rep(i,N)rep(j,M)if(dist[i][j]<=K){
		int tx=min(i, N-1-i);
		int ty=min(j, M-1-j);
		int tmp=min(tx, ty);
		step=min(step, tmp);
	}
	int ans;
	if(step%K == 0)ans=1+step/K;
	else ans=2+step/K;
	cout<<ans<<endl;
}

Measured memory_bytes: 3456
K, N  = map(int, input().split())
A = list(map(int, input().split()))
diff = 0

for i in range(N-1):
  if A[i+1]-A[i] > diff:
    diff = A[i+1]-A[i]

if K-A[N-1]+A[0] > diff:
  diff = K-A[N-1]+A[0]

print(K-diff)

Measured memory_bytes: 26444
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<tuple>
#include<string>
typedef long long int ll;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define F first
#define S second
using namespace std;
const ll INF = 10000000000000;

int main() {
	int n;
	int sum = 0;
	cin >> n;
	if (n < 10)sum += n;
	else if (n >= 10 && n < 100)sum = 9;
	else if (n >= 100 && n < 1000)sum += 9 + n - 99;
	else if (n >= 1000 && n < 10000)sum = 909;
	else if (n >= 10000 && n < 100000)sum += 9 + 900 + n - 9999;
	else if (n == 100000)sum = 90909;
	cout << sum << endl;
}

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

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

    int r;
    cin >> r;
    
    cout << 3 * r * r << endl;

    return 0;
}

Measured memory_bytes: 256
/*input
3 1
1 2
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

vector<int> edge[maxn];
bool vis[maxn];

bool tg[maxn];

bool dfs(int u,bool d){
	vis[u]=1;
	tg[u]=d;
	bool flag=1;
	for(int v:edge[u]){
		if(!vis[v]) flag&=dfs(v,!d);
		else{
			if(tg[v]==tg[u]) flag=0;
		}
	}
	return flag;
}


int main()
{
	IOS;
	int n,m;
	cin>>n>>m;
	while(m--){
		int u,v;
		cin>>u>>v;
		u--;v--;
		edge[u].pb(v);
		edge[v].pb(u);
	}
	ll one=0;
	for(int i=0;i<n;i++) if(SZ(edge[i])==0) one++;
	ll bipartite=0,other=0;
	for(int i=0;i<n;i++) if(SZ(edge[i])&&!vis[i]){
		if(dfs(i,0)) bipartite++;
		else other++;
	}
	ll ans=2LL*n*one-(ll)one*one+(bipartite+other)*(bipartite+other)+bipartite*bipartite;
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 16384
s = list(input())
t = list(input())

n_s = len(s)
n_t = len(t)
last_num = -1

base = [i for i,x in enumerate(s) if x == str(t[0]) or "?"]

if n_s >= n_t:
  for i in base:
    if n_s - i >= n_t:
      sign = 0
      for j in range(i,i+n_t):
        if not ((s[j] == t[j-i]) or (s[j] == "?")):
          sign = 1
        
      if sign == 0:
        last_num = i

  if last_num != -1:
    for i in range(last_num,last_num + n_t):
      if s[i] == "?":
        s[i] = t[i-last_num]
    
    if s[0] == "?":
      ans = "a"
    else:
      ans = str(s[0])
                  
    for j in range(1,n_s):
      if s[j] == "?":
        s[j] = "a"
      ans = ans + s[j]
    
  elif last_num == -1:
    ans = "UNRESTORABLE"

else:
  ans = "UNRESTORABLE"

print(ans)

Measured memory_bytes: 3064
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split("");
  var result = 'Good';

  for(var i = 0; i < (input.length-1) ; i++){
    if(input[i] === input[i + 1]){
      result = 'Bad';
    }
  }
  
 	console.log(result);
 }
 //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
 Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 22080
#include<bits/stdc++.h>
 
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"

using namespace std;

int32_t main()
{
	IOS;
	int n;
	cin>>n;
	vector<int> h(n+1);
	map<int, int> mp;
	int ans = 0;
	for(int i=1; i<=n; i++)
	{
		cin>>h[i];
		mp[i-h[i]]++;
	}
	for(int i=1; i<=n; i++)
	{
		int cnt = mp[i+h[i]];
		if(cnt > 0)
			ans += cnt;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 27416
/**
 *    author:  tourist
 *    created: 22.10.2017 08:54:36       
**/
#include <bits/stdc++.h>

using namespace std;

const int md = (int) 1e9 + 7;

inline void add(int &a, int b) {
  a += b;
  if (a >= md) a -= md;
}

inline void sub(int &a, int b) {
  a -= b;
  if (a < 0) a += md;
}

inline int mul(int a, int b) {
#if !defined(_WIN32) || defined(_WIN64)
  return (long long) a * b % md;
#endif
  unsigned long long x = (long long) a * b;
  unsigned xh = (unsigned) (x >> 32), xl = (unsigned) x, d, m;
  asm(
    "divl %4; \n\t"
    : "=a" (d), "=d" (m)
    : "d" (xh), "a" (xl), "r" (md)
  );
  return m;
}

inline int power(int a, long long b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}

inline int inv(int a) {
  a %= md;
  if (a < 0) a += md;
  int b = md, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int ans = mul(min(d + 1, a), mul(min(d + 1, b), min(d + 1, c)));
  for (int rot = 0; rot < 3; rot++) {
    int bound_x = a - d - 1;
    int x = 1;
    while (x <= bound_x) {
      int y = (long long) b * x / a;
      int z = (long long) c * x / a;
      int by_y = min(y + d, b - 1) - max(y - d, 0) + 1;
      int by_z = min(z + d, c - 1) - max(z - d, 0) + 1;
      int next_x = bound_x + 1;
      if (y + d <= b - 1 && y - d >= 0) {
        // y' + d >= b?
        // b * x' / a >= b - d
        // x' >= (b - d) * a / b
        next_x = min(next_x, (int) (((long long) (b - d) * a + b - 1) / b));
      } else {
        // y' >= y + 1
        // b * x' / a >= y + 1
        next_x = min(next_x, (int) (((long long) (y + 1) * a + b - 1) / b));
      }
      if (z + d <= c - 1 && z - d >= 0) {
        next_x = min(next_x, (int) (((long long) (c - d) * a + c - 1) / c));
      } else {
        next_x = min(next_x, (int) (((long long) (z + 1) * a + c - 1) / c));
      }
      add(ans, mul(next_x - x, mul(by_y, by_z)));
      x = next_x;
    }
    swap(a, b);
    swap(b, c);
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# B - Increment Decrement
# 標準入力の取得
N = int(input())
S_list = list(input())

# 各要素におけるxを計算し、そのうちの最大値を出力する
x_list = [0 for i in range(N)]
for i in range(N):
    x_before = 0
    if i != 0:
        x_before = x_list[i-1]

    if S_list[i] == "I":
        x_list[i] = x_before + 1
    elif S_list[i] == "D":
        x_list[i] = x_before - 1

print(max(max(x_list), 0))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
using namespace std;
int sdkys(int a,int b){
    if(b==0) return a;
    return sdkys(b,a%b);
}
int sskbs(int a,int b){
    return a*b/sdkys(a,b);
}
int n,m,cnt=0,aa[330000],ans=0,ab[220000];
pair<int,int> pp[220000];
string s,sa[220000];
char ca[220000];
queue<int> que;
signed main(){
    cin>>n;
    rep(i,n){
        cin>>aa[i];
    }
    rep(i,n){
        if(aa[aa[i]-1]==i+1){
            cnt++;
        }
    }
    cout<<cnt/2<<endl;
}

Measured memory_bytes: 11252
#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;
typedef pair<int, int> PII;
 
int M, NMIN, NMAX, P[200];
 
int main(void) {
  while(cin >> M >> NMIN >> NMAX, M) {
    REP(i, 0, M) cin >> P[i];
 
    vector<PII> vec;
    REP(i, NMIN, NMAX + 1) vec.push_back(PII(P[i - 1] - P[i], i));
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());
 
    cout << vec[0].second << endl;
  }
}

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

#define all(x) x.begin(),x.end()
#define LB(V,x) lower_bound(all(V),x)-V.begin()

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using pi = pair<int32, int32>;
using pll = pair<int64, int64>;
using vi = vector<int32>;
using vll = vector<int64>;
using ll = int64;

ll gcd(ll A, ll B){
    if(A<B) swap(A, B);
    if(B==0) return A;
    gcd(B,A%B);
}
ll gcd(vll V){
    ll ans=V[0],i=V.size();
    while(i--) ans = gcd(ans,V[i]);
    return ans;
}

void Main(){
    int N;
    vll A(N);
    cin >> N;
    for(auto &a:A) cin >> a;
    cout << gcd(A) << endl;
}

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

Measured memory_bytes: 768
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
using namespace std;

int main(){
	int N,M;
	map<string,int> card;

	cin>>N;

	for(int i = 0;i < N;i++){
	string s;
	cin >> s;
	card[s] = card[s] + 1;
    }

	cin>>M;

	for(int i = 0;i < M;i++){
		string s;
		cin >> s;
		card[s] = card[s] - 1;
	}

	int res = 0;
	for(auto&& p:card){
		res = max(res,p.second);
	}
	cout<<res<<"\n";

	
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define sh cin.tie(0); cin.sync_with_stdio(0); cout.tie(0);
#define FILE freopen("test.in", "r", stdin);
#define vprint(v) for (int ii = 0; ii < v.size(); ii++){cout << v[ii] << " ";}
#define debugv(v) if (v.size() != 0) {cout << "[ "; for (int __ = 0; __ < (int)(v.size()) - 1; __++){cout << v[__] << ", ";} cout << v[(int)(v.size()) - 1] << " ]" << endl;} else {cout << "[]" << endl;}
#define debug cout << "-----------------------------------------------" << endl;
#define print1(a) cout << "{ " << a << " }" << endl;
#define print2(a, b) cout << "{ " << a << ", " << b << " }" << endl;
#define print3(a, b, c) cout << "{ " << a << ", " << b << ", " << c << " }" << endl;
#define print4(a, b, c, d) cout << "{ " << a << ", " << b << ", " << c << ", " << d << " }" << endl;
using namespace std;
//#define int long long
const int INF = 1e9 + 228;
const int MAXN = 1e5 + 228;

signed main()
{
#ifdef LOCAL
    FILE;
#endif
    sh;
	int n;
	cin >> n;
	vector<int> v;
	for (int i = 0; i < n; i++) {
		int aa;
		cin >> aa;
		v.pb(aa);
	}    
	int mn = INF;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (mn > v[i]) {
			ans++;
		}
		mn = min(mn, v[i]);
	}
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1400
import java.io.*;
import java.lang.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int N=Integer.parseInt(br.readLine());
        int A=N/500;
        int ans=A*1000;
        A=(N%500)/5;
        ans+=5*A;
        System.out.println(ans);
    }
}

Measured memory_bytes: 23252
#include<stdio.h>
#include<math.h>

int kaijo(int n);

int main( void ){
    int n,i,j;
    double sum = 0;
    int x[8];
    int y[8];
    int xs,ys;
    scanf("%d",&n);
    for(i = 0; i < n; i++){
        scanf("%d%d",&x[i],&y[i]);
    }
    for(i = 0; i < n; i++){
        for(j = 0; j < n;j++){
            if(n != j){
                xs = pow((x[i]-x[j]),2);
                ys = pow((y[i]-y[j]),2);
                sum += fabs(sqrt(xs+ys))*kaijo((n-1));
            }
        }
    }
    int N = kaijo(n);
    printf("%lf\n", sum/N);
    return 0;
}

int kaijo(int n){
    int m;
    if(n == 0){
        return 1;
    } else {
        m = kaijo(n-1);
        return n*m;
    }
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
  int n;
  cin>>n;
  vector<pair<int,int>> R(n),B(n);
  rep(i,n){
        int a,b;
        cin>>a>>b;
        R[i]={a,b};
  }
  rep(i,n){
        int c,d;
        cin>>c>>d;
        B[i]={c,d};
  }
  sort(all(R));
  sort(all(B));
  
  int ans=0;
  vector<bool> sumi(n,false);

  rep(i,n){
        int xb=B[i].first;
        int yb=B[i].second;
        int id=-1,ma=-1;
    rep(j,n){
            if(sumi[j]) continue;
            int xr=R[j].first;
            int yr=R[j].second;
            if(xr>=xb || yr>=yb) continue;
          //ペアを組めるRのうちY座標(yr)が最大のものとペアに
            if(ma<yr){
                ma=yr;
                id=j;
            }
    }
    
    if(id!=-1){
            ans++;
            sumi[id]=1;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3616
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int sum1;
		int sum2;
		int total;
		if(n>k) {
			sum1 = k*x;
			sum2 = (n-k)*y;
			total = sum1+sum2;
			System.out.println(total);
		} else {
			System.out.println(n*x);
			
		}
		
		
		
				
	 
  	}
}

Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n;
  cin >> n;
  
  double a;
  std::string b;
  std::string str="JPY";
  
  double ans;
  
  for (int i; i<n;i++){
    cin >> a >> b;
    if (std::string(b)==str){
      ans += a;
    } else {
      ans += a * 380000.0;
    }
  }
   
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;
using namespace std;

int main() {
  int n;
  cin >> n;
  long double YEN = 0;
  long double BTC = 0.0;
  for (int i = 0; i < n; i++) {
    double x;
    string u;
    cin >> x >> u;
    if (u == "JPY")
      YEN += x;
    else
      BTC += x;
  }
  YEN += 380000.0 * BTC;
  cout << YEN << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;

class Pair<E,F>{
    E first;
    F second;
    public Pair(E first, F second){
        this.first=first;
        this.second=second;
    }
    public E getFirst(){return first;}
    public F getSecond(){return second;}
    public String toString(){
        return "<"+first.toString()+","+second.toString()+">";
    }
    public int hashCode(){
        return first.hashCode()*30011+second.hashCode()+2;
    }
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Pair another = (Pair) obj;
        return this.getFirst().equals(another.getFirst())&&this.getSecond().equals(another.getSecond());
    }
}

class Point extends Pair<Integer,Integer>{
    public Point(int x, int y){
        super(x,y);
    }
}

class Operation{
    int oldX, oldY, newX, newY;
    public Operation(int oldX, int oldY, int newX, int newY){
        this.oldX = oldX;
        this.oldY = oldY;
        this.newX = newX;
        this.newY = newY;
    }
    public Operation(Point oldCood, Point newCood){
        this.oldX = oldCood.getFirst();
        this.oldY = oldCood.getSecond();
        this.newX = newCood.getFirst();
        this.newY = newCood.getSecond();
    }
    public String toString(){
        return (1+oldX)+" "+(1+oldY)+" "+(1+newX)+" "+(1+newY);
    }
}
public class Main {
    public static boolean inside(int H, int W, int h, int w){
        return h>=0 && h<H && w>=0 && w<W;
    }
    public static boolean inside(int H, int W, Point p){
        return inside(H,W,p.getFirst(),p.getSecond());
    }
    public static Point nextCell(int H, int W, int h, int w){
        if(h%2==0){
        	if(w==W-1) return new Point(h+1,w);
        	else return new Point(h,w+1);
        }else{
        	if(w==0) return new Point(h+1,w);
        	else return new Point(h,w-1);
        }
    }
    public static Point nextCell(int H, int W, Point cell){
        return nextCell(H,W,cell.getFirst(),cell.getSecond());
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int[][] board = new int[H][W];
        for(int h=0;h<H;h++)for(int w=0;w<W;w++) board[h][w]=sc.nextInt();
        LinkedList<Operation> operations = new LinkedList<>();
        Point current = new Point(0,0);
        while(inside(H,W,nextCell(H,W,current))){
        	if(board[current.getFirst()][current.getSecond()]%2!=0){
        	    Operation op = new Operation(current,nextCell(H,W,current));
        	    operations.add(op);
        	    board[current.getFirst()][current.getSecond()]--;
        	    board[nextCell(H,W,current).getFirst()][nextCell(H,W,current).getSecond()]++;
        	}
        	current = nextCell(H,W,current);
        }
        System.out.println(operations.size());
        for(Operation op:operations){
        	System.out.println(op);
        }
        
    }
}


Measured memory_bytes: 104584
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
typedef long long ll;

char buf[200000+10];

int main(void) {
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  cin >> buf;
  --a;
  --b;
  --c;
  --d;
  while(a < c || b < d) {
    // cerr << a << " " << b << endl;
    if(c < d) { // bの方が遠いのでb優先
      if(b < d) {
        if(b+1 <= d && buf[b+1] == '.' && b+1 != a) {
          ++b;
          continue;
        }
        if(b+2 <= d && buf[b+2] == '.' && b+2 != a) {
          b += 2;
          continue;
        }
      }
      if(a < c) {
        if(a+1 <= c && buf[a+1] == '.' && a+1 != b) {
          ++a;
          continue;
        }
        if(a+2 <= c && buf[a+2] == '.' && a+2 != b) {
          a += 2;
          continue;
        }
      }
    } else { // aの方が遠いのでa優先
      if(a < c) {
        if(a+1 <= c && buf[a+1] == '.' && a+1 != b) {
          ++a;
          continue;
        }
        if(a+2 <= c && buf[a+2] == '.' && a+2 != b) {
          a += 2;
          continue;
        }
      }
      if(b < d) {
        if(b+1 <= d && buf[b+1] == '.' && b+1 != a) {
          ++b;
          continue;
        }
        if(b+2 <= d && buf[b+2] == '.' && b+2 != a) {
          b += 2;
          continue;
        }
      }
    }
    puts("No");
    return 0;
  }
  puts("Yes");
  return 0;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using tsii = tuple<string, int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

ll mod =1e9+7;

int main()
{
    ll n,k,ans=0;
    cin>>n>>k;
    vector<ll> a(n), fi(n), al(n);
    for (int i = 0; i < n; i++)
    {
        cin>>a[i];
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if(a[i]>a[j]) 
            {
                al[i]++;
                if(i<j)
                {
                    fi[i]++;
                }
            }
        }
    }
    for (int i = 0; i < n; i++)
    {
        ans+=fi[i]*k;
        ans%=mod;
        ll plus = ((k-1)*k/2)%mod;
        plus = (al[i]*plus)%mod;
        ans+=plus;
        ans%=mod;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
struct Node{
    int num;
    int id;
}node[100010];
bool cmp(Node a,Node b){
    return a.num < b.num;
}
int main(){
    int N;
    cin>>N;
    for(int i = 1;i <= N; i++){
        cin>>node[i].num;
        node[i].id = i;
    }
    sort(node + 1,node + N + 1,cmp);
    for(int i = 1; i<= N; i++) cout<<node[i].id<<" ";
    return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};

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

    int H, W;
    string a[10];

    cin >> H >> W;
    REP(i, H)
    cin >> a[i];

    REP(i, H)
    REP(j, W)
    {
        int in = 0, out = 0;

        REP(k, 4)
        {
            if (i + dy[k] < 0 || H <= i + dy[k] || j + dx[k] < 0 || W <= j + dx[k])
                continue;

            if (a[i + dy[k]][j + dx[k]] == '#')
            {
                if (k == 1 || k == 3)
                    in++;
                else
                    out++;
            }
        }

        if (in > 1 || out > 1)
        {
            cout << "Impossible" << endl;
            return 0;
        }
    }

    cout << "Possible" << endl;

    return 0;
}

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


using namespace std;

int main(void) {

	int n, m, c, b[20], a[20][20], tmp, num = 0;

	cin >> n >> m >> c;

	for (int i = 0; i < m; i++)cin >> b[i];

	for (int k = 0; k < n; k++) {
		tmp = 0;
		for (int l = 0; l < m; l++) {
			cin >> a[k][l];
			tmp += a[k][l] * b[l];
		}
		tmp += c;

		if (tmp > 0)num++;
	}

	cout << num << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define faster ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
#define mod ll(1e9+7)

int main()
{
	faster;
	
	ll n,k;
	cin >> n >> k;

	vector<ll> a(n);

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

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

	ll res = 1,sign = 1,left = 0,right = n-1;

	if(k % 2)
	{
		res = (a[right--]%mod);
		res %= mod;
		if(res < 0)
		{
			sign = -1;
		}
		k--;
	}
	while(k)
	{
		ll x = a[left] * a[left+1], y = a[right] * a[right-1];
		if(x * sign > y * sign)
		{
			res *= (x % mod);
			res %= mod;
			left += 2;
		}
		else 
		{
			res *= (y % mod);
			res %= mod;
			right -= 2;
		}
		k -= 2;
	}
	cout << ((mod+res) % mod)<< endl;
	
	return 0;
}


Measured memory_bytes: 4784
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;

int mod = 1e9 + 7;

// mod
void add(int& a, int b) {
    a += b;
    if (a >= mod)
        a -= mod;
}

// nCr
int fac[2005], rev[2005];

int binpow(int x, int p) {
    if (p == 0) return 1;

    if (p % 2 == 0)
        return binpow((x * x) % mod, p / 2);
    else
        return (x * binpow(x, p - 1)) % mod;
}

int nCr(int n, int r) {
    if (r > n) return 0;
    return ((fac[n] * rev[r]) % mod * rev[n - r]) % mod;
}

void precalc(int n) {
    fac[0] = fac[1] = 1;
    FOR(i, 2, n + 2)fac[i] = (fac[i - 1] * i) % mod;

    rev[n + 1] = binpow(fac[n + 1], mod - 2) % mod;
    REV(i, n, 0) { rev[i] = (rev[i + 1] * (i + 1)) % mod; }
}

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

    int N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;

    precalc(N);

    vector<vector<int>> dp(B + 2, vector<int>(N + 1, 0));
    dp[A][0] = 1;
    for (int k = A; k <= B; k++) {
        for (int n = 0; n <= N; n++) {
            add(dp[k + 1][n], dp[k][n]);

            int v = 1;
            for (int i = 1; n + i * k <= N && i <= D; i++) {
                v *= nCr(N - n - k * (i - 1), k);
                v %= mod;
                if (i < C) continue;
                add(dp[k + 1][n + i * k], (((dp[k][n] * v) % mod) * rev[i]) % mod);
            }
        }
    }
    cout << dp[B + 1][N] << endl;
    return 0;
}


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

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 FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll N;
    cin >> N;

    vector<ll> A(N);
    FOR(i, 0, N){
        cin >> A.at(i);
    }

    ll x = 0;
    for(ll a : A){
        x ^= a;
    }

    if(x==0){
        p_yes();
    }else{
        p_no();
    }
    
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct node{
  int key;
  struct node *next;
  struct node *prev;
};
typedef struct node *Node;
Node head;
void delete(Node);
int main(){
  int n,i,flag,key;
  char inst[12];
  Node index;
  scanf("%d",&n);
  head = (Node *)malloc(sizeof(Node));
  head->next = head;
  head->prev = head;
  for(i=0;i<n;i++){
    scanf("%s",inst);
    if( 'F' == inst[6] ){
      delete(head->next);
    }
    else if( 'L' == inst[6]){
      delete(head->prev);
    }
    else{
      scanf("%d",&key);
      if( 'i' == inst[0]){
    Node tmp;
    tmp = (Node *)malloc(sizeof(Node));
    tmp->key = key;
    tmp->next = head->next;
    head->next->prev = tmp;
    head->next = tmp;
    tmp->prev = head;
      }
      else{
    index = (Node *)malloc(sizeof(Node));
    index = head->next;
    while( index != head && index->key != key){
      index = index->next;
    }
    if( index == head ){
      continue;
    }
    delete(index);
      }
    }
  }
  index = head->next;
  flag = 0;
  while(index != head){
    if( flag > 0){
      printf(" ");
    }
    flag++;
    printf("%d",index->key);
    index = index->next;
  }
  printf("\n"); 
  return 0;
}
void delete(Node tmp){
  tmp->next->prev = tmp->prev;
  tmp->prev->next = tmp->next;
  free(tmp);
}


Measured memory_bytes: 32948
#include <bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
typedef pair<int,int>P;
#define fi first
#define se second
#define mk make_pair
#define int long long
main(){
  int n,k,ans=0,x[100001],y[100001],ss=0;
  cin>>n>>k;
  r(i,n){
    cin>>x[i]>>y[i];
  }
  for(int i=0;pow(2,i)<=k;i++)if(k&(1<<i)){
    int p=k;
    ans=0;
    for(int j=0;j<i;j++){
      p|=(1<<j);
    }
    p-=pow(2,i);
    r(j,n){
     if((x[j]|p)==p)ans+=y[j];
    }
    //cout<<p<<' '<<ans<<endl;
    ss=max(ss,ans);
  }ans=0;
  r(i,n)if((x[i]|k)==k)ans+=y[i];
  ss=max(ss,ans);
  cout<<ss<<endl;
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  int n,k,c;
  cin>>n>>k>>c;
  string s;
  cin>>s;
  c++;

  vector<int>dp(n);
  rep(i,n)if(s[i]=='o')dp[i]=1;
  for(int i=n-1;i>0;i--){
    if(s[i]=='o'&&i-c>=0){
      dp[i-c]=max(dp[i-c],dp[i]+1);
    }
    dp[i-1]=max(dp[i-1],dp[i]);
  }

  int cnt=0;
  vector<int>ans;
  for(int i=0;i<n;i++){
    if(s[i]=='x')continue;
    bool ok=true;
    for(int j=i+1;j<min(i+c,n);j++){
      if(s[j]=='o'&&dp[j]+cnt==k)ok=false;
    }
    if(ok)ans.push_back(i+1);
    cnt++;
    i=i+c-1;
  }

  if(cnt==k){
    for(auto x:ans)cout<<x<<endl;
  }

  return(0);
}


Measured memory_bytes: 3448
function main(arg) {
	arg = Number(arg.split("\n")[0])
	if (arg === 25) console.log('Christmas')
	else if (arg === 24) console.log('Christmas Eve')
	else if (arg === 23) console.log('Christmas Eve Eve')
	else if (arg === 22) console.log('Christmas Eve Eve Eve')
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21952
#include<stdio.h>

main(){
	int x, y;
	
	while(1){
		scanf("%d %d", &x, &y);
		
		if(x == 0 && y == 0)
			break;
		
		else if(x > y)
			printf("%d %d\n", y, x);
			
		else
			printf("%d %d\n", x, y);
	}
}

Measured memory_bytes: 600
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <functional>
#include <sstream>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007
#define M 998244353

using namespace std;

int main(){
    lli n,a,b=0,c;
    vector<lli> vec;
    lli i;
    cin>>n;
    rep(i,0,n){
        cin>>a;
        b^=a;
        vec.push_back(a);
    }
    rep(i,0,n){
        c=vec[i]^b;
        cout<<c;
        if(i!=n-1){
            cout<<" ";
        }
    }
    cout<<endl;
}


Measured memory_bytes: 5268
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;

  int C[VMAX+1];
  int n, i, j;
  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for ( i = 0; i <= VMAX; i++ ) C[i] = 0;

  for ( i = 0; i < n; i++ ){
    scanf("%hu", &A[i + 1]);
    C[A[i + 1]]++;
  }

  for ( i = 1; i <= VMAX; i++ ) C[i] = C[i] + C[i - 1];

  for ( j = 1; j <= n; j++ ){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", B[i]);
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 9572
N = []
A = [0 for i in range(100)]

while True :
    try :
        n = int(input())
        N.append(n)
        A[n - 1] += 1
        
    except :
        break
    
m = max(A)

M = [i for i, x in enumerate(A) if x == m]
l = len(M)

for i in range(l) :
    print(M[i] + 1)




Measured memory_bytes: 5600