akhauriyash/Code-Regression huggingface dataset:
R, G, B, N = map(int, input().split())

ans = 0
X = N // R
Y = N // G
Z = N // B

for i in range(X + 1):
    for j in range(Y + 1):
        if (N - i * R - j * G) >= 0 and (N - i * R - j * G) % B == 0:
            ans += 1

print(ans)

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

int main()
{
  int n, m;
  cin >> n;
  vector <string> s(n + 1);
  for (int i = 0; i < n; i++){
    cin >> s.at(i);
  }
  s.at(n) = "{";
  sort(s.begin(), s.end());
  cin >> m;;
  vector <string> t(m);
  for (int i = 0; i < m; i++){
    cin >> t.at(i);
  }
  int ans = 0;
  int gain = 1;
  int i = 0;
  while (i < n){
    if (s.at(i) == s.at(i + 1)) gain++;
    else{
      for (int j = 0; j < m; j++){
        if (s.at(i) == t.at(j)) gain--;
      }
      if (gain > ans) ans = gain;
      gain = 1;
    }
    i++;
  }
  cout << ans << endl;
}

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

const int mx = 3005 ;
string s, t ;
int dp[mx][mx] ;

string LCS(){
	for(int i = 0 ; i <= s.size() ; i++){
		for(int j = 0 ; j <= t.size() ; j++){
			if(i == 0 || j == 0)
				dp[i][j] = 0 ;
			else if(s[i-1] == t[j-1])
				dp[i][j] = dp[i-1][j-1] + 1 ;
			else 
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]) ;
		}
	}

	string ret = "" ;
	int r = s.size() , c = t.size() ;
	while(r && c){
		if(s[r-1] == t[c-1]){
			ret += s[r-1] ;
			r-- ; c-- ;
		}
		else if(dp[r-1][c] > dp[r][c-1])
			r-- ;
		else 
			c-- ;
	}
	
	reverse(ret.begin(), ret.end()) ;
	return ret ;
}

int main(){

	cin >> s >> t ;
	cout << LCS() << endl ;

	return 0;
}

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

using namespace std;

int main(){
    int k, s;
    cin >> k >> s;
    int ans = 0;
    for (int x = 0; x <= k; x++){
        for (int y = 0; y <= k; y++){
            if (0 <= s - (x + y) and s - (x + y) <= k)
                ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
using namespace std;
string s[20];
int n;
double x[20],add;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x[i]>>s[i];
		if(s[i]!="JPY")
		{
			x[i]*=380000.0;
		}
		add+=x[i];
	}
	cout<<add;
	return 0;
}


Measured memory_bytes: 256
input_str =  input().split()
a = int(input_str[0])
b = int(input_str[1])

output_str = ""
if a < b:
  for s in range(0,b):
    output_str = output_str + str(a)
else:
  for s in range(0,a):
    output_str = output_str + str(b)

print(output_str)


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<cstdio>
#define p push_back
using namespace std;
vector<char> v[10];

void solve(char c){
  if(0<=c-'0' && c-'0'<=4){
    v[0].p('*');
    v[1].p(' ');
  }
  else{
    v[0].p(' ');
    v[1].p('*');
   }
  v[2].p('=');
  if(c-'0' == 0){
    v[3].p(' ');v[4].p('*');v[5].p('*');v[6].p('*');v[7].p('*');
  }
  else if(c-'0' == 1){
 
  v[3].p('*');v[4].p(' ');v[5].p('*');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 2){
 
  v[3].p('*');v[4].p('*');v[5].p(' ');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 3){
 
  v[3].p('*');v[4].p('*');v[5].p('*');v[6].p(' ');v[7].p('*');

  }
 else if(c-'0' == 4){
 
  v[3].p('*');v[4].p('*');v[5].p('*');v[6].p('*');v[7].p(' ');
  }
 else if(c-'0' == 5){
 
  v[3].p(' ');v[4].p('*');v[5].p('*');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 6){
  v[3].p('*');v[4].p(' ');v[5].p('*');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 7){
 
  v[3].p('*');v[4].p('*');v[5].p(' ');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 8){
 
  v[3].p('*');v[4].p('*');v[5].p('*');v[6].p(' ');v[7].p('*');
  }
 else if(c-'0' == 9){
   v[3].p('*');v[4].p('*');v[5].p('*');v[6].p('*');v[7].p(' ');
  }

} 


int main(){
  string s;
  bool air = false;
  while(cin >> s){
    if(air)cout << endl;  
    air = true;
    if(s.size() < 5){
      string p = string(5-s.size(),'0') + s;
      s = p;
    }

    for(int i=0;i<9;i++)v[i].clear();
    for(int i=0;i<s.length();i++){
      solve(s[i]);
    }
  
    for(int i=0;i<8;i++){
      for(int j=0;j<s.length();j++){
      	cout << v[i][j];
      }
      cout << endl;
    }
    
  }
  
  
  return 0;
}

Measured memory_bytes: 1212
import numpy as np

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
d = {}
for i in range(n):
    if a[i] in d:
        d[a[i]] += 1
    else:
        d[a[i]] = 1
d = sorted(d.items(), key=lambda x: x[1])
num = len(d) - k
d = np.array(d)
count = np.sum(d[:num, 1])
print (count)


Measured memory_bytes: 48240
import sys

def solve():
    input = sys.stdin.readline
    zero, one = 0, 0
    s = input().strip("\n")
    for i in range(len(s)):
        if s[i] == "0": zero += 1
        else: one += 1
    print(2 * min(zero, one))

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3188
<?php

fscanf(STDIN, "%d", $d);

switch ($d) {
case 22:
    echo 'Christmas Eve Eve Eve';
    break;
case 23:
    echo 'Christmas Eve Eve';
    break;
case 24:
    echo 'Christmas Eve';
    break;
case 25:
    echo 'Christmas';
    break;
}


Measured memory_bytes: 4604
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	int k, x;
	cin >> k >> x;

	for (int i = x - k + 1; i < x + k; ++i) {
		cout << i << (i < x + k - 1 ? " " : "\n");
	}
	return 0;
}


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

int dp[1001][1001] = {{0}};

int LCS(const string & X, const string & Y){
    auto len_x = X.length();
    auto len_y = Y.length();
    for (int i = 0; i != len_x; ++i){
        for (int j = 0; j != len_y; ++j){
            if (X[i] == Y[j]){
                dp[i + 1][j + 1] = dp[i][j] + 1;
            }else{
                dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
            }
        }
    }
    return dp[len_x][len_y];
}

int main()
{
    ios::sync_with_stdio(false);
    
    int q = 0;
    cin >> q;
    
    string X;
    string Y;
    while (q--){
        cin >> X >> Y;
        cout << LCS(X, Y) << endl;
    }
    return 0;
}

Measured memory_bytes: 7160
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<functional>
#include<map>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
using namespace std;
class shop{
    public:
        string name;
        int price;
        int num;
};

bool operator<(const shop&a, const shop&b){
    return a.name < b.name || (a.name == b.name && a.price > b.price);
}
int main(){
    int N;
    cin >> N;
    vector<shop> line(N);
    REP(i, N){
        cin >> line[i].name >> line[i].price;
        line[i].num = i+1;
    }
    sort(ALL(line));
    REP(i, N){
        cout << line[i].num << endl;
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    public static void Main()
    {
        string[] input = Console.ReadLine().Split();
        int a = int.Parse(input[0]);
        int b = int.Parse(input[1]);
        Console.WriteLine(a*b);
    }
}

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

value_dict = {}

for x in range(N):
    value = input()
    if value not in value_dict.keys():
        value_dict[value] = 1
        continue
    value_dict[value] += 1

max_count = max(value_dict.values())
max_values = [k for k, v in value_dict.items() if v == max_count]
max_values.sort()


print("\n".join(max_values))


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<int> Es(N, N + 1);
    while (M--){
        int a, b;
        cin >> a >> b;
        Es[a - 1] = min(Es[a - 1], b - 1);
    }
    int right = N + 1;
    int count = 0;
    for (int i = 0; i < N; ++i){
        if (right == i){
            ++count;
            right = N + 1;
        }
        right = min(right, Es[i]);
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int val[105];
int main(){
  int a,b;
  scanf("%d %d", &a, &b);
  long long int res = b;
  
  for (int i = 1; i < a; i++){
    res *= b - 1;
  }
  printf("%d\n", res);
  return 0;
}


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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> mii;
typedef map<ll,int> mli;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;  ///1e9+7

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///



void _case()
{
    string a;
    cin>>a;
    for(int i=0;i<sz(a);i++) cout<<'x';
    
}

main()
{
//    fastio();
//    test _case();
//    while(1) _case();
        _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 3592
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt();
		int result;
		if(x == 2) {
			result = x;
		}
		else {
			int count = x;
			while(true) {
				if(isPrime(count)) {
					result = count;
					break;
				}
				count++;
			}
		}
		System.out.println(result);
	}
	public static boolean isPrime(int x) {
		if(x%2==0) {
			return false;
		}
		for(int i = 2; i*i <= x; i++) {
			if((x % i) == 0) {
				return false;
			}
		}
		return true;
	}
	
}

Measured memory_bytes: 35692
#include<iostream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include <algorithm>
#include <set>
#include<math.h>
#include<vector>
#include<map>
#include<vector>
#include<cstring>

using namespace std;

int main(){
    string s;
    cin >> s;
    int count = 0;
    for(int i = 1;i < s.length();i++){
        
        if(s[i]==s[i-1]){
            if(s[i]=='1'){s[i] = '0';}
                       else{s[i] = '1';}
                       count++;
        }

    }
    cout << count << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    string number;
    cin >> number;
    if (number.at(0) == number.at(1) && number.at(1) == number.at(2) ||
        number.at(1) == number.at(2) && number.at(2) == number.at(3)) {
            cout << "Yes" << endl;
            return 0;
        } else {
            cout << "No" << endl;
            return 0;
        }
}

Measured memory_bytes: 256
# C - Divide the Problems
import math
def main():
	N = int(input())
	d = list(map(int,input().split()))
	d.sort()
	K = list(range(d[math.floor(N/2) - 1] + 1, d[math.floor(N/2)] + 1))
	print(len(K))

main()

Measured memory_bytes: 14428
N = int(input())
al = "abcdefghijklmnopqrstuvwxyz"
atoi = {s:i for i, s in enumerate(al)}
itoa = {i:s for i, s in enumerate(al)}

l = []
def func(s, i):
    if i == N:
        print(s)
        l.append(s)
        return
    # if al[:i] == s:
    #     for c in al[:i+1]:
    #         func(s + c, i+1)
    # else:
    #     for c in al:
    #         func(s + c, i+1 )

    # if i == N - 1:
    maxi = max([atoi[c] for c in s])
    for c in al[:maxi+2]:
        func(s+c, i+1)
    # else:
    #     for c in al[:i+1]:
    #         func(s+c, i+1) 

func("a", 1)



Measured memory_bytes: 12772
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
   int n,m,ans=0;
  cin>>n>>m;
 
  for(int i=1;i*i<=m;i++)
  {
      if(m%i==0)
      {
         int fact1=i,fact2=m/i;
         if(fact1*n<=m)
           ans=max(fact1,ans);
         if(fact2*n<=m)
          ans=max(fact2,ans);
      }
  }
cout<<ans;

return 0;
}

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

int main(){


    long long int x;
    cin >> x;
    //bool flag = true;
    long long int i = 1;
    long long int ans = 0;
    while(1){
        long long int tmp = 1+(i-1)*(i+2)/2;
        if(tmp >= x){
            //flag = false;
            ans = i;
            break;
        }
        i++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;

typedef long long LL;
const int N = 305;
const LL MOD = 998244353;
LL dp[N][N * N], f[N][N * N];

int a[N];
int main() {
	int n;
	cin >> n;
	int sum = 0;
	for(int i = 1; i <= n; i ++) {
		scanf("%d", &a[i]);
		sum += a[i];
	}
	LL ans = 1;
	int m = sum;
	dp[0][0] = 1;
	f[0][0] = 1;
	for(int i = 1; i <= n; i ++) {
		ans = ans * 3 % MOD;
		for(int j = 0; j <= m; j ++) {
			if(j >= a[i]) {
				dp[i][j] = (dp[i - 1][j - a[i]] + dp[i - 1][j] * 2) % MOD;
				f[i][j] = (f[i - 1][j] + f[i - 1][j - a[i]]) % MOD;
			}
			else dp[i][j] = dp[i - 1][j] * 2 % MOD, f[i][j] = f[i-1][j];
		}	
	}
	
	for(int j = 1; j <= m; j ++) 
		if(j * 2 >= m) ans = (ans - (3 * dp[n][j] % MOD) + MOD) % MOD;
	if(m % 2 == 0) {
		ans = (ans + 3 * f[n][m / 2] + MOD) % MOD;
	}
	cout << ans  << endl;
	
}


Measured memory_bytes: 439808
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int a,b,k;
    cin>>a>>b>>k;
    std::deque<int> deq;
    for (int i=0;i<k;i++) {
        if (find(deq.begin(),deq.end(),a)==deq.end()) {
            deq.emplace_back(a);
        }
        if (a+1<=b) {
            a++;
        }
    }
    for (int j=0;j<k;j++) {
        if (find(deq.begin(),deq.end(),b)==deq.end()) {
            deq.emplace_back(b);
        }
        if (b-1>=a) {
            b--;
        }
    }
    sort(deq.begin(),deq.end());
    for (int l=0;l<deq.size();l++) {
        cout<<deq[l]<<endl;
    }
}


Measured memory_bytes: 256
#include <cstdio>

int n, a[200005], nw, l, r;
long long ans;

int main(){
  scanf("%d", &n);
  while(r < n){
    scanf("%d", a+r);
    while(nw & a[r]) nw ^= a[l++];
    nw |= a[r++];
    ans += r - l;
  }
  printf("%lld\n", ans);
}

Measured memory_bytes: 896
#include<math.h>
#include<time.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
int main()
{
	int a,b,l,m,n,i,j,k,h[10][10][20];//h[房][层][间]=人
	scanf("%d",&n);
	for(i=1;i<=4;i++)
		for(j=1;j<=3;j++)
			for(k=1;k<=10;k++)
				h[i][j][k]=0;
	for(i=1;i<=n;i++)
	{
		scanf("%d %d %d %d",&l,&a,&b,&m);
		h[l][a][b]+=m;
	}
	for(i=1;i<=4;i++)
	{
		for(j=1;j<=3;j++)
		{
			for(k=1;k<=10;k++)
				printf(" %d",h[i][j][k]);
			printf("\n");
		}
		if(i!=4)
			printf("####################\n");
	}
	return 0;
}


Measured memory_bytes: 2116
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

def f(a):
    ans = 1
    if 0 in a:
        return 0
    for i in a:
        ans *= i
        if ans > 1e+18:
            return -1
    return ans

print(f(a))

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

struct Point
{
  int i;
  int j;
};

static Point minus_point = { -1, -1 };

class Map
{
  public:
    Map(int height, int width);
    ~Map();

  public:
    int Can_go_num(Point p = minus_point);

  private:
    bool CheckIndex(const Point& p);
    bool isBlack(const Point& p);
    bool CanMove(const Point& p);

  private:
    char** m_map;   //  '.' = black, '#' = red, '@' = start, 'x' = already
    int m_height;
    int m_width;
    Point m_start;
};

Map::Map(int height, int width)
{
  m_height = height;
  m_width = width;

  m_map = new char*[m_height];
  for (int i = 0; i < m_height; ++i)
  {
    m_map[i] = new char[m_width];
  }

  for (int i = 0; i < m_height; ++i)
  {
    for (int j = 0; j < m_width; ++j)
    {
      cin >> m_map[i][j];
      if (m_map[i][j] == '@')
      {
        m_start.i = i;
        m_start.j = j;
      }
    }
  }
}

Map::~Map()
{
  for (int i = 0; i < m_height; ++i)
  {
    delete[] m_map[i];
  }
  delete[] m_map;
}

int Map::Can_go_num(Point p)
{
  int result = 1;
  if (p.i == -1)
  {
    p = m_start;
  }
  m_map[p.i][p.j] = 'x';
  Point buf_ps[4] = {
    { p.i, p.j-1 },
    { p.i, p.j+1 },
    { p.i-1, p.j },
    { p.i+1, p.j },
  };
  for (Point buf_p : buf_ps)
  {
    if (CanMove(buf_p) )
    {
      result += Can_go_num(buf_p);
    }
  }

  return result;
}

inline bool Map::CheckIndex(const Point& p)
{
  return (0 <= p.i and p.i < m_height) and (0 <= p.j and p.j < m_width);
}

inline bool Map::isBlack(const Point& p)
{
  return m_map[p.i][p.j] == '.';
}

inline bool Map::CanMove(const Point& p)
{
  return CheckIndex(p) && isBlack(p);
}

int main(void)
{
  int height, width;
  while (true)
  {
    cin >> width >> height;
    if (height == 0 && width == 0) break;
    Map map(height, width);
    cout << map.Can_go_num() << endl;
  }
  return 0;
}

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

//#define int long long
typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string Sd, T;
    cin >> Sd >> T;
    int s = Sd.size();
    int t = T.size();
    if (s < t) {
        cout << "UNRESTORABLE" << "\n";
        return 0;
    }
    bool res = false;
    for (int i=s-t;i>=0;i--){
        bool ok = true;
        for (int x=0;x<t;x++){
            if (Sd[i+x] == '?') continue;
            if (Sd[i+x] != T[x]) {
                ok = false;
                break;
            }
        }
        if (ok) {
            for (int x=0;x<t;x++){
                if (Sd[i+x] == '?') {
                    Sd[i+x] = T[x];
                }
            }
            res = true;
            break;
        }
    }
    if (res) {
        for (int i=0;i<s;i++){
            if (Sd[i]=='?') Sd[i] = 'a';
        }
        cout << Sd << "\n";
    } else {
        cout << "UNRESTORABLE" << "\n";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& base) {
    for (T const& i : base) {
        out << i << ' ';
    }
    return out;
}
int main() {
    int H, W;
    cin >> H >> W;
    string grid[H];
    for(int i = 0; i < H; ++i){
    	cin >> grid[i];
    }
    int64_t DP[H][W];
    DP[H-1][W-1] = 1;
    const int64_t MOD = 1e9 + 7;
    for(int i = H-1; i >= 0; --i){
    	for(int j = W-1; j >= 0; --j){
    		if(grid[i][j] == '#') DP[i][j] = 0;
    		else if(i == H-1 && j == W-1) DP[i][j] = 1;
    		else if(i == H-1) DP[i][j] = DP[i][j+1];
    		else if(j == W-1) DP[i][j] = DP[i+1][j];
    		else DP[i][j] = (DP[i][j+1] + DP[i+1][j]) % MOD;
    	}
    }
    cout << DP[0][0] << endl;
}

Measured memory_bytes: 13312
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

//　全探索ver
int main(void)
{
    const int col = 3;
    const int row = 3;
    vector<vector<int>> box(col, vector<int>(row));
    for (int i = 0; i < col; i++)
    {
        for (int j = 0; j < row; j++)
        {
            cin >> box[i][j];
        }
    }

    int b1, b2, b3;
    string ans = "No";
    for (int a1 = 0; a1 <= 100; a1++)
    {
        for (int a2 = 0; a2 <= 100; a2++)
        {
            for (int a3 = 0; a3 <= 100; a3++)
            {
                b1 = box[0][0] - a1;
                b2 = box[0][1] - a1;
                b3 = box[0][2] - a1;

                if ((box[0][0] - b1 == box[0][1] - b2 && box[0][1] - b2 == box[0][2] - b3) &&
                    (box[1][0] - b1 == box[1][1] - b2 && box[1][1] - b2 == box[1][2] - b3) &&
                    (box[2][0] - b1 == box[2][1] - b2 && box[2][1] - b2 == box[2][2] - b3))
                {
                    ans = "Yes";
                    cout << ans << endl;
                    return (0);
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {

	FastScanner in;
	PrintWriter out;

	void solve() {
		int n = in.nextInt();
		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();

		for (int i = 1; i <= n; i++) {
			map.put(in.nextInt(), i);
		}

		for (int i = 1; i <= n; i++) {
			out.print(map.get(i) + " ");
		}
	}

	void run() {
		try {
			in = new FastScanner(new File("Main.in"));
			out = new PrintWriter(new File("Main.out"));

			solve();

			out.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	void runIO() {

		in = new FastScanner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return null;
				st = new StringTokenizer(s);
			}
			return st.nextToken();
		}

		boolean hasMoreTokens() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return false;
				st = new StringTokenizer(s);
			}
			return true;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

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


Measured memory_bytes: 51592
package main

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

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

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

var s []byte
var pos int
var a int
var ans int

type state func() state

func start() state {
	p := pos
	pos++
	switch s[p] {
	case 'A':
		a++
		return readA
	default:
		return start
	}
}

func readA() state {
	p := pos
	pos++
	switch s[p] {
	case 'A':
		a++
		return readA
	case 'B':
		return readAB
	case 'C':
		a = 0
		return start
	}
	return nil
}

func readAB() state {
	p := pos
	pos++
	switch s[p] {
	case 'A':
		a = 1
		return readA
	case 'B':
		a = 0
		return start
	case 'C':
		ans += a
		return readA
	}
	return nil
}

func main() {
	defer stdout.Flush()
	s = readBytes()

	for state := start; pos < len(s) && state != nil; state = state() {
	}
	println(ans)
}

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


Measured memory_bytes: 1024
package main

import (
	"fmt"
	"strings"
)

func main() {
	var S string
	fmt.Scan(&S)
	for _, v := range []string{"a", "b", "c"} {
		if !strings.Contains(S, v) {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


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

// 長方形の中の円
int main() {
  int W, H, x, y, r, up, down, left, right;

  cin >> W >> H >> x >> y >> r;

  if (x - r < 0 || x + r > W || y - r < 0 || y + r > H)
    cout << "No" << endl;
  if (x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H)
    cout << "Yes" << endl;
}


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

int main() {

    int h, m, s;

    std::cin >> s;

    m = s / 60, s %= 60;
    h = m / 60, m %= 60;

    std::cout << h << ":" << m << ":" << s << std::endl;

    return 0;
}



Measured memory_bytes: 3084
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
s = A1[0] + sum(A2)
ans = s
for i in range(1,N):
    s+=A1[i]-A2[i-1]
    ans = max(ans, s)
print(ans)

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

long gcd(long a, long b){
	return a%b == 0 ? b : gcd(b, a%b);
}

int main(){
	
	int N; cin >> N;
	
	int p[N]; for(int i=0;i<N;++i) cin>>p[i];
	
	int cnt = 0;
	for(int b=1; b<(1<<N); ++b){
		long x=1;
		for(int i=0; i<N; ++i){
			if( ((b>>i)&1) != 0){
				const long g = gcd(x, p[i]);
				
				//cout << x <<" "<< p[i]<<" "<<g<<endl;;
				
				x *= p[i];
				x /= g;
			}
		}
		
		//for(int i=0; i<N; ++i){cout<<((b>>i)&1);}cout<<":" << x << endl;
		
		bool yes = true;
		for(int i=0; i<N; ++i){
			if( ((b>>i)&1) == 0 && x%p[i] == 0){
				
				//cout<<"NO!\n";
				
				yes = false;
				break;
			}
		}
		
		if(yes){
			cnt++;
		}
	}
	
	cout << cnt << endl;
	
}


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

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    if (s.substr(0, (n - 1) / 2) == s.substr((n + 3) / 2 - 1))
        cout
            << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

typedef bitset<10001>bs;

int N,K;
string S[2222];

bs able[2222];

vint zalgorithm(string s){
    vint a(s.size());
    a[0]=s.size();
    int i=1,j=0;
    while(i<s.size()){
        while(i+j<s.size()&&s[j]==s[i+j])j++;
        a[i]=j;
        if(j==0){i++;continue;}
        int k=1;
        while(i+k<s.size()&&k+a[k]<j)a[i+k]=a[k],k++;
        i+=k;j-=k;
    }
    return a;
}

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

    cin>>N>>K;
    rep(i,N)cin>>S[i];

    able[N][0]=1;
    for(int i=N-1;i>=0;i--)able[i]=able[i+1]|(able[i+1]<<S[i].size());

    string s;
    bs ok;
    ok[0]=1;

    for(int i=0;i<N;i++){
        string ss=S[i]+s;
        vint a=zalgorithm(ss);
        bs okok=ok;

        vint latte;

        for(int j=0;j<=s.size();j++){
            if(j+S[i].size()>K)continue;
            if(!ok[j])continue;
            if(!able[i+1][K-j-(int)S[i].size()])continue;

            int lcp;
            if(j==s.size())lcp=0;
            else lcp=a[S[i].size()+j];
            chmin(lcp,S[i].size());
            if(lcp==s.size()-j){
                s+=S[i].substr(lcp,S[i].size()-lcp);
                okok[s.size()]=1;
            }
            else if(lcp==S[i].size()){
                okok[j+S[i].size()]=1;
            }
            else if(s[j+lcp]>S[i][lcp]){
                bool f=true;
                while(latte.size()){
                    int k=latte.back();
                    int tmp=a[S[i].size()+k];
                    if(tmp<j-k){
                        f=false;
                        break;
                    }
                    tmp=a[j-k];
                    if(tmp<S[i].size()-(j-k))latte.pop_back();
                    else break;
                }
                if(f)latte.pb(j);
            }
        }

        if(latte.size()){
            int k=latte.back();
            s=s.substr(0,k)+S[i];
            int tmp=a[S[i].size()+k];
            for(int j=k+tmp+1;j<=K;j++)okok[j]=0;
            for(auto w:latte)okok[w+S[i].size()]=1;
        }

        ok=okok;
    }

    cout<<s<<endl;
    return 0;
}


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

int isprime(int x)
{
    if(x==2)
      return 1;
    else if(x%2==0)
      return 2;
    for(long long int i =3 ; i <= sqrt(x) ; i+=2)
    {
        if(x%i==0)
            return 2;
    }
    return 1;
}
int main()
{
    long long int  x;
    int n,cnt = 0;
    scanf("%d",&n);
    while(n--)
    {
      scanf("%lld",&x);
      if(isprime(x)==1)
          cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}



Measured memory_bytes: 3236
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ユニークなvectorにする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
   char c;
   cin >> c;

   if (
       c == 'a' ||
       c == 'e' ||
       c == 'i' ||
       c == 'o' ||
       c == 'u'
      ) {
       cout << "vowel" << endl;
   } else {
       cout << "consonant" << endl;
   }
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

D = int(input())

memo_F = [0] * 30
memo_T = [0] * 30

for x in range(10):
    for y in range(10):
        memo_T[y-x] += 1
        if x != 0:
            memo_F[y-x] += 1

def F(K,D,allow_leading_zero):
    if K == 0:
        return 1 if D == 0 else 0
    if K == 1:
        if D != 0:
            return 0
        if allow_leading_zero:
            return 10
        else:
            return 9
    x = 10**(K-1)-1
    d = (-D)%10
    # xをd個またはd-10個
    ret = 0
    for use_x in [d,d-10]:
        if allow_leading_zero:
            coef = memo_T[use_x]
        else:
            coef = memo_F[use_x]
        if coef == 0:
            continue
        ret += coef * F(K-2,(D-x*use_x)//10,True)
    return ret

answer = sum(F(K,D,False) for K in range(1,20))
print(answer)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using lint = long long;//
template <typename T>
T sq (T x) {
  return x * x;
}

signed main () {
  lint X;
  cin >> X;
// cout << X << endl;
  lint A = 100;
  lint year = 0;
  while(A < X ) {
    A *= 1.01;
    // cout << A <<endl;
      year++;
  }
  cout << year << endl; 
  return 0;
}



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

int main(){
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    bool flag = true;

    if((x - r) < 0){flag = false;}  
    if((x + r) > W){flag = false;}  
    if((y - r) < 0){flag = false;}  
    if((y + r) > H){flag = false;} 

    cout << (flag == true ? "Yes" : "No") << endl;
}



Measured memory_bytes: 3096
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#define ll long long 
using namespace std;
int main()
{
	int a, b, ans;
	cin >> a >> b;
	ans = a + b / 2;
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{

	static int H;
	static int W;
	static char[][] map;
	static int ans;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		H = sc.nextInt();
		W = sc.nextInt();
		map = new char[H][W];
		for(int i = 0;i < H;i++){
			String xx = sc.next();
			for(int j = 0;j < W;j++){
				map[i][j] = xx.charAt(j);
			}
		}	
		ans = 0;
		for(int i = 0;i < H;i++){
			for(int j = 0;j < W;j++){
				if(map[i][j] == '#'){
					dfs(i,j,0);
				}
			}
		}	

		if(ans == -1){
			System.out.println("No");
		}else{
			System.out.println("Yes");

		}
	}


	static void dfs(int y,int x,int count){

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

		for(int i = 0;i < 4;i++){
			int nx = x + dx[i];
			int ny = y + dy[i];
			if(nx >= 0 && nx < W && ny >= 0 && ny < H){
				if(map[ny][nx] == '#'){
					map[ny][nx] = '.';
					count++;
					dfs(ny, nx, count);
				}
			}
		}

		if(count == 0){
			ans = -1;
		}



	}
}

class UnionFind{
	int[] parent;
	public UnionFind(int N){
		this.parent = new int[N];
		for(int i = 0; i < N;i++){
			parent[i] = i;
		}
	}
	public int root(int x){			//根要素を取得
		if(parent[x] == x){			//初期状態
			return x;
		}else{
			return parent[x] = root(parent[x]);    	//再帰によって根を取得
		}
	}
	public void unite(int x,int y){ 	//統合メソッド
		if(same(x,y)){					//同じ根なら終了
			return;
		}
		int xroot = root(x);
		int yroot = root(y);
		parent[xroot] = yroot;			//統合
		return;

	}

	public boolean same(int x,int y){			//根が同じか（同じグループに属しているか）を判定
		return(root(x) == root(y));
	}
}



class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}



Measured memory_bytes: 22612
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    r = readInts()
    cnt = 0
    for i in range(n):
        while r[i] % 2 == 0:
            cnt += 1
            r[i] //= 2
    print(cnt)



if __name__ == '__main__':
  main()


Measured memory_bytes: 4148
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Equeue | diff Equeue.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Equeue.cpp && ./a.out

/*
 
 5/26/2019
 
 5:14-5:25 WA
 5:51 WA
 6:01 WA
 7:00-
 
 */

const int MAX_N=1e2+1;
LL V[MAX_N];
int N,K;

void solve() {
  LL res=0;
  REPE(l,K)REPE(r,K) if(l+r<=N&&l+r<=K) {
    vector<LL> X;
    REP(i,l) X.push_back(V[i]);
    REP(i,r) X.push_back(V[N-1-i]);
    sort(ALL(X)),reverse(ALL(X));
    int M=K-l-r;
    int L=SZ(X);

    /*
    LL sum=0;
    REP(i,L) {
      sum+=X[i];
      int rem=L-i-1;
      if(rem>M) continue;
      if((M-rem)%2==0) SMAX(res,sum);
    }*/
    LL ans=0;
    int i=L-1;
    while(i>=0&&X[i]<0&&M--) --i;
    /*
    if(M%2==1) {
      if(i+1<L&&i>=0&&-X[i]>X[i+1]) ++i;
      else --i;
      i=max(i,-1);
    }*/
    ans=accumulate(X.begin(),X.begin()+i+1,0LL);
    SMAX(res,ans);
  }
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N>>K;
  REP(i,N) cin>>V[i];
  solve();
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
	std::string n;
  	std::cin >> n;
  	for(int i = 0; i < 3; i++){
      if(n.at(i) == '1'){
        n.at(i) = '9';
      }else{
        n.at(i) = '1';
      }
    }
  	std::cout << n;
  	return 0;
}

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

int main(void) {
  int H,W,h,w;
  cin >> H >> W >> h >> w;
  
  int a=0;
  if (H==h || W==w) {
    cout << 0 << endl;
  } else {
  	a = H*W-(h*W + w*H) + h*w;
	cout << a << endl;
  }
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a;    
    for(int i = 0; i < n; i++){
        int p = 0;
        cin >> p;
        a.push_back(p);
    }
    sort(a.begin(), a.end());
    int alice = 0;
    int bob = 0;
    bool isAlice = true;
    for(int i = n-1; i >= 0; i--){
        if(isAlice){
            alice += a[i];
            isAlice = false;
        } else {
            bob += a[i];
            isAlice = true;
        }
    }
    cout << abs(alice - bob) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <string.h>
#include <stdio.h>

const char main_[] = {
	0x49, 0x89, 0xd2, 
	0x48, 0x31, 0xd2, 
	0x48, 0x89, 0xc8, 
	0x49, 0xc7, 0xc3, 0xf4, 0x01, 0x00, 0x00, 
	0x49, 0xf7, 0xf3, 
	0x48, 0x39, 0xf8, 
	0x73, 0x03, 
	0x48, 0x89, 0xc7, 
	0x4d, 0x31, 0xc0, 
	0x49, 0xc7, 0xc3, 0x32, 0x00, 0x00, 0x00, 
	0x48, 0x31, 0xd2, 
	0x48, 0x89, 0xc8, 
	0x49, 0xf7, 0xf3, 
	0x4c, 0x39, 0xd0, 
	0x76, 0x0c, 
	0x48, 0x89, 0xc2, 
	0x4c, 0x29, 0xd2, 
	0x48, 0xff, 0xc2, 
	0x48, 0xd1, 0xfa, 
	0x48, 0xd1, 0xf8, 
	0x48, 0x39, 0xf0, 
	0x76, 0x03, 
	0x48, 0x89, 0xf0, 
	0x48, 0xff, 0xc0, 
	0x48, 0x29, 0xd0, 
	0x48, 0x83, 0xf8, 0x00, 
	0x7e, 0x03, 
	0x49, 0x01, 0xc0, 
	0x48, 0x81, 0xe9, 0xf4, 0x01, 0x00, 0x00, 
	0x48, 0xff, 0xcf, 
	0x48, 0x83, 0xff, 0x00, 
	0x7d, 0xbc, 
	0x4c, 0x89, 0xc0, 
	0xc3
};

int main(void){
	int fd = open("/dev/zero", O_RDONLY);
	int (*solve)(int, int, int, int) = mmap(NULL, sizeof main_, PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
	memcpy(solve, main_, sizeof main_);

	int a, b, c, x;
	scanf("%d%d%d%d", &a, &b, &c, &x);
	printf("%d\n", solve(a, b, c, x));

	close(fd);
	munmap(solve, sizeof main_);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a==1) a+=13;
  if(b==1) b+=13;
  
  
    if(a>b) cout<<"Alice";
    else if(a==b) cout<<"Draw";
    else cout<<"Bob";
  
  return 0;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
typedef long long int lld;
typedef unsigned long long int llu;
#define INF (long long int)(9223372036854775807)
#define IINF (int)(2147483647)

using namespace std;
int main(void) {
  char a, b, c;
  cin >> a >> b >> c;
  cout << (a == b && b == c ? "No" : "Yes") << "\n";
}

Measured memory_bytes: 256
"use strict";
const Main = (input) =>{
   let xs = input.trim().split('\n');
   let N = Number(xs[0]);
   let A = Number(xs[1].split(" ")[0]);
   let B = Number(xs[1].split(" ")[1]);
   let P1 = [];
   let P2 = [];
   let P3 = [];
   let P = xs[2].split(' ').map(v=>parseInt(v,10));
   
   for(let i=0; i<N; i++){
     if(P[i]<=A){
       P1.push(P[i]);
     }else if(P[i]<=B){
       P2.push(P[i]);
     }else{
       P3.push(P[i])
     }
   }
   let ans =Math.min(P1.length,P2.length,P3.length);
   console.log(ans)
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
while 1 > 0:
    formula = raw_input()
    a, op, b = formula.split()
    if op == "?":
        break
    a = int(a)
    b = int(b)
    if op == "+":
        print a + b
    elif op == "-":
        print a - b
    elif op == "*":
        print a * b
    elif op == "/":
        print a / b

Measured memory_bytes: 6428
import bisect

N = int(input())
alist = list(map(int, input().split()))
alist = [0] + alist
# print(alist)

sumlist = []
# (j, wj)のリストを作る
for i in range(1,N+1):
    # sumlist.append((i, i+alist[i]))
    sumlist.append(i+alist[i])

# 並び替え
sumlist.sort()
# print(sumlist)
# num = 4
# i = bisect.bisect_left(sumlist, num)
# j = bisect.bisect_right(sumlist, num)
# print(i,j)
ans = 0
# 差と一致するものを探す
for i in range(1, N+1):
    diff = i - alist[i]
    if diff <= 0:
        continue
    i = bisect.bisect_left(sumlist, diff)
    j = bisect.bisect_right(sumlist, diff)
    ans += j - i
print(ans)



Measured memory_bytes: 32240
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

bool K=false;
vector<bool> used;
vector<vector<ll>> edge;
vector<ll> high;

ll dfs(ll w,ll p,ll depth){
    used[w]=true;
    high[w]=depth;
    ll ans=depth;
    ll cnt=0;
    for(auto &I:edge[w]){
        if(used[I]){
            ans=min(ans,high[I]);
            continue;
        }
        cnt++;
        ll ret=dfs(I,w,depth+1);
        if(ret>=high[w] && p!=-1){K=true;}
        ans=min(ans,ret);
    }
    if(p==-1 && cnt>=2){K=true;}
    return ans;
}


int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> cnt(n,0);
    edge.resize(n);
    used.resize(n,false);
    high.resize(n);
    for(int i=0;i<m;i++){
        ll a,b;
        cin>>a>>b;
        a--; b--;
        cnt[a]++;
        cnt[b]++;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    dfs(0,-1,0);
    ll cnt4=0;
    ll cnt6=0;
    for(auto &I:cnt){
        if(I&1){cout<<"No"<<endl; exit(0);}
        if(I>=6){cnt6++;}
        if(I==4){cnt4++;}
    }
    if(cnt6){cout<<"Yes"<<endl;}
    else if(cnt4>=3){cout<<"Yes"<<endl;}
    else if(cnt4==2 && K){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
    
    
    
    return 0;
}


Measured memory_bytes: 13696
#include <stdio.h>

int main ()
{
  int i,j,num,tmp,count=0,A[100];

  scanf("%d",&num);

  for(i=0;i<num;i++)
    {
      scanf("%d",&A[i]);
    }
  for(i=0;i<num;i++)
    {
      for(j=num-1;j>=i+1;j--)
	{
	  if(A[j]<A[j-1])
	    {
	      tmp=A[j];
	      A[j]=A[j-1];
	      A[j-1]=tmp;
	      count++;
	    }
	}
    }

  for(i=0;i<num-1;i++)
    {
      printf("%d ",A[i]);
    }
  printf("%d",A[num-1]);
  printf("\n");
  printf("%d\n",count);
  return 0;
}    

Measured memory_bytes: 604
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



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

using namespace std;
string s;

int main(){
  cin >> s;
  int ans = 0;
  
  REP(i,4){
    if(s[i]=='+') ans ++;
    else ans --;
  }
  cout << ans << endl;
  
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
//#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

signed main() {
	int n;
	while (cin >> n, n) {
		set<int> st;
		rep(i, 1, n) {
			int tmp = i * i % n;
			if (!st.count(tmp)) {
				st.insert(tmp);
			}
		}
		vi d(n / 2 + 1, 0);
		for (auto i = st.begin(); i != st.end(); i++) {
			for (auto j = st.begin(); j != st.end(); j++) {
				int tmp = abs(*i - *j);
				if (tmp > n / 2) {
					tmp = n - tmp;
				}
				d[tmp]++;
			}
		}
		rep(i, 1, n / 2 + 1) {
			cout << d[i] << endl;
		}
	}
}

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

int main()
{
  int l, r;
  cin >> l >> r;

  if (r - l + 1 >= 2019) {
    cout << 0 << endl;
    return 0;
  }

  int64_t ans = 2019;
  for (int j = l + 1; j <= r; j++) {
    for (int i = l; i < j; i++) {
      ans = min(ans, int64_t(i) * j % 2019);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256