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

int main(){
  int x[4];
  int y[4];
  cin >> x[0] >> y[0] >> x[1] >> y[1];
  cout << x[1]-(y[1]-y[0]) << " "
       << y[1]+(x[1]-x[0]) << " "
       << x[0]-(y[1]-y[0]) << " "
       << y[0]+(x[1]-x[0]) << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
void inline swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void inline swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }



int main()
{
	int r, g, b;
	cin >> r >> g >> b;
	int x = 10 * g + b;

	if (!(x & 0b11))
		cout << "YES";
	else
		cout << "NO";
	cout << endl;
}


Measured memory_bytes: 256
object Main {
  def main (args: Array[String]) {
    val Array(v1, v2) = scala.io.StdIn.readLine.split(" ").map(_.toLong)
    println( f"${v1/v2}%d ${v1%v2}%d ${v1.toDouble/v2.toDouble}%.5f" )
  }
}

Measured memory_bytes: 44120
#include<iostream>
#include<algorithm>
#pragma GCC diagnostic error "-std=c++11"
using namespace std;
long long a[100005];
int n;
int main(){
	cin>>n;
	int i,j,cnt=0;
	long long sum=0;
	for(i=1;i<=n;++i) cin>>a[i],cnt+=(bool)(a[i]<0),a[i]=abs(a[i]),sum+=a[i];
	sort(a+1,a+n+1);
	if(cnt%2==0) cout<<sum<<endl;
	else cout<<sum-2*a[1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main() {
	int i = 1;
	int x=1;
	while( x > 0) {
		cin >> x ;
		if  ( x > 0 ){
			cout << "Case" << " " << i++ << ":" << " " << x << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 2992
package main

import (
	"fmt"
)

// S....M....E
// R...RL...LR
func searchRange(text string, start, limit int) (int, int, int) {
	middle := -1

	for i := start; i < limit; i++ {
		if text[i] != 'R' {
			middle = i
			break
		}
	}

	end := limit

	for i := middle; i < limit; i++ {
		if text[i] != 'L' {
			end = i
			break
		}
	}

	return start, middle, end
}

func answer() {
	var text string
	fmt.Scan(&text)
	limit := len(text)

	start := 0
	middle := 0
	end := 0
	firstPrinted := false

	for end < limit {
		start, middle, end = searchRange(text, start, limit)
		len1 := middle - start
		len2 := end - middle

		for i := start; i < middle-1; i++ {
			if firstPrinted {
				fmt.Print(" ")
			}
			fmt.Print("0")
			firstPrinted = true
		}

		count1 := (len1+1)/2 + len2/2
		count2 := len1/2 + (len2+1)/2

		if firstPrinted {
			fmt.Print(" ")
		}
		fmt.Printf("%v %v", count1, count2)
		firstPrinted = true

		for i := middle + 1; i < end; i++ {
			if firstPrinted {
				fmt.Print(" ")
			}
			fmt.Print("0")
			firstPrinted = true
		}
		start = end
		firstPrinted = true
	}
	fmt.Println()
}

func main() {
	answer()
}


Measured memory_bytes: 4736
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

ans = 0
ma = A[0]
for x in A[1:]:
    ans += max(0, ma-x)
    ma = max(ma, x)

print(ans)


Measured memory_bytes: 32928
N, M = map(int, input().split())

S=[]
C=[]

for i in range(M):
    a,b = map(int, input().split())
    S.append(a)
    C.append(b)

ran = [[0,10],[10,100],[100,1000]]
ans = []


for i in range(ran[N-1][0],ran[N-1][1]):
    flag = True
    i_str = str(i)
    for j in range(M):
        if i_str[S[j]-1] != str(C[j]):
            flag = False
        
    if flag:
        ans.append(i)
        
if len(ans) == 0:
    print(-1)
    
else:
    print(min(ans))
        



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

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

  int a[n];

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

  for (int i = n - 1; 0 <= i; i--) {
    if (i != n - 1) cout << " ";
    cout << a[i];
  }

  cout << "\n";

  return 0;
}



Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define cf ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;

int main()
{
    cf;
    int i, n, k ;
    cin >> n >> k  ;
    int a[n],d[n+1];
    d[0]=0;
    int x=1;
    for(i=0; i<n; i++)
    {
        cin >> a[i];
        d[i+1]=a[i]+d[i];
        if(d[i+1]<=k)
            x++;
    }
    cout << x;
    return 0;
}

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

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

typedef long long int   ll;
typedef long double     ld;
typedef pair<ll, ll>    pll;
typedef pair<int, int>  pii;

#define all(x)          x.begin(), x.end()
#define kill(x)         return cout << x << endl, 0;
#define X               first
#define Y               second
#define sep             ' '
#define endl            '\n'
#define file_io         freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

ll pw(ll a, ll b, ll mod) {
    if (!b)    return 1;
    if (b & 1) return a * pw(a * a % mod, b / 2, mod) % mod;
    return pw(a * a % mod, b / 2, mod) % mod;
}

const ll MAXN  = 1e5 + 10;
const ll INF   = 8e18;
const ll MOD   = 1e9 + 7; // 998244353;

ll cnt, ptr = -1;
string s, t;
vector<ll> ind[30];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    cin >> s >> t;
    for (ll i = 0; i < s.size(); i++) {
        ll d = (s[i] - 'a');
        ind[d].push_back(i);
    }
    for (ll i = 0; i < t.size(); i++) {
        ll d = (t[i] - 'a');
        if (ind[d].empty()) kill(-1);
        auto it = upper_bound(all(ind[d]), ptr);
        if (it == ind[d].end()) {
            cnt++;
            ptr = ind[d][0];
        }
        else {
            ptr = (*it);
        }
    }
    cout << cnt * s.size() + ptr + 1 << endl;

    return 0;
}



Measured memory_bytes: 1736
import java.util.*;

public class Main {
    public static void main(String[] args) {
        int N;
        String[] Si = null;
        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            Si = new String[N];
            for (int i = 0; i < N; i++) {
                Si[i] = sc.next();
            }
        }
        Map<String,Integer> map = new HashMap<>(N);
        int max =0;
        for(String s : Si){
            int i = map.getOrDefault(s,0);
            map.put(s,++i);
            if(max < i){
                max = i;
            }
        }
        List<String> list = new LinkedList<>();
        for(Map.Entry<String,Integer> entry : map.entrySet()){
            if (entry.getValue() == max){
                list.add(entry.getKey());
            }
        }
        String[] resultArr = new String[list.size()];
        list.toArray(resultArr);
        Arrays.sort(resultArr);
        for (int i = 0; i < resultArr.length; i++) {
            System.out.println(resultArr[i]);
        }
    }
}


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

int main() {
  ll a, b, c, k, ans = 0;
  cin >> a >> b >> c >> k;
  if(k >= a) {
    ans += a;
    k -= a;
  } else {
    ans += k;
    k = 0;
  }
  if (k <= 0) {
    cout << ans << endl;
    return 0;
  }
  if(k >= b) {
    k -= b;
  } else {
    k = 0;
  }
  if (k <= 0) {
    cout << ans << endl;
    return 0;
  }
  if(k >= c) {
    ans += -c;
    k -= c;
  } else {
    ans += -k;
    k = 0;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
from functools import lru_cache
from sys import stdin


@lru_cache(maxsize=None)
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def make_acc_gdbs(As):
    result = []
    tmp = 0
    for x in As:
        tmp = gcd(tmp, x)
        result.append(tmp)
    return result


def main():
    N = int(stdin.readline().rstrip())
    As = [int(x) for x in stdin.readline().rstrip().split()]
    lAs = make_acc_gdbs(As)
    rAs = make_acc_gdbs(As[::-1])[::-1]
    max_ = 0
    for i in range(N):
        left = 0 if i == 0 else lAs[i - 1]
        right = 0 if i == (N - 1) else rAs[i + 1]
        max_ = max(max_, gcd(left, right))
    print(max_)


if __name__ == "__main__":
    main()


Measured memory_bytes: 14652
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(),x.end()
int main()
{
  int N, W;
  cin >> N >> W;
  int WV[N][2];
  for (int i = 0; i < N; ++i) {
    cin >> WV[i][0] >> WV[i][1];
  }
  ll dp[W+1] = {0};
  for (int i = 0; i < N; ++i) {
    int w = WV[i][0];
    int v = WV[i][1];
    for (int j = W; w <= j; --j) {
      dp[j] = max( dp[j], dp[j-w]+v);
    }
  }
  cout << dp[W] << "\n";
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	string s,t;
	cin >> s>>t;
	bool flag=false;
	bool flag2 = false;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end(), greater<char>());
	for (int i = 0; i < min(s.size(),t.size()); i++) {
		if (s[i] < t[i]) {
			flag = true;
			break;
		}else if (s[i] == t[i]) {
			flag2 = true;
			flag = false;
		}
		else {
			flag = flag2=false;
		}
	}
	if (s.size() < t.size()&&flag2) {
		flag = true;
	}
	if (flag) {
		cout << "Yes";
	}
	else cout << "No";
}

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

int main() {
	long long N, K;
	long long INF = 2000000000000000000L;
	cin >> N >> K;
	long long ans = INF;

	if (N>K) {
		ans = min(ans, N-N/K*K);
		ans = min(ans, K-(N-N/K*K));
	} else { // N>=K
		ans = min(ans, N);
		ans = min(ans, K-N);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
<?php
$num=trim(fgets(STDIN));
$divide=[];
//1～9までを出力
//あまりが 0 で商が 9 以下
for($i=1;$i<=9;$i++){

    $division = intdiv($num,$i);
    $residue = $num%$i;
    
    if($division<=9&&$residue==0){
        $divide[]=$i;
        echo "Yes";
        break;
    }
    
}

if(count($divide)==0){
    echo "No";
}
?>

Measured memory_bytes: 4728
#include<bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" << endl;
#define dump(v) cerr<<#v":[ ";for (auto macro_vi:v){cerr<<macro_vi<< " ";}cerr<<"]"<<endl;
#define ddump(v) cerr<<#v":"<<endl;for(auto macro_row:v) {cerr<<"["; for (auto macro__vi:macro_row){cerr<<macro__vi<< " ";}cerr<<"]"<<endl;}
#define damp(m) for(auto macro_pair:m){cerr<< macro_pair.first<<":"<<macro_pair.second<<endl;}
#define dpair(p) cerr << #p":"<<"(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> V(n);
    rep(i,n) cin >> V[i];
    dump(V)
    int ma_cnt=0, cnt=0;
    int idx=0;
    while(idx<n-1){
        if(V[idx]>=V[idx+1]){
            cnt++;
            chmax(ma_cnt,cnt)
            ddd(idx,cnt, ma_cnt)
        } 
        else{
            cnt=0;
        }
        idx++;
    }
    cout << ma_cnt  << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 1000000000000000000

int main(void)
{
    int a, b, c;
    cin >> a >> b >> c;
    if( b - a == c - b){
        cout << "YES";
    } else {
        cout << "NO";
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<string>s(n);
    for(int i=0;i<n;i++)cin >> s[i];
    vector<long>moji(26,0);
    for(int i=0;i<n;i++){
        moji[(int)(s[i][0]-'A')]++;
    }
    int sets[5] = {0,2,(int)('R'-'A'),(int)('H'-'A'),(int)('M'-'A')};
    long ans = 0;
    for(int i=0;i<5;i++){
        for(int j=i+1;j<5;j++){
            for(int k=j+1;k<5;k++){
                ans += moji[sets[i]]*moji[sets[j]]*moji[sets[k]];
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 6144
n, m = map(int, input().split())
needs = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [-1] * (n + 8)
dp[0] = 0
for a in sorted(map(int, input().split()), reverse=True):
    na = needs[a]
    for i in range(n + 1):
        if dp[i] == -1:
            continue
        dp[i + na] = max(dp[i + na], dp[i] * 10 + a)
print(dp[n])


Measured memory_bytes: 16624
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define rv(i,a,b) for(int i=(a);i>=(b);--i)
#define ls (rt<<1)
#define rs (rt<<1|1)
using namespace std;
const int M = 220000;
typedef long long ll;
int n,m,k;
char s[M];
int c[M]={0};
int nx[M];
struct node{
    int x,d;
    bool operator < (const node & b){
        return x<b.x;
    }
}e[M];
int mx[M<<2]={0};
void upd(int rt,int l,int r,int p,int val){
    if(l==r){
        mx[rt]=val;
        return;
    }
    int mid=(l+r)>>1;
    if(p<=mid) upd(ls,l,mid,p,val);
    else upd(rs,mid+1,r,p,val);
    mx[rt]=max(mx[ls],mx[rs]);
}
int query(int rt,int l,int r,int L,int R){
    if(l==L&&r==R) return mx[rt];
    int mid=(l+r)>>1;
    if(L>mid) return query(rs,mid+1,r,L,R);
    if(R<=mid) return query(ls,l,mid,L,R);
    return max(query(ls,l,mid,L,mid), query(rs,mid+1,r,mid+1,R));
}
int dp[M]={0};
const int md=998244353;
int main(){
    cin>>n;
    fo(i,1,n){
        cin>>e[i].x>>e[i].d;
    }
    sort(e+1,e+1+n);
    nx[n]=n;
    upd(1,1,n,n,n);
    rv(i,n-1,1){
        int lo=i,hi=n;
        int tar=e[i].x+e[i].d-1;
        for(int mid=(lo+hi)>>1;lo<hi;mid=(lo+hi)>>1){
            if(e[mid].x<tar) lo=mid+1;
            else hi=mid;
        }
        if(lo>n) lo=n;
        if(e[lo].x>tar) --lo;
        nx[i]=query(1,1,n,i,lo);
        nx[i]=max(nx[i],i);
        upd(1,1,n,i,nx[i]);
    }
    dp[0]=1;
    fo(i,1,n){
        dp[nx[i]]=(dp[nx[i]]+dp[i-1])%md;
        dp[i]=(dp[i]+dp[i-1])%md;
    }
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 6912
def main():
    n = int(input())
    s = input()
    res = w = s.count('.')
    b = 0
    for i in range(n):
        if s[i] == '#':
            b += 1
        else:
            w -= 1
        res = min(res,b+w)

    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3500
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
ll n,x,y,a[200005],ans;
int main(void){
    scanf("%lld",&n);
    for(int i=0;i<n;i++){
        scanf("%lld",a+i);
        if(i==0)x+=a[i];
        else y+=a[i];
    }
    ans=abs(x-y);
    for(int i=1;i<n-1;i++){
        x+=a[i];
        y-=a[i];
        ans=min(ans,abs(x-y));
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int)N;i++)
#define p(s) cout<<(s)<<endl
#define ck(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf=1e9;
int h[100010];
int main(){
	int N,M;
	cin>>N>>M;
	int a,b;
	REP(i,0,M){
		cin>>a>>b;
		h[a]++;
		h[b]++;
	}
	string ans="YES";
	REP(i,0,N){
		if(h[i]%2) {
			ans="NO";
			break;
		}
	}
	p(ans);
	return 0;
}


Measured memory_bytes: 640
<?php
$n = fgets(STDIN);
$omori = explode(' ', rtrim(fgets(STDIN)));

$g1 = 0;    //前半(group1)の重さ
$g2 = array_sum($omori);    //後半(group2)の重さ
$ans = 9999;    //解答（絶対値の最小値）
$sa = 0;

for($i=0; $i<$n; $i++) {
    $g1 += $omori[$i];
    $g2 -= $omori[$i];
    
    $sa = abs($g1 - $g2);
    
    if($sa < $ans) {
        $ans = $sa;
    }
}

echo $ans;
?>

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

using namespace std;

#define int long long
#define ar array
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)

template<class T>
bool umin(T &a, const T &b) {
    return b < a ? a = b, 1 : 0;
}

template<class T>
bool umax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

template<class A>
void read(vt<A> &v);

template<class A, size_t S>
void read(ar<A, S> &a);

template<class T>
void read(T &x) {
    cin >> x;
}

void read(double &d) {
    string t;
    read(t);
    d = stod(t);
}

void read(long double &d) {
    string t;
    read(t);
    d = stold(t);
}

template<class H, class... T>
void read(H &h, T &... t) {
    read(h);
    read(t...);
}

template<class A>
void read(vt<A> &x) {
    EACH(a, x)read(a);
}

template<class A, size_t S>
void read(array<A, S> &x) {
    EACH(a, x)read(a);
}

string to_string(char c) {
    return string(1, c);
}

string to_string(bool b) {
    return b ? "true" : "false";
}

string to_string(const char *s) {
    return string(s);
}

string to_string(string s) {
    return s;
}

string to_string(vt<bool> v) {
    string res;
    FOR(sz(v))res += char('0' + v[i]);
    return res;
}

template<size_t S>
string to_string(bitset<S> b) {
    string res;
    FOR(S)res += char('0' + b[i]);
    return res;
}

template<class T>
string to_string(T v) {
    bool f = 1;
    string res;
    EACH(x, v) {
        if (!f)
            res += ' ';
        f = 0;
        res += to_string(x);
    }
    return res;
}

template<class A>
void write(A x) {
    cout << to_string(x);
}

template<class H, class... T>
void write(const H &h, const T &... t) {
    write(h);
    write(t...);
}

void print() {
    write("\n");
}

template<class H, class... T>
void print(const H &h, const T &... t) {
    write(h);
    if (sizeof...(t))
        write(' ');
    print(t...);
}

template<class T, class U>
void vti(vt<T> &v, U x, size_t n) {
    v = vt<T>(n, x);
}

template<class T, class U>
void vti(vt<T> &v, U x, size_t n, size_t m...) {
    v = vt<T>(n);
    EACH(a, v)vti(a, x, m);
}

void solve() {
    vt<int> a(26);
    
    string s;
    read(s);
    
    FOR(s.size()) {
        a[s[i] - 'a']++;
        if (a[s[i] - 'a'] > 1) {
            print("no");
            return;
        }
    }
    
    print("yes");
}

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int tt = 1;
    //read(tt);
    FOR(tt) {
        
        solve();
        
    }
    
}



Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int H, W;
vector<string> matrix;
vector<pair<int, int>> dirs = {
	{-1, 0},
	{1, 0},
	{0, 1},
	{0, -1}
};
bool isInGrid(int i, int j){
	return i > -1 && j > -1 && i < H && j < W;
}
int dist(pair<int, int> c){
	vector<vector<bool>> v (H, vector<bool> (W));
	queue<pair<pair<int, int>, int>> q;
	q.push({{c.first, c.second}, 0});
	int m = 0;
	while(!q.empty()){
		pair<pair<int, int>, int> curr = q.front(); q.pop();
		pair<int, int> pos = curr.first;
		if(v[pos.first][pos.second]) continue;
		v[pos.first][pos.second] = true;
		m = max(m, curr.second);
		for(auto dir : dirs){
			if(isInGrid(pos.first + dir.first, pos.second + dir.second) && matrix[pos.first + dir.first][pos.second + dir.second] == '.'){
				q.push({{pos.first + dir.first, pos.second + dir.second}, curr.second + 1});
			}
		}
	}
	return m;
}
int main(){
	cin >> H >> W;
	matrix = vector<string> (H);
	for(int i = 0; i < H; i++) cin >> matrix[i];
	int res = 0;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			if(matrix[i][j] == '.'){
				res = max(res, dist({i, j}));
			}
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
map <int ,int> mpa,mpb;

struct Card{ char suit, value;};

void trace(struct Card A[], int n){
  for(int i=0;i<n;i++){
    if(i) cout << " ";
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}

int selectionSort(struct Card A[], int n){
  int minv=0;
  int cnt=0;
  for(int i=0;i<n;i++){
    minv=i;
    for(int j=i;j<n;j++){
      if(A[minv].value > A[j].value){
        minv=j;
      }
    }
    swap(A[i],A[minv]);
    if(i!=minv) cnt++;
  }
  return cnt;
}

int bubbleSort(struct Card A[], int n){
  int cnt=0;
  int flag=1;
  int v=0;
  while(flag){
    int i=0;
    flag=0;
    for(int j=n-1;i+1<=j;j--){
      if(A[j].value < A[j-1].value){
        Card t=A[j];A[j]=A[j-1];A[j-1]=t;
        cnt++;
        flag=1;
      }
    }
    i++;
  }
  return cnt;
}

bool isStable(struct Card C1[], struct Card C2[], int n){
  for(int i=0;i<n;i++){
    if(C1[i].suit !=C2[i].suit) return false;
  }
  return true;
}

int main (){
  Card C1[100],C2[100];
  int N;
  char ch;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> C1[i].suit >> C1[i].value;
  }
  for(int i=0;i<N;i++) C2[i]=C1[i];

  bubbleSort(C1,N);
  selectionSort(C2,N);
  
  trace(C1,N);
  cout << "Stable" << endl;
  
  trace(C2,N);
  if(isStable(C1,C2,N)){
    cout << "Stable" << endl;
  } else {
    cout << "Not stable" << endl;
  }
  return 0;
}


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

using namespace std;

int main() {

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

	vector<int> a(m, 0);

	for (int i = 0; i < n; i++) {
		int k;
		cin >> k;
		int tmp;
		for (int j = 0; j < k; j++) {
			cin >> tmp;
			a[tmp-1]++;
		}
	}

	int counter = 0;
	for (int j = 0; j < m; j++) {
		if (a[j] == n) {
			counter++;
		}
	}

	cout << counter << endl;
}

Measured memory_bytes: 256
n = int(input())
v = []
for i in range(n):
    v.append(int( input() ))
v.sort()

c = v[n // 2]
ans = 0
for i in range(n):
    ans += 2 * abs(v[i] - c)

if (n % 2 == 0):
    ans -= c - v[n//2 - 1]
else:
    ans -= min(v[n//2+1]-c, c-v[n//2-1])

print(ans)


Measured memory_bytes: 7424
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X = sc.nextInt();
		int Y = sc.nextInt();
		Map<Integer, Integer> ans = new HashMap<>();
		for(int i = 1; i < N; i++)
			ans.put(i, 0);
		for(int i = 1; i <= N; i++) {
			for(int j = i+1; j <= N; j++) {
				int d = Math.min(j-i, Math.min(Math.abs(X-i)+1+Math.abs(Y-j), Math.abs(Y-i)+1+Math.abs(X-j)));
				ans.put(d, ans.get(d)+1);
			}
		}
		for(int i = 1; i < N; i++)
			System.out.println(ans.get(i));
	}

}

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

int main(){
  int n;
  cin>>n;
  while(n--){
    string str;
    cin>>str;

    int cnt=1;
    while(str.size()!=1){
       cnt++;
      int a=(str[0]-'0')+(str[1]-'0');
      string b;
      if(a>=10) b+=(a/10+'0'),b+=(a%10+'0');
      else b=(a+'0');
      str=b+str.substr(2,str.size());
    }


  if(cnt%2)cout <<"Audrey wins."<<endl;
  else cout <<"Fabre wins."<<endl;
  }

  return 0;
}

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int r, g;
  while (cin >> r >> g) {
    cout << 2 * g - r << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
S = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2,5,4,1,4,1,51]
K = int(input())
print(S[K-1])

Measured memory_bytes: 3060
#include <iostream>

bool ACGT(char x) {
    return (x == 'A') || (x == 'T') || (x == 'G') || (x =='C');
}

int main() {
    std::string s;
    int ans = 0, idx = 0, n, cnt;
    std::cin >> s;
    n  = s.size();
    while (idx < n) {
        if (ACGT(s[idx])) {
            cnt = 0;
            while (idx < n && ACGT(s[idx])) {
                ++cnt;
                ++idx;
            }
            ans = std::max(cnt, ans);
        } else {
            while(idx < n && !ACGT(s[idx])) ++idx;
        }
    }
    std::cout << ans << '\n';
    return 0;
}

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

int main() {
    ll h, w, n;
    cin >> h >> w >> n;
    vector<ll> ans(10, 0);
    ans[0] = (h - 2) * (w - 2);
    set<pair<ll, ll>> filled;
    vector<pair<ll, ll>> points(n);
    rep(i, n) {
        cin >> points[i].first >> points[i].second;
        points[i].first--;
        points[i].second--;
        filled.insert(points[i]);
    }

    set<pair<ll, ll>> checked;
    rep(i, n) {
        for (int dx = -1; dx <= 1; dx++) {
            for (int dy = -1; dy <= 1; dy++) {
                ll cx = points[i].first + dx;
                ll cy = points[i].second + dy;
                if (cx < 1 || h - 1 <= cx || cy < 1 || w - 1 <= cy) continue;
                if (checked.count({cx, cy})) continue;
                int cnt = 0;
                for (int dirx = -1; dirx <= 1; dirx++) {
                    for (int diry = -1; diry <= 1; diry++) {
                        if (filled.count({cx + dirx, cy + diry})) cnt++;
                    }
                }
                ans[0]--;
                ans[cnt]++;
                checked.insert({cx, cy});
            }
        }
    }
    rep(i, 10) {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 64256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

ll GCD(ll a, ll b){
   return b ? GCD(b, a%b) : a;
}

ll LCM(ll a, ll b){
   return a/(GCD(a, b)) * b;
}

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, C, D;
   cin >> A >> B >> C >> D;

//   ll diff = B - A;
//
//   cout << diff - (diff/C + diff/D - diff/LCM(max(C,D),min(C,D))) << endl;

   A--;
   ll ans1 = B - (B/C + B/D - B/LCM(max(C,D),min(C,D)));
   ll ans2 = A - (A/C + A/D - A/LCM(max(C,D),min(C,D)));
   cout << ans1 - ans2 << endl;

   return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
char *repl(char *s,int a,int b,char *r){
	int i=0;
	for(;a<=b;a++,i++){
		s[a]=r[i];
	}
	return s;
}
char *rev(char *s,int a,int b){
	char t[1000]={};
	int i=0,j;
	for(j=b;j>=a;j--,i++){
		t[i]=s[j];
	}
	repl(s,a,b,t);
	return s;
}
void prt(char *s,int a,int b){
	for(;a<=b;a++){
		printf("%c",s[a]);
	}
	printf("\n");
	return;
}

int main(void) {
	char s[1000],r[1000],o[8];
	int q,a,b;
	scanf("%s",s);
	scanf("%d",&q);
	for(;q;q--){
		scanf("%s",o);
		if(!strcmp(o, "replace")){
			scanf("%d %d %s",&a,&b,r);
			repl(s,a,b,r);
		}else if(!strcmp(o, "reverse")){
			scanf("%d %d",&a,&b);
			rev(s,a,b);
		}else if(!strcmp(o, "print")){
			scanf("%d %d",&a,&b);
			prt(s,a,b);
		}
	}
	return 0;
}

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

fn main() {
    let sx: i32 = read();
    let sy: i32 = read();
    let tx: i32 = read();
    let ty: i32 = read();

    let mut ans = String::new();

    for _ in 0..tx - sx {
        ans.push('R');
    }
    for _ in 0..ty - sy {
        ans.push('U');
    }
    for _ in 0..tx - sx {
        ans.push('L');
    }
    for _ in 0..ty - sy {
        ans.push('D');
    }
    ans.push('D');
    for _ in 0..tx - sx + 1 {
        ans.push('R');
    }
    for _ in 0..ty - sy + 1 {
        ans.push('U');
    }
    ans.push('L');
    ans.push('U');
    for _ in 0..tx - sx + 1 {
        ans.push('L');
    }
    for _ in 0..ty - sy + 1 {
        ans.push('D');
    }
    ans.push('R');

    println!("{}", ans);
}

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


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int n;
string st;

int main(){
	while(getline(cin,st)){
		if(st=="0")return 0;
		int cur=0,p=0,one=0,s=0;
		while(cur<st.size()){
			if(isdigit(st[cur]))p=p*10+st[cur]-'0';
			if(st[cur]==' '){
				if(p==1)one++;
				if(p>10)s+=10;
				else s+=p;
				p=0;
			}
			cur++;
		}
		if(p==1)one++;
		if(p>10)s+=10;
		else s+=p;
		if(s>21)cout<<0<<endl;
		else{
			if(s<12&&one)cout<<s+10<<endl;
			else cout<<s<<endl;
		}
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 100009;
ll i,n,p;
string s;
ll r[N], l[N], w[N];
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>s;
    n = s.length();
    s = "$" + s;
    rep(i,1,n + 1){
        if(s[i] == 'R')
            p = i;
        r[i] = p;
    }
    revrep(i,n,1){
        if(s[i] == 'L')
            p = i;
        l[i] = p;
    }
    rep(i,1,n + 1){
        if(s[i] == 'R'){
            p = l[i];
            if((p - i) & 1) w[p - 1] += 1;
            else
                w[p] += 1;
        }
        else{
            p = r[i];
            if((i - p) & 1) w[p + 1] += 1;
            else
                w[p] += 1;
        }
    }
    rep(i,1,n + 1) cout<<w[i]<<" ";
    return 0;
}

Measured memory_bytes: 2924
#include<stdio.h>

int main(){
    char s[11];
    int year, month, day;
    scanf("%d/%d/%d", &year, &month, &day);
    
    if(year>=2019){
        if(month>4){
            printf("TBD");
        }else{
            printf("Heisei");
        }
    }else{
        printf("TBD");
    }

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
// lint mod = 998244353;

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

  int n=s.length();
  int o=0;
  rep(i,n/2){
    if(s[i]!=s[n-1-i]) o++;
  }

  return o;
}

int main(){cout<<app()<<endl;return 0;}


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

int main(){
  int A,B;
  cin >> A >> B;
  if(A>=13){
    cout << B << endl;
  }else if(A<=5){
    cout << 0 << endl;
  }else{
    cout<< B/2 << endl;
  }
  return 0;
}


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

public class Main {
	public static void main(String[] args){
		Toi junbi = new Junbi2();
		junbi.solve();
	}
}

interface Toi{
	public void solve();
}

class Junbi1 implements Toi{
	public void solve(){
		for (int i = 1; i <= 9; i++) {
			for (int j = 1; j <= 9; j++) {
				System.out.println(i + "x" + j + "=" + i * j);
			}
		}
	}
}

class Junbi2 implements Toi{
	public void solve(){
		Scanner sc = new Scanner(System.in);
		int[] array = new int[10];
		for (int i = 0; i < array.length; i++) {
			array[i] = sc.nextInt();
		}
		Arrays.sort(array);
		for (int i = 0; i < 3; i++) {
			System.out.println(array[array.length - (i + 1)]);
		}
	}
}


Measured memory_bytes: 26244
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {

	int A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;
	int money = 0;
	if ((A + B) / 2.0 <= C) {
		money += A * X + B * Y;
	}
	else {
		money += 2 * min(X, Y) * C;
		if (X > Y) {
			money += min(A, 2 * C) * (X - Y);
		}
		else {
			money += min(B, 2 * C) * (Y - X);
		}
	}

	cout << money;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
ll A[5000001],bin[5000001];
vector<ll>v;
map<int,int>myMap;
set<int>mySet;
vector<pair<ll,ll> >vp;
/*void bti(ll n)
{
ll k=1;
  while(n!=0)
    {
    bin[k++]=n%2;
    n/=2;
    }
}*/
/*void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}*/
int main()
{
 ll n,k,a,ans=0,d;
 cin>>n;
 for(int i=1;i<=n;i++)
 {
   cin>>d;
   myMap[d]=i;
 }
 for(int i=1;i<=n;i++)
 {
     cout<<myMap[i];
     if(i==n)
        cout<<endl;
     else
        cout<<" ";
 }
 //cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 5504
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
a, b, k = [int(num) for num in lines.pop(0).split(" ")]
s1 = set(range(a, min(b, a + k)))
s2 = set(range(max(a, b - k + 1), b + 1))
lis = sorted(s1 | s2)
for i in lis:
    print(i)


Measured memory_bytes: 9080
solver::Int->Int->Int->Int->String
solver a b c d = if a+b == c+d then "Balanced\n" else if a+b > c+d then "Left\n" else "Right\n"

main::IO()
main=do
  abcdc<-getLine
  let a:b:c:d:[]=map read (words abcdc)
  putStr (solver a b c d)

Measured memory_bytes: 508
#include <stdio.h>

int main (void)
{
    int a, b, c, d, e, k;

    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    scanf("%d", &d);
    scanf("%d", &e);
    scanf("%d", &k);

    if (e - a > k) {
        puts(":(");
        return 0;
    }
    puts("Yay!");
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		int[]X = new int[N];
		string[] str = Console.ReadLine().Split();
		for(var i=0;i<N;i++){
			X[i] = int.Parse(str[i]);
		}
		long ans = 99999999999999999;
		for(var i=1;i<=100;i++){
			long ct = 0;
			for(var j=0;j<N;j++){
				ct += (i-X[j])*(i-X[j]);
			}
			ans = Math.Min(ans,ct);
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 11092
// Queue_ex.cs

using System;
using System.Collections.Generic;

class Queue_ex {
	public static void Main() {

		Queue<string> names = new Queue<string>();
		Queue<int> numbers = new Queue<int>();

		string qq = Console.ReadLine();
		string[] str = qq.Split();
		int n = int.Parse(str[0]);
		int q = int.Parse(str[1]);

		string[] name = new string[n];
		int[] time = new int[n];

		string name_time;
		string[] name_time_arr = new string[2];
		for(int i = 0; i < n; i++) {
			name_time = Console.ReadLine();
			name_time_arr = name_time.Split();
			name[i] = name_time_arr[0];
			time[i] = int.Parse(name_time_arr[1]);
			names.Enqueue(name[i]);
			numbers.Enqueue(time[i]);
		}
		int j;
		int sum = 0;
		Queue<int> strage_num = new Queue<int>();
		Queue<string> strage_names = new Queue<string>();
		while(true) {

			int now_num = numbers.Dequeue();
			string now_name = names.Dequeue();
			bool b = false;
			for(j = 1; j <= q; j++) {
				now_num--;
				if(now_num == 0) {
					sum += j;
					strage_num.Enqueue(sum);
					strage_names.Enqueue(now_name);
					j = q;
					b = true;
				}
			}
			if(b == false) {
				sum += q;
			}

			if(now_num != 0) {
				numbers.Enqueue(now_num);
				names.Enqueue(now_name);
			}
			if(numbers.Count == 0) {
				break;
			}

		}
		int how = strage_num.Count;
		int[] last_arr = new int[how];
		string[] last_arr2 = new string[how];
		for(int u = 0; u < n; u++) {
			last_arr2[u] = strage_names.Dequeue();
			last_arr[u] = strage_num.Dequeue();
		}

		for(int z = 0; z < how; z++) {
			Console.WriteLine(last_arr2[z] + " " + last_arr[z]);
		}

	}
}

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

#define ll long long

ll n, m, x;
vector < vector <ll> > a;
ll result = LLONG_MAX;

void bt(ll i, ll c, vector <ll> iq){
	if (i == n){
		// cout << c << " ";
		bool ok = 1;
		for (ll j = 0; j < m ; j ++){
			if (iq[j] < x) ok = 0;
		}
		if (ok){
			result = min(result, c);
		}
		return;
	}

	vector <ll> iq_ = iq;
	for (ll j = 0; j < m; j ++){
		iq_[j] += a[i][j + 1];
	}
	bt(i + 1, c + a[i][0], iq_);
	bt(i + 1, c, iq);
}

int main(){
	cin >> n >> m >> x;
	a.resize(n, vector <ll> (m + 1));
	for (ll i = 0; i < n; i ++){
		for (ll j = 0; j < m + 1; j ++){
			cin >> a[i][j];
		}
	}
	vector <ll> cr(m);
	bt(0, 0, cr);
	if (result == LLONG_MAX) cout << "-1\n";
	else	cout << result << "\n";
}

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


int main(){
	long long n,a=1,b=1,c,x,y;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> x >> y;
		c=max( (a+x-1)/x,(b+y-1)/y );
		
		a=x*c;
		b=y*c;
	}
	
	cout << a+b << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var S = cin.Read;
            var chars = S.ToCharArray();
            var ans = 0;
            for (int i = 0; i < chars.Length / 2; i++)
            {
                if (chars[i] != chars[chars.Length - i - 1])
                {
                    ans++;
                }
            }
            Console.WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


Measured memory_bytes: 13268
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int h,n;
    R(h,n);
    int v=0;
    REP(i,n){
        int x;
        R(x);
        v+=x;
    }
    W(h<=v?"Yes":"No");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


bool isPrime[101];

// n番目までの数について素数かどうか判断する
void primeTable(int n) {
	for (int i = 1; i <= n; i++) isPrime[i] = true;
	isPrime[0] = isPrime[1] = false;

	for (int i = 2; i <= n; i++) {
		if (isPrime[i]) {
			for (int j = 2 * i; j <= n; j += i) isPrime[j] = false; // iの倍数はすべて素数でない
		}
	}
}

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

	int N; cin >> N;

	primeTable(N);
	vector<int> prime; // N以下の素数
	prime.push_back(2);
	for (int i = 3; i <= N; i += 2) {
		if (isPrime[i])prime.push_back(i);
	}

	vector<int> L(prime.size());
	for (int i = 2; i <= N; i++) {
		int tmp = i;
		for (int j = 0; j < prime.size() && tmp != 1; j++) {
			// 素因数分解
			while (tmp%prime[j] == 0) {
				L[j]++;
				tmp /= prime[j];
			}
		}
	}
	
	int R[5];
	for (int i = 0; i < 5; i++)R[i] = 0;
	for (int i = 0; i < L.size(); i++) {
		if (L[i] >= 2) R[0]++; // 3回以上現れる素数の個数
		if (L[i] >= 4) R[1]++; // 5回
		if (L[i] >= 14) R[2]++; // 15回
		if (L[i] >= 24) R[3]++; // 25回
		if (L[i] >= 74) R[4]++; // 75回
	}

	ll ans = 0;
	ans += R[1] * (R[1] - 1) * (R[0] - 2) / 2;
	ans += R[2] * (R[1] - 1);
	ans += R[3] * (R[0] - 1);
	ans += R[4];
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256