akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#define INF 100000000

#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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

static const double EPS = 1e-8;

const int tx[] = {0,1,0,-1};
const int ty[] = {1,0,-1,0};

int main(){
	int n,r;
	while(~scanf("%d %d",&n,&r)){
		if(n==r && r==0) break;
		vector<int> pile;
		for(int i=n;i>=1;i--){
			pile.push_back(i);
		}
		for(int i=0;i<r;i++){
			int p,c;
			scanf("%d %d",&p,&c);

			vector<int> tmp;
			for(int j=p-1;j<p+c-1;j++){
				tmp.push_back(pile[j]);
			}

			for(int j=0;j<p-1;j++){
				tmp.push_back(pile[j]);
			}

			for(int j=p+c-1;j<n;j++){
				tmp.push_back(pile[j]);
			}

			pile = tmp;
		}

		printf("%d\n",*pile.begin());
	}
}

Measured memory_bytes: 0
x, n = map(int, input().split())
p = list(map(int, input().split()))
if x not in p:
    print(x)
else:
    a, b = 1, 1
    while True:
        if (x + a) not in p:
            break
        else:
            a += 1

    while True:
        if (x - b) not in p:
            break
        else:
            b += 1

    if a >= b:
        print(x - b)
    else:
        print(x + a)

Measured memory_bytes: 9144
class BinaryIndexTree
  attr_reader :bit, :size

  def initialize(size, init: 0)
    @bit = Array.new(size, init)
    @size = size
  end

  def sum(i)
    s = 0

    while i > 0
      s += bit[i]
      i -= i & -i
    end

    s
  end

  def add(i, x)
    while i < size
      bit[i] += x
      i += i & -i
    end
  end
end

N, Q = gets.split.map(&:to_i)
bit = BinaryIndexTree.new(N + 1)

Q.times do
  com, x, y = gets.split.map(&:to_i)

  if com == 0
    bit.add(x, y)
  else
    puts bit.sum(y) - bit.sum(x - 1)
  end
end



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

int main(){
    ll a,b,n;
    cin >> a >> b >> n;
    ll x = n;
    if(n>=b-1) x = b-1;
    ll ans = a*x/b - a*(x/b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define DELNL        cin.ignore(numeric_limits<streamsize>::max(),'\n')
#define VV(T,h,w)    vector<vector<T>>(h,vector<T>(w))
#define VVI(T,h,w,i) vector<vector<T>>(h,vector<T>(w,i))
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}

int main()
{
    ll n=in(),d=in();
    ll foo=d*2+1;
    cout<<(n+foo-1)/foo<<endl;
}

Measured memory_bytes: 256
import os, sys, re, math

N = int(input())
XY = []

for i in range(N):
    XY.append([int(n) for n in input().split()])

d = []
for i in range(N):
    dd = []
    for j in range(N):
        if i == j:
            dd.append(0)
        else:
            v = math.sqrt((XY[i][0] - XY[j][0]) ** 2 + (XY[i][1] - XY[j][1]) ** 2)
            dd.append(v)
    d.append(dd)

S = [0, 0, 1, 3, 6, 10, 15, 21, 28]
T = math.factorial(N)
m = T * (N - 1) // S[N] // 2

print(m * sum([sum(dd) for dd in d]) / T)


Measured memory_bytes: 9668
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

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

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */


int main() {
    string s;
    cin >> s;
    int year = stoi(s.substr(0,4));
    int month = stoi(s.substr(5,2));
    if(year == 2019 && month > 4){
        cout << "TBD" << endl;
    }else if(year > 2019){
        cout << "TBD" << endl;
    }else {
        cout << "Heisei" << endl;
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    ll n; cin >> n;
    vector<ll> a(n);

    bool dp[1000005];
    rep(i,1000005) dp[i] = false;
    map<ll,ll> mp;

    rep(i,n){
        cin >> a[i];
        mp[a[i]]++;
    }

    sort(all(a));

    ll ans = 0;
    rep(i,n){
        if(dp[a[i]]){
            continue;
        }
        if(mp[a[i]] == 1){
            ans++;
        }

        ll num = a[i];
        while(num <= 1000001){
            dp[num] = true;
            num += a[i];
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 18152
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = INT()
    P = LIST()

    P.append(-1)
    cnt = 0
    i = 0
    while i < N:
        if P[i] == i + 1:
            cnt += 1
            i += (P[i+1] == i + 2)
        i += 1

    print(cnt)


if __name__ == '__main__':
    main()


Measured memory_bytes: 21412
#include <stdio.h>

int main (){
	int angka, ratusan, puluhan, satuan;
	
	scanf("%d", &angka);
	ratusan = (angka / 100);
	puluhan = (angka%100)/10;
	satuan = (angka%100%10);
	
	if(ratusan == 7 || puluhan== 7||satuan ==7){
		puts("Yes");
	}
	else {
		puts("No");
	}
	return 0;
}

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

int main() {
	string s;
	cin >> s;
	vector<char> v;
	int n = s.size();
	for (int i = 0;i < n;i++) {
		if (s[i] == '0')v.push_back('0');
		else if (s[i] == '1')v.push_back('1');
		else if(!v.empty())v.pop_back();
	}
	int m = v.size();
	for (int i = 0;i < m;i++)cout << v[i];
}

Measured memory_bytes: 256
'''
研究室PCでの解答
'''
import math
#import numpy as np
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7 #998244353
dir = [(-1,0),(1,0),(0,-1),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"


def main():
    n = int(ipt())
    dp = [1]*(4**3)
    dp[0*16+2*4+1] = 0
    dp[2*16+0*4+1] = 0
    dp[0*16+1*4+2] = 0
    for _ in range(n-3):
        ndp = [0]*(4**3)
        for i in range(4):
            ndp[0*16+2*4+1] -= dp[i*16+0*4+2]
            ndp[i*16+2*4+1] -= dp[0*16+i*4+2]
            ndp[2*16+i*4+1] -= dp[0*16+2*4+i]
        ndp[0*16+2*4+1] += dp[0*16+0*4+2]
        ndp[2*16+2*4+1] += dp[0*16+2*4+2]
        for i in range(4):
            for j in range(4):
                for k in range(4):
                    for l in range(4):
                        ndp[i*16+j*4+k] += dp[l*16+i*4+j]
        # ndp[0*16+2*4+1] = 0
        ndp[2*16+0*4+1] = 0
        ndp[0*16+1*4+2] = 0
        for i in range(4**3):
            ndp[i] %= mod
        dp = ndp*1
#        print(dp)

    ans = 0
    for i in dp:
        ans += i
    print(ans%mod)
    return None

if __name__ == '__main__':
    main()


Measured memory_bytes: 75668
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(){
  int N,M;
  cin >> N >> M;
  ll ans = 0;
  vector<ll> X(M);
  for(int i = 0;i < M;i++)cin >> X[i];

  if(N >= M){
    cout << 0 << endl;
    return 0;
  }
  else{

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

    vector<ll> d;
    for(int i = 1;i < M;i++){
      d.push_back(X[i-1] - X[i]);
      ans += X[i] - X[i-1];
    }

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

    ll dd = 0;
    for(int i = 0;i < N - 1;i++){
      dd -= d[i];
    }

    cout << ans - dd << endl;

  }

  return 0;
}


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

#define f(i,a,b) for( ll  i = a; i < (ll) b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter   ios::sync_with_stdio(false);cin.tie(0)

// policy-based



using namespace std;


typedef long long ll; // int or long long
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;



 
const ll MAX = 3e5+100;
const ll inf = 1e9;
const ll mod = 1e9+7;


int main(){
	fastio;
	ll x;
	cin >> x;
	cout << 1-x << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

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

	long long a[100];
	a[0] = 2;
	a[1] = 1;

	range(i,2,n + 1){
		a[i] = a[i - 1] + a[i - 2];
	}
	cout << a[n] << endl;
}


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

int main() {
  	int N;
  	cin >> N;
  	int a[N];
  	for (int i = 0; i < N; i++) cin >> a[i];
  
  	int count = 0;
  	
  	for (int i = 0; i < N; i++){
      	if (i % 2 == 0 && a[i] % 2 == 1) count++;
    }
  
  	cout << count << endl;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define int long long
int h;
void maxHeapify(int *A,int i){
  int l=i*2+1;
  int r=i*2+2;
  int largest;
  if(l<h&&A[l]>A[i]) largest=l;
  else largest=i;
  if(r<h&&A[r]>A[largest]) largest=r;
  if(largest!=i){
    swap(A[i],A[largest]);
    maxHeapify(A,largest);
  }
}
void insert(int *A,int x){
  int i=h++;
  A[i]=x;
  while(i&&A[(i-1)/2]<A[i]){
    swap(A[(i-1)/2],A[i]);
    i=(i-1)/2;
  }
}
int extract(int *A){
  int res=A[0];
  A[0]=A[--h];
  maxHeapify(A,0);
  return res;
}
int A[2222222];
signed main(){
  string s;
  while(cin>>s,s!="end"){
    if(s=="insert"){
      int x;
      cin>>x;
      insert(A,x);
    }
    if(s=="extract") cout<<extract(A)<<endl;
  }
  return 0;
}

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

using namespace std;

using ll = long long;

struct Item {
  ll v, w, m;
  Item(){}
  explicit Item(ll v, ll w, ll m):v(v), w(w), m(m){}
  bool operator < (const Item& item) const {
    return v*item.w < item.v*w;
  }
};

constexpr ll MAX_N = 50;
constexpr ll MAX_V = 50;
constexpr ll LIMIT = MAX_N*MAX_N*MAX_V;

ll N, W, L;
ll w[MAX_N], p[MAX_N];
vector<ll> graph[MAX_N];

ll dp[LIMIT+1];

ll sumv[MAX_N];
ll sumw[MAX_N];
void dfs(int u) {
  sumv[u] = 1;
  sumw[u] = w[u];
  for(int v : graph[u]) {
    dfs(v);
    sumv[u] += sumv[v];
    sumw[u] += sumw[v];
  }
}

int main() {

  cin >> N >> W >> L;
  cin >> w[0];
  for(int i = 1; i < N; ++i) {
    cin >> w[i] >> p[i];
    graph[--p[i]].push_back(i);
  }
  dfs(0);

  vector<Item> items;
  for(ll i = 0; i < N; ++i) {
    items.emplace_back(sumv[i], sumw[i], (i ? L : 1e9));
  }
  sort(items.rbegin(), items.rend());

  // knapsack dp
  fill(dp, dp+LIMIT+1, LLONG_MAX/2);
  dp[0] = 0;
  for(ll i = 0; i < N; ++i) {
    ll v = items[i].v;
    ll w = items[i].w;
    ll m = min(items[i].m, MAX_V);
    for(ll k = 0; m > 0; ++k) {
      ll use = min(m, 1LL<<k);
      for(ll j = LIMIT-v*use; j >= 0; --j) {
	dp[j+v*use] = min(dp[j+v*use], dp[j]+w*use);
      }
      m -= use;
    }
  }

  // greedy
  ll ans = 0;
  for(ll i = 0; i <= LIMIT; ++i) {
    ll sum = i;
    ll cap = W-dp[i];
    if(cap < 0) continue;
    for(Item item : items) {
      if(item.m < MAX_V) continue;
      ll use = min(cap/item.w, item.m-MAX_V);
      sum += use*item.v;
      cap -= use*item.w;
    }
    ans = max(ans, sum);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1280
#include<iostream>
using namespace std;
int main (){
  int n,s[100000],q,t[50000],i,j,l,r,m,count=0; 
    
  cin>>n;
  for(i=0;i<n;i++){
    cin>>s[i];
  }
  cin>>q;
  for(i=0;i<q;i++){
    cin>>t[i];
  }

  //Binary Search

  for(i=0;i<q;i++){
     l=0;
     r=n;
     while(l<r){
       m=(l+r)/2;
       if(s[m]>t[i]){
	 r=m;
       }else if(s[m]<t[i]){
	 l=m+1;
       }else{
	 count++;
	 break;
       }
     }
  }

  cout<<count<<endl;

  return 0;
}

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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define sz(v) v.size()
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define sqr(x) x*x
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ten(n) (int)1e##n
#define tenll(n) (lli)1e##n
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

///priority_queue< int, vector< int >, greater< int > > minHeap;

void mor(){cout<<"NO"; exit(0);}


int main()
{
    ///freopen("output.txt","w",stdout);
    ///freopen("input.txt","r",stdin);

    ///FastIO;

    int n;
    scn(n);
    int a[n];
    lli dp[n][2];

    for(int i=0; i<n; i++) dp[i][1] = dp[i][0] = 0;

    for(int i=0; i<n; i++)scn(a[i]);
    dp[0][0] = a[0];
    dp[0][1] = a[0];

    for(int i=1 ; i<n; i++){
        dp[i][0] = a[i] + dp[i-1][0];
        dp[i][1] = -a[i] - a[i-1];
        if(i>1){
            dp[i][1] += max(dp[i-2][1] , dp[i-2][0]);
            dp[i][0] = max(dp[i][0] , a[i]+dp[i-1][1]);
            dp[i][1] = max(dp[i][1] , -a[i] + dp[i-1][1] + a[i-1] + a[i-1]);
        }
    }
    cout<<max(dp[n-1][0],dp[n-1][1]);
    return 0;
    ///return main();
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)


Measured memory_bytes: 2176
def rot13(c, n):
    if 'A' <= c and c <= 'Z':
        # 13 文字分ずらす
        return chr((ord(c) - ord('A') + n) % 26 + ord('A'))

    if 'a' <= c and c <= 'z':
        # 13 文字分ずらす
        return chr((ord(c) - ord('a') + n) % 26 + ord('a'))

    # その他の文字は対象外
    return c


n = int(input())
s = input()
ans = []

for i in list(s):
    ans.append(rot13(i, n))

print(''.join(ans))


Measured memory_bytes: 40048
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans += b[a[i]-1]
    if i > 0 and a[i] - a[i-1] == 1:
        ans += c[a[i-1]-1]

print(ans)

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(a.rbegin(), a.rend());

    ll ans = 0;
    if (n % 2 == 0) {
        for (int i = 0; i < n / 2; ++i)
            ans += a[i] * 2;

        for (int i = n / 2; i < n; ++i)
            ans -= a[i] * 2;

        ans -= a[n / 2 - 1];
        ans += a[n / 2];
    } else {
        ll ans1 = 0, ans2 = 0;
        for (int i = 0; i < n / 2; ++i)
            ans1 += a[i] * 2;

        ans1 -= a[n / 2];
        ans1 -= a[n / 2 + 1];
        for (int i = n / 2 + 2; i < n; ++i)
            ans1 -= a[i] * 2;

        for (int i = 0; i < n / 2 - 1; ++i)
            ans2 += a[i] * 2;
        ans2 += a[n / 2 - 1];
        ans2 += a[n / 2];
        for (int i = n / 2 + 1; i < n; ++i)
            ans2 -= a[i] * 2;

        ans = max(ans1, ans2);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3800
import sys
import string
input = sys.stdin.readline

T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())

if A1 < B1 and A2 < B2:
    print(0)
    exit()
if A1 > B1 and A2 > B2:
    print(0)
    exit()
delta1 = T1 * A1 - T1 * B1
delta2 = T2 * A2 - T2 * B2
if (delta1 + delta2) / delta1 > 0:
    print(0)
    exit()
if delta1 + delta2 == 0:
    print('infinity')
    exit()
if delta1 % (delta1 + delta2) == 0:
    print(2 * abs(delta1 // (delta1 + delta2)))
else:
    print(2 * abs(delta1 // (delta1 + delta2)) - 1)



Measured memory_bytes: 3892
n = int(input())
ans = [input() for i in range(n)]

cA = ans.count("AC")
print(f"AC x {cA}")
cW = ans.count("WA")
print(f"WA x {cW}")
cT = ans.count("TLE")
print(f"TLE x {cT}")
cR = ans.count("RE")
print(f"RE x {cR}")

Measured memory_bytes: 16248
#include<stdio.h>

int main(void){
	int h,m,s = 0;
	scanf("%d",&s);
	if(0 <= s && s < 86400){
		h = s/3600;
		s = s%3600;
		m = s/60;
		s = s%60;
		printf("%d:%d:%d\n",h,m,s);
	}
	return 0;
}


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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define FOR(i,m,n) for(int i=(m) ; i<(n) ; i++)
#define FORR(i,m,n) for(int i=(m) ; i>=(n) ; i--)

typedef long long ll;
typedef unsigned long long ull;

const int INF = 999999999;

int main(){
   string s;cin >> s;
   if(s[0] == s[2])cout <<"Yes";
   else cout << "No";
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i,a, b) for (ll i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template <class T>inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
int main()
{
    ll a,b,n;
    cin >> a >> b >> n;
    cout << min(n,(b-1))*a/b << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

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

Measured memory_bytes: 256
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	if(n%2==1){
		for(int i=0;i<m;i++)printf("%d %d\n",i+1,n-i);
	}else{
		for(int i=0;i<m;i++){
			if(i%2==0)printf("%d %d\n",i/2+1,n-i/2);
			else printf("%d %d\n",n/2-i/2-1,n/2+i/2+1);
		}
	}
}

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

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n; cin >> n;
	vector<pair<string, pair<int, int>>> vec(n);
	rep(i, 1, n)
	{
		string s;
		int p;
		cin >> s >> p;
		vec[i - 1] = { s,{p,i} };
	}
	sort(all(vec));
	rep(i, 0, n - 1)
	{
		vector<pair<int, int>> sub;
		sub.push_back({ vec[i].second.first, vec[i].second.second });
		while (i + 1 < n && vec[i].first == vec[i + 1].first)
		{
			++i;
			sub.push_back({ vec[i].second.first, vec[i].second.second });
		}
		sort(all(sub));
		reverse(all(sub));
		for (pair<int, int> x : sub)
		{
			cout << x.second << endl;
		}
	}
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {

	public static final MyScanner in = new MyScanner();

	public static void main(String[] args) {

		final String AC = "AC";
		final String WA = "WA";

		int N = in.nextInt();
		int M = in.nextInt();

		boolean[] accepteds = new boolean[N];
		int[] waCnts = new int[N];
		int acCnt = 0;
		int waCnt = 0;

		for(int i=0; i < M; i++) {
			if (acCnt == N) break;

			int p = in.nextInt();
			boolean isAc = in.next().equals(AC);
			int idx = p-1;
			if (accepteds[idx]) continue;

			if (isAc) {
				acCnt++;
				waCnt += waCnts[idx];
				accepteds[idx] = true;
			} else {
				waCnts[idx]++;
			}
		}

		System.out.println(acCnt + " " + waCnt);

	}

	public static class MyScanner{
		Scanner sc = new Scanner(System.in);
		String nextLine() {return sc.nextLine();}
		String next() {return sc.next();}
		int nextInt() {return Integer.valueOf(sc.next());}
		long nextLong() { return Long.valueOf(sc.next());}
	}
}

Measured memory_bytes: 51356
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define mod 1000000007 
#define check exit(0)
#define nl cout<<endl;
#define inp 200005
#define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define deb(v) for(int i=0;i<v.size();i++) {cout<<v[i]; (i==v.size()-1) ? cout<<"\n":cout<<" "; }
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace __gnu_pbds;
using namespace std;

// Pick yourself up, 'cause...

int main()
{
    jaldi

    int n,m;
    cin>>n>>m;

    char arr[n+1][m+1];

    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++) cin>>arr[i][j];
    }

    vector<vector<ll>> dp(n+1,vector<ll>(m+1,0));
    dp[1][0]=1;

    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(arr[i][j]=='#') continue;
            dp[i][j] = (dp[i-1][j]+dp[i][j-1])%mod;
        }
    }

    cout<<dp[n][m];
    return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define ll long long
#define pi 3.14159265358979
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
const int INF = 1000100100;

int main(){
    ll n,s[101],sum=0;
    cin>>n;
    rep(i,n){
        cin>>s[i];
        sum+=s[i];
    }
    sort(s,s+n);
    rep(i,n){
        if(sum%10!=0) break;
        if(s[i]%10!=0) sum-=s[i];
    }
    if(sum%10==0){
        cout<<0;
    }else{
        cout<<sum;
    }
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;
typedef vector<vl> v2;
typedef vector<v2> v3;
typedef vector<v3> v4;


const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

ll N;

int main(){
  cin >> N;
  for(ll h = 1;h <= 3500;h++){
    for(ll n = 1;n <= 3500;n++){
      ll hoge = -(n+h)*N+4*h*n;
      if(hoge >= 1){
        if((h*n*N)%hoge == 0){
          ll w = (h*n*N)/hoge;
          cout << h << " " << n << " " << w << endl;
          return 0;
        }
      }
    }
  }

}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

public class Main{
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		int tempA=sc.nextInt();
		int tempB=sc.nextInt();
		int frost=sc.nextInt();
		int defrs=sc.nextInt();
		int hotte=sc.nextInt();
		if(tempA<0) {
			pl(-tempA*frost+defrs+tempB*hotte);
		}
		else {
			pl((tempB-tempA)*hotte);
		}

	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
}



Measured memory_bytes: 24276
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		if(c>=a && c<=b) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 21972
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

ll GCD(ll a, ll b) { if(b==0) return a; else return GCD(b, a%b); }
ll LCM(ll a, ll b) { return a/GCD(a,b)*b; }

class BMixJuice {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int n,k;in>>n>>k;
	    vector<int> p(n);
	    rep(i,n) in>>p[i];
	    sort(all(p));
	    out<<accumulate(p.begin(),p.begin()+k, 0)<<endl;

	}
};


int main() {
	BMixJuice solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3116
#include <iostream>

using namespace std;

int main()
{
    string x,y,z;
    int x1,y1;
    cin>>x>>y;
    cin>>x1>>y1;
    cin>>z;
    if(z==x){x1--;}
    else if(z==y){y1--;}
    cout<<x1<<" "<<y1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include <set>

#define DIV 1000000007
using namespace std;
using ll = long long;

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

    vector<vector<int>> train(N + 1, vector<int>(N + 1));
    for (int i = 0; i < M; i++) {
        int l, r;
        cin >> l >> r;
        train[l][r]++;
    }

    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= N; j++) {
            if (i + 1 <= N)
                train[i + 1][j] += train[i][j];
            if (j + 1 <= N)
                train[i][j + 1] += train[i][j];
            if (i + 1 <= N && j + 1 <= N)
                train[i + 1][j + 1] -= train[i][j];
        }
    }
    /*
    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= N; j++) {
            printf("train[%d][%d]=%d ", i, j, train[i][j]);
        }
        cout << endl;
    }
    */
    for (int i = 0; i < Q; i++) {
        int p, q;
        cin >> p >> q;

        cout << train[q][q] - train[p-1][q] - train[q][p-1] + train[p-1][p-1] << endl;
    }

}


Measured memory_bytes: 1920
/// Bismillahir Rahmanir Rahim
/* Mohammad Morsalin
   Dept of ICE, NSTU
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define int long long
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ms2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pi pair<int,int>
#define tc(t) int t;cin>>t;while(t--)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ins insert
#define ALL(v) v.begin(),v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define fi first
#define se second
#define PI acos(-1)
#define sz(a) (int)a.size();
#define IOS ios::sync_with_stdio(false);
using namespace std;
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
double sq(double x) {return x*x;}
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
signed main()
{
    IOS
    int n;
    cin>>n;
    int arr[n+1];
    for(int i=1;i<=n;i++)arr[i]=1;
    for(int i=2;i<=n;i+=2){
        arr[i]++;
    }
    for(int i=3;i<=n;i++){
        for(int j=i;j<=n;j+=i){
            arr[j]++;
        }
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
        //cout << i << " "<< arr[i] << endl;
        ans+=(arr[i]*i);
    }
    cout << ans << endl;
    return 0;
}
///Alhamdulillah


Measured memory_bytes: 81756
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pi pair<int, int>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define deb(x) cout << #x << ":" << x << endl;
/* freopen("input.txt", "r", stdin); */
/* freopen("output.txt", "w", stdout); */
const ll inf = 1e17 + 7, MOD = 1e7 + 9;


int main() {
	fastio();
	int r;
	cin >> r;
	double ans = 2 * r * 3.14159265358979323846;
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
#define int long long
using namespace std;
int dp[5];

int32_t main() {
	int n,k;
	cin>>n>>k;
	int h[n];
	int dp[n];
	for(int i=0;i<n;i++){
	    cin>>h[i];
	    dp[i]=INT_MAX;
	}
	dp[0]=0;
	for(int i=1;i<n;i++){
	    for(int j=1;j<=k && j<=i;j++){
	        dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
	    }
	    
	}
	cout<<dp[n-1]<<endl;
}

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

int n;
int cur;
int ways[200005];
int prevocc[200005];
int prevpos[200005];
int ans;

int dp(int pos){
    if (ways[pos]!=-1) return ways[pos];
    if (pos==0 || pos == -1 ) return 1;
    if (prevocc[pos]==-1 || prevocc[pos] == pos-1) return ways[pos] = (dp(pos-1) % 1000000007);
    return ways[pos] = ((dp(pos-1) + dp(prevocc[pos]))%1000000007);
}

int main(){
memset(prevpos,-1,sizeof(prevpos));
memset(prevocc,-1,sizeof(prevocc));
memset(ways,-1,sizeof(ways));
scanf("%d",&n);
for (int x = 0; x<n; x++){
    scanf("%d",&cur);
    if (prevpos[cur]!=-1){
        prevocc[x] = prevpos[cur];
    }
    prevpos[cur] = x;

}
printf("%d",dp(n-1));
}


Measured memory_bytes: 8832
#include <stdio.h>
#define N 3
#define MAX 15
typedef struct{
    int A[N][N];
}Pazzle;
Pazzle P;
int d_x[4]={0,1,0,-1};
int d_y[4]={1,0,-1,0};

void swap(int *A,int *B){
 int hoge;
 hoge=*A;
 *A=*B;
 *B=hoge;
 
 
}

int check(Pazzle P){
    int sum=0,i,j,hy,hx;
    for(i=0;i<N;i++){
 
    for(j=0;j<N;j++){
        if(P.A[i][j]==0)
        continue;
        hy=(P.A[i][j]-1)/N-i;
        hx=(P.A[i][j]-1)%N-j;
        if(hy<0)
        sum-=hy;
        else
        sum+=hy;
        if(hx<0)
        sum-=hx;
        else
        sum+=hx;
 
 
}
}
 
return sum;
}

int dfs(int x,int y,int max,int cnt,int m){
         int i;
  int heau;
  int x_0,y_0;
  int ans=-1;   
  heau=check(P);
  if(heau==0) return cnt;
  if(cnt+heau>max) return -1; 
  for(i=0;i<4;i++){
    x_0=x+d_x[i];
    y_0=y+d_y[i];      
   
    if((m!=-1&&i==(m+2)%4)||!(0<=x_0 && x_0<N && 0<=y_0 && y_0<N)) continue;    
    swap(&P.A[y][x],&P.A[y_0][x_0]);
    ans=dfs(x_0,y_0,max,cnt+1,i);
    if(ans!=-1) return ans;       
     swap(&P.A[y][x],&P.A[y_0][x_0]);
  }   
  return -1;
}

int main(void){
    Pazzle t_P;
    int  i,j,ans;
    int x0,y0;

    for(i=0;i<N;i++){
        for(j=0;j<N;j++){
            scanf("%d",&P.A[i][j]);
            if(P.A[i][j]==0){
                x0=j;
                y0=i;
                
            }
            
        }
    }
    t_P=P;
    for(i=1;i<46;i++){
        P=t_P;
    ans=dfs(x0,y0,i,0,-1);
    if(ans!=-1){printf("%d\n",ans); break;}
    }
    return 0;
}






Measured memory_bytes: 2056
n = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

import bisect

ans = 0
for b in B:
    a = bisect.bisect_left(A,b)
    c = n - bisect.bisect_right(C,b)
    ans += a*c

print(ans)


Measured memory_bytes: 22720
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

ans = 0
ci = [0 for _ in range(w)]
for i in range(h - 1, -1, -1):
    co = 0
    for j in range(w - 1, -1, -1):
        if s[i][j] == 'J':
            ans += co * ci[j]
        elif s[i][j] == 'O':
            co += 1
        elif s[i][j] == 'I':
            ci[j] += 1

print(ans)


Measured memory_bytes: 85284
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int s[105],p=0;
char in[10];
int main()
{
    while(cin>>in)
        if(in[0]=='+')s[p]+=s[p--];
        else if(in[0]=='-')s[p]-=s[p--];
        else if(in[0]=='*')s[p]*=s[p--];
        else s[++p]=atoi(in);
    cout<<s[1]<<endl;
    return 0;
}



Measured memory_bytes: 3104
#include <iostream>
#include <iomanip> //setprecision()
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
using ll = long long;
using namespace std;

double Mcos(double k){return cos(k*atan(1.0)*4/180);}

void monmo(){
    
}

int main() {
    int k;
    cin>>k;
    if(k%2==0){
        cout<<"-1";
        exit(0);
    }
    int s=7;
    int hoji=7;
    for(int i=1;;i++){
        if(s%k==0){
            cout<<i;
            exit(0);
        }
        s%=k;
        hoji=(hoji*10)%k;
        s+=hoji;
        
    if(i>1000000){
        cout<<"-1";
        exit(0);
    }
    }
}


Measured memory_bytes: 3672
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <cmath>
#include <map>

template<typename T> bool chmax( T &a, T b ) { if ( a < b ) { a = b; return ( true ); } else { return ( false ); } }
template<typename T> bool chmin( T &a, T b ) { if ( a > b ) { a = b; return ( true ); } else { return ( false ); } }

using namespace std;

using ll = long long;
using ull = unsigned long long;

using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp( a, b ) make_pair( a, b )
#define mt( ... ) make_tuple( __VA_ARGS__ )

#define F first
#define S second

#define rep( i, n ) for ( int i = 0; i < (int)( n ); ++i )
#define reps( i, n ) for ( int i = 1; i <= (int)( n ); ++i )
#define rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()

#define MOD ( 1e9 + 7 )


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

	vector<Pll> v( M );
	rep( i, M )
	{
		cin >> v[i].F >> v[i].S;
	}

	ll min = N, max = 0;

	rep( i, M )
	{
		chmax( max, v[i].F );
		chmin( min, v[i].S );
	}

	ll result = ( min - max ) + 1;
	if ( result < 0 )
	{
		result = 0;
	}

	cout << result << endl;

	return ( 0 );
}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    int a, b;
    char op;
   do{
        cin>> a >> op >> b;
       if (op == '+'){
           cout << a + b <<endl;
       }
       if (op == '-'){
           cout << a - b <<endl;
       }
       if (op == '*'){
           cout << a * b <<endl;
       }
       if (op == '/'){
           cout << a / b <<endl;
       }
       if (op == 'w'){
           cout << "Hello www" <<endl;
       }
       
   }while(op != '?');
    
    return 0;
}



Measured memory_bytes: 3124
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  var num: BigInt = 100000
  for(i <- 0 until n) {
    num += num / 20
    if(num%1000!=0) {
      num = num / 1000
      num = num * 1000 + 1000
    }
  }
  println(num)
}

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

#順に考えているとTLEする
#26進数と考える

if N <= 26:
    print(chr(96 + N))
else:
    ans = list()

    while 1:
        if N%26 != 0:
            ans.append(chr(96 + N%26))
        else:
            ans.append("z")
            N -= 1
        N = N//26

        if N <= 26:
            if N%26 != 0:
                ans.append(chr(96 + N%26))
            else:
                ans.append("z")

            break

    print(''.join(map(str, ans[::-1])))

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

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

const ll MRINF = 5000000000000000;

int main() {

    int N; cin >> N;
    string S; cin >> S;
    int ans = 0;
    int ansnum = 1;

    REP1(i, S.length()-1){
        string s1, s2;
        s1 = S.substr(0, i);
        s2 = S.substr(i, S.length()-i);
        int res = 0;
        map<char, int> s1_;
        REP(j, s1.length()){
            s1_[s1[j]]++;
        }
        for(auto itr = s1_.begin(); itr != s1_.end(); ++itr){
            char t = itr->first ;
            REP(k, s2.length()){
                if(t == s2[k]){
                    res++;
                    break;
                }
            }
        }
        if(res > ans){
            ansnum = i;
            ans = res;
        }
        // ans = max(ans, res);
    }
    cout << ans << endl;


}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int a, b, c;

    cin >> a >> b >> c;

    if ((a <= c && c <= b) || (b <= c && c <= a)) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

}


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

int main(){
  int N,cnt=0;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; i++)cin>>p.at(i);

  for (int i = 0; i < N; i++){
    if(p[i]!=i+1)cnt++;
  }
  

  //cout << cnt;
  if(cnt<=2)cout << "YES" << endl;
  else cout << "NO" << endl;
}

/*
解説読んで納得したけど数字が1~Nまでの順列なので一回の入れ替えで昇順になるのは2箇所違ってるときだけ
任意の数字の順列だと思って全探索ソートカウントするものだと思ってた。
問題文はちゃんと読もう！
*/

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

using namespace std;

const int N = 1e5 + 10;

int n, q;
int cnt[N];
long long res;

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int x; cin >> x;
        cnt[x]++; res += x;
    }
    cin >> q;
    while (q--) {
        int x, y; cin >> x >> y;
        res -= 1ll * cnt[x] * x;
        res += 1ll * cnt[x] * y;
        cnt[y] += cnt[x]; cnt[x] = 0;
        cout << res << endl;
    }
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, n, 0)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1e9 + 7

using namespace std;

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

int main(void)
{
    int k;
    cin >> k;
    cout << ((k % 2 == 0) ? pow(k / 2, 2) : pow(k / 2, 2) + k / 2) << endl;
    return 0;
}

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

int n, q;
char s[200001], t[200000], d[200001];

char last_place(int index){
    for(int i=0; i<q; i++){
        if(s[index]==t[i]){
            if(d[i]=='R') index++;
            else index--;
        }
        if(index==-1) return 'l'; // lift
        else if(index==n) return 'r'; // right
    }
    return 'i'; // inside
}

int l_limit(int l, int r){
    int mid = (r + l) / 2;
    if(mid == r) return mid-1;
    else if(mid == l) return mid;

    char result = last_place(mid);
    if(result == 'l') return l_limit(mid, r);
    return l_limit(l, mid);
}

int r_limit(int l, int r){
    int mid = (r + l) / 2;
    if(mid == r) return mid;
    else if(mid == l) return mid + 1;

    char result = last_place(mid);
    if(result == 'r') return r_limit(l, mid);
    return r_limit(mid, r);
}

int main(){
    scanf("%d%d", &n, &q);
    scanf("%s", s);
    for(int i=0; i<q; i++){
        scanf(" %c %c", &t[i], &d[i]);
    }

    int vanish_left = l_limit(-1, n) + 1;
    int vanish_right = n - r_limit(-1, n);

    printf("%d\n", n - vanish_left - vanish_right);
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<int> vi;
typedef vector<ll> vl;
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}


int main (){
    int h,w;
    int ans=0;
    cin >> h >> w;
    int c[10][10];
    int a[h][w];
    rep(i,10)rep(j,10) cin >> c[i][j];
    rep(i,h) rep(j,w) cin >> a[i][j];
    for(int k=0;k<10;k++){
        for(int st=0;st<10;st++){
            for(int gl=0;gl<10;gl++){
                c[st][gl]=min(c[st][gl],c[st][k]+c[k][gl]);
            }
        }
    }
    rep(i,h){
        rep(j,w){
            if(a[i][j]==-1||a[i][j]==1) continue;
            ans+=c[a[i][j]][1];
        }
    }
    cout << ans <<endl;

    return 0;
}


Measured memory_bytes: 384
sx,sy,tx,ty = map(int,input().split())

x = tx-sx
y = ty-sy

ans = ''
ans += 'U'*y
ans += 'R'*x
ans += 'D'*y
ans += 'L'*(x+1)
ans += 'U'*(y+1)
ans += 'R'*(x+1)
ans += 'D'
ans += 'R'
ans += 'D'*(y+1)
ans += 'L'*(x+1)
ans += 'U'

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(void){
	int n,now,ans=0;
	scanf("%lld",&n);
	int a[n];
	for(int i=0;i<n;i++) scanf("%lld",&a[i]);
	now=a[0];
	for(int i=1;i<n;i++){
		if(a[i]>=now) now=a[i];
		else ans+=now-a[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5288
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
const ll INF = 1LL<<60;

string s,t;
int dp[3100][3100]={0};

int main()
{
  cin>>s>>t;
  for(int i=0;i<s.size();i++){
    for(int j=0;j<t.size();j++){
      if(s[i]==t[j])chmax(dp[i+1][j+1],dp[i][j]+1);
      chmax(dp[i+1][j+1],dp[i+1][j]);
      chmax(dp[i+1][j+1],dp[i][j+1]);
    }
  }
  string res="";
  int i=(int)s.size(),j=(int)t.size();
  while(i>0&&j>0){
    if(dp[i][j]==dp[i-1][j]){
      i--;
    }else if(dp[i][j]==dp[i][j-1]){
      j--;
    }else{
      res=s[i-1]+res;
      i--,j--;
    }
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 37120
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

void print(){ std::cout << std::endl; }
template<typename H> void print(H&& head){ std::cout << head << std::endl; }
template<typename H, typename... T> void print(H&& head, T&&... tail){
  std::cout << head << " ", print(std::forward<T>(tail)...);
}

void solve()
{
  ll M1, D1, M2, D2;
  std::cin >> M1 >> D1 >> M2 >> D2;

  if (D2 == 1) print(1);
  else print(0);

  return;
}

int main()
{
  solve();
  return 0;
}



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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if (a == b && b == c) cout << 1 << endl;
  else if (a == b && b != c) cout << 2 << endl;
  else if (a != b && b == c) cout << 2 << endl;
  else if (a == c && c != b) cout << 2 << endl;
  else cout << 3 << endl;
}

Measured memory_bytes: 3584