akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<cassert>

using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds; 

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
*/
#define pfi(a) printf("%d",a);
#define pfl(a) printf("%lld",a);
#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pb push_back
#define f(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define inf INT_MAX
#define llinf LONG_LONG_MAX

const int N=50+3;
const int M=998244353;


int main(){

	ll prod=1;

	int n;
	sfi(n)

	ll maxim=1e18;

	int f=0;

	f(i,0,n){
		ll temp;
		sfl(temp)

		if(temp==0)
			prod=0;

		else{
			if(prod>(maxim/temp)){
				f=1;
			}
			else if(f==0)
				prod*=temp;
		}
	}

	if(f==1 && prod!=0){
		prod=-1;
	}

	cout<<prod;

	return 0;
}

Measured memory_bytes: 3760
#include<stdio.h>
int main(){
	int n,k,x,y,r;
	scanf("%d%d%d%d%d",&n,&k,&x,&y,&r);
	if(x+r>n||y+r>k||x-r<0||y-r<0)puts("No");
	else puts("Yes");
	return 0;
}


Measured memory_bytes: 2052
a, b, c = gets.split.map(&:to_i)
k = gets.to_i

answer = 'No'

k.times do
  if a >= b
    b *= 2
  elsif b >= c
    c *= 2
  end

  if a < b && b < c
    answer = 'Yes'
    break
  end
end

puts answer


Measured memory_bytes: 14336
#! usr/bin/env python
# -*- coding: utf-8 -*-

H, W = map(int, input().split())
mat = [list(map(int, input().split())) for i in range(H)]


def main():
    ans = []
    for i in range(H):
        for j in range(W):
            if not mat[i][j] % 2:
                continue

            if j + 1 < W:
                mat[i][j] -= 1
                mat[i][j+1] += 1
                ans.append((i+1, j+1, i+1, j+2))
            elif i + 1 < H:
                mat[i][j] -= 1
                mat[i+1][j] += 1
                ans.append((i+1, j+1, i+2, j+1))

    print(len(ans))
    for i in ans:
        print(" ".join([str(j) for j in i]))


if __name__ == '__main__':
    main()


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

typedef long long ll;

const int N = 100100;

int n, t;
ll a[N], ans;
map<ll, ll> cnt;

int main() {
	cin >> n >> t;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	set<ll> st;
	for (int i = n; i; i--) {
		if (!st.empty()) {
			ll big = *st.rbegin();
			if (big > a[i]) cnt[big - a[i]]++;
		}
		st.insert(a[i]);
	}
	if (!cnt.empty()) ans = (*cnt.rbegin()).second;
	cout << ans;
}


Measured memory_bytes: 15220
//g++ -std=c++17 -Wshadow -Wall -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g PROGRAM -o OUTPUT -DLOCAL -lasan -lubsan
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define alli(a, n, k) (a + k), (a + n + k)
#define FP(i, a, b, k) for (__typeof(a) i = a; i < b; i += k)
#define FS(i, a, b, k) for (__typeof(a) i = a; i > b; i -= k)
#define IT(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

template <class T>
inline T gcd(T x, T y)
{
    if (!y)
        return x;
    return gcd(y, x % y);
}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector<pair<int, int>> VPII;
typedef vector<pair<int, PII>> VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;


inline ll modulo(ll a, ll m)
{
    return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
    assert(__gcd(a, m) == 1);
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;

        m = a % m, a = t;
        t = y;

        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
    if (y == 0)
        return 1LL;
    else if (y == 1)
        return x;
    else
    {
        ll ans = modPow(x, y / 2, m) % m;
        if (y & 1)
        {
            return (((ans * ans) % m) * x) % m;
        }
        else
        {
            return (ans * ans) % m;
        }
    }
}

vector<string> split(char d,string s)
{
    stringstream ss(s);
    string t;
    vector<string> words;
    while(getline(ss,t,d))
    {
        words.pb(t);
    }

    return words;
}

int main(int argc, char *argv[])
{
#ifdef LOCAL
    auto start = chrono::high_resolution_clock::now();
#endif
    
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n, k;
    cin >> n >> k;
    VII arr(n);
    for(auto &x:arr)
        cin >> x;

    sort(all(arr));
    int s = 0;
    for(int i=0;i<k;++i)
        s += arr[i];

    cout << s;
    exit(0);

#ifdef LOCAL
    auto end = chrono::high_resolution_clock::now();
    double time_taken =
        chrono::duration_cast<chrono::nanoseconds>(end - start).count();

    time_taken *= 1e-9;

    cerr << "\nTime taken by program is : " << fixed
         << time_taken << setprecision(9);
    cerr << " sec" << endl;
#endif
    return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N=1e5+9;
int main()
{
    FASTINOUT;
    int a,b;
    cin>>a>>b;
    cout<<(a-1)*(b-1)<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
d = input().split()
m = int(input())
t = input().split()
 
dic = dict()
 
for di in d:
    if di in dic:
        dic[di] += 1
    else:
        dic[di] = 1
 
ans = "YES"
for ti in t:
    if ti not in dic or dic[ti] == 0:
        ans = "NO"
        break
    else:
        dic[ti] -= 1
 
print(ans)

Measured memory_bytes: 53604
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string a;
	cin>>a;
	int x;
	for(x=0;x<a.size();x++)
	{
		if(a[x]=='1')
		{
			cout<<9;
		}
		else
		{
			cout<<1;
		}
	}
	cout<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define gc(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
#define ms(a,b) memset(a,b,sizeof(a));
char _;
typedef long long ll;
const ll mod = 1000000007;
using namespace std;

ll dist[1000][1000];
bool visited[1000][1000];
vector<pair<int, int> >graph[1000][1000];
void dfs(int x,int y){
    for (auto && it:graph[x][y]){
            if(!visited[it.first][it.second]){
                dfs(it.first,it.second);
            }
            dist[x][y]+=dist[it.first][it.second];
            if(dist[x][y]>=mod){
                dist[x][y]%=mod;
            }
        }
        visited[x][y]=1;
    }

int main()
{
    ms(dist,0);
    ms(visited,false);
    int x,y; gc(y); gc(x);
    dist[x-1][y-1]=1;
    int arr[1000][1000];
    for(int i = 0; i < y; ++i){
        for(int j = 0; j < x; ++j){
            char c; cin>>c;
            if(c=='.'){
                arr[j][i]=0;
            }
            else{
                arr[j][i]=1;
            }
        }
    }
    for(int i = 0; i < y; ++i){
        for(int j = 0; j < x; ++j){
            if(arr[j][i]==0){
                if(j+1<x&&arr[j+1][i]!=1){
                    graph[j][i].push_back({j+1,i});
                }
                if(i+1<y&&arr[j][i+1]!=1){
                    graph[j][i].push_back({j,i+1});
                }
            }
        }
    }
    dfs(0,0);
    printf("%llu\n",dist[0][0]);
    return 0;
}


Measured memory_bytes: 67712
#include <bits/stdc++.h>
#include <boost/math/tools/minima.hpp>
using namespace std;
using boost::math::tools::brent_find_minima;

# define REP(i,n) for (int i=0;i<(n);++i)
# define PER(i,n) for (int i=(N-1);i>=0;--i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

const int inf = 1e9+7;

int main(){
	string s;
    cin >> s;
	
    int n = s.size();
	int now = 0;
	ll ans = 0;
	int tmp = 0;
	for(int i = n - 1; i >= 0; i--) {
		if (s[i] == 'A') {
			if (now == 1) {
				now = 0;
                tmp = 0;
			}
			ans += tmp;
		} else if (now == 0) {
			if (s[i] == 'C') {
				now = 1;
			} else {
				tmp = 0;
			}
		} else {
			if (s[i] == 'B') {
				now = 0;
                tmp++;
			} else if(s[i] == 'A'){
				now = 0;
                tmp = 0;
			} else {
				now = 1;
                tmp = 0;
			}
		}
	}
	cout << ans << endl;
    return 0;
}


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

const int MAXN = 1000006;
const int INF = 1<<28;
vector<int> V;
int dp1[MAXN], dp2[MAXN];

int main() {
  for(int i = 1; ; ++i) {
    int k = i * (i + 1) * (i + 2) / 6;
    if(k >= MAXN) break;
    V.push_back(k);
  }
  fill(dp1, dp1 + MAXN, INF);
  fill(dp2, dp2 + MAXN, INF);
  dp1[0] = dp2[0] = 0;
  for(int i = 0; i < V.size(); ++i) {
    for(int j = V[i]; j < MAXN; ++j) {
      dp1[j] = min(dp1[j], dp1[j - V[i]] + 1);
      if(V[i] & 1) dp2[j] = min(dp2[j], dp2[j - V[i]] + 1);
    }
  }
  for(int n; cin >> n && n; ) {
    cout << dp1[n] << " " << dp2[n] << endl;
  }
  return 0;
}

Measured memory_bytes: 9028
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl '\n'
//#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
#define INIT                               \
    std::cin.tie(nullptr);                 \
    std::ios_base::sync_with_stdio(false); \
    cout << std::fixed << std::setprecision(15);

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pi = pair<int, int>;
template <typename T>
using Pq = priority_queue<T>;
template <typename T>
using pQ = priority_queue<T, vector<T>, greater<T>>;

template <typename T>
vector<T> make_vec(size_t a, T n) { return vector<T>(a, n); }
template <typename T, typename... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
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;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

signed main() {
    INIT;
    cin >> N;
    vector<double> x(N), y(N);
    REP(i, N)
    cin >> x[i] >> y[i];
    vector<double> ang(N);
    vector<pair<double, int>> ai(N);
    REP(i, N) {
        ang[i] = atan2(y[i], x[i]);
        ai[i].first = ang[i];
        ai[i].second = i;
    }
    sort(ALL(ai));
    double ans = 0;
    const double EPS = 0;
    dump(ai);
    REP(i, N) {
        double vx = 0;
        double vy = 0;
        double angle = ai[i].first;
        int start = ai[i].second;
        dump(angle, angle + M_PI);
        REP(jj, N) {
            int j = (start + jj) % N;
            int ind = ai[j].second;
            vx += x[ind];
            vy += y[ind];
            chmax(ans, sqrt(vx * vx + vy * vy));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4172
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int main(){
    char input[1500];
    int i;
    fgets(input, sizeof(input), stdin);
    input[strlen(input)-1] = '\0';

    for(i=0; input[i]!='\0'; i++){
        if(islower(input[i])){
            input[i] = toupper(input[i]);
        }
        else if(isupper(input[i])){
            input[i] = tolower(input[i]);
        }
    }

    printf("%s\n", input);
}



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

int main() {
  int a;
  cin >> a;
  ll sum;
  sum = a + a * a + a * a * a;
  cout << sum << endl;
  return 0;
}

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

int main(){
  int x;
  cin>>x;
  
  int a=x%100;
  int sum=0;
  while(a>=5){
    a-=5;
    sum++;
  }
  if(a==0){
    if(105*sum<=x){
      cout<<"1"<<endl;
    }else{
      cout<<"0"<<endl;
    }
  }else if(a>0){
    if(105*sum+100+a<=x){
      cout<<"1"<<endl;
    }else{
      cout<<"0"<<endl;
    }
  }
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        final String S = scan.next();
        final String T = scan.next();
        int result = 0;
        for(int i = 0; i < 3; i++){
            if(S.substring(i,i+1).equals(T.substring(i,i+1))){
                result++;
            }
        }
        System.out.println(result);
        scan.close();
    }
    
}


Measured memory_bytes: 21844
from collections import deque

n = int(input())
a = [int(e) for e in input().split()]

a.sort()

total = 0
q = deque()
q.append(a[n -1])
for i in reversed(range(n - 1)):
    q.append(a[i])
    q.append(a[i])
    total += q.popleft()

print(total)

Measured memory_bytes: 32436
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<vector>
using namespace std;
 
int bit[1000000],bit_n;
int sum(int i){
  int s=0;
  while(i){
    s+=bit[i];
    i-=i&-i;
  }
  return s;
}
void add(int i,int x){
  while(i<=bit_n){
    bit[i]+=x;
    i+=i&-i;
  }
}
 
struct data{
  int time,type,l,r;
  bool operator < (const data &p)const{
    return (time==p.time?type<p.type:time<p.time);
  }
};
// 1 | add
// 2 - check
// 3 | delete
 
int n;
vector<data> t;
vector<int> X;
map<int,int> mapx;
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    X.push_back(a);
    X.push_back(c);
    if(a==c){
      t.push_back((data){min(b,d),1,a,a});
      t.push_back((data){max(b,d),3,a,a});
    }else{
      t.push_back((data){b,2,min(a,c),max(a,c)});
    }
  }
  sort(t.begin(),t.end());
  sort(X.begin(),X.end());
  int c=2;
  for(int i=0;i<(int)X.size();i++)
    if(i==0||X[i]!=X[i-1])
      mapx[X[i]]=c++;
   
  bit_n=n*2+1;
  long long ans = 0;
  for(int i=0;i<(int)t.size();i++){
    data d=t[i];
    d.l=mapx[d.l],d.r=mapx[d.r];
    if(d.type==1){
      add(d.l,1);
    }else if(d.type==2){
      long long A=sum(d.r)-sum(d.l-1);
      ans+=A;
    }else if(d.type==3){
      add(d.l,-1);
    }
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 9064
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  vec<vec<int>> c(3, vec<int>(3));
  REP(i, 3) REP(j, 3) cin >> c[i][j];

  for (int b1 = 0; b1 <= 100; b1++) {
    for (int b2 = 0; b2 <= 100; b2++) {
      for (int b3 = 0; b3 <= 100; b3++) {
        if (c[0][0] - b1 == c[1][0] - b2 && c[1][0] - b2 == c[2][0] - b3 &&
            c[0][1] - b1 == c[1][1] - b2 && c[1][1] - b2 == c[2][1] - b3 &&
            c[0][2] - b1 == c[1][2] - b2 && c[1][2] - b2 == c[2][2] - b3) {
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


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

using namespace std;

int main(){
    int N;
    int odd[100001];
    int even[100001];
    int v[100001];
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> v[i];
    }

    for(int i = 1;i < N; i+=2){
        odd[v[i]]++;
        even[v[i-1]]++;
    }

    int omax = 0,emax = 0, omax2 = 0, emax2 = 0;
    for(int i = 0;i < 100001; i++){
        if(omax < odd[i]){
            omax = odd[i];
            omax2 = i;
        }
        if(emax < even[i]){
            emax = even[i];
            emax2 = i;
        }
    }

    if(omax2 != emax2){
        cout << (N -omax -emax) << endl;
    }else{
        int osec = 0, esec = 0;
        for(int i = 0;i < 100001; i++){
            //なるほど、ほんとの最大値は引っかからないようにif文を設定して最大値をもう一度求めることで二番目の最大値を求めれるというわけか
            if(osec <= odd[i] && i!= omax2){
                osec = odd[i];
            }
            if(esec < even[i] && i != emax2){
                esec = even[i];
            }
        }
        cout << min((N-omax-esec),(N-emax-osec));
    }
    return 0;
}

Measured memory_bytes: 1408
n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
pq = {}

if n==1:
    print(1)
    exit(0)

for (x, y) in xy:
    for (a, b) in xy:
        if (x, y) != (a, b):
            if (x-a, y-b) in pq.keys():
                pq[(x-a, y-b)] = pq[(x-a, y-b)] + 1
            else:
                pq[(x-a, y-b)] = 1

print(n - max(pq.values()))

Measured memory_bytes: 3444
const int isDebugMode = 1;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long gcd(T1 a, T2 b){return a % b ? gcd(b , a % b) : b;}
template<class T1, class T2> void reduce(T1 &a, T2 &b){ll g = gcd(a, b); a /= g; b /= g; return;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

int main(){
    ll N; cin >> N;
    string ans; 
    while(N > 0){
        N--;
        ans += abc[N % 26];
        N /= 26;
    }
    reverse(all(ans));
    pt(ans);
}

Measured memory_bytes: 3624
import java.util.*;
import java.awt.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        int[] v=new int[n];
        HashMap<Integer,Integer> mapE=new HashMap<>();
        HashMap<Integer,Integer> mapO=new HashMap<>();
        for (int i = 0; i < n; i++) {
            v[i]=sc.nextInt();
            if(i%2==0){
                mapE.put(v[i],mapE.getOrDefault(v[i], 0)+1);
            }else{
                mapO.put(v[i], mapO.getOrDefault(v[i],0)+1);
            }
        }
        
        int Emax=0,Omax=0;
        for(int k:mapE.keySet()){
            Emax=max(Emax,mapE.get(k));
        }
        for(int k:mapO.keySet()){
            Omax=max(Omax,mapO.get(k));
        }
        int tmpE=0,tmpO=0;
        for(int k:mapE.keySet()){
            if(mapE.get(k)==Emax)tmpE=k;
        }
        for(int k:mapO.keySet()){
            if(mapO.get(k)==Omax)tmpO=k;
        }
        int Emax2=0,Omax2=0;
        for(int k:mapE.keySet()){
            if(k!=tmpO)Emax2=max(Emax2,mapE.get(k));
        }
        for(int k:mapO.keySet()){
            if(k!=tmpE)Omax2=max(Omax2,mapO.get(k));
        }
        out.println(min(n-Omax-Emax2,n-Omax2-Emax));
    }
}


Measured memory_bytes: 66916
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
    string s, t;
    cin >> s >> t;
    int ans = 1e9;
    REP(i,s.length()-t.length()+1){
        int c = 0;
        REP(j,t.length()){
            if (t[j] != s[i + j]) c++;
        }
        chmin(ans, c);
    }
    cout << ans << endl;
    return 0;
}


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

int main(void) 
{
    char input[50];
    scanf("%s", input);
    char str[20][20];
    int i = 0, j, flg1, flg2, flg3, flg4;
    for(i = 0; i < 2*2*2*2; ++i) {
        flg1 = ((i & 1) != 0)? 1 : 0;
        flg2 = ((i & 2) != 0)? 1 : 0;
        flg3 = ((i & 4) != 0)? 1 : 0;
        flg4 = ((i & 8) != 0)? 1 : 0;
        j = 0;
        if(flg1) { str[i][j++] = 'A'; }
        str[i][j++] = 'K';
        str[i][j++] = 'I';
        str[i][j++] = 'H';
        if(flg2) { str[i][j++] = 'A'; }
        str[i][j++] = 'B';
        if(flg3) { str[i][j++] = 'A'; }
        str[i][j++] = 'R';
        if(flg4) { str[i][j++] = 'A'; }
        str[i][j] = '\0';
    }
    int flag = 0;
    for(i = 0; i < 2*2*2*2; ++i) {
        if( strcmp(input, str[i]) == 0 ) { flag = 1; break; }
    }
    if(flag) { printf("YES\n"); } else { printf("NO\n"); }
    return 0;
}

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

using namespace std;

pair<int, int> a[1111], b[1111];
int g[1111][1111];
int main() {
	int p = 1e9 + 7;
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> a[i].first, a[i].second = i;
	for (int j = 0; j < m; j++)
		cin >> b[j].first, b[j].second = j;
	sort(a, a + n, greater<pair<int, int>>());
	sort(b, b + m, greater<pair<int, int>>());
	a[n].first = -1, b[m].first = -1;
	int x = 0, y = 0, h = 0;
	long r = 1;
	for (int i = n * m; i; i--) {
		if (a[x].first == i && b[y].first == i) {
			int s = a[x].second, t = b[y].second;
			if (g[s][t]) {
				cout << 0 << endl;
				return 0;
			}
			for (int j = 0; j < n; j++) {
				if (g[j][t] > 1) {
					cout << 0 << endl;
					return 0;
				}
				if (g[j][t]++) h++;
			}
			for (int j = 0; j < m; j++) {
				if (g[s][j] > 1) {
					cout << 0 << endl;
					return 0;
				}
				if (g[s][j]++) h++;
			}
			g[s][t]++, h--;
			x++, y++;
			continue;
		}
		if (a[x].first == i) {
			int s = a[x].second, t = 0, c = 0;
			for (; t < m; t++) {
				if (g[s][t] == 1) c++;
				if (g[s][t] > 1) {
					cout << 0 << endl;
					return 0;
				}
				if (g[s][t]++) h++;
			}
			if (!c) {
				cout << 0 << endl;
				return 0;
			}
			while (g[s][--t] != 2);
			g[s][t]++, h--;
			r = r * c%p;
			x++;
			continue;
		}
		if (b[y].first == i) {
			int s = 0, t = b[y].second, c = 0;
			for (; s < n; s++) {
				if (g[s][t] == 1) c++;
				if (g[s][t] > 1) {
					cout << 0 << endl;
					return 0;
				}
				if (g[s][t]++) h++;
			}
			if (!c) {
				cout << 0 << endl;
				return 0;
			}
			while (g[--s][t] != 2);
			g[s][t]++, h--;
			r = r * c%p;
			y++;
			continue;
		}
		if (!h) {
			cout << 0 << endl;
			return 0;
		}
		r = r * h%p;
		h--;
	}
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 4608
#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define LOCAL 1

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define dbg(...) cout<<#__VA_ARGS__ ": ["; for(auto e: __VA_ARGS__){cout<<e<<", ";} cout<<"]\n"
#define dbg1(...) cout<<#__VA_ARGS__ " "<< __VA_ARGS__ 
#else
#define dbg(...) 1;
#define dbg1(...) 1;
#endif

typedef long long ll;
typedef unsigned long long ull;
constexpr int R=5e6+69, INF=2e9+6969;

int qq;

int main()
{
	string s;
	cin>>s;
	if(s[0]>='A' && s[0]<='Z') cout<<'A';
	else cout<<'a';
	return 0;
}


Measured memory_bytes: 3624
def calc(n, a, b):
    if n == 1:
        return b
    ls = [0 for i in range(n + 1)]
    ls[0], ls[1] = a, b
    for i in range(2, n + 1):
        ls[i] = ls[i - 1] + ls[i - 2]
    return ls[-1]

n = int(input())
print(calc(n, 2, 1))

Measured memory_bytes: 3060
#include <stdio.h>

int main(){
    int h, w;
    int i, j;
    
    scanf("%d %d\n", &h, &w);
    
    while((h!=0) && (w!=0)){
        for (j=0;j<h;j++){
            for(i=0;i<w;i++){
                if ((j!=0)&&(i!=0)&&(j!=h-1)&&(i!=w-1)){
                    printf(".");                   
                } else {
                    printf("#");
                }

            }
            printf("\n");
        }
        printf("\n");
        scanf("%d %d\n", &h, &w);        
    }
    

    return 0;
}


Measured memory_bytes: 2044
n,m = map(int,input().split())
if m != 0:
    l = [list(input().split()) for i in range(m)]
    p,s = [list(i) for i in zip(*l)]
t = [0] * n
ac = 0
wa = 0

for i in range(m):
    if s[i] == 'WA' and t[int(p[i])-1] != 'AC':
        t[int(p[i])-1] += 1
    elif s[i] == 'AC' and t[int(p[i])-1] != 'AC':
        ac += 1
        wa += t[int(p[i])-1]
        t[int(p[i])-1] = 'AC'

print(ac,wa)

Measured memory_bytes: 38732
#include <math.h>
#include <ctype.h>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)

int main(){
    int n;
    cin >> n;
    long long A[n], S[n];
    REP(i, n){
        cin >> A[i];
        if(i == 0) S[i] = A[i];
        else S[i] = A[i] + S[i - 1];
    }

    long long mi = INT_MAX, a, b, sum = S[n - 1];
    for(int i = 1; i < n; i++){
        a = S[i - 1];
        b = sum - a;
        mi = min(mi, abs(a - b));
    }
    cout << mi  << endl;

    return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<set>
using namespace std;
using ll = long long int;

const int C_NUM = 26;
const int D_MAX = 366;
int D;
ll c[C_NUM+5];
ll s[D_MAX][C_NUM+5];

int t[D_MAX];
set<int> last[C_NUM+5];

const int M_MAX = 1E+05 + 5;
int d[M_MAX];
int q[M_MAX];

int main(){
    cin >> D;
    for(int i = 1; i <= C_NUM; i++)cin >> c[i];
    for(int i = 1; i <= D; i++){
        for(int j = 1; j <= C_NUM; j++){
            cin >> s[i][j];
        }
    }
    for(int i = 1; i <= D; i++){
        cin >> t[i];
    }
    int m;
    cin >> m;
    for(int i = 0; i < m; i++){
        cin >> d[i] >> q[i];
    }

    for(int j = 1; j <= C_NUM; j++)last[j].insert(0);
    ll v = 0;
    for(int i = 1; i <= D; i++){
        v += s[i][t[i]];
        last[t[i]].insert(i);
        for(int j = 1; j <= C_NUM; j++){
            v -= c[j] * (i - *last[j].rbegin());
        }
    }
    for(int j = 1; j <= C_NUM; j++)last[j].insert(D+1);
    for(int l = 0; l < m; l++){
        int day = d[l];
        int o = t[day];
        int n = q[l];
        v += s[day][n] - s[day][o];
        int bo = *(--last[o].find(day));
        int ao = *(++last[o].find(day));
        v -= c[o] * (day - bo) * (ao - day);
        last[o].erase(day);
        last[n].insert(day);
        int bn = *(--last[n].find(day));
        int an = *(++last[n].find(day));
        v += c[n] * (day - bn) * (an - day);
        t[day] = n;
        cout << v << endl;
    }
    return 0;
}

Measured memory_bytes: 4228
#include <iostream>
#include <list>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  int q;
  cin >> q;
  list<char> result;

  for (int i = 0; i < s.length(); i++) {
    result.push_back(s[i]);
  }
  bool reversed = false;
 
  for (int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      reversed = reversed ? false : true;
    } else {
      int f;
      cin >> f;
      char c;
      cin >> c;
      if (f == 1) {
        if (reversed) {
          result.push_back(c);
        } else {
          result.push_front(c);
        }
      } else {
        if (reversed) {
          result.push_front(c);
        } else {
          result.push_back(c);
        }
      }
    }
  }
 
  if (reversed) {
    for (auto itr = result.rbegin(); itr != result.rend(); ++itr) {
      cout << *itr;
    }
  } else {
    for (auto itr = result.begin(); itr != result.end(); ++itr) {
      cout << *itr;
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 9984
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{

  ll n,k;
  cin >> n >> k;
  map<ll,ll> m;
  rep(i,n)
  {
    ll buf;
    cin >> buf;
    m[buf]++;
  }

  ll ans = 0;
  
  if(k < sz(m)) // 書き換えあり
  {
    vll b;
    for(auto it : m)
    {
      b.push_back(it.second);
    }

    vsort(b);

    ll bb = sz(m);

    for(auto i: b)
    {
      ans += i;
      bb--;
      if(bb <= k)
        break;
    }
  }

  cout << ans << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 14964
/* Manish Pant - insider_pants */

#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#include "debug.h"
#endif

#define F first
#define S second
#define endl "\n"
#define pb push_back
typedef long long ll;
typedef long double ldob;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

int main()
{
    fast();
    ll sum = 0;
    map<ll, ll> m;
    int n; cin >> n;
    for(int i = 0; i < n; i++)
    {
        int a; cin >> a;
        m[a]++;
        sum += a;
    }
    int q; cin >> q;
    while(q--)
    {
        int b, c; cin >> b >> c;
        sum -= m[b] * b;
        sum += m[b] * c;
        m[c] += m[b];
        m[b] = 0;
        cout << sum << endl;
    }
}

Measured memory_bytes: 9608
#include<stdio.h>
int N=100;

int main(){
  int M[N][N];
  int n,u,k,v,i,j;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      M[u-1][v-1]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%d",M[i][j]);
      if(j!=n-1){
	printf(" ");
      }
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2108
//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var N = nextInt();
	var map = {};
	for(var i = 0; i < N; i++){
		var s = nextCharArray();
		s.sort();
		var tmpS = myconv(s,0);
		if(map[s] == null){
			map[s] = 0;
		}else{
			map[s]++;
		}
	}
	var keys = Object.keys(map);
	var output = 0;
	for(var i = 0; i < keys.length; i++){
		var count = map[keys[i]];
		output += count * (count + 1) / 2;
	}
	myout(output);
}


Measured memory_bytes: 72308
#include<stdio.h>
 
int main()
{
    int a,b;
    scanf("%d %d",&a,&b);
    if(a < b){
         printf("a < b\n");
    }
    if(a > b){
         printf("a > b\n");
    }
    if(a == b){
         printf("a == b\n");
    }
    return 0;
}


Measured memory_bytes: 2056
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{
  public static void main(String[] args) throws Exception {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String str = in.readLine();
    System.out.println(str.substring(0,1)
                      + str.substring(1,str.length()-1).length()
                      + str.substring(str.length()-1,str.length()));
  }
}

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


int main() {
  //T L U R D
  string moji[10][5] ={{"wa","x","nn","x","wo"},
		       {"a","i","u","e","o"},
		       {"ka","ki","ku","ke","ko"},
		       {"sa","si","su","se","so"},
		       {"ta","ti","tu","te","to"},
		       {"na","ni","nu","ne","no"},
		       {"ha","hi","hu","he","ho"},
		       {"ma","mi","mu","me","mo"},
		       {"ya","x","yu","x","yo"},
		       {"ra","ri","ru","re","ro"}};
  
  
  string str;
  cin >> str;

  int sta;
  for(int i=0;i<str.size();i+=2) {
    int  n = str[i] - '0';
    char cha = str[i+1];
    if(cha == 'T') sta = 0;
    else if(cha == 'L') sta = 1;
    else if(cha == 'U') sta = 2;
    else if(cha == 'R') sta = 3;
    else if(cha == 'D') sta = 4;
    cout << moji[n][sta];
  }
  cout << endl;


  return 0;

}

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

const int n = 10000;

int main(){
    int a ,b, c;
    
    cin >> a >> b >> c;
    
    int sum = 0;
    sum = a - b;
    
    int ans = 0;
    ans = c - sum;
    
    if(ans < 0)
        cout << "0" << endl;
    else
        cout << ans << endl;
        }



Measured memory_bytes: 256
import java.io.*;

public class Main{
	public static void main(String[] args) throws IOException{
		//
		int[] data = new int[10001];
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder output = new StringBuilder();
		for(int i=0; i < 10001; i++){
			data[i] = Integer.parseInt(input.readLine());
			if( data[i] == 0){
				break;
			}
			output.append("Case ").append(Integer.toString(i+1)).append(": ").append(Integer.toString(data[i])).append("\n");
		}
		System.out.print(output);
		//
	}
}

Measured memory_bytes: 31840
#include <bits/stdc++.h>
#define Mod 1000000007
#define INF 9e8
#define INFL 9e18
#define EPS 1e-9
#define pb push_back
#define mp make_pair
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define CPY(a,b) memcpy(a,b,sizeof(a))
#define N 500005
#define fs first
#define sc second 
#define UNIVISITED 0
#define EXPLORED 1
#define VISITED 2
using namespace std;
typedef  long long int ll;
typedef pair<ll,ll> ii;
typedef vector <ii> vii;
typedef vector <ll> vi;

ll arr[N];
int dr[] = {1,1,0,-1,-1,-1, 0, 1}; // trick to explore an implicit 2D grid
int dc[] = {0,1,1, 1, 0,-1,-1,-1}; // S,SE,E,NE,N,NW,W,SW neighbors

int main()
{
// #ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
// #endif
ios::sync_with_stdio(false);
cin.tie(0);
ll h,w;
string str[100];
int ans[100000];
cin>>h>>w;
for(int i=0;i<h;i++)
cin>>str[i];
ll adi=0;
for(int i=0;i<h;i++)
{
  for(int j=0;j<w;j++)
  {
    //cout<<str[i][j]<<endl;
    char ch=str[i][j];
    //ans[i][j]=ch;
    if(str[i][j]=='.')
    {
      ll cnt=0;
      for(int k=0;k<8;k++)
      {
        if(i+dr[k]>=0 && i+dr[k]<h && j+dc[k]>=0 && j+dc[k]<w && str[i+dr[k]][j+dc[k]]=='#')
          cnt++;
      }
      ans[adi++]=cnt;
    }
  }
}
adi=0;
for(int i=0;i<h;i++)
{
  for(int j=0;j<w;j++)
  {
    if(str[i][j]=='.')
      cout<<ans[adi++];
    else
      cout<<str[i][j];
  }
  //cout<<ans[i][j];
cout<<endl;
}









return 0;


}



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

using namespace std;


int main()
{
	string line;

	cin >> line;

	int num = atoi(line.c_str());
	int sum = 0;
	for (int ci = 0; ci < line.size(); ci++) {
		sum += line[ci] - '0';
	}

	if (num % sum == 0) {
		printf("Yes");
	}
	else {
		printf("No");
	}

	return 0;
}



Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];puts("");}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
// int dx[]={0,1,0,-1};
// int dy[]={1,0,-1,0};//RDLU
#define yes puts("YES")
#define no puts("NO")

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

	int x,p;
	cin>>x>>p;
	cout<<shosu(9)<<(x+1)/2*100./p<<endl;
}


Measured memory_bytes: 256
N = gets.to_i
S = gets.chomp

ans = ''
lv = 0
S.chars.each do |c|
  lv += (c == '(' ? 1 : -1)
  while lv.negative?
    ans = '(' + ans
    lv += 1
  end
  ans += c
end

while lv.positive?
  ans += ')'
  lv -= 1
end

puts ans


Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

void solve(){
    ll n;cin>>n;
    vl a(n);rep(i,n)cin>>a[i];
    rep(i,n)a[i]=-a[i];

    vl dp(n+1,INF);
    rep(i,n){
        ll idx=upper_bound(all(dp),a[i])-dp.begin();
        dp[idx]=a[i];
    }
    rep(i,n+1){
        if(dp[i]==INF){
            cout<<i<<endl;
            return;
        }
    }
}

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


Measured memory_bytes: 1792
#include <iostream>

typedef long long ll;

#define FOR(i,a,b) for(ll i = (a);i < (b);++i)
#define REP(i,n) FOR(i,0,n)

#define debug(x) cout << #x << "=" << x << endl;

using namespace std;

#define N 10

int cost[N][N];

void warshall_floyd(){
  REP(k,N){
      REP(i,N){
          REP(j,N){
            cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
          }
      }
  }
}

int main(void){

  int h,w;
  cin >> h >> w;

  REP(i,N){
    REP(k,N){
      cin >> cost[i][k];
    }
  }

  warshall_floyd();

  int a[h][w];

  REP(i,h){
    REP(k,w){
      cin >> a[i][k];
    }
  }

  long long ans = 0;

  REP(i,h){
    REP(k,w){

      if(a[i][k] >= 0) ans += cost[a[i][k]][1];
    }
  }

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


Measured memory_bytes: 384
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let r: u64 = read();
    let d: u64 = read();
    let mut x: u64 = read();

    for i in 0..10 {
        x = r * x - d;
        println!("{}", x);
    }
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE

signed solve(){
  Int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(b>d){
    cout<<"No"<<endl;
    return 0;
  }
  if(a<b){
    cout<<"No"<<endl;
    return 0;
  }
  a%=b;
  d%=b;
  if(a>c){
    cout<<"No"<<endl;
    return 0;
  }
  if(c>=b-1){
    cout<<"Yes"<<endl;
    return 0;
  }
  Int x=__gcd(b,d);
  a%=x;
  Int e=(b-a)/x*x+a;
  while(e>=b) e-=x;
  while(e+x<b) e+=x;
  if(e>c){
    cout<<"No"<<endl;
    return 0;
  }
  cout<<"Yes"<<endl;
  return 0;
}
signed main(){
  Int T;
  cin>>T;
  while(T--) solve();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
 
int main(){
  int N;
  cin >> N;
 
  int d[300000];
  for(int i=0;i<N;i++){
    cin >> d[i];
  }
 
  int D=0;
 
  for(int i=0;i<N-1;i++){
    D=max(D,d[i]);
 
    if(D<10){
      cout << "no" << endl;
      return 0;
    }
 
    D-=10;
  }
 
  D=0;
 
  for(int i=N-1;i>0;i--){
    D=max(D,d[i]);
 
    if(D<10){
      cout << "no" << endl;
      return 0;
    }
 
    D-=10;
  }
 
  cout << "yes" << endl;
 
  return 0;
}


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

int main(){
  int N,i;
  cin>>N;
  int a[N];
  for(i=0;i<N;i++) cin>>a[i];
  long long l=0,r=0,t=a[0],s=0;
  while(l<N){
	while(!(t&a[r+1])&&r<N-1) {
		t+=a[++r];
	}
	s+=r-l+1;
	t-=a[l++];
  }	
  cout<<s;
}

Measured memory_bytes: 1024
n = int(input())
listS = list(input())
listT = list(input())

if listS == listT:
    print(len(listS))

else:
    count = len(listS)+ len(listT)
    index1 = 0
    while index1 < len(listS):
        if listS[index1] == listT[0]:
            index2 = 0
            while index2 < len(listS)-index1:
                if listS[index1+index2] == listT[index2]:
                    index2+=1
                else:
                    break
            if index2 == len(listS)-index1:
                count-=(len(listS)-index1)
                print(count)
                break
            else:
                index1+=1
        else:
            index1+=1
    if index1 == len(listS):
        print(count)

Measured memory_bytes: 3064