akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define Phuong // <3
typedef pair<int,int> ii;


int main()
{
#ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
#endif // ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; ++i)
    cin >> a[i];
    int minn=a[n-1];
    bool f=true;
    for(int i=n-2;i>=0; --i)
    {
        if (a[i]>minn)
        {
            a[i]--;
            if (a[i]>minn)
            {
                f=false;
                break;
            }
        }
        minn=a[i];
    }
    puts((f)?"Yes":"No");
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main()
{
	long long a,b;
	cin>>a>>b;
	long long p[55],q[55];
	p[0]=1;
	q[0]=1;
	for(int i=1;i<=50;i++){
		p[i]=p[i-1]*2+3;
		q[i]=q[i-1]*2+1;
	}
	long long ans=0;
	while (b>0){
        if(b==p[a]){
            ans+=q[a];
            b=0;
        }
		else if(b>=p[a]/2+1){
            ans+=q[a-1]+1;
            b-=p[a]/2+1;
        }
		else
        b--;
        a--;
    }
	cout<<ans<<endl;
}

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

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define mp make_pair

int n;
char message[10000000];

void solve() {
  map<char,char> ct;
  rep(i,n) {
    char from, to; cin>>from>>to;
    ct.insert(mp(from, to));
  }
  
  int m; cin>>m;
  rep(i,m) cin>>message[i];
  
  rep(i,m) {
    if (ct.count(message[i])) message[i] = ct[message[i]];
  }
  
  rep(i,m) cout<<message[i];
  cout<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>n, n) {
    solve();
  }
  return 0;
}

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

using namespace std;

#define MAX 100000

int main(){
  string str;
  int cnt[3];
  
  cin >> str;

  int ans = 0, size = str.size();
  const char JOI[3] = {'J','O','I'};

  for(int i = 0 ; i < size ; i++){
    if(str[i] == 'J'){
      memset(cnt,0,sizeof(cnt));
      for(int j = 0 ; j < 3 ; j++){
        while(i != size && JOI[j] == str[i]){
          cnt[j]++; i++;
        }
      } 
      i--;
      if(cnt[0] < cnt[1]) continue;
      if(cnt[1] > cnt[2]) continue;
      ans = max(ans, *min_element(cnt, cnt + 3));  
    }

  }
  cout << ans << endl;

  return 0;
}

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

void push(int);
int pop(void);

int top = 0;
int S[101];

int main(){
  int x;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      push(pop()+pop());
    } else if ( s[0] == '-' ){
      x = pop()-pop();
      push(x * -1);
    } else if ( s[0] == '*' ){
      push(pop()*pop());
    } else {
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n",S[1]);

  return 0;
}

void push(int x){
  if(top == 101)exit(1);
  top++;
  S[top] = x;
}

int pop(void){
  if(top == 0)exit(2);
  top--;
  return S[top+1];
}



Measured memory_bytes: 2048
k = int(input())
L = [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]
print(L[k-1])

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

using namespace std;

const int N = 100005;
int f[N];

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    for (int i = 0; i < q; i++) {
        int x;
        cin >> x;
        f[x]++;
    }
    for (int i = 1; i <= n; i++) {
        if (k - (q - f[i]) > 0) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A = sc.nextInt();
    int[] x = new int[N];
    for(int i = 0; i < N; i++) {
      x[i] = sc.nextInt();
    }
    // dp[i][j][k]はx[0]～x[i]の中からk個選んで和をjにする選び方の総数を表す
    long[][][] dp = new long[N][2501][N + 1];
    dp[0][0][0] = 1;
    dp[0][x[0]][1] = 1;
    for(int i = 1; i < N; i++) {
      for(int j = 0; j < 2501; j++) {
        for(int k = 0; k < N + 1; k++) {
          if(k == 0) {
            if(j == 0) {
              dp[i][j][k] = 1; 
            } else {
              dp[i][j][k] = 0;
            }
          } else {
            if(j >= x[i]) {
              dp[i][j][k] = dp[i - 1][j - x[i]][k - 1] + dp[i - 1][j][k];
            } else {
              dp[i][j][k] = dp[i - 1][j][k];
            }
          }
        }
      }
    }
    long ans = 0;
    for(int k = 1; k <= N; k++) {
      ans += dp[N - 1][A * k][k];
    }
    System.out.println(ans);
  }
}


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

int main() {
  double w, h, x, y;
  bool flg;
  cin >> w >> h >> x >> y;
  flg = (x == 0.5*w) && (y == 0.5*h);
  cout << 0.5*w*h << " " << flg << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100
int main(){

  int n,i,j,minj;
  int flag=0,array[N];
  int temp,count=0;
  
  scanf("%d",&n);

  for(i=0;i<n;i++)
    scanf("%d",&array[i]);

  for(i=0;i<n;i++){

    minj=i;

    for(j=i;j<n;j++){

      if(array[minj]>array[j]){

	minj=j;
	flag=1;
	
    }
    }
    if(flag==1){
      count++;
      flag=0;
    }
    temp=array[i];
    array[i]=array[minj];
      array[minj]=temp;
      
 
  }

  for(i=0;i<n-1;i++)
    printf("%d ",array[i]);

    printf("%d\n",array[n-1]);
    printf("%d\n",count);
  return 0;

}

Measured memory_bytes: 2744
#include <iostream>
#include <vector>
//#include <list>
#include <queue>
//#include <unordered_map>
#include <algorithm>
//#include <string>
#include <cstring>
#include <cmath>
using namespace std;

int main()
{
	int n;
	int i,j,k,m;
	cin>>n;
	if(n<2)
	{
		cout<<0<<"\n";
		return 0;
	}
	vector<int> dp(n+1,0);
	vector<int> a(n);
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	dp[1]=max(a[1]-a[0],a[0]-a[1]);
	if(n==2)
	{
		cout<<dp[1]<<"\n";
		return 0;
	}
	int x,y,z;
	for(i=2;i<n;i++)
	{
		z=a[i]-a[i-1];
		z=(z>0) ? z : -1*z;
		y=a[i]-a[i-2];
		y=(y>0) ? y : -1*y;
		dp[i]=min(dp[i-2]+y, dp[i-1]+z);
	}
	cout<<dp[n-1]<<"\n";
	return 0;
}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    lint a,b,c,ans,k;cin>>a>>b>>c>>k;
    if(k%2==0){
        ans=a-b;
    }
    else ans=b-a;
    cout<<ans<<endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,x,y;
    cin>>x>>y;
    a=x+y;
    b=x-y;
    c=x*y;
    if((a>=b)&&(a>=c)){
        cout<<a<<endl;
    }
    else if((b>=c)&&(b>=a)){
        cout<<b<<endl;
    }
    else{
        cout<<c<<endl;
    }
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    string s;
    cin >> s;
    int n = s.size();
    if(s[0] == '0' || s[n-1] == '1')
    {
        cout << -1 << endl;
        return 0;
    }
    for(int i = 0; i < n-1; i++)
    {
        if(s[i] != s[n-2-i])
        {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << "1 2" << endl;
    cout << "2 3" << endl;
    int now = 2;
    for(int i = 1; i < n-2; i++)
    {
        if(s[i] == '0')
        {
            cout << now << " " << i+3 << endl;
        }
        else
        {
            cout << i+2 << " " << i+3 << endl;
            now = i+2;
        }
    }
}


Measured memory_bytes: 3760
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue> 
 
using namespace std;

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

	int N, M;

	cin >> N >> M;

	if(N == M) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 892
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		double[] s = new double[a];
		for (int i = 0; i < a; i++) {
			s[i] = scan.nextDouble();
		}
		Arrays.sort(s);
		for (int i = 0; i < a - 1; i++) {
			s[i + 1] = (s[i] + s[i + 1]) / 2;
		}
		System.out.println(s[a - 1]);
	}
}


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

using namespace std;

int main()
{
    int t;
    cin >> t;
    t = t % 10;
    if( t == 3 )
        cout << "bon" << endl;
    else if( t == 0 || t == 1 || t == 6 || t == 8 )
        cout << "pon" << endl;
    else
        cout << "hon" << endl;
    
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>

using namespace std;

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

	vector<pair<long long, int>> stores;
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		pair<long long, int> s;
		cin >> s.first >> s.second;
		stores.push_back(s);
	}
	sort(stores.begin(), stores.end());
	long long ans = 0;
	for (auto s : stores) {
		ans += s.first * 1LL * ((m - s.second) < 0 ? m : s.second);
		m -= s.second;
		if (m < 0) break;
	}
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 2420
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
int cnt(int l, int k){
  return max(l-k+1, 0);
}
int main(){
  	int N, X, Y;
    cin >> N >> X >> Y;

    int dis[N+1][N+1];
    for(int i=1;i<N;i++){
      for(int j=i+1;j<=N;j++){
        dis[i][j] = j-i;
      }
    }

    for(int i=1;i<N;i++){
      for(int j=i+1;j<=N;j++){
        dis[i][j] = min(dis[i][j], abs(X-i)+1+abs(Y-j));
      }
    }

    int cnt[N];
    for(int k=0;k<N;k++) cnt[k] = 0;


    for(int i=1;i<N;i++){
      for(int j=i+1;j<=N;j++){
        cnt[dis[i][j]]++;
      }
    }

    for(int k=1;k<N;k++){
      cout << cnt[k] <<endl;
    }

    
  	return 0;
}


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

int main() {
    string s;
    cin >> s;

    int ans = 0;
    string bunkatu = "";
    string bunkatu_bef = "";
    for (int i = 0; i < s.size(); i++) {
        bunkatu += s[i];
        if (bunkatu == bunkatu_bef) {
            continue;  // 前の分割と同じならば、さらに分割文字を伸ばす。
        } else {
            // 前の分割と異なるならば、bunkatuは新しい分割として採用する。
            // それを bunkatu_bef に保存し、新しい分割との比較対象にする。
            bunkatu_bef = bunkatu;
            bunkatu = "";
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
int main()
{
  int x, n;
  scanf("%d %d", &x, &n);
  int p[n], i;
  int a[101];
  int ans = x;
  int cnt = 0;
  for (i = 0; i <= 100; i++)
    a[i] = i;
  
  for (i = 0; i < n; i++)
  {
    scanf("%d", &p[i]);
    a[p[i] - 1] = -1;
  }
  
  for (i = 0; i <= 100; i++)
  {
    if (a[x - 1 - i] >= 0)
    {
      printf("%d", x - i);
      return 0;
    }
    if (a[x - 1 + i] >= 0)
    {
      printf("%d", x + i);
      return 0;
    }
  }
}

Measured memory_bytes: 1712
#include"bits/stdc++.h"


#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(int x = (l);x<=(u);x++)
#define RREP(x,l,u) for(int x = (l);x>=(u);x--)
#define mst(x,a) memset(x,a,sizeof(x))
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define cl(x) x.clear()

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;

const int maxn = 200010;
const int mod = 1e9+7;
const int MAX = 1000000010;
const double eps = 1e-6;
const double PI = acos(-1);

template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

template<typename A,typename B> inline void read(A&x,B&y){read(x);read(y);}
template<typename A,typename B,typename C> inline void read(A&x,B&y,C&z){read(x);read(y);read(z);}
template<typename A,typename B,typename C,typename D> inline void read(A&x,B&y,C&z,D&w){read(x);read(y);read(z);read(w);}
template<typename A,typename B> inline A fexp(A x,B p){A ans=1;for(;p;p>>=1,x=1LL*x*x%mod)if(p&1)ans=1LL*ans*x%mod;return ans;}
template<typename A,typename B> inline A fexp(A x,B p,A mo){A ans=1;for(;p;p>>=1,x=1LL*x*x%mo)if(p&1)ans=1LL*ans*x%mo;return ans;}


int main(){
	int a,b,c,k;
	read(a,b,c,k);
	if(k&1)cout<<b-a<<endl;else cout<<a-b<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
class Main{
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		long MOD=1000000007L;
		
		int n=sc.nextInt();
		String s[]=new String[n];
		int p[]=new int[n];
		long sum[]= new long[n];
		Map<Long,Integer> map = new HashMap<>();
		for(int i=0;i<n;++i) {
			s[i]=sc.next();
			p[i]=sc.nextInt();
			
			for(int m=10;m>0;--m) {
				if(s[i].length()>=11-m)sum[i]=sum[i]+('z'-s[i].charAt(10-m)+1)*(long)Math.pow(30, m);
				else sum[i]=sum[i]+('z'-'a'+2)*(long)Math.pow(30, m);
			}
			sum[i]+=p[i];
			map.put(sum[i], i);
			
		}
		
		Arrays.sort(sum);
		
		for(int i=n-1;i>=0;--i) {
			System.out.println(map.get(sum[i])+1);
		}
	}
	
}


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

int main() {
  int N, M, a, b;
  cin >> N >> M;
  vector<int> num(N);
  for (int i = 0; i < M; i++){
    cin >> a >> b;
    num.at(a-1)++;
    num.at(b-1)++;
  }
  for (int i = 0; i < N; i++){
    cout << num.at(i) << endl;
  }
}


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

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

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    string s;
    string t;
    cin >> s;
    cin >>t;
    
    sort(s.begin(),s.end());
    sort(t.begin(),t.end(),greater<char>());
    
   if(s<t){
       printf("Yes\n");
   }else{
       printf("No\n");
   }
    return 0;
}


Measured memory_bytes: 256
# n=int(input())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

a,b,t=map(int, input().split())

print(b * math.floor(((t + 0.5) / a)))


Measured memory_bytes: 18856
import numpy
import sys

N,M,X=map(int,(input().split()))
book=[list(map(int,input().split())) for _ in range(N)]

row_sum = numpy.sum(book, axis=0)
if(min(row_sum)<X):
  print("-1")
  sys.exit()

result=-1
for i in range(2**N):
  t=[0]*M
  money=0
  for j in range(N):
    # 右から数えてj番目の本が0の場合はcontinue,1の場合は購入
    if (i>>j)&1==0:
      continue
    money+=book[j][0]
    for k in range(1,M+1):
      t[k-1]+=book[j][k]
  # すべての習熟度がX以上ならば
  if all(xx>=X for xx in t):
    if(result==-1):
      result=money
    else:
      result=min(result,money)
print(result)

Measured memory_bytes: 27240
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
int main() {
	string s;
	int k;
	cin >> s >> k;
	vector<string> sub;
	rep(i, 0, s.size()) {
		string t = "";
		rep(i2, 0, k) {
			if (i + i2 >= s.size())break;
			t += s[i + i2];
			sub.push_back(t);
		}
	}
	sort(all(sub));
	vec_unique(sub);
	puts(sub[k - 1].c_str());
	return 0;
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using PL = pair<ll, ll>;
// Welcome to my source code!

int main() {
    int x;
    cin >> x;
    ll ans = 0;
    ans += (x / 500) * 1000;
    x %= 500;
    ans += (x / 5) * 5;
    x %= 5;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <queue>
#include <vector>
#include <functional>

using namespace std;

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

int main() {
    long N, M;
    cin >> N >> M;

    long A, B;
    priority_queue<pair<long, long>, vector<pair<long, long> >, greater<pair<long, long> > > que;
    REP(0, i, N) {
        cin >> A >> B;
        que.push(make_pair(A, B));
    }

    long ans = 0;
    REP(0, i, N) {
        pair<long, long> p = que.top(); que.pop();

        if (M > p.second) {
            ans += p.first * p.second;
            M -= p.second;
        } else {
            ans += p.first * M;
            M = 0;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int N,i,j,tmp,sum=0;
    cin >> N;
    for(i=1;i<=N;i+=2){
        tmp=0;
        for(j=1;j<=i;j+=2){
            if( i%j == 0) tmp++;
        }
        if(tmp == 8) sum++;
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  string a[3];
  int b[3]={};//vectory
  int c[3]={};
  int d=0;
  for(int i=0;i<3;i++) cin>>a[i];
  while(true){
    b[d]++;
    if(b[0]==a[0].size()+1){
      cout<<"A\n";
      break;
    }
    if(b[1]==a[1].size()+1){
      cout<<"B\n";
      break;
    }
    if(b[2]==a[2].size()+1){
      cout<<"C\n";
      break;
    }
    if(a[d][c[d]]=='a') c[d]++,d=0;
    else{
      if(a[d][c[d]]=='b') c[d]++,d=1;
      else c[d]++,d=2;
    }
  }
}

Measured memory_bytes: 256
#pragma GCC optimize "03"
#include "bits/stdc++.h"
using namespace std;
 
#define ll long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
 
signed main() {
	IOS;
	#ifdef LOCAL
		freopen("input.txt","r", stdin);
		freopen("output.txt","w",stdout);
	#endif
	string s;	cin >> s;
	for(int i = 0; i < 3; i++){
		if(s[i] == s[i+1])
			return cout << "Bad", 0;
	}	
	cout << "Good";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)
#define SHOWP(x) cerr<<"("<<(x).FI<<", "<<(x).SE<<")"<<endl;
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}

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


ll dp[110][110][500];
int main()
{
  REP(i, 110) REP(j, 110) REP(k, 500) dp[i][j][k] = -1;
  ll N, W;
  cin >> N >> W;
  vector<ll> v(N), w(N);
  REP(i, N) cin >> w[i] >> v[i];

  dp[0][0][0] = 0;
  REP(i, N) {
    REP(j, N) {
      REP(k, 400) {
        if (dp[i][j][k] == -1) continue;
        dp[i + 1][j][k] = max(dp[i + 1][j][k], dp[i][j][k]);
        dp[i + 1][j + 1][k + (w[i] - w[0])] = max(dp[i + 1][j + 1][k + (w[i] - w[0])], dp[i][j][k] + v[i]);
      }
    }
  }

  ll ans = -1;
  REP(i, N + 1) {
    REP(j, 400) {
      if (w[0]*i + j <= W) ans = max(ans, dp[N][i][j]);
    }
  }
  cout << ans << endl;

  return 0;
}

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

using namespace std;

int main () {

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);

    long long X, K, D; cin >> X >> K >> D;
    long long KK = K;
    if (X > 0) {
        K -= min(X/D, K);
        X -= D * min(X/D, KK);
        cout << (K%2 == 0? X: D - X) << '\n';
    }else {
        K -= min(-X/D, K);
        X += D * min(-X/D, KK);
        cout << (K%2 == 0 ? -X: D + X) << '\n';
    }

    return 0;
}



Measured memory_bytes: 3604
let () = Scanf.scanf "%d %d\n" @@ fun h w ->
  let ass =
    Array.init h @@ fun _ ->
      Array.init w @@ fun _ ->
        Scanf.scanf "%d " @@ fun a -> a in
  let moves = ref [] in
  for i = 0 to h - 1 do
    if i mod 2 = 0 then begin
      for j = 0 to w - 2 do
        if ass.(i).(j) mod 2 = 1 then begin
          ass.(i).(j + 1) <- 1 + ass.(i).(j + 1);
          moves := (i, j, i, j + 1) :: !moves
        end
      done;
      if ass.(i).(w - 1) mod 2 = 1 && i + 1 < h then begin
        ass.(i + 1).(w - 1) <- 1 + ass.(i + 1).(w - 1);
        moves := (i, w - 1, i + 1, w - 1) :: !moves
      end
    end else begin
      for j = w - 1 downto 1 do
        if ass.(i).(j) mod 2 = 1 then begin
          ass.(i).(j - 1) <- 1 + ass.(i).(j - 1);
          moves := (i, j, i, j - 1) :: !moves
        end
      done;
      if ass.(i).(0) mod 2 = 1 && i + 1 < h then begin
        ass.(i + 1).(0) <- 1 + ass.(i + 1).(0);
        moves := (i, 0, i + 1, 0) :: !moves
      end
    end
  done;
  Printf.printf "%d\n" (List.length !moves);
  if !moves = [] then print_newline ()
  else List.iter (fun (y, x, y', x') ->
    Printf.printf "%d %d %d %d\n" (y + 1) (x + 1) (y' + 1) (x' + 1)) !moves

                
            



Measured memory_bytes: 15360
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			long n = scanner.nextLong();
			int x = scanner.nextInt(), m = scanner.nextInt();
			List<Long> list = new ArrayList<>();
			// contains判定用
			Set<Long> set = new HashSet<>();
			long next = x % m;
			list.add(next);
			set.add(next);
			while (list.size() < n) {
				next = next * next % m;
				if (set.contains(next)) {
					break;
				}
				set.add(next);
				list.add(next);
			}
			if (list.size() == n) {
				// n項目に到達する場合
				System.out.println(list.stream().mapToLong(i -> i).sum());
			} else {
				// 繰り返しの始まるindex
				int start = list.indexOf(next);
				// 繰り返しの合計
				long loop = list.stream().skip(start).mapToLong(i -> i).sum();
				// 繰り返しが始まるまでの合計
				long startSum = list.stream().mapToLong(i -> i).limit(start).sum();
				// 繰り返しの回数
				long bai = (n - start) / (list.size() - start);
				// 繰り返し1周に満たない最後の部分の個数
				long remain = (n - start) % (list.size() - start);
				System.out.println(
						startSum + bai * loop + list.stream().mapToLong(i -> i).skip(start).limit(remain).sum());
			}
		}
	}
}


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

using namespace std;
using ll = long long;
const int INF = 1e9 + 5;

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  for(int& i : h) 
    	cin >> i;
  vector<int> dp(n, INF);
  dp[0] = 0;
  for(int i=0; i<n; i++) {
    for(int j : {i + 1, i + 2}) {
      if(j < n)
        	dp[j] = min(dp[j] , dp[i] + abs(h[i] - h[j]));
    }
  }
  cout << dp[n-1];
  return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {

	class Point{
		int y, x;
		Point(int y, int x){
			this.y = y;
			this.x = x;
		}
	}

	char[][] board;
	int[] dx = {0,0,1,-1};
	int[] dy = {1,-1,0,0};
	int W, H;

	void run(){
		Scanner in = new Scanner(System.in);
		for(;;){
			W = in.nextInt() + 2;
			H = in.nextInt() + 2;
			if(W==2 && H==2) return;
			board = new char[H][W];
			for(int i=0; i<H; i++){
				Arrays.fill(board[i], '.');
			}
			for(int i=0; i<H-2; i++){
				String line = in.next();
				for(int j=0; j<W-2; j++){
					board[i+1][j+1] = line.charAt(j);
				}
			}
			System.out.println(solve());
		}
	}

	int solve(){
		Queue<Point> Q1 = new LinkedList<Point>(), Q2 = new LinkedList<Point>();
		int[][] dist = new int[H][W];
		boolean[][] visited = new boolean[H][W];
		for(int i=0; i<H; i++){
			visited[i][0] = true;
			visited[i][W-1] = true;
			Q1.add(new Point(i,0));
			Q1.add(new Point(i,W-1));
		}
		for(int j=1; j<W-1; j++){
			visited[0][j] = true;
			visited[H-1][j] = true;
			Q1.add(new Point(0,j));
			Q1.add(new Point(H-1,j));
		}
		for(;;){
			while(!Q1.isEmpty()){
				Point tp = Q1.poll();
				for(int k=0; k<4; k++){
					int ny = tp.y + dy[k], nx = tp.x + dx[k];
					if(0<=ny && ny<H && 0<=nx && nx<W && !visited[ny][nx]){
						visited[ny][nx] = true;
						if(board[ny][nx] == '&'){
							return dist[tp.y][tp.x];
						}
						else if(board[ny][nx] == '.'){
							dist[ny][nx] = dist[tp.y][tp.x];
							Q1.add(new Point(ny,nx));
						}
						else if(board[ny][nx] == '#'){
							dist[ny][nx] = dist[tp.y][tp.x] + 1;
							Q2.add(new Point(ny,nx));
						}
					}
				}
			}
			while(!Q2.isEmpty()){
				Point tp = Q2.poll();
				for(int k=0; k<4; k++){
					int ny = tp.y + dy[k], nx = tp.x + dx[k];
					if(0<=ny && ny<H && 0<=nx && nx<W && !visited[ny][nx]){
						visited[ny][nx] = true;
						if(board[ny][nx] == '&'){
							return dist[tp.y][tp.x];
						}
						else if(board[ny][nx] == '.'){
							dist[ny][nx] = dist[tp.y][tp.x];
							Q1.add(new Point(ny,nx));
						}
						else if(board[ny][nx] == '#'){
							dist[ny][nx] = dist[tp.y][tp.x];
							Q2.add(new Point(ny,nx));
						}
					}
				}
			}
		}
	}

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

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

for i in range(16):
    if i % 2 == 0 and A > 0:
        A -= 1
    elif i % 2 == 1 and B > 0:
        B -= 1

if A == 0 and B == 0:
    print('Yay!')
else:
    print(':(')


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

int main(){
    int m, h;
    char cards[256], temp[256], result[256];
    int i, j=0, len;

    while(1){
        scanf("%s", cards);
        len=strlen(cards);
        if(strcmp(cards, "-")==0&&len==1)break;
        scanf("%d", &m);
        for(;m>0;m--){
            scanf("%d", &h);
            strcpy(temp, cards);
            for(i=0;i<h;i++){
                cards[len-h+i]=temp[i];
            }
            for(i=0;i<len-h;i++){
                cards[i]=temp[i+h];
            }
        }
        for(i=0;i<len;i++){
            result[j++]=cards[i];
        }
        result[j++]='\n';
    }
    result[j]='\0';
    printf("%s", result);

    return 0;
}\

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

int main() {
	int k;
	cin >> k;
	int x = 7%k;
	set<int> s;
	int i = 1;
	while (s.count(x) == 0) {
		if (x == 0) {
			cout << i << endl;
			return 0;
		}
		s.insert(x);
		x = (x*10 + 7)%k;
		++i;
	}

	cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 50340
import math

a,b=map(int,input().split())
A=a/0.08
B=(a+1)/0.08
C=b/0.1
D=(b+1)/0.1

P=max(A,C)
Q=min(B,D)
if math.ceil(P)<Q:
    print(math.ceil(P))
else:
    print(-1)

Measured memory_bytes: 3064
#include<stdio.h>
int main(){
	int a,b,hasil;
	char op;
	for(int i=0;i<20000;i++){
		scanf("%d %c %d",&a,&op,&b);
		if(op=='+'){
			hasil=a+b;
		}
		else if(op=='-'){
			hasil=a-b;
		}
		else if(op=='*'){
			hasil=a*b;
		}
		else if(op=='/'){
			hasil=a/b;
		}
		else if(op=='?')break;
		printf("%d\n",hasil);
	}
	
	return 0;
}


Measured memory_bytes: 2764
//In The Name Of Allah
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define double long double 
#define fi first
#define se second
#define pii pair<int, int>

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	int n;
	cin >> n;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<vector<int>> dp(n, vector<int> (n, INT64_MIN));
	for (int i = 0; i < n; i++) {
		dp[i][i] = a[i];
	}
	for (int l = 2; l <= n; l++) {
		for (int i = 0, j = l - 1; j < n; i++, j++) {
			dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1]);
		}
	}
	cout << dp[0][n - 1] << "\n";
}



Measured memory_bytes: 70784
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
using namespace std;
int word_search(vector<string> s,  string key){
	for(int i = 0; i < s.size(); i++){
		if(s[i].length() <= 2 || s[i].length() >= 6) continue;
		for(int j = 0; j < s[i].length() - 1; j++)
			if(s[i][j] == '.') continue;
		if(s[i][s[i].length() - 1] == '.') s[i].erase(s[i].end() - 1);
		for(int j = 0; j < 26; j++){
			string turned_word;
			for(int k = 0; k < s[i].length(); k++){
				turned_word.push_back((s[i][k] + j - 'a') % 26 + 'a');
			}
			if(turned_word == key) return j;
		}
	}
	return -1;
}
int main(){
	for(;;){
		char line[200];
		if(fgets(line, sizeof(line), stdin) == NULL) break;
		vector<string> s;
		char *token = strtok(line, " ");
		s.push_back(token);
		for(;;){
			token = strtok(NULL, " ");
			if(token == NULL) break;
			s.push_back(token);
		}
		int num;
		if(word_search(s, "the") != -1) num = word_search(s, "the");
		if(word_search(s, "this") != -1) num = word_search(s, "this");
		if(word_search(s, "that") != -1) num = word_search(s, "that");
		for(int i = 0; i < s.size(); i++){
			for(int j = 0; j < s[i].length(); j++){
				if(s[i][j] == '.' || s[i][j] == '\n') cout << s[i][j];
				else cout << (char)((s[i][j] + num - 'a') % 26 + 'a');
			}
			if(i != s.size() - 1)cout << ' ';
		}
	}
	return 0;
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
#define ll long long int
#define ulli unsigned long long int 
#define pb push_back
using namespace std;
ll BS(ll s[],ll q,ll n)
{
    ll beg = 0,last = n;
    while(beg<=last)
    {
        ll mid = (beg+last)/2;
        if (s[mid+1]>=q && s[mid]<q)
            return mid+1;
        else if (s[mid]<q)
            beg = mid+1;
        else 
            last = mid-1;
    }
    return 0;
}
bool isprime(ll n) 
{
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
} 
int main()
{  
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   //while(!cin.eof())
   int t; t=1;
   while(t--)
   {
       int d,t,s;
       cin>>d>>t>>s;
       if(s*t>=d) cout<<"Yes"<<"\n";
       else cout<<"No"<<"\n";
   }
   return 0;
}

Measured memory_bytes: 3644
from collections import defaultdict


def prime_factorize(n):
    i = 2
    res = defaultdict(lambda: 0)
    while i * i <= n:
        while n % i == 0:
            res[i] += 1
            n = n // i
        i += 1
    if n != 1:
        res[n] = 1
    res = dict(res)
    return res


def divisor(n):
    i = 1
    res = set()
    while i * i <= n:
        if n % i == 0:
            res.add(i)
            res.add(n // i)
        i += 1
    return res


def solve(n):
    pf1 = prime_factorize(n - 1)
    ans = 1
    for v in pf1.values():
        ans *= v + 1
    ans -= 1
    # print(ans)

    pf2 = divisor(n)
    pf2.remove(1)
    for y in pf2:
        m = n
        while m % y == 0:
            m //= y
        m %= y
        if m == 1:
            ans += 1
    return ans


n = int(input())
print(solve(n))


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

int main(){

 int a, b ;
 char op ;

 	for (int i=1; i<=10000; i=i+1 )
 	{
 	cin >>a >> op >> b ;

         if ( op == '+' ){
         cout<<a + b << endl;// 和
         } else if ( op == '-' ){
         cout<<a - b << endl;// 差
         } else if ( op == '*' ){
         cout<<a * b << endl;// 積
         } else if ( op == '/' ){
         cout<<a / b << endl;// 商
         } else {
         break; // 終了
         }


 	}

 return 0;
 }


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

int main(){
    string s,t;
    cin >> s >> t;
    
    if(s.size()<t.size()){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    
    //入れる場所があるのかどうか
    int fit=-1;
    for(int i=0; i<=s.size()-t.size(); i++){
        for(int j=0; j<t.size(); j++){
            if(s[i+j]=='?' || s[i+j]==t[j]){
                if(j == t.size() -1){
                    fit = max(fit,i);
                }
            }else{
                break;
            }
        }
    }
    // cout << fit << endl;
    
    // 不可能判定
    if(fit==-1){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    
    // 入れるべき場所にいれる
    for(int i=fit; i<t.size() + fit; i++){
        s[i] = t[i-fit];
    }
    // cout << s << endl;
    
    // ？をaに
    for(int i=0; i<s.size(); i++){
        if(s[i] == '?') s[i] = 'a';
    }
    cout << s << endl;
}


Measured memory_bytes: 3636
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
	cout.precision(10);
	int n, k;
	cin >> n >> k;
	vector<double> p(100001);
	double ans = 0;
	for (int i = 1; i <= n; ++i) {
		p[i] = 1.0 / n;
		if (i >= k) {
			ans += p[i];
		}
	}
	for (int i = 1; i < k; ++i) {
		if (i * 2 >= k) {
			ans += p[i] * 0.5;
		} else {
			p[i * 2] += p[i] * 0.5;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

ll n,z,w;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin>>n>>z>>w;
	vector<ll> a(n);
	REP(i,n) cin>>a[i];
	if(n==1) {

	}
	vector<vector<ll>> dp(2,vector<ll>(n));
	for(ll i=n-1; i>=0; i--) {
		for(ll j=0; j<2; j++) {
			ll buf;
			if(j==0) buf=-1;
			else buf=INF*INF;
			FOR(k,i+1,n) {
				if(j==0) {
					if(buf<dp[1][k]) {
						buf=dp[1][k];
					}
				} else {
					if(buf>dp[0][k]) {
						buf=dp[0][k];
					}
				}
			}
			if(i!=0) {
				if(j==0) {
					buf=max(buf,abs(a[i-1]-a[n-1]));
				} else {
					buf=min(buf,abs(a[i-1]-a[n-1]));
				}
			} else {
				if(j==0) {
					buf=max(buf,abs(w-a[n-1]));
				} else {
					buf=min(buf,abs(z-a[n-1]));
				}
			}
			dp[j][i]=buf;
		}
	}
	cout<<dp[0][0]<<endl;
}


Measured memory_bytes: 384
#include <stdio.h>
int main(){
    char S[10];
    scanf("%s",S);
    //printf("%s\n",S);
    if(S[0]=='S'){
        printf("Cloudy\n");
    }
    else if(S[0]=='C'){
        printf("Rainy\n");
    }
    else{
        printf("Sunny\n");
    }
    return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, int> PILL;
typedef pair<ll, ll> PLL;

const int MAX_N = 1e5+5;
const int M = 1e6;
const ll INF = (ll)(1e18);
const int inf = 1e9;
const ll MOD = 1000000007LL;

void solve() {

}

int n, k, Q;
int cnt[MAX_N];

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

    cin >> n >> k >> Q;
    for (int i=0; i<Q; i++) {
        int a; cin >> a;
        cnt[a]++;
    }

    for (int i=1; i<=n; i++) {
        int tmp = Q - cnt[i];
        if (k - tmp > 0) {
            cout << "Yes";
        } else {
            cout << "No";
        }
        cout << "\n";
    }


    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


int cnv(string& s) {
	int res = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'm') {
			if (i == 0 || (s[i-1] == 'm' || s[i-1] == 'c' || s[i-1]=='x' || s[i-1] == 'i') ) {
				res += 1000;
			}
			else {
				res += (s[i - 1] - '0') * 1000;
			}
		}
		if (s[i] == 'c') {
			if (i == 0 || (s[i - 1] == 'm' || s[i - 1] == 'c' || s[i - 1] == 'x' || s[i - 1] == 'i')) {
				res += 100;
			}
			else {
				res += (s[i - 1] - '0') * 100;
			}
		}
		if (s[i] == 'x') {
			if (i == 0 || (s[i - 1] == 'm' || s[i - 1] == 'c' || s[i - 1] == 'x' || s[i - 1] == 'i')) {
				res += 10;
			}
			else {
				res += (s[i - 1] - '0') * 10;
			}
		}
		if (s[i] == 'i') {
			if (i == 0 || (s[i - 1] == 'm' || s[i - 1] == 'c' || s[i - 1] == 'x' || s[i - 1] == 'i')) {
				res += 1;
			}
			else {
				res += (s[i - 1] - '0') * 1;
			}
		}
	}
	return res;
}

string recnv(int n) {
	string res;
	if (n >= 1000) {
		if(n/1000 >= 2) res += to_string(n / 1000);
		res += 'm';
		n %= 1000;
	}
	if (n >= 100) {
		if(n/100 >= 2) res += to_string(n / 100);
		res += 'c';
		n %= 100;
	}
	if (n >= 10) {
		if (n / 10 >= 2) res += to_string(n / 10);
		res += 'x';
		n %= 10;
	}
	if (n >= 1) {
		if (n / 1 >= 2) res += to_string(n / 1);
		res += 'i';
	}
	return res;
}
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	int kkt; scanf("%d", &kkt);
	while (kkt--) {
		string s1, s2; cin >> s1 >> s2;
		int ans = cnv(s1) + cnv(s2);
		cout << recnv(ans) << "\n";
	}
	return 0;

}


Measured memory_bytes: 3208
import java.util.Scanner;

public class Main {


    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();//n?????°????????????
		int vals[] = new int[n];
		for(int cnt = 0; cnt < n; cnt++){//??°????????\?????????
			vals[cnt] = scan.nextInt();
		}
		for(int cnt = n - 1; cnt >= 0; cnt--){//??°??????????????????
			System.out.print(vals[cnt]);
			if(cnt != 0){//?????????????????§?????????
				System.out.print(" ");
			}
		}
		System.out.println();
        scan.close();
    }

}

Measured memory_bytes: 26264
#include<iostream>
#include<vector>
#include<string.h>
using namespace std;

int main() {
	string s,ans;
	int w;
	cin >> s;
	cin >> w;

	for (int i=0;w <= s.size();i++) {
		if ((i * w) >= s.size())break;
		ans += s[i * w];
	}
	cout << ans << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include<iostream>
using namespace std;
 
int main() {
    int a,b,c,d,ans,tmp;
    string s;
 
    a = b = c = d = ans = tmp = 0;
    //vector<int>a();

   cin >> a >> b >> c;
   for(;;){
       tmp += b;
       ans += c;
       if(tmp >= a){
           cout << ans;
           break;
       }
   }
}


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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

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

    if(n > 9)
        cout << r << '\n';
    else
        cout << r + 100 * (10 - n) << '\n';
    return 0;
}


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

n, u, v = [int(x) for x in input().split()]

import heapq
def dijkstra_heap(s):
    #始点sから各頂点への最短距離
    d = [float("inf")] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,[e[0]+d[v],e[1]])
    return d

################################
n, w = n, n - 1 #n:頂点数　w:辺の数

edge = [[] for i in range(n)]
#edge[i] : iから出る道の[重み,行先]の配列
for i in range(w):
    x,y = map(int,input().split())
    z = 1
    edge[x - 1].append([z,y - 1])
    edge[y - 1].append([z,x - 1]) 

takahashi = dijkstra_heap(u - 1)
aoki = dijkstra_heap(v - 1)

ans = -1

for i, j in zip(takahashi, aoki):
    if j - i > 0:
        ans = max(ans, j - 1)

print(ans)

Measured memory_bytes: 105504
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;
const int INF = 100005;

int main() {
    int n;
    cin >> n;
    vector<int> dp(100005, INF);
    dp[0] = 0;
    for(int i = 1; i <= n; ++i) {
        dp[i] = dp[i-1]+1;
        for(int j = 6; j <= i; j*=6) { 
            dp[i] = min(dp[i], dp[i-j]+1);
        }

        for(int j = 9; j <= i; j*=9) { 
            dp[i] = min(dp[i], dp[i-j]+1);
        }
    }
    cout << dp[n] << endl;
    return 0;
}

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

int main(){
	int s,k;cin>>k>>s;
	int cnt=0;
	for(int i=0;i<=k;i++){
		for(int j=0;j<=k;j++){
			if(s-i-j<=k&&s-i-j>=0){
				cnt++;
			}
		}
	}
	cout<<cnt;
	return 0;
}


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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    int n, c;
    cin >> n >> c;
    
    v2_int prog(c, v_int(200000, 0));

    irep(i, n) {
        int s, t, ch;
        cin >> s >> t >> ch;
        int time = (s-1) * 2;
        irep2(j, s, t) {
            if(j != s) {
                prog[ch-1][time] = 1;
                prog[ch-1][time+1] = 1;
            } else { 
                prog[ch-1][time+1] = 1;
            }
            time += 2;
        }
    }

    v_int tv(200000, 0);

    irep(i, c) {
        irep(j, 200000) {
            tv[j] += prog[i][j];
        } 
    }

    int ans = -1;
    irep(j, 200000) {
        ans = max(tv[j], ans);
    } 
    cout << ans << endl;
    return 0;
}
/** atcoder **/


Measured memory_bytes: 24576
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str,s;
  int cnt=0;
  cin >> s;
  for(int i=0,l=s.size();i<l;i++)
    if(s[i]>='A'&&s[i]<='Z')s[i]+=('a'-'A');
  while(cin >> str){
    if(str=="END_OF_TEXT")break;
    for(int i=0,l=str.size();i<l;i++)
      if(str[i]>='A'&&str[i]<='Z') str[i]+=('a'-'A');
    if(s==str) cnt++;
  }
  cout << cnt << endl;
}


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

int main() {
  int N,K,Q;
  cin >>N>>K>>Q;
  vector<int>S(Q);
  for (int i = 0; i < Q; i++) {
    cin >> S[i];
  }
  vector<int> scr(N, K);
  for (int i= 0; i < Q; i++){
    scr[S[i]-1]+=1;
  }
  for (int i= 0; i < N; i++){
    if(scr[i]-Q>0){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	static const ULL M = 998244353;

	void Solve() {
		string S; cin >> S;
		UL N = S.size();
		deque<ULL> F = { 1 };
		rep(i, N) {
			if (S[i] == '0') { F.push_front(0); F.push_front(0); }
			if (S[i] == '1') { F.push_front(0); F.push_back(0); }
			if (S[i] == '2') { F.push_back(0); F.push_back(0); }
			rep(j, F.size() - 1) F[j] = (F[j] + F[j + 1]) % M;
			F.pop_back();
		}
		rep(i, N) {
			rep(j, F.size() - 1) F[j] = (F[j] + F[j + 1]) % M;
			F.pop_back();
		}
		cout << F[0] << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    string s;
    cin >> a >> b >> s;
    bool f = true;
    rep(i, 0, a) if(!isdigit(s[i])) f = false;
    if(s[a] != '-') f = false;
    rep(i, a + 1, a + b + 1) if(!isdigit(s[i])) f = false;
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
#define MAXN 120
#define MAXK 100020
#define MOD 1000000007
 
int N,K;
long long dp[MAXN][MAXK];
long long a[MAXN];
 
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> a[i];
  
  for (int i = 0; i <= a[0]; i++) dp[0][i] = 1;
  
  for (int i = 1; i < N; i++) {
    dp[i][0] = dp[i-1][0];
    for (int j = 1; j <= a[i]; j++) {
      dp[i][j] = (dp[i][j-1] + dp[i-1][j])%MOD;
    }
    for (int j = a[i]+1; j <= K; j++) {
      dp[i][j] = (dp[i][j-1] + dp[i-1][j])%MOD;
      dp[i][j] -= (dp[i-1][j-a[i]-1]);
      dp[i][j]%=MOD;
      if (dp[i][j] < 0) dp[i][j] += MOD;
    }
    
  }
      
      
  cout << dp[N-1][K] << endl;
}

Measured memory_bytes: 80128