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

using namespace std;

const int N=362880;

map<int,int> mp;
int H[9][2]={{2,9},{3,1},{4,2},{5,3},{6,4},{7,5},{8,6},{9,7},{8,1}};
int V[9][2]={{7,4},{8,5},{9,6},{1,7},{2,8},{3,9},{4,1},{5,2},{6,3}};

bool vis[N];
queue<int> q;
int ch,cv,a[9],b[9],p[9],dis[N],f[N],Gh[N][2],Gv[N][2];

int Trans(int* a)
{
	int res=0;
	for(int i=0;i<9;i++)
		res=res*10+a[i];
	return mp[res];
}

int RTrans(int x,int* p)
{
	int y=f[x],pos;
	for(int i=8;i>=0;i--,y/=10)
	{
		p[i]=y%10;
		if(p[i]==0) pos=i;
	}
	return pos;
}

void Init()
{
	int cnt=0,per[9],p[9];
	for(int i=0;i<9;i++)
		for(int j=0;j<2;j++)
			H[i][j]--,V[i][j]--;
	for(int i=0;i<9;i++)
		per[i]=i;

	do
	{
		int res=0;
		for(int i=0;i<9;i++)
			res=res*10+per[i];
		f[cnt]=res,mp[res]=cnt++;
	}while(next_permutation(per,per+9));

	for(int i=0;i<cnt;i++)
	{
		int pos=RTrans(i,p);
		for(int j=0;j<2;j++)
		{
			swap(p[pos],p[H[pos][j]]),Gh[i][j]=Trans(p),swap(p[pos],p[H[pos][j]]);
			swap(p[pos],p[V[pos][j]]),Gv[i][j]=Trans(p),swap(p[pos],p[V[pos][j]]);
		}
	}
	assert(cnt==362880);
}

void AddPoint(int v,int d)
{
	if(dis[v]>d)
	{
		dis[v]=d;
		if(!vis[v])
			vis[v]=1,q.push(v);
	}
}

int SPFA()
{
	memset(vis,0,sizeof(vis));
	for(int i=0;i<N;i++)
		dis[i]=(1<<30);
	int pa=Trans(a),pb=Trans(b);

	for(vis[pa]=1,dis[pa]=0,q.push(pa);!q.empty();q.pop())
	{
		int u=q.front(); 
		for(int i=0;i<2;i++)
			AddPoint(Gh[u][i],dis[u]+ch),AddPoint(Gv[u][i],dis[u]+cv);
		vis[u]=0;
	}
	return dis[pb];
}

int main()
{
	for(Init();cin>>ch>>cv,ch;)
	{
		for(int i=0;i<9;i++)
			scanf("%d",a+i);
		for(int i=0;i<9;i++)
			scanf("%d",b+i);
		cout<<SPFA()<<endl;
	}
}

Measured memory_bytes: 29368
n = int(input())
maxv = 0
elem = 0
A = []
res = 0
for i in range(n):
    A.append(int(input()))
    maxv = max(maxv,A[i])
    if maxv==A[i]:
        elem = i

for j in range(n):
    if j == elem:
        res += int(A[j]/2)
    else:
        res += A[j]

print(res)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int t,len;
long long x,ans,y,pw[20]={1},ret;
long long solve(int len){
	y=x,ret=1;
	if(len==0)return 0;
	for(int i=0;i<((len+1)/2);++i){
		long long p=pw[len-i]-pw[i];
		long long x=-y/p;
		y%=p;
		if(y>=0){
			if(y%pw[i+1]!=0)y-=p,x--;
			if(y%pw[i+1]!=0||abs(x)>=10)return 0;
		//	printf("<%lld,%lld,%lld>\n",x,p,y);
			ret*=10-abs(x)-(!i);
		} else {
			if(y%pw[i+1]!=0)y+=p,x++;
			if(y%pw[i+1]!=0||abs(x)>=10)return 0;
		//	printf("<%lld,%lld,%lld>\n",x,p,y);
			ret*=10-abs(x)-(!i&&x==0);
		}
	}
	if(y)return 0;
	if(len%2==0)ret*=10;
//	printf("<%d>",len);
	return ret;
}
int main(){
//	scanf("%d",&t);
	t=1;
	for(int i=1;i<=18;++i)pw[i]=pw[i-1]*10;
	while(t--){
		scanf("%lld",&x);
		y=x,ans=0,len=0;
		if(x%9!=0){printf("0\n");continue;}
		while(y)y/=10,len++;
		for(int i=len-1;i<len*2;++i)ans+=solve(i);
		printf("%lld\n",ans);
	}
}

Measured memory_bytes: 256
object Main extends App {
	val x = scala.io.StdIn.readInt

	if(x == 1){
		println(1)
	}else{

		var ans = 0
		for(i<-2 to x){
			
			var tp = i*i
			var tq = 2
			
			while(tp <= x){
				tp = tp * i
				tq += 1
			}

			if(tq != 2){
				ans = math.max(ans, tp/i)	
			}
		}

		println(ans)
	}

}


Measured memory_bytes: 25408
A,B = map(int,input().split())

ans1 = A+B
ans2 = A-B
ans3 = A*B

if ans1>=ans2 and ans1>=ans3:
    print(ans1)
elif ans2>=ans1 and ans2>=ans3:
    print(ans2)
elif ans3>=ans1 and ans3>=ans2:
    print(ans3)


Measured memory_bytes: 2940
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iostream>
#include <limits>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#pragma comment(linker, "/STACK:36777216")

using namespace std;

#define MP make_pair
#define all(v) (v).begin(), (v).end()
#define PROBLEM_ID "A"

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

int sign(int x) {
  if (x < 0) {
    return -1;
  } else if (x > 0) {
    return 1;
  } else {
    return 0;
  }
}

int main() {
  //freopen(PROBLEM_ID".in", "r", stdin);
  int x, y;
  cin >> x >> y;
  int result = abs(abs(x) - abs(y));
  if (sign(x) * sign(y) < 0) {
    ++result;
  } else {
    if (y < x) {
      ++result;
      if (x != 0 && y != 0) {
        ++result;
      }
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
int a[maxn],gcd_front[maxn],gcd_back[maxn];
int gcd(int a,int b)
{
	if(a>b)
		swap(a,b);
	if(a==0)
		return b;
	return gcd(b%a,a);
}
void fl()
{
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
int main()
{
//  fl();
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	int gcd_tmp=a[1];
	gcd_front[1]=a[1];
	for(int i=2;i<=n;i++)
		gcd_front[i]=gcd_tmp=gcd(gcd_tmp,a[i]);
	gcd_tmp=gcd_back[n]=a[n];
	for(int i=n-1;i>=1;i--)
		gcd_back[i]=gcd_tmp=gcd(gcd_tmp,a[i]);
	int ans=gcd_back[2];
	for(int i=2;i<n;i++)
		ans=max(ans,gcd(gcd_front[i-1],gcd_back[i+1]));
	ans=max(ans,gcd_front[n-1]);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}






int main(){
  ll D;
  cin >> D;
  vector<ll> c(26);
  FOR(i,0,26) cin >> c[i];
  vector<ll> last(26,0),s(26);
  vector<vector<ll>> S;
  vector<ll> t_(D);

  FOR(i,0,D){
    FOR(j,0,26){
      cin >> s[j];
    }
    S.push_back(s);
  }

  ll ans = 0;

  FOR(i,0,D) cin >> t_[i];
  
  FOR(i,0,D){
    ll t;
    t = t_[i];
    t--;
    ans += S[i][t];
    last[t] = i+1;
    FOR(j,0,26){
      ans -= c[j] * (i+1 - last[j]);
    }
    //cout << ans << endl;
  }


  ll M;
  cin >> M;
  FOR(k,0,M){
    ll d,q;
    cin >> d >> q;

    t_[d-1] = q;
    ans = 0;
    FOR(i,0,26)last[i] = 0;
    FOR(i,0,D){
      ll t;
      t = t_[i];
      t--;
      ans += S[i][t];
      last[t] = i+1;
      FOR(j,0,26){
        ans -= c[j] * (i+1 - last[j]);
      }
      //cout << ans << endl;
    }
    cout << ans << endl;
  }



}



Measured memory_bytes: 3732
use std::io;
use std::str::FromStr;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
    let (A, B) = (it.next().unwrap(), it.next().unwrap());

    let C = A + B;
    if 10 <= C {
        println!("error");
    } else {
        println!("{}", A+B);
    }
}

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

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


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main (void)
{
  char S[3];
  int i = 0;
  for (auto &e: S)
  {
    cin >> e;
    i += (int) (e - 'A');
  }
  if (i == 0 || i == 3)
  {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

typedef long long LL;
typedef vector<LL> VL;
typedef vector<vector<LL>> VVL;
typedef vector<string> VS;

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

LL llRead(){
  LL a;
  cin >> a;
  return a;
};

string stringRead(){
  string a;
  cin >> a;
  return a;
};

vector<LL> vlRead(LL a){
  vector<LL> rv;
  REP(i, a){
    LL input;
    cin >> input;
    rv.push_back(input);
  }
  return rv;
}

vector<string> vsRead(LL a){
  vector<string> rv;
  REP(i, a){
    string input;
    cin >> input;
    rv.push_back(input);
  }
  return rv;
}
vector<vector<LL>> vvlRead(LL a, LL b){
  vector<vector<LL>> rv;
  REP(i, a){
    rv.push_back(vector<LL>());
    REP(j, b) {
      LL input;
      cin >> input;
      rv.at(i).push_back(input);
    }
  }
  return rv;
}

#if 1
#define debug(d) debug1(__LINE__,#d, d)
void debug1(LL line, const char* name, VL& v) {
  cout << line << ":" << name << ":vector<LL>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, LL i) {
  cout << line << ":" << name << ":LL " << i << endl;;
}
void debug1(LL line, const char* name, VS& v) {
  cout << line << ":" << name << ":vector<string>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, VVL& v) {
  cout << line << ":" << name << ":vector<vector<LL>>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    REP(j, (LL)v.at(i).size()) {
      cout << v.at(i).at(j) << " ";
    }
    cout << ", ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, char* s) {
  cout << line << ":" << name << ":char* " << s << endl;;
}
void debug1(LL line, const char* name, vector<const char*>& v) {
  cout << line << ":" << name << ":vector<const char*>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, priority_queue<LL>& p) {
  cout << line << ":" << name << ":priority_queue<LL>(" << p.size() << ") ";
  priority_queue<LL> copy = p;
  while(!copy.empty()) {
    cout << copy.top() << " ";
    copy.pop();
  }
  cout << endl;
}
#else
#define debug(n)
#endif

int main(int argc, const char * argv[]) {
	cout.precision(16);
  // source code

  auto n = llRead();

  cout << ((double)((n+1)/2)) / n << endl;

  return 0;
}


Measured memory_bytes: 636
import os
import sys
from io import BytesIO, IOBase


def solution(n):
    if n % 10 in [2, 4, 5, 7, 9]:
        write("hon")
    elif n % 10 in [0, 1, 6, 8]:
        write("pon")
    else:
        write("bon")


def main():
    n = r_int()
    solution(n)


# fast-io region

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


def input():
    return sys.stdin.readline().rstrip("\r\n")


def write(*args, end='\n'):
    for x in args[:-1]:
        sys.stdout.write(str(x) + ' ')
    sys.stdout.write(str(args[-1]))
    sys.stdout.write(end)


def r_array():
    return [int(x) for x in input().split()]


def r_int():
    return int(input())


if __name__ == "__main__":
    main()


Measured memory_bytes: 62740
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
int h,w,a[1410][1410];
int s[1410][1410];

int main(){
	cin >> h >> w;
	REP(i,0,h) REP(j,0,w) cin >> a[i][j],s[i+1][j+1]=a[i][j];
	REP(i,1,h+1) REP(j,1,w+1) s[i][j]+=s[i-1][j];
	REP(j,1,w+1) REP(i,1,h+1) s[i][j]+=s[i][j-1];
	
	int c=0;
	REP(i,0,h){
		REP(j,0,w){
			if(a[i][j]) continue;
			if(i+c<=h and j+c<=w){
				if(!(s[i+c][j+c]-s[i+c][j]-s[i][j+c]+s[i][j])){
					for(int k=c+1;i+k<=h and j+k<=w;k++){
						if(s[i+c+1][j+c+1]-s[i+c+1][j]-s[i][j+c+1]+s[i][j]) continue;
						c++;
					}
				}
			}
			/*
			if(i-c>=0 and j-c>=0){
				if(!(s[i][j+c]-s[i][j]-s[i-c][j+c]+s[i-c][j])){
					for(int k=c+1;i-c>0 and j-c>0;k++){
						if(s[i][j+c]-s[i][j]-s[i-c][j+c]+s[i-c][j]) continue;
						c++;
					}
				}
			}*/
		}
	}
	
	cout << c*c << endl;
	return 0;
}



Measured memory_bytes: 18512
#include <stdio.h>

int selectsort(int n,int *a){
    int flag = 0;
    int count = 0;
    int i,j,tmp,minj;
    for(i = 0; i < n; i++){
        minj = i;
        for(j = i; j < n; j++){
            if(a[j] < a[minj]){
                minj = j;
                flag = 1;
                //count++;
            }

        }
        tmp = a[i];
        a[i] = a[minj];
        a[minj] = tmp;
        if(flag){
            count++;
            flag = 0;
        }
    }
    return count;
}

int main() {

    int n,i,j,x;
    int a[101] = {};

    scanf("%d",&n);

    for(i = 0; i < n; i++){
        scanf("%d",&a[i]);
    }
    x = selectsort(n,a);

    for(j = 0; j < n; j++ ){
        if(j == 0){
            printf("%d",a[j]);
        }else{
            printf(" %d", a[j]);
        }
    }
    putchar('\n');
    printf("%d\n",x);
    return 0;
}



Measured memory_bytes: 2056
INF = 2000000000


def calc_xx(A, B, mult, comp_field, diff_field):
    AA = list(sorted(A, key=lambda pp: (pp[comp_field], pp[diff_field])))
    BB = list(sorted(B, key=lambda pp: (pp[comp_field], pp[diff_field])))

    a = 0
    b = 0

    min_time = INF
    while a < len(A) and b < len(B):
        # 衝突判定 (ソートの重複値の全組み合わせで検証)
        if AA[a][comp_field] == BB[b][comp_field]:
            astart = a
            asame = a + 1
            while asame < len(A) and AA[asame][comp_field] == AA[a][comp_field]:
                asame += 1
            aend = asame - 1

            bstart = b
            bsame = b + 1
            while bsame < len(B) and BB[bsame][comp_field] == BB[b][comp_field]:
                bsame += 1
            bend = bsame - 1

            # まさかの二重DP
            aa = astart
            bb = bstart
            while aa <= aend and bb <= bend:
                diff = BB[bb][diff_field] - AA[aa][diff_field]
                if diff > 0:
                    hit_time = diff * mult
                    min_time = min(min_time, hit_time)

                if aa == aend:
                    bb += 1
                elif bb == bend:
                    aa += 1
                elif BB[bb][diff_field] > AA[aa][diff_field]:
                    aa += 1
                else:
                    bb += 1

            a = aend + 1
            b = bend + 1

        elif a == len(A) - 1:
            b += 1
        elif b == len(B) - 1:
            a += 1
        elif AA[a][comp_field] > BB[b][comp_field]:
            b += 1
        elif AA[a][comp_field] < BB[b][comp_field]:
            a += 1
        else:
            raise Exception

    return min_time


def main():
    N = int(input())
    PLANES = []

    U = []
    R = []
    D = []
    L = []
    for i in range(N):
        # x=c[0]
        # y=c[1]
        # u=c[2]
        p = input().split()
        p[0] = int(p[0])
        p[1] = int(p[1])

        pp = [p[0], p[1], (p[0] + p[1]), (p[1] - p[0])]

        PLANES.append(p)
        if p[2] == "U":
            U.append(pp)
        elif p[2] == "R":
            R.append(pp)
        elif p[2] == "D":
            D.append(pp)
        else:
            L.append(pp)

    min_time = min(
        calc_xx(R, U, 10, 2, 0),
        calc_xx(U, D, 5, 0, 1),
        calc_xx(U, L, 10, 3, 0),
        calc_xx(R, D, 10, 3, 0),
        calc_xx(R, L, 5, 1, 0),
        calc_xx(D, L, 10, 2, 0),
    )

    if min_time == INF:
        print("SAFE")
    else:
        print(min_time)


main()


Measured memory_bytes: 195956
//Atcoder 125 A - Biscuit Generator
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int t = sc.nextInt();
		int ans = 0;
		ans = (t/a) * b;

		System.out.println(ans);

	}

}


Measured memory_bytes: 35868
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		String[] S=sc.next().split("");
		int K=sc.nextInt();
		String s_vlaue=S[K-1];
		String result="";

		for(int i=0;i<S.length;i++) {
			if(!S[i].equals(s_vlaue)) S[i]="*";
		}
		for(int i=0;i<S.length;i++) {
			System.out.print(S[i]);
		}
    }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}


int main(){
	int N, A, B;
	cin >> N >> A >> B;
	string S;
	cin >> S;

	int i = 0;
	int b = 0;
	for(auto& c : S){
		if(c == 'a') {
			Cout(Yes(i < A+B));
			if(i < A+B) i++;
		} else if(c == 'b'){
			Cout(Yes(i < A+B && b < B));
			if(i < A+B && b < B) i++, b++;
		} else {
			Cout("No");
		}
	}
}


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

using namespace std;

int main()
{
    vector<int> v={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << v[k-1] << endl;
    return 0;
}


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

int main() {
  int a, b, c, d, N;
  cin >> N;
  a = N / 1000;
  b = (N - 1000 * a) / 100;
  c = (N - 1000 * a - 100 * b) / 10;
  d = N - 1000 * a - 100 * b - 10 * c;    
  if (a == b && b== c || b == c && c== d) {
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
def is_square_num(n):
    
    mod256 = [
        0, 1, 4, 9, 16, 17, 25, 33, 36, 41,
        49, 57, 64, 65, 68, 73, 81, 89, 97, 100,
        105, 113, 121, 129, 132, 137, 144, 145, 153, 161,
        164, 169, 177, 185, 193, 196, 201, 209, 217, 225,
        228, 233, 241, 249 ]

    mod100 = [
        0, 1, 4, 9, 16, 21, 24, 25, 29, 36, 41, 44, 49, 56, 61, 64, 69, 76, 81, 84, 89, 96
    ]
    if not n % 256 in mod256:
        return False
    
    if not n % 100 in mod100:
        return False

    import math
    x = math.sqrt(n)

    # import numpy
    # x = numpy.sqrt(n)
    
    return x.is_integer()


n = input().replace(" ","")

print(['No','Yes'][is_square_num(int(n))])



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

#define ll long long
#define pb push_back
#define INF 1e9+7
#define cases int t;cin>>t;while(t--)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define ff first
#define ss second

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	string s;
	cin>>s;
	ll flag=0;
	ll n=s.size();
	ll i=0,j=s.size()-1;
	while(i<j){
		if(s[i]!=s[j]){
			flag=1;
			break;
		}
		i++;
		j--;
	}
	if(flag==1){
		cout<<"No\n";
		return 0;
	}
	i=0,j=(n-1)/2;
	j--;
	while(i<j){
		if(s[i]!=s[j]){
			flag=1;
			break;
		}
		i++;
		j--;
	}
	if(flag==1){
		cout<<"No\n";
		return 0;
	}
	i=n+3,j=n-1;
	i/=2;
	i--;
	while(i<j){
		if(s[i]!=s[j]){
			flag=1;
			break;
		}
		i++;
		j--;
	}
	if(flag==1){
		cout<<"No\n";
		return 0;
	}
	cout<<"Yes\n";


	
	
	
	return 0;
}

Measured memory_bytes: 3568
N = int(input())
A = [int(_) for _ in input().split()]
LIMIT = 10 ** 18


def solve():
    if any([x == 0 for x in A]):
        return "0"

    ans = 1
    for a in A:
        ans *= a
        if ans > LIMIT:
            return "-1"
    return str(ans)


print(solve())


Measured memory_bytes: 21612
#include<iostream>
#include<stdio.h>
using namespace std;

int T;
int p,q;
int main(){
    scanf("%d",&T);
    while(T--){
        scanf("%d%d",&p,&q);
        int ans=0;
        for(int m=-200;m<200;m++){
            for(int n=-200;n<200;n++){
                int l=m*m+n*n;

                if(l>0){
                    if( ( (m*p+n*q) % l == 0) && ((m*q-n*p) % l == 0) ){
                        ans++;
                    }
                }
            }
        }
        if(ans==8){
            printf("P\n");
        }
        else{
            printf("C\n");
        }
    }
    return 0;
}

Measured memory_bytes: 1168
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const inputs = input.trim().split('\n');
const [n, k] = inputs[0].split(' ').map(Number);
const wi = inputs.slice(1).map(Number);

const isAllocatable = (wi, p, k) => {
  for (let i = 0, w = 0; i < wi.length; i++) {
    if (wi[i] > p) {
      return false;
    }
    w += wi[i];
    if (w > p) {
      if (--k === 0) {
        return false;
      }
      w = wi[i];
    }
  }
  return true;
}

let l = 0;
let r = wi.reduce((a, b) => a + b) + 1;
while (l + 1 < r) {
  const p = Math.floor((l + r) / 2);
  if (isAllocatable(wi, p, k)) {
    r = p;
  } else {
    l = p;
  }
}
const p = r;
console.log(p);



Measured memory_bytes: 33108
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = long long unsigned;
using P = pair<int,int>;
const int INF=1001001001;
const int NMAX=8;
const int MOD=1000000007;
const int dbase=80*160;

int main()
{
	int n;
	cin>>n;
	vector<int> a(n);
	rep(i,n)cin>>a[i];
	int now=0;
	int cnt=0;
	rep(i,n){
		if (a[i]!=now+1) cnt++;
		else{
			now++;
		}
	}
	if (now==0) cnt=-1;
	cout<<cnt;
}


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

int main(){
	string weather[3]={"Sunny", "Cloudy", "Rainy"};
	string givenWeather;
 	getline(cin, givenWeather);

	for (int i = 0; i < 3; i++)
	{
		if((givenWeather.compare(weather[i])) == 0)
		{
			cout <<  weather[(i+1)%3];
			return 0;
		}
	}
	
	return 0;
}

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

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine().Trim().ToCharArray().Select(i => int.Parse(i.ToString())).ToArray();
            var ans = n.Any(i => i == 7);

            Console.WriteLine(ans ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 28156
#include <cstdio>

int main(){
  int S;
  scanf("%d", &S);

  int tmp, h,m,s;
  h = (int)S/3600;
  tmp = S-h*3600;
  m = (int)tmp/60;
  s = tmp-m*60;
  printf("%d:%d:%d\n",h,m,s);
  return 0;
}

Measured memory_bytes: 1020
S=input().strip()
T=input().strip()
fl=True
dicu={}
dicl={}
for i in range(len(S)):
    if S[i] in dicu:
        if dicu[S[i]] != T[i]:
            fl=False
            break
    else:
        dicu[S[i]]=T[i]
    if T[i] in dicl:
        if dicl[T[i]] != S[i]:
            fl=False
            break
    else:
        dicl[T[i]]=S[i]
if fl:
    print('Yes')
else:
    print('No')

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

using namespace std;

using ll = long long;

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

    ll a, b, k;
    cin >> a >> b >> k;

    bool is_a = true;
    for (int i = 0; i < k; ++i) {
        if (is_a) {
            if (a % 2 == 1) --a;
            b += a / 2;
            a = a / 2;
        }
        else {
            if (b % 2 == 1) --b;
            a += b / 2;
            b = b / 2;
        }
        is_a = !is_a;
    }

    cout << a << " " << b << endl;

    return 0;
}


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

template<class T> inline void chmin(T& a, const T& b) { if(b < a) a = b; }

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

	for(int e; cin >> e, e;) {
		int m = INT_MAX;
		for(int z = 0; z * z * z <= e; ++z) {
			const int z3 = z * z * z;
			for(int y = 0; y * y + z3 <= e; ++y) {
				const int x = e - z3 - (y * y);
				if(x >= 0)
					chmin(m, x + y + z);
					
			}
		}

		cout << m << endl;
	}

	return EXIT_SUCCESS;
}

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

int main(){
	long long int N, D, i, count=0;
	cin >> N >> D;
	long long int X[N], Y[N];
	
	for(i=0; i<N; i++){
		cin >> X[i] >> Y[i];
	}
	
	long long int D2 = D*D;
	
	for(i=0; i<N; i++){
		long long int d = X[i]*X[i]+Y[i]*Y[i];
		if(d<=D2){
			count++;
		}
	}
	
	cout << count << endl;
	
	return 0;
}


Measured memory_bytes: 6716
#include<bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define A first
#define B second
#define make_pair MP
#define MOD 1000000007
#define MAXM 100005
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int mulmd(ll a, ll b){
    ll ret = (a * b) % MOD;
    return (int)ret;

}

inline int power(ll x, ll y, int p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = mulmd(res,x);
        y = y>>1;
        x = mulmd(x,x);
    }
    return (int)res;
}

int submd(ll a, ll b){
    ll ret = a-b;
    if(ret<0){
        ret+=MOD;
    }
    return (int)ret;
}

int addmd(ll a, ll b){
    ll ret = (a + b) % MOD;
    return (int)ret;
}

int phi(int n){
    int result = n;
    for(int i=2;i*i<=n;i++){
        if(n%i==0){
            while(n%i==0){
                n=n/i;
            }
            result-=result/i;
        }
    }
    if(n>1) result-=result/n;
    return result;
}

int gcd(int a, int b, int& x, int& y){
    if(a==0){
        x=0;
        y=1;
        return b;
    }
    int x1,y1;
    int d = gcd(b%a, a, x1, y1);
    x = y1 - (b/a)*x1;
    y = x1;
    return d;
}

int arr[100005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<int>a(n);
    vector<int>b(n);
    vector<int>c(n-1);
    REP(i,n)
    cin>>a[i];
    REP(i,n)
    cin>>b[i];
    REP(i,n-1)
    cin>>c[i];
    int ans=0;
    REP(i,n-1)
    {
        ans+=b[a[i]-1];
        if(a[i+1]==(a[i]+1))
          ans+=c[a[i]-1];
        //DEBUG(ans);
    }
    ans+=b[a[n-1]-1];
    cout<<ans;

}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <ctype.h>
#include <iomanip>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <array>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <array>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
// #include <pair> 
       
using namespace std;
typedef pair<long long int, long long int> ii;
typedef vector<long long int> vi;
typedef vector<ii> vii;
#define INF 1000000000000000
       
#define endl '\n'
#define MOD 1000000007
// #define INF 1ll<<30
// #define MAX 100010
 
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES
 
// long long binpow(long long a,long long b)
// {
//     if (b == 1) return a;
//     long long res = binpow(a, b/2)%MOD;
//     if (b % 2) return (res*((res*a)%MOD))%MOD;
//     else return (res * res)%MOD;
// }
 
// long long int fact(long long int a)
// {
//     if(a==0||a==1)
//         return 1;
//     long long int ans = 1;
//     for(int i=a;i>=1;i--)
//         ans = (ans * i);
//     return ans;
// }
 
// long long int ivmod(long long int a)
// {
//     return binpow(a,MOD-2);
// }
 
// long long int ncr(long long int a,long long int b)
// {
//     long long int pans=1;
//     for(int i =a;i>max(b,a-b);i--)
//         pans=pans*i;
//     long long int div = fact(min(b,a-b));
//     pans = pans/div;
//     return pans;
// }

vector< vector< int > > g(102);
vector<int> ans;
bool vis[102];

void dfs(int node)
{
    vis[node] =1;
    for(int i=0;i<g[node].size();i++)
    {
        int temp = g[node][i];
        if(vis[temp]==0)
        {
            dfs(temp);
        }
    }
    ans.push_back(node);
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(0);
    cout<<fixed;

#ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
#endif
    string a;
    cin>>a;
    if(a.size()>=4)
    {
        if(a[0]=='Y'&&a[1]=='A'&&a[2]=='K'&&a[3]=='I')
            cout<<"Yes";
        else
            cout<<"No";
    }
    else
        cout<<"No"<<endl;
#ifndef ONLINE_JUDGE
   cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif

    return 0;
}   


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define MAXN 301
#define LL long long
using namespace std;
LL n,m,l;
LL dis[MAXN][MAXN];
LL ans[MAXN][MAXN];
int main()
{
    for(int i=0;i<MAXN;i++)
        for(int j=0;j<MAXN;j++)
            ans[i][j]=dis[i][j]=1000000000ll*100000000ll;
    scanf("%lld%lld%lld",&n,&m,&l);
    
    for(int i=1;i<=m;i++)
    {
        int tx,ty,tz;
        scanf("%d%d%d",&tx,&ty,&tz);
        dis[tx][ty]=dis[ty][tx]=tz;
    }
    
    for(int k=1;k<=n;k++)
    {
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
            }
        }
    }
    
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            if(dis[i][j]<=l)ans[i][j]=1;
    
    for(int k=1;k<=n;k++)
        for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++)
                ans[i][j]=min(ans[i][j],ans[i][k]+ans[k][j]);
    
    int q;
    scanf("%d",&q);
    for(int i=1;i<=q;i++)
    {
        int tx,ty;
        scanf("%d%d",&tx,&ty);
        printf("%lld\n",ans[tx][ty]==ans[0][0]?-1:ans[tx][ty]-1);
    }
    
    
    return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};


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

    int n,x,t; cin>>n>>x>>t;
    int ans = (n + x - 1) / x * t;
    cout << ans << endl;
}   

Measured memory_bytes: 3648
#include<iostream>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<=int(b);++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

using namespace std;
using ll = long long;

int main()
{
    // 整数の入力
    int k,a,b;
    cin >> k >> a >> b;
    
    repi(i,a,b){
        if(i%k == 0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<set>
#include<bitset>
#include<cmath>
#include<numeric>
#include<limits>

#define REP(i, m, n) for(int i = (m); i < (n); i++)
#define rep(i,n) REP(i,0,n)
#define NIL -1
using namespace std;
typedef long long ll;
typedef long long int lli;
static const int MOD = 10000007;

string s;
int N;


vector<int> move(queue<int> R, queue<int> L) {
  vector<int> S(s.size(), 0);
  int cumr = 0, r, l;
  while(!R.empty()) {
    r = R.front(); R.pop();
    l = L.front(); L.pop();
    cumr += r;
    int even = (r+1)/2 + l/2;
    int odd = r + l - even;
    S[cumr-1] = even;
    S[cumr] = odd;
    cumr += l;
  }
  return S;
}


int main() {
  cin >> s;
  queue<int> R, L;
  int r = 0, l = 0, flag = 1;
  rep(i, s.size()){
    if (s[i] == 'R') {
      if(flag == 1) {
        r++; // R -> R
      } else { // L -> R
        L.push(l);
        r = 1;
        flag = 1;
      }
    }

    if (s[i] == 'L') {
      if (flag == 1) {
        R.push(r);
        l = 1; // R -> L
        flag = 0;
      } else {
        l++; // L -> L
      }
    }
  }
  L.push(l); // last l

  if ( R.size() != L.size() ) {
    cout << "ERROR: R neq L" << endl;
  } else {
    vector<int> S = move(R, L);
    rep(i, S.size()) {
      cout << S[i] << " ";
    }
    cout << endl;
  }
}


Measured memory_bytes: 1536
import java.util.Scanner

import scala.collection.Searching._
import scala.annotation.tailrec
import scala.collection.immutable.{NumericRange, Queue}
import scala.collection.mutable
import scala.io.StdIn.readLine

class IUnionFind(val size: Int) {

  private case class Node(var parent: Option[Int], var treeSize: Int)

  private val nodes = Array.fill[Node](size)(new Node(None, 1))

  def union(t1: Int, t2: Int): IUnionFind = {
    if (t1 == t2) return this

    val root1 = root(t1)
    val root2 = root(t2)
    if (root1 == root2) return this

    val node1 = nodes(root1)
    val node2 = nodes(root2)

    if (node1.treeSize < node2.treeSize) {
      node1.parent = Some(t2)
      node2.treeSize += node1.treeSize
    } else {
      node2.parent = Some(t1)
      node1.treeSize += node2.treeSize
    }
    this
  }

  def connected(t1: Int, t2: Int): Boolean = t1 == t2 || root(t1) == root(t2)

  def root(t: Int): Int = nodes(t).parent match {
    case None => t
    case Some(p) => root(p)
  }
}


object Main {
  def solve(sc: => Scanner): Unit = {
    val N, d = sc.nextInt
    val ans = Array.fill(N)(sc.nextInt - d).filter(_ >= 0).sum
    println(if (ans == 0) ("kusoge") else (ans))
  }

  def gcd(i: Long, j: Long): Long = {
    if (i < j) (gcd(j, i)) else (if (j == 0) (i) else (gcd(j, i % j)))
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}


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

using namespace std;

int H, W;
vector<vector<char>> s;

int main(void){
    int w = 0;
    cin >> H >> W;
    s.resize(W, vector<char>(H, 0));
    for(int j=0;j<H;j++){
        for(int i=0;i<W;i++){
            cin >> s[i][j];
            if(s[i][j] == '.') w++;
        }
    }

    struct info{
        int x, y, d;
    };

    int a = -1;
    queue<info> q;
    q.push(info{0, 0, 1});
    while(!q.empty()){
        auto f = q.front(); q.pop();
        if(f.x < 0 || f.y < 0 || f.x >= W || f.y >= H) continue;
        if(s[f.x][f.y] == '#' || s[f.x][f.y] == 'X') continue;
        if(f.x == W-1 && f.y == H-1){
            a = f.d;
            break;
        }
        s[f.x][f.y] = 'X';
        q.push(info{f.x+1, f.y, f.d+1});
        q.push(info{f.x-1, f.y, f.d+1});
        q.push(info{f.x, f.y+1, f.d+1});
        q.push(info{f.x, f.y-1, f.d+1});
    }

    if(a == -1) cout << -1 << endl;
    else cout << w-a << endl;
    return 0;
}

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

using namespace std;



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

    int n, T;
    cin >> n >> T;
    vector <int> A(n);
    vector <int> suff(n);

    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }
    suff[n - 1] = A[n - 1];

    for (int i = n - 2; i >= 0; i--) {
        suff[i] = max(suff[i + 1], A[i]);
    }
    int best = 0;

    for (int i = 0; i < n - 1; i++) {
        best = max(best, suff[i + 1] - A[i]);
    }
    int res = 0;

    for (int i = 0; i < n - 1; i++) {
        if (suff[i + 1] - A[i] == best) {
            res++;
        }
    }
    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 1024
N,Q=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(N-1)]
A.sort()

cost=[0]*(N+1)

for _ in range(Q):
	a,b=map(int,input().split())
	cost[a]+=b

for a in A:
	cost[a[1]] += cost[a[0]]
print(*cost[1:])

Measured memory_bytes: 66708
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n, v[20], c[20], x = 0;
	cin >> n;
	for (int a = 0; a < n; a++) {
		cin >> v[a];
	}
	for (int b = 0; b < n; b++) {
		cin >> c[b];
	}
	for (int i = 0; i < n; i++) {
		if (v[i] > c[i]) {
			x += v[i] - c[i];
		}
	}
	cout << x << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

	public void run() {
		while(sc.hasNextLine()){
			char[] str=sc.nextLine().toCharArray();
			StringBuilder res=new StringBuilder();
			for(int i=0;i<str.length;i++){
				if(str[i]=='@'){
					i++;
					int n=str[i]-'0';
					i++;
					for(int j=0;j<n;j++){
						res.append(str[i]);
					}
				}else{
					res.append(str[i]);
				}
			}
			ln(res);
		}
	}

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

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}
class P {
	double x;
	double y;
	P(double _x,double _y){
		x=_x;
		y=_y;
	}

	public static  final P Xunit=new P(1,0);
	public static  final P Yunit=new P(0,1);

	public static double dot(P a,P b){
			return a.x*b.x+a.y*b.y;
	}
	public static  double cross(P a,P b){
		return a.x*b.y-a.y*b.x;
	}
	public static boolean isParallel(P a1,P a2,P b1,P b2){
		return Math.abs(cross(a2.s(a1),b2.s(b1)))<Double.MIN_NORMAL;
	}
	public static boolean isVertical(P a1,P a2,P b1,P b2){
		return Math.abs(dot(a2.s(a1),b2.s(b1)))<Double.MIN_NORMAL;
	}

	public P a(P a){
		return new P(x+a.x,y+a.y);
	}
	public P s(P a){
		return new P(x-a.x,y-a.y);
	}

	public double norm(){
		return Math.sqrt(x*x+y*y);
	}

	public double arg(){
		double s=Math.acos(x/norm());
		return y>0?s:2*Math.PI-s;
	}

	public P rotate(double t){
		return new P(Math.cos(t)*this.x-Math.sin(t)*this.y,Math.sin(t)*this.x+Math.cos(t)*this.y);
	}

	public static int ccw(P a,P b,P c){
		if(P.cross(b.s(a),c.s(a))>Double.MIN_NORMAL){
			return 1;
		}
		if(P.cross(b.s(a),c.s(a))<-Double.MIN_NORMAL){
			return -1;
		}
		if(P.dot(b,c)<-Double.MIN_NORMAL)return 2;
		if(b.norm()<c.norm()-Double.MIN_NORMAL)return -2;
		return 0;
	}

	@Override
	public boolean equals(Object obj) {
		if(obj instanceof P){
			P p=(P)obj;
			return x==p.x && y==p.y;
		}
		return false;
	}
	public String toString(){
		return "("+x+","+y+")";
	}
}

Measured memory_bytes: 12000
#include <stdio.h>
#include <string.h>
int main(void){

    char str1[200020], str2[200020];
    scanf("%s", str1);
    scanf("%s", str2);

    int count = 0;
    for(int i = 0; i < strlen(str1); i++){
        if(str1[i] != str2[i]){
            count++;
        }
    }
    
    printf("%d\n", count);

   
    return 0;
}

Measured memory_bytes: 2120
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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;
}

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   int N, M;
   cin >> N >> M;
   int ans[N];
   memset(ans, 0, sizeof(ans));
   int a, b;
   for (int i = 0; i < M; i++) {
      cin >> a >> b;
      a--;
      b--;
      ans[a]++;
      ans[b]++;
   }
   for (int i = 0; i < N; i++) {
      cout << ans[i] << endl;
   }
   return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<vector>
#include<utility>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
int n,x,l[105],a[105],ans;
int main(){
	cin>>n>>x;
	for(int i=1;i<=n;i++)
		cin>>l[i];
	a[1]=0;
	for(int i=2;i<=n+1;i++)
		a[i]=a[i-1]+l[i-1];
	for(int i=1;i<=n+1;i++)
		if(a[i]<=x)
			ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
const ll ATCODER_AMARI = 1000000007; //10^9 + 7
const ll INF = 10000000000000;

//階乗関数　ATCODER_AMARIに注意
ll factorial(ll k){
  ll sum = 1;
  for(int i = 1 ; i < k + 1; i++) {
    sum *= i;
    //sum = sum % ATCODER_AMARI;
  }
  return sum;
}

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

  ll baisu_max = ceil(sqrt(n));

  ll ans_min = INF;

  rep(i,baisu_max + 1) {
    if(i == 0) continue;
    
    if(n % i == 0) {
      ll tmp = floor(log(i) / log(10)) + 1;
      ll tmp2 = floor(log(n / i) / log(10)) + 1;
      ll tmp_ans = max(tmp,tmp2);

      ans_min = min(ans_min,tmp_ans);
    }
  }

  cout << ans_min << endl;
}


Measured memory_bytes: 3736
#include <iostream>
#include <vector>
#include <set>
#include <cstring>
#include <queue>
#define pb push_back
#define tam 520004
#define offset 320000
#define se second
#define fi first
#define pitem item*
#define ptr tre*
#define forr(i,p,n) for(ll i=p;i<n;i++)
using namespace std;
typedef long long ll;
const ll MOD=1000000007 ;
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
typedef pair<ll,ll> ii;
typedef pair<ll,ii> iii;
vector<ii> grafo[tam];
bool vis[tam],marca[tam];
ll peso[tam];
void dfs(ll num)
{
    ll hijo;
    vis[num]=true;

    for(ll i=0;i<grafo[num].size();i++)
    {
        hijo=grafo[num][i].fi;
        if (vis[hijo]==false)
        {
            peso[hijo]=peso[num]+grafo[num][i].se;
            dfs(hijo);
        }
        else
        {
            if (peso[num]+grafo[num][i].se>peso[hijo])
            {
                marca[hijo]=1;
            }
        }
    }
}
ll dp[tam];
ll n,m;
ll f(int num)
{
    if (num==n-1)
        return 0;
    if (dp[num]!=-1e15)
        return dp[num];
    vis[num]=1;
    ll maxx=-1e15;
    forr(i,0,grafo[num].size())
    {
    int  hijo=grafo[num][i].fi;
        if (vis[hijo]==1)
            continue;
        maxx=max(maxx,f(hijo)+grafo[num][i].se);
    }
    return dp[num]=maxx;
}
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);

    cin>>n>>m;
    ll iz,der,pe;
    forr(i,0,m)
    {
        cin>>iz>>der>>pe;
        iz--,der--;
        grafo[iz].pb(ii(der,pe));
    }
    memset(vis,0,sizeof vis);
    memset(marca,0,sizeof marca);
    peso[0]=0;
    dfs(0);
    memset(vis,0,sizeof vis);
    memset(peso,0,sizeof peso);
    priority_queue<ii> cola;
    cola.push(ii(marca[0],0));
    peso[0]=marca[0];
    while(!cola.empty())
    {
        ll num=cola.top().se;
        pe=cola.top().fi;
        cola.pop();
        if (vis[num])
            continue;
        vis[num]=1;
        //cout<<pe<<" "<<num<<endl;
        forr(i,0,grafo[num].size())
        {
           ll  hijo=grafo[num][i].fi;
            if (peso[hijo]<=pe+marca[hijo])
            {
                peso[hijo]=pe+marca[hijo];
                cola.push(ii(peso[hijo],hijo));
            }
        }
    }
    if (peso[n-1]!=0)
    {
        cout<<"inf"<<endl;
    }
    else
    {
        memset(vis,0,sizeof vis);
        forr(i,0,tam)
        dp[i]=-1e15;
        cout<<f(0)<<endl;
    }

}


Measured memory_bytes: 21760