akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define MIN -1000000
using namespace std;
typedef long long ll;
typedef pair <int,int> pii;
bool visited[100005];
const int max_N=1e5+10;
int H,W,h,w;
int board[105][105];
int mxindex,mxchain=0;
string S;
int ans=0;

void dfs(string T, bool three, bool five, bool seven){
  if(T.size()>S.size() || stoi(T)>stoi(S))return;
  else if(three && five &&seven) ans++;

  dfs(T+'3', true, five, seven);
  dfs(T+'5', three, true, seven);
  dfs(T+'7', three, five, true);
}


int main(void)
{
  cin >> S;
  dfs("3",true,false,false);
  dfs("5",false,true,false);
  dfs("7",false,false,true);
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#! /usr/bin/python3
# バイナリハックイージー / Unhappy Hacking (ABC Edit)
"""
    1. 先頭のB全部を消す
    2.
"""
import re

test_mode = False
s = str(input())

for _ in range(10):
    while s[0] == 'B':
        s = s[1:]
        if test_mode is True:
            print(s)
    s = re.sub('0B|1B', '', s)
    if 'B' not in s:
        print(s)
        break


"""
参考
    Pythonで文字列の最初・最後の１文字（数文字）を削除する
    https://robotics4society.com/2017/06/29/python_mojisakujo/
"""


Measured memory_bytes: 3188
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;

int n;
long long x[1010],y[1010];
long long p[40];
int fx[4]={-1,1,0,0};
int fy[4]={0,0,1,-1};

int main(){
	scanf("%d",&n);
	scanf("%lld %lld",&x[1],&y[1]);
	long long flag=(x[1]+y[1]+(long long)10e9)%2;
	for(int i=2;i<=n;i++){
		scanf("%lld %lld",&x[i],&y[i]);
		if(flag!=(x[i]+y[i]+(long long)10e9)%2){
			printf("-1\n");
			return 0;
		}
	}
	for(int i=30;i>=0;i--) p[30-i+1]=(1ll<<i);
	int m=31;
	if(flag==0) p[++m]=1;
	printf("%d\n",m);
	for(int i=1;i<=m;i++) printf("%lld ",p[i]);
	printf("\n");
	long long tempx,tempy;
	long long mmin;
	int w;
	
	for(int i=1;i<=n;i++){
		long long xx=x[i],yy=y[i];
		for(int j=1;j<=m;j++){
			mmin=0x3f3f3f3f3f3f3f3f,w=0;
			for(int q=0;q<4;q++){
				tempx=xx+fx[q]*p[j];
				tempy=yy+fy[q]*p[j];
				if(abs(tempx)+abs(tempy)<mmin){
					mmin=abs(tempx)+abs(tempy);
					w=q;
				}
			}
			if(w==0) printf("R");
			else if(w==1) printf("L");
			else if(w==2) printf("D");
			else if(w==3) printf("U");
			xx+=fx[w]*p[j];
			yy+=fy[w]*p[j];
		}
		printf("\n");
	}
	
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <map>
#include <string>
#include <math.h>
using namespace std;


int main() {

    int i=0;
    int N,M;
    cin >> N >> M;
    if(N>=M){
        for(int i=0;i<N;i++){
            cout<<M;
        }
    }else{
        for(int i=0;i<M;i++){
            cout<<N;
        }
    }

    return 0;
}

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

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a, ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t =rep_jijo(n,x/2);
        return t*t%mod;
  }
  return n*rep_jijo(n,x-1)%mod;
}

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

    d[K-1]=1;
   
    for(ll i=K; i>0; i--){
         ll sum=0;
        for(ll j=2*i; j<K+1; j+=i){
            
        
         sum+=d[j-1];}
         ll z;
         z=rep_jijo(K/i,N);
  
     d[i-1]=z-sum;

    
    }
ll ans=0;
    rep(i,K){
ans+= d[i]*(i+1);
    }
ans%=mod;


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



Measured memory_bytes: 4056
#include <iostream>
#include <math.h>
#include <cstdlib>

#define el endl
#define fd fixed

using namespace std;

double min1(int x[], int y[], int n) {
  double res = 0;
  for (int i = 0; i < n; i++)
    res += abs(x[i]-y[i]);
  return res;
}

double min2(int x[], int y[], int n) {
  double res = 0;
  for (int i = 0; i < n; i++)
    res += pow(abs(x[i]-y[i]), 2);
  return pow(res, 1.0/2.0);
}

double min3(int x[], int y[], int n) {
  double res = 0;
  for (int i = 0; i < n; i++)
    res += pow(abs(x[i]-y[i]), 3);
  return pow(res, 1.0/3.0);
}

double mininf(int x[], int y[], int n) {
  double res = 0;
  for (int i = 0; i < n; i++)
    if (res < abs(x[i]-y[i]))
      res = abs(x[i]-y[i]);
  return res;
}

int main() {
  int n;
  cin >> n;
  int x[n], y[n];
  for (int i = 0; i < n; i++)
    cin >> x[i];
  for (int i = 0; i < n; i++)
    cin >> y[i];
  cout << fd << min1(x, y, n) << el << fd << min2(x, y, n) << el << fd << min3(x, y, n) << el << fd << mininf(x, y, n) << el;
  return 0;
}

Measured memory_bytes: 1300
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector <int> a;
    int th;
    for (int i=0; i<n; i++){
        cin >> th;
        a.push_back(th);
    }
    sort(a.begin(), a.end());
    int k = a[n-1];
    int ans = -1;
    int ansr = 2000000009;
    for (int i=0; i<n-1; i++){
        if (abs(k - a[i] * 2) < ansr){
            ansr = abs(k - a[i] * 2);
            ans = a[i];
        }
    }
    cout << k << ' ' << ans;
    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e,v); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int N;
  cin >> N;
  vector<int> A(N);
  cin >> A;
  vector<int> B = A;
  REP(i,N) B[i] = A[i] - (i + 1);
  SORT(B);
  int b = B[N/2];
  int ans = 0;
  REP(i,N) ans += abs(A[i] - (b + i + 1));
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <map>
#include <cstdlib>
#include <cctype>
#include <ctype.h>
#define ll long long
using namespace std;
int main()
{
    int n;
    string a, b;
    cin >> n >> a >> b;
    for (int i = 0; i < n;i++)
    {
        cout << a[i] << b[i];
    }
    return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $n);
$a = array();
for($i = 0; $i < $n; $i++){
       fscanf(STDIN, "%d", $a[]);
       $b[] = 1;
}
$count = 1;
$button = $a[0];
while($button != 2){
  $num = $button-1;
  $button = $a[$num];
  if($a[$num] == -1){
    echo "-1\n";
    return; 
  }
  $a[$num] = -1;
  $count++;
}
echo $count."\n";
?>


Measured memory_bytes: 15096
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    vector<ll> p(n);
    vector<double> kitai(n);
    for(ll i = 0; i < n; i++) {
        cin >> p[i];
        kitai[i] = (double)((1 + p[i]) * p[i] / 2) / p[i];
    }
    for(ll i = 1; i < n; i++) {
        kitai[i] += kitai[i - 1];
    }
    double ans = 0;
    for(ll i = k - 1; i < n; i++) {
        double tmp;
        if(i == k - 1) {
            tmp = kitai[i];
        } else {
            tmp = kitai[i] - kitai[i - k];
        }
        chmax(ans, tmp);
    }
    cout << fixed << setprecision(15);
    cout << ans << endl;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int n,a[55];
double ans;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+n+1);
	ans=a[1];
	for(int i=2;i<=n;i++) ans=(ans+a[i])/2;
	cout<<ans;
	return 0;
}

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

#define FOR(i,l,r) for(int i = int(l);i < int(r);i++)
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;



int main()
{
    int N;
	scanf("%d",&N);
	int ans = 0;
	FOR(i,0,N){
		int l,r;
		scanf("%d%d",&l,&r);
		ans += r - l + 1;
	}
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 256
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

k = int(input())
kl = list(range(1,k+1))
res = 0

for i in kl:
    for j in kl:
        for k in kl:
            res += gcd(i,j,k)

print(res)



Measured memory_bytes: 69500
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


int main(){

    string S;
    cin >> S;

    if(S.length() == 6 && S[2]==S[3] && S[4]==S[5]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INF = 1000000007;
const int mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};


int main(){
  string S;
  cin >> S;
  string T;
  for(int i=0; i<S.size(); i++){
    if(S[i] == '0'){
      T = T + "0";
    }else if(S[i] == '1'){
      T = T + "1";
    }else if(S[i] == 'B'){
      if(T.size() == 0){
        continue;
      }
      T.pop_back();
    }
  }
  cout << T << endl;
  return 0;
}


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

int main() {
  int a, b, c, d, e, k;

  cin >> a >> b >> c >> d >> e >> k;

  if (e - a > k) {
    cout << ":(" << endl;
  }
  else {
    cout << "Yay!" << endl;
  }

  return 0;
}


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

int main() {
  int H, N;
  long long int K = 0;
  cin >> H >> N;
  vector<int> A(H);
  for(int i = 0;i < H; i++) cin >> A.at(i);
  sort(A.begin(), A.end());
  for (int i =0; i < H-N; i++) K += A.at(i);
  
  cout << K << endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q,K;
string S,T;
ll ans;
ll x[1000000];
ll y[1000000];
ll a[1000000];
ll b[1000000];
ll c[1000000];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
struct Edge{
	ll to,cost;
	 Edge(int to, int cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;
void DFS(ll nowpos,ll cost){
	if(dist[nowpos]!=INF)return;
	dist[nowpos]=cost;
	rep(i,0,graph[nowpos].size()){
		DFS(graph[nowpos][i].to,cost+graph[nowpos][i].cost);
	}
}
int main() {
	cin>>N;
	graph = AdjList(N);
	dist=vector<ll>(N,INF);
	rep(i,0,N-1){
		cin>>a[i]>>b[i]>>c[i];
		a[i]--;
		b[i]--;
		graph[a[i]].push_back(Edge(b[i],c[i]));
		graph[b[i]].push_back(Edge(a[i],c[i]));
		cerr<<a[i]<<" "<<b[i]<<" "<<c[i]<<endl;
	}
	cin>>Q>>K;
	cerr<<K<<endl;
	K--;
	DFS(K,0);
	rep(i,0,Q){
		cin>>x[i]>>y[i];
		x[i]--;
		y[i]--;
		cout<<dist[x[i]]+dist[y[i]]<<endl;;
	}
	return 0;
}


Measured memory_bytes: 25856
import java.util.Scanner;

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

Measured memory_bytes: 12000
def main():
    a = int(input())
    b = int(input())
    c  = int(input())
    x = int(input())
    count = 0 
    for i in range(a+1):
        for j in range(b+1): 
            for k in range(c+1):
                # print(500*i + 100*j + 50*k)
                if 500*i + 100*j + 50*k == x:
                    count += 1 

    print(count)

main()

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
#define INF (1<<29)

void move(int m,int x[10],int y[10]){
	int minx = INF,miny=INF;
	for(int i=0;i<m;i++){
		minx=min(minx,x[i]);
		miny=min(miny,y[i]);
	}
	for(int i=0;i<m;i++){
		x[i] -= minx;
		y[i] -= miny;
	}
}
void rotate(int m,int x[10],int y[10]){
	for(int i=0;i<m;i++){
		int nx,ny;
		nx = -y[i];
		ny = x[i];
		x[i]=nx;
		y[i]=ny;
	}
	move(m,x,y);
}
void reverse(int m,int x[10],int y[10]){
	for(int i=0;i<m/2;i++){
		swap(x[i],x[m-1-i]);
		swap(y[i],y[m-1-i]);
	}
	move(m,x,y);
}
bool same(int m,int x[10],int y[10],int m1,int x1[10],int y1[10]){
	if(m!=m1)return false;
	for(int i=0;i<m;i++){
		if(x[i]!=x1[i]||y[i]!=y1[i])return false;
	}
	return true;
}
int main(){
	int n;
	while(cin>>n&&n){
		int m0,x0[10],y0[10];
		int m,x[10],y[10];
		cin>>m0;
		for(int i=0;i<m0;i++){
			cin>>x0[i]>>y0[i];
		}
		move(m0,x0,y0);
		for(int i=0;i<n;i++){
			cin>>m;
			int j;
			for(j=0;j<m;j++){
				cin>>x[j]>>y[j];
			}
			for(j=0;j<4;j++){
				rotate(m,x,y);
				if(same(m0,x0,y0,m,x,y))break;
				reverse(m,x,y);
				if(same(m0,x0,y0,m,x,y))break;
			}
			if(j!=4)cout<<i+1<<endl;
		}
		cout<<"+++++"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define null nullptr
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mp make_pair
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

using namespace std;

typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;
typedef unordered_map<int,int> mp;

const int mod = 1e9+7;
const int inf = 1e17+21;



int32_t main(){
    FAST;

    int n;  cin >> n;
    int T;  cin >> T;
    int ans = inf;

    for(int x=0;x<n;x++){
        int t , c;
        cin >> c >> t;
        if(t <= T)
            ans = min(ans, c);
    }

    if(ans == inf){
        cout << "TLE\n";
        return 0;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	long long x, ans;
	scanf("%lld", &x);
	ans = (x / 11) * 2;
	if(x % 11 == 0){
		ans--;
	}
	else if(x % 11 > 6){
		ans++;
	}
	printf("%lld\n", ans + 1);
	return 0;
}

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

void solv() {
    int a, b, c;
    cin >> a >> b >> c;
    int sato = 0;
    int yamada = 0;
    sato = a;
    if (sato == b + c) {
        cout << "Yes" << endl;
        return;
    }
    if (sato + b == c) {
        cout << "Yes" << endl;
        return;
    }
    if (sato + c == b) {
        cout << "Yes" << endl;
        return;
    }
    cout << "No" << endl;
    return;
}

int main() {
    solv();
    return 0;
}

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

int main() {
    int N; cin >> N;
	vector<int> A(N);
	int sum = 0;
	for(int i=0; i<N; ++i) {
	    cin >> A[i];
		sum ^= A[i];
	}
	for(int i=0; i<N; ++i) {
	    cout << (sum ^ A[i]) << (i + 1 == N ? '\n' : ' ');
	}
}


Measured memory_bytes: 4048
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));


#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl
#define dv(name, value) cerr << (name) << " is " << (value) << endl
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl

signed main(){
  string S; cin >> S;
  int ans = 0;
  if (S == "SAT") {
    ans = 1;
  } 
  if (S == "FRI") {
    ans = 2;
  } 
  if (S == "THU") {
    ans = 3;
  } 
  if (S == "WED") {
    ans = 4;
  } 
  if (S == "TUE") {
    ans = 5;
  } 
  if (S == "MON") {
    ans = 6;
  } 
  if (S == "SUN") {
    ans = 7;
  } 
  cout << ans << endl;
}


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

class InsertionSort{
private:
    std::vector<int> dataSet;
public:
    InsertionSort(std::vector<int> dataSet);
    void showArray();
    void dataSort();
};

InsertionSort::InsertionSort(std::vector<int> dataSet){
    this->dataSet = dataSet;
}

void InsertionSort::showArray(){
    for(int i = 0;i < dataSet.size();i++){
        std::cout << (i ? " " : "") << dataSet[i];
    }
    std::cout << std::endl;
}

void InsertionSort::dataSort(){
    for(int i = 1;i < dataSet.size();i++){
        int v = dataSet[i];
        int j = i - 1;
        while(j >= 0 && dataSet[j] > v){
            dataSet[j + 1] = dataSet[j];
            j--;
        }
        dataSet[j + 1] = v;
        showArray();
    }
}

int main(){
    
    std::vector<int> vec;

    int maxCount = 0;
    std::cin >> maxCount;
    
    int i = 0;

    int input;
    while(std::cin >> input){
        vec.push_back(input);
        
        i++;
        if(i >= maxCount){
            break;
        }
    }

    InsertionSort is = InsertionSort(vec);
    is.showArray();
    is.dataSort();

    return 0;
}

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

using namespace std;
using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

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

int main(){

    ll x;
    cin>>x;

    ll a=100,cnt=0;

    while(a<x){
        cnt++;
        a*=1.01;
    }

    cout<<cnt<<endl;

}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int num[5],K;
    rep(i,0,5)cin >> num[i];
    cin >> K;
    rep(i,0,5){
        rep(j,i+1,5)
        if(num[j] - num[i] > K){
            cout << ":(" << endl;
            return 0;
        }
    }
    cout << "Yay!" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int N,tp;
int main(){
    cin >> N;
    vector<ll> lt; 
    map<int,int> num;
    rep(i,N){
        cin >> tp;
        num[tp]++;
        if(num[tp]==2 || num[tp]==4) lt.pb(tp);
    }
    sort(ALL(lt));
    ll ans;
    if(sz(lt)>=2) ans = lt[sz(lt)-1]*lt[sz(lt)-2];
    else ans = 0;
    cout << ans << endl;
}

Measured memory_bytes: 4992
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main()
{
  int a, b, c, i, j;
  int A[101][101];

  while(scanf("%d", &a)!=EOF){
    memset(A, 0, sizeof(A));
    
    for(i = 0; i < a; ++i){
      scanf("%d %d", &c, &b);
      
      while(0 < b--){
	scanf("%d", &j);
	A[c][j] = 1;
      }
    }

    for(i = 1; i <= a; ++i){
      
      for(j = 1; j < a; ++j)
	printf("%d ", A[i][j]);
      printf("%d\n", A[i][a]);
    }
  }

  return 0;
}



Measured memory_bytes: 2088
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define INF 1<<25
 
typedef long long ll;

int dy[8]={1,1,1,0,0,-1,-1,-1};
int dx[8]={-1,0,1,-1,1,-1,0,1};
struct S{
	int a,b,c;
};
bool asc(const S& left,const S& right){
	return left.c > right.c;
}

int mn=INF;
int N,K;
void dfs(int num,int now){
	if(num==N){
		mn=min(mn,now);
		return;
	}
	dfs(num+1,now*2);
	dfs(num+1,now+K);
}
int main(){
	cin>>N>>K;
	dfs(0,1);
	cout<<mn<<endl;
	return 0;
}



Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+30;
int fa[maxn], a[maxn];
vector<int>v[maxn];
int find(int x) {return x==fa[x]?x:fa[x]=find(fa[x]);}
int main()
{
    int n, m, x, y;
    scanf("%d%d",&n,&m);
    for(int i=1; i<=n; ++i)
    {
        scanf("%d",&a[i]);
        fa[i] = i;
    }
    while(m--)
    {
        scanf("%d%d",&x,&y);
        fa[find(x)] = find(y);
    }
    int ans = 0;
    for(int i=1; i<=n; ++i)
    {
        v[find(i)].push_back(i);
        v[find(i)].push_back(a[i]);
    }
    for(int i=1; i<=n; ++i)
    {
        sort(v[i].begin(), v[i].end());
        for(int j=0; j<v[i].size(); ++j)
            if(j && v[i][j] == v[i][j-1]) ++ans;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 6528
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7

cntA = Counter(A)

if N % 2 == 0:
    for i in range(1, N, 2):
        if cntA[i] != 2:
            print(0)
            exit()
        cntA[i] = 0
    if max(cntA.values()) > 0:
        print(0)
        exit()
    print(pow(2, N // 2, MOD))
else:
    for i in range(2, N, 2):
        if cntA[i] != 2:
            print(0)
            exit()
        cntA[i] = 0
    if cntA[0] != 1:
        print(0)
        exit()
    cntA[0] = 0
    if max(cntA.values()) > 0:
        print(0)
        exit()
    print(pow(2, N // 2, MOD))

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

using namespace std;

int main(){
  int a, b, c;
  char A, B;
  cin >> a >> b >> c;
  int count = 0;
  for(int i = a; i > 0; i--){
    if(a >= i && b >= i){
      if(a%i == 0 && b % i == 0){
        count++;
        if(count  == c) cout << i << endl;
      }
    }
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	int a=0;
	string s;
	cin>>s;
	rep(i,4)a += (s[i]=='+'? 1 : -1);
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 256
str_normal = input()
str = [i for i in str_normal]
for k in range(int(input())):
	list = [i for i in input().split()]
	
	if list[0]=="print":
		a =int(list[1])
		b =int(list[2])
		str_print=[]
		for i in range(a,b+1):
			str_print +=str[i] 
		print("".join(str_print))
	
	if list[0]=="reverse":
		a =int(list[1])
		b =int(list[2])
		str_a = str[a:b+1]
		str_a.reverse()
		cnt = 0
		for i in range(a,b+1):
			str[i] = str_a[cnt]
			cnt+=1
		
	if list[0]=="replace":
		a =int(list[1])
		b =int(list[2])
		p =list[3]
		p_list=[i for i in p]
		cnt =0
		for i in range(a,b+1):
			str[i]= p_list[cnt]
			cnt+=1


Measured memory_bytes: 5640
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val x = sc.nextInt()
    val a = sc.nextInt()
    val b = sc.nextInt()
    println(if (a - b >= 0) "delicious" else if (a + x >= b) "safe" else "dangerous")
}




Measured memory_bytes: 29480
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int A, B, C, D;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> A >> B >> C >> D;

  if (A + B > C + D) {
    cout << "Left" << endl;
  }
  else if (A + B == C + D) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] list = new int[100001];
        long ans = 0;
        for (int i = 0; i < n; i++) {
            long value = sc.nextLong();
            if (value > 100000) {
                ans++;
            } else {
                list[(int)value]++;
            }
        }
        for (int i = 0; i < list.length; i++) {
            if (i > list[i]) {
                ans += list[i];
            } else if (i < list[i]) {
                ans += list[i] - i;
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 50068
n, m = map(int, input().split())
a = [int(i) for i in input().split()]
sum_a = sum(a)
cnt = 0
for i in range(n):
    if sum_a / (4*m) <= a[i]:
        cnt += 1
if m <= cnt:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
const int N=1e5+5;

int main(){
int n;
cin>>n;
int t=n%10;
if(t==2||t==4||t==5||t==7||t==9)cout<<"hon";
else if(t==0||t==1||t==6||t==8)cout<<"pon";
else cout<<"bon";


return 0;}


Measured memory_bytes: 3620
#include <iostream>

using namespace std;

int main() {
    int a1, a2, a3;
    cin >> a1 >> a2 >> a3;

    int min = a1;
    int max = a1;
    if (a2 < min) {
        min = a2;
    }
    if (a2 > max) {
        max = a2;
    }
    if (a3 < min) {
        min = a3;
    }
    if (a3 > max) {
        max = a3;
    }

    cout << max - min << endl;

    return 0;
}


Measured memory_bytes: 256
S = input()

left_count = [0] * (len(S) + 1)
right_count = [0] * (len(S) + 1)

S = "*" + S + "*"
cur_left_count = 0
cur_right_count = 0
for i in range(len(left_count)):
    if S[i] == "<":
        cur_left_count += 1
    else:
        cur_left_count = 0

    if S[-i-1] == ">":
        cur_right_count += 1
    else:
        cur_right_count = 0
    
    left_count[i] = cur_left_count
    right_count[-i-1] = cur_right_count

a =  [max(l, r) for l, r in zip(left_count, right_count)]

print(sum(a))


Measured memory_bytes: 31828
#include<bits/stdc++.h>
using namespace std;
const int INF=1e9;

int main(){
  vector<tuple<int,int,int> > e;
  int dist[101][101]={};
  int N, M;
  cin >> N >> M;
  for(int i=1; i<=N; i++){
    for(int j=1; j<=N; j++){
      if(i==j) dist[i][j]=0;
      else dist[i][j]=INF;
    }
  }
  for(int i=0; i<M; i++){
    int u, v, c;
    cin >> u >> v >> c;
    dist[u][v]=dist[v][u]=c;
    e.push_back(make_tuple(u,v,c));
  }
  for(int k=1; k<=N; k++){
    for(int i=1; i<=N; i++){
      for(int j=1; j<=N; j++){
        dist[i][j]=min(dist[i][j], dist[i][k]+dist[k][j]);
      }
    }
  }
  int ans = M;
  for(int i=0; i<M; i++){
    for(int j=1; j<=N; j++){
      if(dist[j][get<0>(e[i])]+get<2>(e[i])==dist[j][get<1>(e[i])]){
        ans--;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define m(a,b) memset(a,b,sizeof(a))
typedef long long LL;
const int MAX = 1000;
using namespace std;

string a,b;
int main(){
	cin>>a>>b;
	if(a.size() > b.size()){
		cout<<"GREATER"<<endl;
		return 0;
	}
	else if(a.size() < b.size()){
		cout<<"LESS"<<endl;
		return 0;
	}
	else{
		for(int i=0; i<=a.size(); ++i){
			if(a[i] > b[i]){
				cout<<"GREATER"<<endl;
				return 0;
			}
			else if(a[i] < b[i]){
				cout<<"LESS"<<endl;
				return 0;
			}
			else {
				cout<<"EQUAL"<<endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <float.h>
#include <random>

#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
#define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> Pll;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/10;
const ll MOD = 1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;cin>>N;
  vector<pair<pair<string,ll>,ll> > rest(N);
  for(ll i=0;i<N;i++){
    cin>>rest[i].first.first>>rest[i].first.second;
    rest[i].first.second *= -1;
    rest[i].second = i+1;
  }
  sort(rest.begin(),rest.end());
  for(ll i=0;i<N;i++){
    cout<<rest[i].second<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
MAX = 10 ** 6 + 5
cnt = [0] * MAX
ok = [True] * MAX
for x in a:
    cnt[x] += 1
ans = 0
for i in range(1, MAX):
    if cnt[i] > 0:
        for j in range(i * 2, MAX, i):
            if cnt[j] > 0:
                ok[j] = False       
        if ok[i] and cnt[i] == 1:
            ans += 1
print(ans)

Measured memory_bytes: 114048
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


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

  int ans = 1;
  while(N--){
    (ans *= N+1) %= MOD;
  }
  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 256
#include <math.h>

#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
    int x, n, m, up = 101, down = -1;
    cin >> x >> n;
    int check[101];
    for (int i = 0; i <= 100; i++) {
        check[i] = 0;
    }
    if (n == 0) {
        cout << x << endl;
        goto coco;
    } else {
        for (int i = 0; i < n; i++) {
            cin >> m;
            check[m] = 1;
        }
        for (int j = x; j >= 0; j--) {
            if (check[j] == 0) {
                down = j;
                break;
            }
        }
        for (int k = x + 1; k <= 100; k++) {
            if (check[k] == 0) {
                up = k;
                break;
            }
        }

        if ((abs(x - up) > abs(x - down)) || (abs(x - up) == abs(x - down))) {
            cout << down << endl;
            goto coco;
        } else {
            cout << up << endl;
            goto coco;
        }
    }
coco:
    return 0;
}


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

void solve(){

	string ans="" ;

	ll n ;
	cin>>n ;

	while(n>0){
		n-- ;
		ans+='a'+n%26 ;
		n/=26 ;
	}

	reverse(ans.begin(),ans.end()) ;
	
	cout<<ans ;


}


int main(){

		ll y ;

		y=1 ;
		//cin>>y ;

		while(y--){
 
			solve() ;

		}

}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define show(x) std::cerr << #x << " = " << x << std::endl
using ll = long long;
constexpr int N = 500;
constexpr int MAX = 16 * N;
constexpr int NUM = 2 * N - 1;
bool isprime[16 * N];
ll p1[N][N], p2[N][N], ans[N][N];
int main()
{
    std::fill(isprime, isprime + MAX, true);
    std::vector<ll> prime;
    for (int i = 2; i < MAX; i++) {
        if (not isprime[i]) { continue; }
        prime.push_back(i);
        if (prime.size() == NUM) { break; }
        for (int j = 2; i * j < MAX; j++) { isprime[i * j] = false; }
    }
    for (int i = 0; i < 2 * N; i += 2) {
        for (int y = 0; y < N; y++) {
            const int x = i - y;
            if (x < 0 or N <= x) { continue; }
            p1[y][x] = prime[i / 2];
        }
    }
    for (int i = N - 2; i >= -N + 2; i -= 2) {
        for (int y = 0; y < N; y++) {
            const int x = y + i;
            if (x < 0 or N <= x) { continue; }
            p2[y][x] = prime[(i + N - 2) / 2 + N];
        }
    }

    auto get = [&](const int y, const int x) { return y >= 0 and y < N and x >= 0 and x < N ? std::pair<ll, ll>{p1[y][x], p2[y][x]} : std::pair<ll, ll>{1LL, 1LL}; };
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (i % 2 == j % 2) {
                ans[i][j] = p1[i][j] * p2[i][j];
            } else {
                std::set<ll> p;
                p.insert({get(i - 1, j).first,
                          get(i - 1, j).second,
                          get(i + 1, j).first,
                          get(i + 1, j).second,
                          get(i, j - 1).first,
                          get(i, j - 1).second,
                          get(i, j + 1).first,
                          get(i, j + 1).second});
                ans[i][j] = 1;
                for (const ll P : p) { ans[i][j] *= P; }
                ans[i][j]++;
            }
        }
    }
    int N;
    std::cin >> N;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            std::cout << ans[i][j] << " ";
        }
        std::cout << std::endl;
    }
    return 0;
}


Measured memory_bytes: 8960
#include <iostream> 
#include <cstdio>

using namespace std;

#define For(i , a , b) for (int i = a , _b = b ; i <= _b ; ++i)
#define Ford(i , a  ,b) for (int i = a , _b = b : i >= _b ; --i)
#define Rep(i , n) for (int i = 0 , _n = n ; i < _n ; ++i)
#define sz(A) ((int)A.size())
#define LL(x) (x << 1)
#define RR(x) ((x << 1) | 1)

typedef pair<int , int> pt;

int a, b; 

void ReadData() {
	cin >> a >> b;
}

void doAsk(int a, int b) {
	cout << "? ";
	cout << a << " " << b << endl;
}
bool getAns(int a, int b) {
	doAsk(a,b);
	string t; cin >> t;
	if (t == "Y") return true;
	return false;
}

const int maxn = 5000;
int res[maxn];
void Process() {
	if (b >= a) {
		cout << "Impossible" << endl;
		return;
	}
	int c = 1, d = 0;
	for (int i = 1; i < a + b; i++) {
		if (getAns(i, d)) {
			++c;
		} else --c;
		if (c < 0) {
			d = i;
			c = 1;
		}
	}
	res[d] = 1;
	for (int i = 0; i < a + b; i++) if (i != d) {
		if (getAns(d, i)) res[i] = 1; else res[i] = 0;
	}

	cout << "! ";
	for (int i = 0; i < a + b; i++) cout << res[i] ;
}

int main() {

	ReadData();
	Process();
	return 0;

}			

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

using namespace std;

void solve()
{
	vector<int> fibo;
	fibo.push_back(1);
	fibo.push_back(1);
	for (int i = 2; i <= 44; ++i)
	{
		fibo.push_back(fibo[i - 1] + fibo[i - 2]);
	}
	int n;
	cin >> n;
	cout << fibo[n] << endl;
}

int main()
{
	solve();
	return(0);
}

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

typedef long long int ll;
void solved(){
	ll a,b,c,k;cin>>a>>b>>c>>k;
	if(a >= k){
		cout<<k<<endl;
	}else{
		int ans = a;
		k -= a;
		if(b >= k){
			cout<<ans<<endl;
		}else{
			k -= b;
			cout<<ans + -1 * k<<endl;
		}
	}
}
int main(){
	solved();
	return 0;
} 

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
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(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    int n,m;cin>>n>>m;
    if(abs(n-m)%2==1){
        cout << "IMPOSSIBLE" << endl;

    }else{
        cout << (int)((n+m)/2) << endl;
    }
    return 0;
}


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

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}

int main(){
  int i,j,n,r,a[64],p,c,mem[64];
  while(scanf("%d%d",&n,&r),n!=0){
    for(i=0;i<n;i++){a[i]=n-i;}
    for(i=0;i<r;i++){
      scanf("%d%d",&p,&c);
      p--;
      for(j=0;j<p;j++){mem[j]=a[j];}
      for(j=p;j<p+c;j++){
        a[j-p]=a[j];
      }
      for(j=c;j<p+c;j++){
        a[j]=mem[j-c];
      }
    }
    printf("%d\n",a[0]);
  }
  return 0;
}



Measured memory_bytes: 2020
N, T = gets.split.map(&:to_i)
ts = gets.split.map(&:to_i)

dp = []
ts.each do |t|
  if !dp.empty? && dp[-1][0] + T > t
    dp << [t, T - ((dp[-1][0] + T) - t)]
  else
    dp << [t, T]
  end
end

total = 0
dp.each do |_, diff|
  total += diff
end

puts(total)

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

// i枚目まで見て、j個選んだときの合計が、kになる組み合わせ
const static int MAX_N = 50;
int SUMMAX = MAX_N * MAX_N + 1;
long long dp[MAX_N + 1][MAX_N + 1][MAX_N * MAX_N + 1];

void solve(long long N, long long A, std::vector<long long> x) {
  dp[0][0][0] = 1;

  for (int i = 1; i <= N; i++) {
    long long xi = x[i - 1];

    for (int j = 0; j <= i; j++) {
      for (int k = 0; k < SUMMAX; k++) {
        // i番目のカードを選ばない
        dp[i][j][k] = dp[i - 1][j][k];

        // i番目のカードを選ぶ
        if (k - xi >= 0 && j > 0) {
          dp[i][j][k] += dp[i - 1][j - 1][k - xi];
        }
      }
    }
  }

  long long ans = 0;
  for (int j = 1; j <= N; j++) {
    if (j * A < SUMMAX) {
      ans += dp[N][j][j * A];
    }
  }

  printf("%lld\n", ans);
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  long long N;
  scanf("%lld", &N);
  long long A;
  scanf("%lld", &A);
  std::vector<long long> x(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &x[i]);
  }
  solve(N, A, std::move(x));
  return 0;
}


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

int main(void){
    int A, B;
    cin >> A >> B;
    int cnt = 0;
    for (int num = A; num <=B; num++)
    {
        string str = to_string(num);
        if (str[0] == str[4] && str[1] == str[3])  cnt++;
    }
    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 256
n=int(input())
yr_m=[]
sum_m=0
for i in range(n):
    yr_m.append(list(map(str,input().split())))

for k in range(n):
    yr_m[k][0]=float(yr_m[k][0])

for j in range(n):
    if yr_m[j][1]=="BTC":
        yr_m[j][0]=yr_m[j][0]*380000.0
    sum_m=sum_m+yr_m[j][0]

print(sum_m)

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

int main(){
    string s;
    cin >> s;
    cout << s.substr(0,3);
}

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

int main()
{
    int n, i;
    int a[100];
    cin >> n;
	for(i = 0; i < n; i++) cin >> a[i];
	for(i = 0; i < n - 1; i++) cout << a[n - 1 - i] << " ";
    cout << a[0] << endl;

    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <utility>
#include <numeric>
#include <map>
using namespace std;

const string i2c = "753";
map<char, int> c2i;

int main() {
    int N; cin >> N;
    int res = 0;
	c2i.insert(std::make_pair('7', 0));
	c2i.insert(std::make_pair('5', 1));
	c2i.insert(std::make_pair('3', 2));

    for (int d = 3; d < 10; d++) {
        for (int b = 0; b < pow(3, d); b++) {
            string S;
            int cb = b;
            for (int i = 0; i < d; ++i) {
                S.push_back(i2c[cb % 3]);
                cb /= 3;
            }
            bool count[3]; fill(count, count + 3, false);
            for (char c : S) count[c2i[c]] = true;
            bool judge = true;
            for (int i = 0; i < 3; ++i) if (!count[i]) judge = false;
            if (!judge) continue;
            if (stoi(S) <= N) res++;
        }
    }
    cout << res << endl;
    return 0;
}

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

def dfs(s):
    # 空文字の場合を特別扱い
    if s and int(s) > N:
        return 0
    ret = 1 if all(c in s for c in '753') else 0
    for c in '753':
        ret += dfs(s + c)
    return ret

print(dfs(''))


Measured memory_bytes: 3064
# AOJ 0085 Joseph's Potato
# Python3 2018.6.15 bal4u

while True:
	try:
		n, m = map(int, input().split())
		if n == 0:
			break
			
	except EOFError:
		break
		
	k = 1;
	for j in range(2, n+1):
		k = (k + m) % j
		if k == 0: k = j
	print(k)


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

int main(){
  string s, t;
  cin>>s>>t;
  int a=s.size();
  for(int i=0;i<a;i++){
    if(s.at(i)!=t.at(i)){
      cout<<"No"<<endl;
  return 0;}}
  if(t.size()-a==1)
    cout<<"Yes"<<endl;
}

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

int main() {

  long N, K;
  cin >> N >> K;
  
  vector<int> n(100100);

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

  int count = 0;

  for (int i = 1; i < 100100; i++) {
    if (n[i] != 0) {
      count = i;
    }
    if (n[i] < K) {
      K -= n[i];
    } else {
      break;
    }
  }

  cout << count << endl;

}

Measured memory_bytes: 640
from collections import Counter
def main():
  N=int(input())
  A=list(map(int,input().split()))
  d=Counter(A)
  for i in range(1,N+1):
    if i not in d:
      print(0)
    else:
      print(d[i])
if __name__=='__main__':
  main()


Measured memory_bytes: 34112