akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w,ans = 0,i,j,ny,nx,dy,dx,vy[4] = {1,0,-1,0},vx[4] = {0,1,0,-1};cin >> h >> w;
  char m[h][w];int c[h][w] = {};
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      cin >> m[i][j];
      if(m[i][j]=='.') ans++;
    }
  }
  queue<pair<int,int>> q;
  q.push(make_pair(0,0));
  while(!q.empty()){
    ny = q.front().first;nx = q.front().second;
    for(i=0;i<4;i++){
      dy = ny+vy[i];dx = nx+vx[i];
      if(dy>=0 && dx>=0 && dy<h && dx<w && m[dy][dx]=='.' && c[dy][dx]==0){
        c[dy][dx] = c[ny][nx]+1;q.push(make_pair(dy,dx));
      }
    }
    q.pop();
  }
  if(c[h-1][w-1]==0) cout << -1 << endl;
  else cout << ans-c[h-1][w-1]-1 << endl;
}

Measured memory_bytes: 256
from functools import reduce


def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

def gcd_list(numbers):
    return reduce(gcd, numbers)


n = int(input())
a = list(map(int, input().split()))
print(gcd_list(a))

Measured memory_bytes: 14596
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM 1000000000;
#define mod MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
int main(){
    ll x, y; cin >> x >> y;
    ll cnt = 0;
    ll m = x;
    while(m <= y){
        m *= 2;
        cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  double l;
  cin >> l;
  double ans = pow(l / 3.0, 3);
  printf("%.16f\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int n, i;
  scanf("%d", &n);
  int a[n];
  for(i = 0; i < n; i++)
    scanf("%d", &a[i]);
  for(i = n-1; i >= 0; i--) {
    printf("%d", a[i]);
    if(i == 0) break;
    printf(" ");
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 2036
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			int n = sc.nextInt();
			int r = sc.nextInt();
			
			if ( n >= 10 ) {
				System.out.println(r);
			}
			else {
				System.out.println(r + 100 * ( 10 - n));
			}
			
		}
	}
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

ll h,w,dp[1010][1010];
char a[1010][1010];
const ll MOD=1e9+7;

ll ad(ll x,ll y=0){
  return (x+y)%MOD;
}

ll M(ll i,ll j){
  if(dp[i][j]!=-1) return dp[i][j];
  if(a[i][j]=='#'){dp[i][j]=0;return 0;}
  dp[i][j]=ad(M(i-1,j),M(i,j-1));
  return dp[i][j];
}

int main(){
  cin>>h>>w;
  Fr(i,h) Fr(j,w){cin>>a[i][j];dp[i][j]=-1;}
  dp[1][1]=1;
  cout<<M(h,w)<<endl;
}

Measured memory_bytes: 9216
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 1e18;
const double PI = acos(-1);

typedef tuple<ll, ll, int> T;
const int VEC_SIZE = 60;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N, K;
	cin >> N >> K;
	vll A(N);
	REP(i, N) {
		cin >> A[i];
	}
	vll bits(VEC_SIZE, 0);
	REP(i, N) {
		REP(j,VEC_SIZE) {
			bits[j] += A[i] % 2;
			A[i] >>= 1;
		}
	}
	ll mul = 1;
	vector<T> VT(VEC_SIZE);
	REP(i, VEC_SIZE) {
		VT[i] = T((N - 2 * bits[i]) * mul , mul, i);
		mul *= 2;
	}
	so(VT);
	rev(VT);
	ll cur = 0;
	vb isRev(VEC_SIZE, false);
	REP(i, VEC_SIZE) {
		if (get<0>(VT[i]) < 0)break;
		if (cur + get<1>(VT[i]) <= K) {
			isRev[get<2>(VT[i])] = true;
			cur += get<1>(VT[i]);
		}
	}
	ll ans = 0;
	mul = 1;
	REP(i, VEC_SIZE) {
		if (isRev[i])ans += (N - bits[i]) * mul;
		else ans += bits[i] * mul;
		mul *= 2;
	}
	cout << ans << endl;
	PAU;
	return 0;
}


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

#define MAX 51
#define MAX_M 5001
typedef pair<int,int> pii;
 
int main(){
    int X,Y,Z,N,E,A;
    while(cin >> X >> Y >> Z, X){
        pii M[MAX];
        vector<int> V(X);
        for(int i = 0 ; i < X ; i++){
            cin >> V[i];
        }
        for(int i = 0 ; i < MAX ; i++){
            M[i] = pii(-1,-1);
        }
        for(int i = 0 ; i < Z ; i++){
            cin >> N >> E >> A;
            M[N] = pii(E,A);
        }
        double dp[MAX][MAX_M] = {{0}};
        dp[0][0] = 1;
        for(int i = 0 ; i < Y ; i++){
            for(int j = 0 ; j < MAX_M ; j++){
                if(dp[i][j] == 0) continue;
                for(int k = 0 ; k < X ; k++){
                    int next = min(i+V[k], Y);
                    int v = M[next].first;
                    int v2 = M[next].second;
                    if(v == -1){
                        dp[next][j] += dp[i][j]/X;
                    }else if(v == 2){
                        dp[next][min(j+v2,MAX_M-1)] += dp[i][j]/X;
                    }else if(v == 3){
                        dp[next][max(j-v2,0)] += dp[i][j]/X;
                    }else{
                        next = min(next+v2,Y);
                        dp[next][j] += dp[i][j]/X;
                    }
                }
            }
        }
        double res = 0;
        for(int i = 0 ; i < MAX_M ; i++){
            res += i*dp[Y][i];
        }
        cout << (int)res << endl;
    }
    return 0;
}

Measured memory_bytes: 5076
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  int k, a, b;
  cin >> k;
  cin >> a >> b;
  int ans = 0;


  for(int i = a; i <= b ; ++i){
    if(i%k == 0){
      ans = 1;
    }
  }

  if(ans) cout << "OK" << endl;
  else cout << "NG" << endl;

}

Measured memory_bytes: 3604
/*input
4
1 1 1 1
*/
import java.util.*;
class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int[] f1=new int[100001];
		int[] f2=new int[100001];
		int[] arr=new int[n];
		StringBuffer sb = new StringBuffer();
		for(int i=0;i<n;i++)
		{
			arr[i]=sc.nextInt();
			if(i%2==0)
				f1[arr[i]]++;
			else
				f2[arr[i]]++;
		}

		int l11=0,l12=0,l21=0,l22=0;
		int i11=0,i12=0,i21=0,i22=0;
		for(int i=0;i<=100000;i++)
		{
			if(f1[i]>=l11)
			{
				l11=f1[i];
				i11=i;
			}

			if(f2[i]>=l21)
			{
				l21=f2[i];
				i21=i;
			}
		}
		for(int i=0;i<=100000;i++)
		{
			if(i!=i11)
			{
				if(f1[i]>=l12)
				{
					l12=f1[i];
					i12=i;
				}
			}
			
			if(i!=i21)
			{
				if(f2[i]>=l22)
				{
					l22=f2[i];
					i22=i;
				}
			}
			
		}

		if(i11!=i21)
			System.out.println(n/2 - l11 + n/2 - l21);
		else
		{
			int x=Math.max(l11+l22,l12+l21);
			System.out.println(n-x);
		}
	}

	static boolean check(int n)
	{
		int x=n%10;
		n/=10;
		if(n%10!=x)
			return false;
		n/=10;
		if(n%10!=x)
			return false;
		return true;
	}
}

Measured memory_bytes: 60772
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();

		if(n == m) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 23252
n,k=map(int,input().split())
a=list(map(int,input().split()))
if a.index(1)<k-1:
  print((n-2)//(k-1) +1)
  exit()
else:
  print((n-2)//(k-1) +1)
  exit()
print((a.index(1)+k-2)//(k-1) + (n-a.index(1)-1+k-2)//(k-1))

Measured memory_bytes: 52476
using System;
using System.Linq;

class Program {
    static void Main(string[] args) {
        int N = Cin.Ni();
        long answer = 1;
        for (int i = 0; i < N; i++) {
            answer *= i + 1;
            answer %= 1000000007;
        }
        Console.WriteLine(answer);
    }
}


public class Cin {
    private static string[] s = new string[0];
    private static int i = 0;

    private static char[] cs = new char[] { ' ' };

    public static string Next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return Next();
    }

    public static int Ni() {
        return int.Parse(Next());
    }

    public static long NextLong() {
        return long.Parse(Next());
    }

    public static double NextDouble() {
        return double.Parse(Next());
    }

}


Measured memory_bytes: 13140
#include <iostream>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)

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

    int n;
    cin >> n;

    int sum_taro = 0;
    int sum_hanako = 0;
    REP(i, n) {
        string taro, hanako;
        cin >> taro >> hanako;
        if (taro == hanako) {
            sum_taro++;
            sum_hanako++;
        } else if (taro > hanako) {
            sum_taro += 3;
        } else {
            sum_hanako += 3;
        }
    }

    cout << sum_taro << ' ' << sum_hanako << '\n';
    return 0;
}


Measured memory_bytes: 3200
#include <stdio.h>
#define N 100
#define WHITE 1
#define BLACK 2
#define GRAY 3

int time,color[N],f[N],d[N],adj[N][N];

void visit(int u,int n){
  int v;
  color[u]=GRAY;
  d[u]=++time;
  for(v=0;v<n;v++){
    if(adj[u][v]==0) continue;
    if(color[v]==WHITE) visit(v,n);
  }
  color[u]=BLACK;
  f[u]=++time;
}

void dfs(int n){
  int u;
  for(u=0;u<n;u++){
    color[u]=WHITE;
  }

  time=0;

  for(u=0;u<n;u++){
    if(color[u]==WHITE) visit(u,n);
  }

  for(u=0;u<n;u++){
    printf("%d %d %d\n",u+1,d[u],f[u]);
  }
}

int main(){
  int n,i,j,u,k,v;

  scanf("%d",&n);

  for(i=0;i<n;i++) for(j=0;j<n;j++) adj[i][j]=0;

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



Measured memory_bytes: 2044
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;

using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
	public Program() { }

	static void Main(string[] args)
	{
		new Program().prog();
	}
	Scanner cin;
	const int MOD = 1000000007;
	const int INF = int.MaxValue - 10;
	const long INFL = long.MaxValue - 10;
	const double EPS = 1e-7;
	const double PI = 3.1415926536;

	int N;
	void prog()
	{
		cin = new Scanner();
		int[,] dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } };
		int[,] dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };

		int H = cin.nextInt();
		int W = cin.nextInt();
		char[,] A = new char[H, W];
		for (int i = 0; i < H; i++)
		{
			string str = cin.next();
			for (int j = 0; j < W; j++)
			{
				A[i, j] = str[j];
			}
		}
		Pair pos = new Pair(0, 0);
		while (pos.Key != H - 1 || pos.Value != W - 1)
		{
			if (pos.Key + 1 < H && A[pos.Key + 1, pos.Value] == '#')
			{
				if(pos.Value + 1 < W && A[pos.Key, pos.Value + 1] == '#')
				{
					Console.WriteLine("Impossible");
					return;
				}
				A[pos.Key + 1, pos.Value] = '.';
				pos = new Pair(pos.Key + 1, pos.Value);
				continue;
			}
			else if (pos.Value + 1 < W && A[pos.Key, pos.Value + 1] == '#')
			{
				A[pos.Key, pos.Value + 1] = '.';
				pos = new Pair(pos.Key, pos.Value + 1);
				continue;
			}
			else
			{
				Console.WriteLine("Impossible");
				return;
			}
		}
		A[0, 0] = '.';
		A[H - 1, W - 1] = '.';
		
		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < W; j++)
			{
				if (A[i, j] == '#')
				{
					Console.WriteLine("Impossible");
					return;
				}
			}
		}
		Console.WriteLine("Possible");
	}

	public static int Compare(Pair x, Pair y)
	{
		if (x.Value == y.Value) return y.Key - x.Key;
		return x.Value - y.Value;
	}
}

class Scanner
{
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner()
	{
		s = new string[0];
		i = 0;
	}

	public string next()
	{
		if (i < s.Length) return s[i++];
		string st = Console.ReadLine();
		while (st == "") st = Console.ReadLine();
		s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
		i = 0;
		return next();
	}

	public int nextInt()
	{
		return int.Parse(next());
	}

	public long nextLong()
	{
		return long.Parse(next());
	}

	public double nextDouble()
	{
		return double.Parse(next());
	}
}

Measured memory_bytes: 2904
N,Q = map(int,input().split())
s = input()
q = []
for _ in range(Q):
  t,d = map(str,input().split())
  q.append([t,d])

def check(x):
  for t,d in q:
    if s[x] != t: continue
    if d == "L":
      x -= 1
    else:
      x += 1
    if x < 0: return -1
    if x >= N: return 1
  return 0

# checking left position
ok,ng = -1,N
while abs(ok-ng) > 1:
  x = (ok+ng)//2
  if check(x) == -1:
    ok = x
  else:
    ng = x
left = ok

ng,ok = -1,N
while abs(ok-ng) > 1:
  x = (ok+ng)//2
  if check(x) == 1:
    ok = x
  else:
    ng = x
right = ok

d = 0
if left != -1:
  d += left+1

if right != N:
  d += N - right

print(N-d)

Measured memory_bytes: 116540
#include<iostream>
#include<string>
#include<vector>
#include <math.h>

#define LL long long
#define MOD 1000000007
#define rep(i,n) for(int i = 0;i < (n);i++)

using namespace std;

int main(){
    LL X;
    cin >> X;

    LL yokin = 100;
    int ans = 0;
    while(1){
        ans++;
        yokin += yokin*0.01;
        if(X <= yokin)
            break;
    }
    cout << ans <<endl;

    return 0;

}

Measured memory_bytes: 3624
import java.util.Arrays;
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();

if(b%a==0){
	System.out.println(a+b);
}else{
		System.out.println(b-a);
		
	}}}

Measured memory_bytes: 21716
import java.util.Scanner;
class Fx{
	int a;
	int [] p=new int[200000];
	int ans;
	void rieki() {
		int minv=p[0];
		int maxv=p[1]-p[0];
		for(int j=1;j<a;j++) {
			maxv=Math.max(maxv, p[j]-minv);
			minv=Math.min(minv,p[j]);
		}
		ans=maxv;
	}
}
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int [] s=new int [n];
		for(int i=0;i<n;i++) {
			s[i]=sc.nextInt();
		}
		Fx f=new Fx();
		f.a=n;
		for(int i=0;i<n;i++) {
			f.p[i]=s[i];

		}
		f.rieki();
		System.out.println(f.ans);
		sc.close();
	}
}



Measured memory_bytes: 101608
/*************************************************************************
    > File Name: a.cpp
    > Author: BlockChanZJ
    > Mail: 386636627@qq.com 
    > Created Time: 2018年05月27日 星期日 10时22分26秒
 ************************************************************************/

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <cassert>
#include <iomanip>
using namespace std;

#define rep(i,a,b) for(int i = (a); i <= (b); ++i)
#define per(i,a,b) for(int i = (a); i >= (b); --i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fi first 
#define se second
#define SZ(x) ((int)(x).size())
#define sqr(x) (x) * (x)

typedef long long ll;
typedef long double ld;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef pair<PII,int> PIII;
const int N = 100005;
const int P = 1000000007;
const ll mod = P;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld eps = 1e-8;
ll qmod(ll a,ll n,ll mod){ll ans=1;while(n){assert(ans>0);if(n&1ll)ans=ans*a%mod;n>>=1;a=a*a%mod;}return ans%mod;}

//head

//your code goes there

int main()
{
	int a, b; cin>>a>>b;
	int ans = a+b;
	ans = max(ans, a-b);
	ans = max(ans, a*b);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  string s,t;
  int c=0;
  cin>>s;
  cin>>t;
  for(int i=0;i<3;i++)
  {
    if(s[i]==t[i])
    {
      c=c+1;
    }
  }
  cout<<c<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	for (int n; cin >> n&&n;) {
		int ans = 0;
		while (n != 1) {
			ans++;
			if (n % 2) {
				n = 3 * n + 1;
			}
			else {
				n /= 2;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3012
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int a[100001][3], dp[100001][3];
int n; 
int ans=0;

int solve(int i, int j){
    if(i == n) return 0;
    if(dp[i][j] != -1) return dp[i][j];
    if(j == 0){
        return dp[i][j] = max(solve(i+1,1)+a[i][1], solve(i+1,2)+a[i][2]);
    }
    else if(j == 1){
        return dp[i][j] = max(solve(i+1,0)+a[i][0], solve(i+1,2)+a[i][2]);
    }
    else if(j == 2){
        return dp[i][j] = max(solve(i+1,0)+a[i][0], solve(i+1,1)+a[i][1]);
    }
    return dp[i][j];
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for(int i = 0; i<n;i++){
        for(int j = 0; j<3;j++){
            cin >> a[i][j];
            dp[i][j] =  -1;
        } 
    }
    int ans = max(solve(0,0), solve(0,1));
    ans = max(ans, solve(0,2));
    cout << ans << endl;
    
    return 0;

}



Measured memory_bytes: 10580
#include<bits/stdc++.h>
inline int read(){
	char c=getchar();while (c!='-'&&(c<'0'||c>'9'))c=getchar();
	int k=1,kk=0;if (c=='-')c=getchar(),k=-1;
	while (c>='0'&&c<='9')kk=kk*10+c-'0',c=getchar();return kk*k;
}using namespace std;
int n,k,a[1000000],ans,x;
int main(){
	n=read();k=read();for (int i=1;i<=n;i++)x=read(),a[x]++;
	sort(a+1,a+1+n);for (int i=n-k+1;i<=n;i++)ans+=a[i];
	cout<<n-ans<<endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long X=sc.nextLong();
		long year=0;
		long yoki=100;
		while(yoki<X) {
			year++;
			yoki*=1.01;
		}
		System.out.println(year);
		}
}


Measured memory_bytes: 35896
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	if s[0] == 'A' {
		s = s[1:]
	} else {
		fmt.Println("WA")
		return
	}

	if strings.Count(s[1:len(s)-1], "C") != 1 {
		fmt.Println("WA")
		return
	}

	for _, v := range s {
		if !(v >= 'a' && v <= 'z' || v == 'C') {
			fmt.Println("WA")
			return
		}
	}
	fmt.Println("AC")
}


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


int main() {
  int n; cin >> n;
  vector<pair<int,int>>p(n);
  rep(i,n){
    cin >> p[i].first;
    p[i].second = i + 1;
  }
  sort(p.begin(), p.end());
  rep(i,n)cout << p[i].second << endl;
}


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

int main(){
    int K;
    string S;
    string ans="",dots="...";
    cin >> K >> S;
    for(int i=0;i<K;i++){
        if(i >= S.size()){
            break;
        }
        ans.push_back(S.at(i));
    }
    if(K < S.size()){
        ans += dots;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<cmath>
#include<iomanip>
#include<set>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;

int main() {
    int n; cin >> n;
    string bef;
    rep(i, n) {
        string s; cin >> s;
        if (i) {
            if (bef == "T" && s == "F") {
                s = "F";
            } else {
                s = "T";
            }
        }
        bef = s;
    }
    cout << bef << endl;
    
}







Measured memory_bytes: 3140
# -*- coding: utf-8 -*-
import math
from collections import Counter
N = int(input())

S = []
for n in range(N):
    S.append(input()[0])

S_cnt = Counter(S)

cond = [['M','A','R'],
        ['M','A','C'],
        ['M','A','H'],
        ['M','R','C'],
        ['M','R','H'],
        ['M','C','H'],
        ['A','R','C'],
        ['A','R','H'],
        ['A','C','H'],
        ['R','C','H']]

ans = 0
for li in cond:
    ans += S_cnt[li[0]] * S_cnt[li[1]] * S_cnt[li[2]]
print(ans)


Measured memory_bytes: 4472
import math
n,d=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]

c=0

for i in range(n):
    for j in range(i+1,n):
        a=0
        for k in range(d):
            a+=math.pow(x[i][k]-x[j][k],2)
        a=math.sqrt(a)
        if a==int(a):
            c+=1
print(c)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define maxn 200010
#define pii pair<int,int>
#define mp make_pair
int n, q;
long long int arr[maxn];
stack <long long int> st;
long long int a[maxn];
long long int dp[maxn], ans[maxn];
vector <long long int> v, adj[maxn], opp[maxn], revcost[maxn], cost[maxn];
set <long long int> s;
map <long long int, long long int> M;


int main(){
	int org;
	cin>>n>>q;
	org=n;
	for (int i=1; i<=q; i++) cin>>arr[i];
	int cur= 0;
	st.push(n);
	for (int i=1; i<=q; i++){
		if (st.empty()){
			st.push(arr[i]);
			continue;
		}
		while(1){
			if (st.empty()){
				st.push(arr[i]);
				break;
			}
			if (arr[i]>st.top()){
				st.push(arr[i]);
				break;
			}
			st.pop();
		}
	}
	while(!st.empty()){
		v.push_back(st.top());
		st.pop();
	}
	reverse(v.begin(), v.end());
	for (int i=0; i<v.size(); i++){
		a[i+1]= v[i];
		s.insert(v[i]);
		M[v[i]]=i+1;
	}
	n= v.size();
	
	for (int i=2; i<=n; i++){
		long long int t= a[i];
		while (t>a[1]){
			long long int x= *(--s.lower_bound (t));
			int ind= M[x];
			adj[i].push_back(ind);
			opp[ind].push_back(i);
			long long int c= t/x;
			revcost[ind].push_back(c);
			cost[i].push_back(c);
			t= t%x;
			if (t<=a[1] and t>0){
				adj[i].push_back(n+t);
				cost[i].push_back(1);
				opp[n+t].push_back(i);
				revcost[n+t].push_back(1);
			}
		}
	}	
	for (long long int i=a[1]; i<=a[1]; i++){
		adj[1].push_back(n+i);
		cost[i].push_back(1);
		opp[n+i].push_back(1);
		revcost[n+i].push_back(1);

	}
	dp[n]=1;
	for (int i=n-1; i>=1; i--){
		for (int j=0; j<opp[i].size(); j++){
			dp[i]+=1LL*revcost[i][j]*dp[opp[i][j]];
		}
	}
	for (long long int i=n+1; i<=n+a[1]; i++){
		for (int j=0; j<opp[i].size(); j++){
			dp[i]+=1LL*revcost[i][j]*dp[opp[i][j]];
		}
	}
	for (int i=a[1]; i>=1; i--){
		ans[i]= (ans[i+1]+dp[n+i]);
	}
	for (int i=1; i<=org; i++) cout<<ans[i]<<endl;
}

Measured memory_bytes: 74672
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <iomanip>
#include <sstream>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long ll;

int main() {
	int n; cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	int cnt = 0;
	for(int i=0;i<n-2;i++) {
		if (a[i] < a[i + 1] && a[i + 1] < a[i + 2]) {
			cnt++;
		}
		else if (a[i] > a[i + 1] && a[i + 1] > a[i + 2]) {
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

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

ll n,a[1000];
vector<pair<ll,ll>>e[1001][1001];
ll num[1001][1001],d[1001][1001],ans,cnt;

int main(){
    cin>>n;
    FOR(i,1,n+1){
        rep(j,n-1){
            cin>>a[j];
            if(j){
                e[min(i,a[j-1])][max(i,a[j-1])].push_back({min(i,a[j]),max(i,a[j])});
                num[min(i,a[j])][max(i,a[j])]++;
            }
        }
    }

    queue<pair<ll,ll>>que;
    FOR(i,1,n+1)FOR(j,i+1,n+1)if(num[i][j]==0){
        que.push({i,j});
        d[i][j]=1;
    }

    while(!que.empty()){
        ll x=que.front().first,y=que.front().second,nx,ny;
        que.pop();
        cnt++;
        rep(i,e[x][y].size()){
            nx=e[x][y][i].first;
            ny=e[x][y][i].second;
            num[nx][ny]--;
            if(num[nx][ny]==0){
                que.push({nx,ny});
                d[nx][ny]=d[x][y]+1;
                ans=max(ans,d[nx][ny]);
            }
        }
    }
    cout<<(cnt==n*(n-1)/2?ans:-1)<<endl;
}

Measured memory_bytes: 64640
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut ans = vec![vec![0; n]; n];
    let mut cur = 1;
    construct(&mut ans, 1, 0, n);
    for i in 0..n {
        for j in (i + 1)..n {
            print!("{} ", ans[i][j]);
        }
        println!();
    }
}

fn construct(ans: &mut Vec<Vec<u64>>, depth: u64, from: usize, to: usize) {
    let length = to - from;
    let prefix = length / 2;
    let suffix = length - prefix;
    for i in 0..prefix {
        for j in 0..suffix {
            let left = from + i;
            let right = from + prefix + j;
            ans[left][right] = depth;
            ans[right][left] = depth;
        }
    }
    if prefix >= 2 {
        construct(ans, depth + 1, from, from + prefix);
    }
    if suffix >= 2 {
        construct(ans, depth + 1, from + prefix, to);
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 6652
#include <iostream>
#include <list>

int main()
{
	int n, q; std::cin >> n >> q;
	
	std::list<int>* li = new std::list<int>[n];
	
	for (int i=0; i<q; i++) {
		int op, x, s, t;
		std::cin >> op;
		switch (op) {
		case 0:
			std::cin >> t >> x;
			li[t].push_back(x);
			break;
		case 1:
			std::cin >> t;
			for (std::list<int>::iterator it = li[t].begin(); it != li[t].end(); ++it) {
				if (it != li[t].begin()) std::cout << " ";
				std::cout << *it;
			}
			std::cout << std::endl;
			break;
		case 2:
			std::cin >> s >> t;
			li[t].splice(li[t].end(), std::move(li[s]));
			break;
		}
	}
	
	delete[] li;
	
	return 0;
}
		



Measured memory_bytes: 18656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30;
typedef pair<int,pair<int,int>> P;

struct dat{
    int l;
    int r;
    int id;
};

bool ans[MAX];
bool need[MAX];
bool visited[MAX];
pair<int,int> edge[MAX];

bool ok=true;

vector<pair<int,int>> G[MAX];

void DFS(int u,int p,int e){
    visited[u]=1;
    
    for(auto to:G[u]){
        if(to.fi==p) continue;
        if(visited[to.fi]) continue;
        DFS(to.fi,u,to.se);
    }
    
    if(need[u]){
        if(e==-1) ok=false;
        else{
            ans[e]=1;
            need[edge[e].fi]^=1;
            need[edge[e].se]^=1;
        }
    }
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,M;cin>>N>>M;
    vector<pair<int,int>> S(N);
    for(int i=0;i<N;i++){
        cin>>S[i].fi>>S[i].se;
    }
    sort(all(S));
    S.push_back({INF,INF});
    vector<dat> T(M);
    for(int i=0;i<M;i++){
        cin>>T[i].l>>T[i].r;
        auto it=lower_bound(all(S),make_pair(T[i].l,-1));
        T[i].l=it-S.begin();
        
        it=lower_bound(all(S),make_pair(T[i].r,INF));
        T[i].r=it-S.begin();
        T[i].id=i;
        
        edge[i]={T[i].l,T[i].r};
        
        if(T[i].l==T[i].r) continue;
        
        G[T[i].l].push_back({T[i].r,i});
        G[T[i].r].push_back({T[i].l,i});
    }
    
    for(int i=0;i<N;i++){
        if(i==0) need[i]=S[i].se;
        else{
            need[i]=S[i-1].se^S[i].se;
        }
        if(i==N-1) need[N]=S[i].se;
    }
    
    sort(all(T),[](auto a,auto b){
        return make_pair(a.l,a.r)<make_pair(b.l,b.r);
    });
    
    for(int i=0;i<N;i++){
        if(!visited[i]) DFS(i,-1,-1);
    }
    
    if(!ok) cout<<-1<<endl;
    else{
        int cnt=0;
        for(int i=0;i<M;i++) if(ans[i]) cnt++;
        cout<<cnt<<endl;
        for(int i=0;i<M;i++) if(ans[i]) cout<<i+1<<" ";
        cout<<endl;
    }
    
}




Measured memory_bytes: 21104
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;
 
namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
 
            char[] nc = new char[s.Length];
            for (int i = 0; i < s.Length; i++)
            {
                nc[i] = (char)((((s[i] - 'A') + N) % 26) + 'A');
            }
 
            Console.WriteLine(nc);
        }
    }
}

Measured memory_bytes: 13192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define vmax 10000
constexpr ll inf = 100000000000000;
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/

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

int lcm(int a,int b){
    return a*b/gcd(a,b);
}

void Findfactor(int n,vector<int> &a){
    for(int i=2;i<=n;i++){
        while(n%i==0){
            a.at(i)++;
            n/=i;
        }
    }
}

int main(){
    int n,mod=1e9+7;
    cin>>n;
    vector<int> a(n+1,0);
    for(int i=2;i<=n;i++){
        Findfactor(i,a);
    }
    ll ans=1;
    for(int i=2;i<=n;i++){
        ans*=(a[i]+1);
        ans%=mod;
    }
    cout<<ans<<endl;
}

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

int main() {
  int n;
  scanf("%d", &n);
  bool b = true;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    if (a % 2 == 0 && a % 3 && a % 5)
      b = false;
  }

  if (b)
    printf("APPROVED\n");
  else
    printf("DENIED\n");

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

int main(){
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
  if(u == s)--a;
  else --b;
  cout << a << " " << b << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int N,Q,A[100000],a[100000];
  	long K;
  scanf("%d %ld %d",&N,&K,&Q);
  for(int i=0;i<Q;i++){
  	scanf("%d",&A[i]);
  }
  for(int i=0;i<N;i++){
    a[i]=K-Q;
  }
  
  for(int i=0;i<Q;i++){
  	a[A[i]-1]++;
  }
  for(int i=0;i<N;i++){
  	if(a[i]<=0){
    printf("No\n");
    }else{
      printf("Yes\n");
    }
  }
  
}

Measured memory_bytes: 1280
n=int(input())
wlist=list(map(int,input().split()))
ans =sum(wlist)
for i in range(0,len(wlist)):
    list1 = wlist[0:i] 
    list2=wlist[i:]
    if ans > abs(sum(list1)-sum(list2)):
        ans = abs(sum(list1)-sum(list2))

print(ans)  

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

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define  endl 			"\n"
#define  FOR(i, a, n)   for (ll i = a; i < n; i++)
#define  ROF(i, a, n)   for (ll i = a; i >= n; i--)
#define  all(x)         (x).begin(), (x).end()
#define  mset(x, val)   memset(x,val,sizeof(x))
#define  dline          cout<<"///REACHED///\n";

typedef long long ll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  4e+5+7;


int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	//int T;
	//cin >> T;
	//while (T--) {
		
	//}
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for(int& x: a) cin >> x;
	vector<int> dp(n, INFi);
	dp[0] = 0;
	FOR(i, 0, n) {
		FOR(j, 1, k+1) {
			if (i+j < n) {
				dp[i+j] = min(dp[i+j], dp[i]+abs(a[i+j]-a[i]));
			}
		}
	}
	cout << dp[n-1] << endl;
	return 0;
}


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

using namespace std;
using ll = long long;

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

    int N;
    cin >> N;

    vector<ll> a(N), b(N);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
        ll temp = a[i];
        int cnt = 0;
        while (temp % 2 == 0) {
            ++cnt;
            temp /= 2;
        }
        b[i] = cnt;
    }

    int b1=0, b2=0, b4=0;
    for (int i = 0; i < N; ++i) {
        if (b[i]==0) ++b1;
        else if(b[i]==1) ++b2;
        else ++b4;
    }

    if (b2) cout << ((b1 <= b4) ? "Yes":"No") << "\n";
    else cout << ((b1 <= b4+1) ? "Yes":"No") << "\n";
    return 0;
}

Measured memory_bytes: 1792
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

ll N;
ll M;
ll Q;
vi A, a, b, c, d;

ll f(ll i)
{
    if (i == N + 1)
    {
        ll s = 0;
        REP(j, Q)
        {
            if (A[b[j]] - A[a[j]] == c[j])
            {
                s += d[j];
            }
        }
        return s;
    }
    ll res = 0;
    for (ll j = A[i - 1]; j <= M; ++j) {
        A[i] = j;
        CH(max, res, f(i + 1));
    }
    return res;
}

int main()
{
    cin >> N;
    cin >> M;
    cin >> Q;
    a.assign(Q, 0);
    b.assign(Q, 0);
    c.assign(Q, 0);
    d.assign(Q, 0);
    REP(i, Q)
    {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    A.assign(N + 1, 0);
    A[1] = 1;
    ll ans = f(2);
    OUT(ans);
}

Measured memory_bytes: 3492
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    let A = parseInt(arg[0].split(" ")[0]);
    let B = parseInt(arg[0].split(" ")[1]);
    let C = parseInt(arg[0].split(" ")[2]);
    
    console.log(C + " " + A + " " + B);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
#include<iostream>
#include<cstdio>
#include<algorithm>
#define reg register
#define ios ios::sync_with_stdio(false)
using namespace std;
int t[101],p[101];
int main() 
{
	ios;string s1,s2;cin>>s1;s2=s1;
	reverse(s2.begin(),s2.end());//交换函数abc->cba //orz%%%dalao
	int l=s2.length();
	for(reg int i=0;i<=l-1;i++)
	{
		if(s2[i]=='b'){s2[i]='d';continue;}
		if(s2[i]=='d'){s2[i]='b';continue;}
		if(s2[i]=='p'){s2[i]='q';continue;}
		if(s2[i]=='q'){s2[i]='p';continue;}
	}
	if(s1==s2)puts("Yes");
	else	puts("No");
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>

using namespace std;
typedef long long int ll;typedef pair<int, int> P;
const long long mod = 1e9 + 7;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }


int main(void) {
	int ans = 0;
	int n; cin >> n;
	vector<int> v(n); rep(i, n)cin >> v[i];
	sort(allg(v));
	bool f = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			for (int k = j + 1; k < n; k++) {
				if (v[i] < v[j] + v[k])ans++;
				else {
					break;
					f = 1;
				}
			}
			if (f) {
				f = 0;
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}





int main() {
 
	ll N, K,an=1;
	cin >> N >> K;
	rep(i, N) {
		an = min(2 * an, an + K);
	}
	cout << an << endl;
}

Measured memory_bytes: 256
// https://beta.atcoder.jp/contests/abc072

#include <bits/stdc++.h>
using namespace std;

int c[100000 + 10];

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        c[a]++;
        c[a + 1]++;
        if (a != 0) c[a - 1]++;
    }

    auto ans = *max_element(c, c + 100000);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
S = input().split()
stack = []
for i in range(len(S)):
    if S[0] == '+':
        S.pop(0)
        s = stack.pop(-2)+stack.pop(-1)
    elif S[0] == '-':
        S.pop(0)
        s = stack.pop(-2)-stack.pop(-1)
    elif S[0] == '*':
        S.pop(0)
        s = stack.pop(-2)*stack.pop(-1)
    else:
        sl = S.pop(0)
        s = int(sl)
    stack.append(s)
print(stack[0])



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

using ll = long long;
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))

int n, k;
ll x[60], y[60];

int main() {
   cin >> n >> k;
   rep (i, n) {
      cin >> x[i] >> y[i];
   }

   ll ans = 1LL << 62;
   rep (xi, n) {
      rep (xj, n) {
         rep (yi, n) {
            rep (yj, n) {
               if (x[xi] <= x[xj] && y[yi] <= y[yj]) {
                  int cnt = 0;
                  rep (p, n) {
                     if (x[p]>=x[xi] && x[p]<=x[xj] && y[p]>=y[yi] && y[p]<=y[yj]) {
                        cnt++;
                     }
                  }
                  if (cnt >= k) {
                     ans = min(ans, (x[xj] - x[xi]) * (y[yj] - y[yi]));
                  }
               }
            }
         }
      }
   }
   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a, b;
	scanf("%d %d", &a, &b);
	if(a < b){
		printf("a < b\n");
	}else if(a > b){
		printf("a > b\n");
	}else{
		printf("a == b\n");
	}
	return 0;
}



Measured memory_bytes: 2120
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <iomanip>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int n,t,l,b;
	while(cin>>n>>t>>l>>b,n){
		vector<vector<double> > dp(t + 2,vector<double>(n + 1,0.0));
		vector<int> gammon(n + 1,0);
		REP(i,l){
			int tmp;
			cin >> tmp;
			gammon[tmp] = 1;
		}
		REP(i,b){
			int tmp;
			cin >> tmp;
			gammon[tmp] = 2;
		}
		dp[0][0] = 1;
		for(int i = 1;i <= t;i++){
			int max_mass = i*6 <= n ? i*6 : n;
			for(int j = 0;j <= max_mass;j++){
				if(gammon[j] == 0){//normal
				for(int roll = j-6 < 0 ? j : 6;roll > 0;roll--){
					dp[i][j] += dp[i-1][j-roll] * (1.0/6.0);
					}
				for(int backroll = j > n-6 && j != n ? j - n + 6 : 0;backroll > 0;backroll--){
					dp[i][j] += dp[i-1][n - backroll]* (1.0/6.0);
					}
				}else if(gammon[j] == 1){//lose turn
				for(int roll = j-6 < 0 ? j : 6;roll > 0;roll--){
					dp[i + 1][j] += dp[i-1][j-roll]* (1.0/6.0);
				}
				for(int backroll = j > n-6 && j != n ? j - n + 6 : 0;backroll > 0;backroll--){
					dp[i + 1][j] += dp[i-1][n - backroll]* (1.0/6.0);
					}
				}else{//back
				for(int roll = j-6 < 0 ? j : 6;roll > 0;roll--){
					dp[i][0] += dp[i-1][j-roll]* (1.0/6.0);
				}
				for(int backroll = j > n-6 && j != n ? j - n + 6 : 0;backroll > 0;backroll--){
					dp[i][0] += dp[i-1][n - backroll]* (1.0/6.0);
					}
				}
			}
		}
		double ans = 0.0;
		REP(i,t+2)ans += dp[i][n];
	cout << fixed << setprecision(5) << ans << endl;
	}
  return 0;
}

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

int main(){
  int N,T,a=1001,flag=0;
  cin >> N >> T;
  int c[N],t[N];
  for(int i=0;i<N;i++){
    cin >> c[i] >> t[i];
    if(t[i]<=T){
      flag = 1;
      a = min(a,c[i]);
    }
  }
  if(flag)
  	cout << a << endl;
  else
    cout << "TLE" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define re register
using namespace std;
int n,a,b,ans;
int main(){
	scanf("%d%d",&a,&b);
	for(re int i=1;i<=10000;++i){
		if((int)(i*0.08)==a&&(int)(i*0.1)==b){
			printf("%d",i);
			return 0;
		}
	}
	puts("-1");
}

Measured memory_bytes: 256
A, B = map(int, input().split())
S = input()
SA = S[0:A]
SB = S[A+1:A+B+1]
if not(all(map(lambda c: c in "0123456789", SA))):
  print("No")
  exit()
if not(S[A] == "-"):
  print("No")
  exit()
if not(all(map(lambda c: c in "0123456789", SB))):
  print("No")
  exit()
print("Yes")


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair 
#define f(i,n) for(int i=0;i<n;i++) 
#define F first 
#define S second 
#define pb push_back 

using namespace std;



void test(){
	int n;
	cin>>n;
	ll a[n];
	f(i,n)cin>>a[i];
	reverse(a,a+n);
	
	ll dp[n];
	dp[0] = 0;
	dp[1] = abs(a[1]-a[0]);
	
	for(int i=2;i<n;i++){
		dp[i] = min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]);
	}
	cout<<dp[n-1]<<"\n";
}

int main(){
	int tests=1;
	// cin>>tests;
	while(tests--){
		test();
	}
}


Measured memory_bytes: 5192
/******************************************************************************

                         بسم الله الرحمن الرحيم
                     Author: Mst: Mhamuda Khatun
                               RUCSE27

*******************************************************************************/

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ull unsigned long long
#define OrderSetTree tree<ll,null_type/*mapped_type*/,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define pi 2*acos(0.0)
#define f first
#define s second
#define pb push_back
#define gap ' '
#define fastio {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mod 1000000007
#define MAX 1000000000000
#define N 305

int main()
{
    fastio;
    //OrderSetTree ost;
    ll i,j,t,n,l;
    string s;
    vector<string>v;

    cin>>n>>l;

    for(i=0;i<n;i++)
    {
        cin>>s;
        v.push_back(s);
    }

    sort(v.begin(),v.end());

    for(auto i:v)
        cout<<i;

    cout<<"\n";
    return 0;   //:D
}




Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
typedef float fl;
typedef long long ll;
int A,B,C,D;

int main(){
    cin >> A >> B >> C >> D;
    for(;;){
        C -= B;
        if (C <= 0){
            cout << "Yes" << endl;
            return 0;
            }
        A -= D;
        if (A <= 0){
            cout << "No" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3636