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

using ci = const int;
using ld = long double;
using ll = long long;
using ull = unsigned long long;
using pii = pair <int,int>;
using pcc = pair <char,char>;
using pll = pair <ll,ll>;
using pss = pair <string,string>;
using vi = vector <int>;
using vb = vector <bool>;
using vpii = vector <pii>;
using vll = vector <ll>;
using vii = vi::iterator;

#define INF (0x3f3f3f3f)
#define MOD 1000000007
#define mt make_tuple
#define all(c) c.begin(), c.end()
#define ms(name,val) memset(name, val, sizeof (name))
#define np nullptr
// inline functions



vector <pll> v;

bool cmp(pll &A, pll &B)
{
    if (A.second != B.second) return (A.second < B.second);
    return (A.first > B.first);
}

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

    int n;
    cin >> n;
    v.resize(n);

    for (int t1 = 0; t1 < n; ++t1)
        cin >> v[t1].first >> v[t1].second;

    sort(all(v), cmp);
    ll t = 0;

    for (int t1 = 0; t1 < n; ++t1)
    {
        if (t+v[t1].first <= v[t1].second)
            t += v[t1].first;
        else
        {
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";



























































    return 0;
}

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

using namespace std;

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

    vector<long long> a(3 * n);
    for (int i = 0; i < 3 * n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    long long ans = 0;
    for (int i = 0; i < 2 * n; i += 2) {
        ans += a[n + i];
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace AOJ.Codes
{
    //問題の名称... ALDS1_3_B:   Elementary data structures - Queue
    //問題文のURL... http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_B&lang=jp
    //所要時間... XXX
    //学んだこと... 単純なQueueの使い方を学ぶことができた。
    //教室内の大まかな着席位置... 中央 x 中央

    class ElementaryDataStructuresB
    {
        static void Main(string[] args)
        {
            //読み込み
            var x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var n = x[0];
            var q = x[1];

            var Q = new Queue<Tuple<string, int>>();

            for (int i = 0; i < n; i++)
            {
                var xx = Console.ReadLine().Split().ToArray();
                var t = new Tuple<string, int>(xx[0], int.Parse(xx[1]));
                Q.Enqueue(t);
            }

            //計算
            var Ans = new List<Tuple<string, int>>();
            var Now = 0;

            while (Q.Count > 0)
            {
                var item = Q.Dequeue();

                if (q < item.Item2) //終了しない場合。
                {
                    Now += q;
                    Q.Enqueue(new Tuple<string, int>(item.Item1, item.Item2 - q));
                }
                else //終了する場合！
                {
                    Now += item.Item2;
                    Ans.Add(new Tuple<string, int>(item.Item1,Now));
                }
            }

            //出力
            foreach (var item in Ans)
            {
                Console.WriteLine(item.Item1 + " " + item.Item2);
            }

            //Enterを押して終了
            Console.ReadLine();
        }


    }
}



Measured memory_bytes: 32056
n, m = gets.split.map(&:to_i)
xs = gets.split.map(&:to_i).sort!

dists = 0.upto(m - 2).with_object(Array.new(m - 1, 0)) do |i, a|
  a[i] = xs[i + 1] - xs[i]
end

puts xs.last - xs.first - (dists.max(n - 1).inject(:+) || 0)


Measured memory_bytes: 10480
n = int(input())

p1, p2 = (0, 0), (100, 0)
ans_ls = [p1, p2]


def koch(d, p1, p2):
    '''
    d...現在の深さ 0スタートにする
    p1,p2...端の座標。ここから途中の座標を計算しlistにappendする
    '''
    # 終了条件
    if d == n:
        return

    # 内分点の計算
    s = (2/3 * p1[0] + 1/3 * p2[0], 2/3 * p1[1] + 1/3 * p2[1])
    t = (1/3 * p1[0] + 2/3 * p2[0], 1/3 * p1[1] + 2/3 * p2[1])

    # 正三角形の頂点uの計算
    # (u-s)=R(1/3 pi) (t-s)が成り立つのでsを移行してuが計算できる。R()は回転行列で、加法定理から導出可能。
    R = [[1/2, -0.86602540378], [0.86602540378, 1/2]]
    u = (R[0][0] * (t[0] - s[0]) + R[0][1] * (t[1] - s[1]) + s[0],
         R[1][0] * (t[0] - s[0]) + R[1][1] * (t[1] - s[1]) + s[1])
    ans_ls.extend([s, u, t])  # 確定した点を追加

    # 再帰的に探索
    koch(d+1, p1, s)
    print(*s)
    koch(d+1, s, u)
    print(*u)
    koch(d+1, u, t)
    print(*t)
    koch(d+1, t, p2)


print(*p1)
koch(0, p1, p2)
print(*p2)



Measured memory_bytes: 6192
N = int(input())
A = list(map(int,input().split()))
C = {}
for i in range(N):
    if A[i] not in C:
        C[A[i]] = 0
    C[A[i]] += 1
cmax = 0
for a in A:
    cnt = C[a]
    if a-1 in C:
        cnt += C[a-1]
    if a+1 in C:
        cnt += C[a+1]
    cmax = max(cmax,cnt)
print(cmax)

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;


int N, K;
string S;

signed main(){
    cin >> N >> K;
    cin >> S;
    /*
    int l = 0, r = N - 1, cnt = 0, ans = 0;
    while(l <= r){
        while(S[l] == S[l + 1] && l + 1 <= r - 1) {ans++; l++;}
        while(S[r - 1] == S[r] && l + 1 <= r - 1) {ans++; r--;}
        if(cnt < K){
            ans += 2;
            cnt++;
        }
        l++; r--;
    }
    PRINT(ans);
    */
    int cnt = 0, ans = 0;
    REP(i, N){
        if(i > 0 && S[i - 1] == 'L' && S[i] == 'L') ans++;
        if(i < N - 1 && S[i] == 'R' && S[i + 1] == 'R') ans++;
    }
    REP(i, N - 1) if(S[i] != S[i + 1]) cnt++;
    if(K >= (cnt + 1) / 2) ans += cnt;
    else ans += 2 * K;
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int main()
{
  int a,b,ans1,ans2;
  double ans3;
  scanf("%d%d",&a,&b);

  ans1=a/b;
  ans2=a%b;
  ans3=(double)a/b;
  printf("%d %d %2.5f",ans1,ans2,ans3);
  return 0;
}

Measured memory_bytes: 640
n, p = map(int, input().split())
a = list(map(int, input().split()))
cnt = [0 for i in range(5001)]
cnt[0] = 1
for i in range(n):
    for j in range(5000-i, -1, -1):
        if cnt[j] > 0:
            cnt[j+a[i]] += cnt[j]
total = 0
for i in range(p, 5001, 2):
    total += cnt[i]

print(total)


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

int main() {
  int n, k;
  cin >> n >> k;
  int s = 0;
  
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x < k-x)
      s += 2 * x;
    else
      s += 2 * (k-x);
  }
  
  cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lower_bound lowb
#define upper_bound upb
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
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 mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};



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

	int n;
	cin >> n;
	int a[n];
	rep(i, n) cin >> a[i];

	int res = INF;
	int l = 0;

	int sum[n];
	sum[0] = a[0];
	REP(i, 1, n) sum[i] = sum[i - 1] + a[i];

	rep(i, n) {
		int t = abs(sum[n - 1] - (2 * sum[i]));
		chmin(res, t);
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3968
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: u32 = read();
    let b: u32 = read();

    let res = (a + b + 1) / 2;

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


Measured memory_bytes: 4352
#pylint: disable=missing-docstring,bad-whitespace,invalid-name,len-as-condition,trailing-newlines,multiple-statements,unnecessary-semicolon,trailing-whitespace,superfluous-parens
import math as M

n = int(input())
h = list(map(int,input().split()))
tot = 0
for i in range(1,n):
    if(h[i]<h[i-1]):
        tot += abs(h[i-1]-h[i])
        h[i] += abs(h[i-1]-h[i])
print(tot)
exit()

num = input()
sum = 0
for ch in num :
    sum += ord(ch)-ord('0')
if sum%9==0 :
    print('Yes')
else :
    print('No')
exit()      

n,x,t = (map(int,input().split()))
print(t*(n//x) + t*(min(n%x,1)))
exit()

n = int(input())
a = list(map(int,input().split()))
cm = 1000
p1 = p2 = a[0]
for i in range(1,n):
    #print(i,a[i],p1,p2)
    if(a[i]>=p2):
        p2 = a[i]
    elif(a[i]<p2):
        cm += (cm//p1)*(p2-p1)
        p1 = p2 = a[i]
cm += (cm//p1)*(p2-p1)
print(cm)
exit()

cm = 1000
for i in range(0,40):
    st = cm//100
    cm -= st*100
    cm += st*200
print(cm)
print(M.log10(cm))
print(M.log2(10**16))
exit()

isPrime = [1]*101
isPrime[0]=isPrime[1]=0
for i in range(2,int(M.sqrt(101)+1)) :
    if not isPrime[i] : continue
    for j in range(i*i,101,i) :
        isPrime[j]=0

pa = 5
pb = 1
ctr= 0
for i in range(2,101) : 
    if not isPrime[i] : continue
    if i==5 : 
        ctr+=1
        continue
    if(ctr&1) : 
        pa *= i
    else : 
        pb *= i
    ctr+=1
print(pa,' ',pa<=2*(10**18))
print(pb,' ',pb<=2*(10**18))


#init pa = 5, pb = 1
#into b  2
#into a  3
#into a  7
#into b  11
#into a  13
#into b  17
#into a  19
#into b  23
#into a  29
#into b  31
#into a  37
#into b  41
#into a  43
#into b  47
#into a  53
#into b  59
#into a  61
#into b  67
#into a  71
#into b  73
#into a  79
#into b  83
#into a  89
#into b  97
#1931237034633205845   True
#1193829614179601806   True


Measured memory_bytes: 33332
#include<bits/stdc++.h>
//#pragma GCC optimize("O3")
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back

using namespace std;
using ll=long long;
// using ll=int;

const ll mod = (ll)(1e9+7);

typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

int main(){

    /*
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("myoutput.txt", "w", stdout);
    #endif
    */

    fast;
    ll t = 1;
    // cin >> t;
    while(t--){
        ll r, c; cin >> r >> c;
        if(r == 1 or c == 1) { cout << 1 << endl; return 0; }
        ll odd_col=c-c/2;
        ll even_col = c-odd_col;
        ll odd_row=ceil(r*1.0/2);
        ll even_row=r-odd_row;
        cout << odd_col*odd_row+even_col*even_row << endl;
        
    }
    // cerr << (double)clock()/CLOCKS_PER_SEC << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 998244353
#define INF 98765431219876543
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, string> PS;

int main() {
  ll n;
  cin >> n;
  vector<ll> x, y, h;
  REP(i, n) {
    ll a, b, c;
    cin >> a >> b >> c;
    x.pb(a);
    y.pb(b);
    h.pb(c);
  }

  REP(i, 101) {
    REP(j, 101) {
      ll height = -1, height2 = INF;
      REP(k, n) {
        if (h[k] == 0) {
          height2 = min(height2, abs(x[k] - i) + abs(y[k] - j));
        } else {
          ll e = h[k] + abs(x[k] - i) + abs(y[k] - j);
          if (height > 0 && e != height) {
            break;
          }
          height = e;
        }

        if (k == n - 1) {
          if (height == -1) {
            if (height2 > 0) {
              cout << i << " " << j << " " << height2 << endl;
            }
          } else {
            if (height > 0 && height <= height2) {
              cout << i << " " << j << " " << height << endl;
            }
          }
        }
      }
    }
  }
}

Measured memory_bytes: 256
import bisect
INF = float('inf')
A, B, Q = [int(_) for _ in input().split()]
S = [-INF] + [int(input()) for _ in range(A)] + [INF]
T = [-INF] + [int(input()) for _ in range(B)] + [INF]
X = [int(input()) for _ in range(Q)]
for x in X:
    i_sl = bisect.bisect_left(S, x)
    i_tl = bisect.bisect_left(T, x)
    D_sl = S[i_sl] - x
    D_tl = T[i_tl] - x
    D_sr = x - S[i_sl - 1]
    D_tr = x - T[i_tl - 1]
    print(
        min([
            max(D_sl, D_tl),
            max(D_sr, D_tr),
            min(D_sl, D_tr) + D_tr + D_sl,
            min(D_tl, D_sr) + D_sr + D_tl
        ]))

Measured memory_bytes: 16144
a = input()
a_list = list(a)
l = len(a)
count = 0
if a_list[0] == "A" and a_list[1].islower() and a_list[l-1].islower():
  for i in range(l-3):
    if a_list[i+2] == "C":
         count = count+1
    elif a_list[i+2].isupper():
        print("WA")
        exit()
if count == 1:
    print("AC")
else:
  print("WA")

Measured memory_bytes: 3064
var
	A,B,C,K:Longint;
begin
	read(A,B,C,K);
	while A>=B do begin
		dec(K);
		B:=B*2;
	end;
	while B>=C do begin
		dec(K);
		C:=C*2;
	end;
	if K<0 then writeln('No')else writeln('Yes');
end.


Measured memory_bytes: 1384
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N = int(readline())
A = [0]+list(map(int,readline().split()))

m = map(int,read().split())
UV = zip(m,m)
graph = [[] for _ in range(N+1)]
for u,v in UV:
    graph[u].append(v)
    graph[v].append(u)

root=1
parent = [0] * (N+1)
ts = []
stack = [root]
while stack:
    x = stack.pop()
    ts.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)

INF = 10**18

"""
各頂点において、
・「根側を全て正にするための切断回数」
・「各切断回数ごとの、根側に残る数の和の最小値」（array）
を持つ
"""

def merge(dp1,dp2):
    # 回数 -> 和の最小値が入っている
    L1,L2 = len(dp1),len(dp2)
    if L1>L2:
        L1,L2=L2,L1
        dp1,dp2=dp2,dp1
    dp = np.full(L1+L2-1,INF)
    for i,x in enumerate(dp1):
        np.minimum(dp[i:L2+i],x+dp2,out=dp[i:L2+i])
    return dp

def v_to_e(cut,arr):
    # 部分木頂点までのdp情報を、辺までのdp情報に変更
    arr = np.append(arr,0)
    negative = np.where(arr<0)[0]
    # 全て正として切る
    if cut != INF:
        if arr[cut+1] > 0:
            arr[cut+1] = 0
    # 全て負として切る
    if len(negative)>0:
        n = negative[0]
        if cut>n+1:
            cut=n+1
    np.minimum(arr[negative+1],0,out=arr[negative+1])
    return cut,arr

positive_cut_cnt = [None]*(N+1)
rest_sum_array = [None]*(N+1)

for x in ts[::-1]:
    a = A[x]
    arr = np.array([a],np.int64)
    cut = 0
    for c in graph[x]:
        if c == parent[x]:
            continue
        c_cut = positive_cut_cnt[c]
        c_arr = rest_sum_array[c]
        c_cut,c_arr = v_to_e(c_cut,c_arr)
        cut += c_cut
        arr = merge(arr,c_arr)
    if a<0:
        cut=INF
    positive_cut_cnt[x]=cut
    rest_sum_array[x] = arr

answer = positive_cut_cnt[1]
negative = np.where(rest_sum_array[1]<0)[0]
if len(negative):
    n = negative[0]
    if answer > n:
        answer = n

print(answer)

Measured memory_bytes: 135144
require 'set'

def main
    n,k = gets.chomp.split(" ").map(&:to_i)
    as = gets.chomp.split(" ").map(&:to_i)

    memory = [1]
    ord = Array.new(n+1,-1)
    i = 1
    ord[0] = 1
    initpoint = -1
    cnt = 0
    while k > cnt
        cnt += 1
        i = as[i-1]
        if ord[i-1] != -1
            initpoint = i
            break
        else
            memory.push i
            ord[i-1] = memory.size
        end
    end
    if initpoint == -1
        puts memory[-1]
    else
        init_i = ord[initpoint-1]
        k -= cnt
        puts memory[k % (memory.size - init_i + 1) + init_i - 1]
    end
end

main

## イディオムなど
# until s.empty? do
#
## 配列のインデックス
# s[0,6] # 0番目から6文字
# s[0..6] # 0番目から6番目まで
# s[5..-1] # 5番目から最後まで
#
## 全探索
# [0, 1].repeated_permutation(n) do |combination| # 2^n の全探索
# array.combination(i) do |selected| # array から要素が i 個である部分列を全部抽出

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

bool f(char c){
    return c == 'A' || c == 'C' || c == 'G' || c == 'T';
}

int main(){
    int ans = 0;
    string S;
    cin >> S;
    for(int i = 0; i < S.size(); ++i){
        int buf = 0;
        for(int j = i; j < S.size(); ++j){
            if(f(S[j])) ++buf;
            else break;
        }
        ans = max(ans, buf);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;
    int a=((n-1)*(n-2))/2;
    if(k>a){
        cout<<-1<<endl;
        return 0;
    }
    cout<<n-1+a-k<<endl;
    Fr(i,n-1){
        cout<<i<<" "<<n<<endl;
    }
    int c=a-k;
    Fr(i,n-1){
        Fr(j,i-1){
            if(c==0) return 0;
            cout<<i<<" "<<j<<endl;
            --c;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

double dot(P a,P b){return real(conj(a)*b);}
double cross(P a,P b){return imag(conj(a)*b);}

typedef long double Real;

int main(){
  int s;
  while(~scanf("%d",&s)){
    vi x;
    if(s>0)x.push_back(s);
    REPR(i,8){
      scanf("%d",&s);
      if(s>0)x.push_back(s);
    }
    if(x.size()==4){
      puts("B");
    }else if(x.size()==1){
      puts("C");
    }else{
      int a=0,b=0;
      while(x[0]%10==0){
        ++a;
        x[0]/=10;
      }
      while(x[1]%10==0){
        ++b;
        x[1]/=10;
      }
      if(x.size()==3){
        if(a==b){
          puts("D");
        }else{
          puts("F");
        }
      }else{
        if(a==b){
          puts("A");
        }else if(a>b){
          puts("E");
        }else{
          puts("G");
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1184
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] number =	new int[n];
		long ans = 1;
		for(int i=0;i<n;i++){
			number[i] = stdIn.nextInt();
		}
		
		for(int i=2;i<=1000;i++){
			int max=0;
			for(int j=0;j<n;j++){
				int count=0;
				while(number[j]%i==0){
					count++;
					number[j] =number[j]/i;
				}
				if(count>max){
					max = count;
				}
			}
			for(int j=1;j<=max;j++){
				ans = ans * i;
			}
		}
		
		System.out.println(ans);
	}

}

Measured memory_bytes: 17324
#include <stdio.h>

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

Measured memory_bytes: 1008
#include <bits/stdc++.h>
using namespace std;
int main(){
  int k;
  string s;
  cin >> k >> s;
  for(int i=0; i<min(k, (int)s.size()); i++){
    cout << s[i];
  }
  cout << (k < s.size() ? "..." : "") << endl;
}

Measured memory_bytes: 3600
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<long long>::max();
const double PI = acos(-1);
#define fir first
#define sec second
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m,k, s, t, q, ans, sum, a, d[1000000], last;
struct Edge { LL to,cost; };
vector<Edge>vec[100010];
string str, ss;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> n >> m;
	if (m == 0)ans = n*n;
	else {
		rep(i, n + 1) {
			if (m < i) {
				h = n / i;
				ans += h*(i - m) + max(n%i - m + 1, (LL)0);
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back

const int INF = 1e9;
const int MOD = 1e9+7;

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i++)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

//library----------------------------------------------

int main() {
    CIN(N,M);
    int AC=0,WA=0;
    vector<int> ac(N),wa(N);

    rep(i,M){
        CIN(p);SCIN(s);
        if(s=="AC"){
            if(ac[p-1]==0){
                AC++;
                WA+=wa[p-1];
            }
            ac[p-1]=1;
        }else{
            wa[p-1]++;
        }
    }
    
    printf("%d %d\n",AC,WA);
    return 0;
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N;
    cin >> N;
    Vl A(N), B(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (ll i = 0; i < N; i++) {
        cin >> B[i];
    }
    Vl cumA(N + 1), cumB(N + 1);
    for (ll i = 0; i < N; i++) {
        cumA[i + 1] += cumA[i] + A[i];
        cumB[i + 1] += cumB[i] + B[i];
    }
    ll ans = 0;
    for (ll i = 0; i < N; i++) {
        ans = max(ans, cumA[i + 1] + cumB[N] - cumB[i]);
    }
    cout << ans << "\n";
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 256
#-*-coding:utf-8-*-

def main():
    blackboard_list = list(map(int, input().split()))
    K = int(input())

    blackboard_list[blackboard_list.index(max(blackboard_list))] = max(blackboard_list) * 2 ** K
    print(sum(blackboard_list))

if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
import sys

# sys.stdin = open('d1.in')

n, W = map(int, input().split())
g = {}
w1 = 0
for i in range(n):
    w, v = map(int, input().split())
    if i == 0:
        w1 = w
        for x in range(w, w + 4):
            g[x] = []
    g[w].append(v)
for w, values in g.items():
    values.sort(reverse=True)

sg = {}
sg[w1] = {}
sg[w1 + 1] = {}
sg[w1 + 2] = {}
sg[w1 + 3] = {}
for a in range(len(g[w1]) + 1):
    sg[w1][a] = sum(g[w1][:a])
for b in range(len(g[w1 + 1]) + 1):
    sg[w1 + 1][b] = sum(g[w1 + 1][:b])
for c in range(len(g[w1 + 2]) + 1):
    sg[w1 + 2][c] = sum(g[w1 + 2][:c])
for d in range(len(g[w1 + 3]) + 1):
    sg[w1 + 3][d] = sum(g[w1 + 3][:d])

res = 0
for a in range(len(g[w1]) + 1):
    for b in range(len(g[w1 + 1]) + 1):
        for c in range(len(g[w1 + 2]) + 1):
            for d in range(len(g[w1 + 3]) + 1):
                total_w = w1 * a + (w1 + 1) * b + (w1 + 2) * c + (w1 + 3) * d
                if total_w > W:
                    continue

                total_v = sg[w1][a] + sg[w1 + 1][b] + sg[w1 + 2][c] + sg[w1 + 3][d]
                if total_v > res:
                    res = total_v
print(res)


Measured memory_bytes: 3188
EPS = 1e-9
INF = Float::INFINITY
n, m, l = gets.split.map(&:to_i)
p, t, v = n.times.map{ gets.split.map(&:to_f) }.transpose
v.map!{ |e| l / e }
prob_set = n.times.map{ [0] * (m + 1) }

factorial = (1..m).each_with_object([1]) { |i, arr| arr << arr[-1] * i }
n.times do |i|
  (m + 1).times do |j|
    prob_set[i][j] = (p[i] / 100.0) ** j * (1 - p[i] / 100.0) ** (m - j) * factorial[m] / factorial[m - j] / factorial[j]
  end
end
prob_sum = prob_set.map{ |ps| (0..m).map{ |i| ps[i..-1].reduce(:+) } }

n.times do |i|
  ret = 0
  (m + 1).times do |j|
    prob = prob_set[i][j]
    time = v[i] + t[i] * j
    n.times do |k|
      next if i == k
      upper = (time - v[k]) / t[k] + EPS
      if upper >= m || time - v[k] == 0 && t[k] == 0 || v[i] == INF && v[k] == INF
        prob = 0
        break
      end
      upper = upper < 0 ? 0 : upper.ceil
      prob *= prob_sum[k][upper]
    end
    ret += prob
  end
  puts '%.8f' % ret
end

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

int main(){
 int n,m;  cin>>  n >> m  ;
  
 // vector<int>vec();
 // for(int i=0; i<  ;i++)  cin>>vec.at(i);  
  if(n>=m)
  cout<< 10  <<  endl;
  else cout<<0<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    
    int k, x;
    cin >> k >> x;
    
    int max = x + (k - 1);
    int min = x - (k - 1);
    
    for(int i = min; i <= max; i ++){
        cout << i << " " ;
    }
}

Measured memory_bytes: 3652
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)

def solve(n: int, a: "List[int]"):
    tmp = 0
    s = 0
    for i, v in enumerate(a):
        s += v
        if i % 2 == 0 and s <= 0:
            tmp += abs(s) + 1
            s = 1
        elif i % 2 != 0 and s >= 0:
            tmp += abs(s) + 1
            s = -1
    ret = tmp
    tmp = 0
    s = 0
    for i, v in enumerate(a):
        s += v
        if i % 2 == 0 and s >= 0:
            tmp += abs(s) + 1
            s = -1
        elif i % 2 != 0 and s <= 0:
            tmp += abs(s) + 1
            s = 1
    ret = min(ret, tmp)
    print(ret)

def _solve(n: int, a: "List[int]"):
    o, e = 0, 0
    tmp = 0
    for i, v in enumerate(a):
        if i % 2 == 0:
            e += v
            if e < 0:
                tmp += abs(e) + 1
                e = 1
            else:
                tmp += max(0, abs(o) - abs(e) + 1)
                e += tmp
        else:
            o += v
            if o > 0:
                tmp += abs(o) + 1
                o = -1
            else:
                tmp += max(0, abs(e) - abs(o) + 1)
                o -= tmp
    ret = tmp

    o, e = 0, 0
    tmp = 0
    for i, v in enumerate(a):
        if i % 2 == 0:
            e += v
            if e > 0:
                tmp += abs(e) + 1
                e = -1
            else:
                tmp += max(0, abs(o) - abs(e) + 1)
                e -= tmp
        else:
            o += v
            if o < 0:
                tmp += abs(o) + 1
                o = 1
            else:
                tmp += max(0, abs(e) - abs(o) + 1)
                o += tmp
    ret = min(ret, tmp)
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(n) ]  # type: "List[int]"
    solve(n, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 15348
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
 
const int mxN=300, M=1e9+7;
int n, a[21][21];
ll dp[1<<21];
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
 
	cin >> n;
	for(int i=0; i<n; ++i)
		for(int j=0; j<n; ++j)
			cin >> a[i][j];
	dp[0]=1;
	for(int i=1; i<1<<n; ++i)
		for(int j=0; j<n; ++j)
			if(i>>j&1&&a[__builtin_popcount(i)-1][j])
				dp[i]=(dp[i]+dp[i^1<<j])%M;
	cout << dp[(1<<n)-1];
}

Measured memory_bytes: 19988
#include <iostream>
#include <vector>
#include <string>

#define INPUT_FROM_FILE (0)
#if INPUT_FROM_FILE
#include <fstream>
#endif

enum Face{
	TOP,
	SOUTH,
	EAST,
	WEST,
	NORTH,
	BOTTOM,
};

class Dice{
private:
	std::vector<int> faces_;	

public:
	Dice(const std::vector<int> &labels);

	~Dice();

	void roll_north();

	void roll_east();

	void roll_west();

	void roll_south();

	void roll_to(char d);

	int get_cur_top_label();
};

Dice::Dice(const std::vector<int> &labels) : faces_(labels){
	return;
}

Dice::~Dice(){
	return;
}

void Dice::roll_north(){
	int tmp = faces_[TOP];
	faces_[TOP] = faces_[SOUTH];
	faces_[SOUTH] = faces_[BOTTOM];
	faces_[BOTTOM] = faces_[NORTH];
	faces_[NORTH] = tmp;
	return;
}

void Dice::roll_east(){
	int tmp = faces_[TOP];
	faces_[TOP] = faces_[WEST];
	faces_[WEST] = faces_[BOTTOM];
	faces_[BOTTOM] = faces_[EAST];
	faces_[EAST] = tmp;
	return;
}

void Dice::roll_west(){
	int tmp = faces_[TOP];
	faces_[TOP] = faces_[EAST];
	faces_[EAST] = faces_[BOTTOM];
	faces_[BOTTOM] = faces_[WEST];
	faces_[WEST] = tmp;
	return;
}

void Dice::roll_south(){
	int tmp = faces_[TOP];
	faces_[TOP] = faces_[NORTH];
	faces_[NORTH] = faces_[BOTTOM];
	faces_[BOTTOM] = faces_[SOUTH];
	faces_[SOUTH] = tmp;
	return;
}

void Dice::roll_to(char d){
	switch(d){
	case 78:
		roll_north();
		break;
	case 69:
		roll_east();
		break;
	case 87:
		roll_west();
		break;
	case 83:
		roll_south();
		break;
	default:
		break;
	}
	return;
}

int Dice::get_cur_top_label(){
	return faces_[TOP];
}

int main(int argc, char **argv){
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif
	int num_faces = 6;
	std::vector<int> labels(num_faces, 0);
	Dice *dice = NULL;
	std::string operations;

	for(int i = 0; i < num_faces; i++){
#if INPUT_FROM_FILE
		ifs >> labels[i];
#else
		std::cin >> labels[i];
#endif;
	}

	dice = new Dice(labels);

#if INPUT_FROM_FILE
	ifs >> operations;
#else
	std::cin >> operations;
#endif;

	for(unsigned int i = 0; i < operations.size(); i++){
		dice->roll_to(operations.at(i));
	}

	std::cout << dice->get_cur_top_label() << std::endl;	
	delete dice; dice = NULL;
	return 0;
}

Measured memory_bytes: 3124
from collections import Counter, deque, defaultdict
from functools import lru_cache

c=Counter()
n=int(input())
for i in range(n):
	s=input()
	c[s] +=1

x = c.most_common()
pv = x[0][1]
arr=[]
for k,v in x:
	if v < pv:
		break
	arr.append(k)
arr.sort()
for k in arr:
	print(k)

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

int main () {

    string S, T;
    cin >> S >> T;

    int ans = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == T[i]) {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main()
{
    int A, B;
    cin >> A >> B;
    
    int result = -1;
    for (int i = 1; i <= 1009; i++) {
        int sumA = i * 0.08;
        int sumB = i * 0.1;
        if (sumA == A && sumB == B) {
            result = i;
            break;
        }
    }
    
    cout << result << endl;
}

Measured memory_bytes: 256
n = int(input())

ans = -1

tmp = -1

for _ in range(n):
  a = int(input())
  if a == tmp +1:
    ans += 1
    tmp = a
  elif a <= tmp:
    ans += a
    tmp = a
  else:
    print(-1)
    exit()

print(ans)
  
  

Measured memory_bytes: 48600
N, K = map(int, input().split())
A = list(map(int, input().split()))

A_dic = dict()
for i in range(N):
    if A[i] in A_dic:
        A_dic[A[i]] += 1
    else:
        A_dic[A[i]] = 1
A_dic = sorted(A_dic.items(), key=lambda x:x[1])        

change_count = len(A_dic) - K
count = 0
for i in range(change_count):
    count += A_dic[i][1]
    

print(count)

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

using namespace std;

int main(){
	long long n,k;
	cin>>n>>k;
	n++;
	vector<long long> ruisekiH(n+1,0);
	vector<long long> ruisekiL(n+1,0);

	for(int i=1;i<=n;i++) ruisekiL.at(i)=ruisekiL.at(i-1)+i;
	for(int i=1;i<=n;i++) ruisekiH.at(i)=ruisekiH.at(i-1)+n-i+1;

	long long ans=0;

	for(int i=k;i<=n;i++){
		ans=(ans+ruisekiH.at(i)-ruisekiL.at(i)+1)%1000000007;
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 6364
a, b = gets.split.map(&:to_i)

ans = Array.new(100) {Array.new(100, ?.)}
ans.map!{|e| e.fill(?#, 50..99)}

i = 1
j = 51
while a > 1
    ans[i][j] = ?.
    j += 2
    if j > 99
        i += 2
        j = 51
    end
    a -= 1
end

i = j = 1
while b > 1
    ans[i][j] = ?#
    j += 2
    if j > 48
        i += 2
        j = 1
    end
    b -= 1
end

puts "100 100"
ans.each {|e| puts e.join}

Measured memory_bytes: 14384
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,a,b;
    while(~scanf("%d %d %d",&a,&b,&n))
    {
        if(n>=a&&n<=b)
            printf("Yes\n");
            else if(n<a||n>b)
                printf("No\n");

    }

    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

vvl G;
vl visited;
vl ans;

void dfs(ll v) {
    // 行きの処理はこのへんに書く
    visited[v] = 1;
    for(auto u : G[v]) { 
        if(visited[u]) {
            continue;
        }
        ans.pb(u);
        dfs(u);
        // 帰りの処理はこのへんに書く
        return;
    }
}

int main() {
    ll n, m;
    cin >> n >> m;    
    
    G.resize(n);
    visited.resize(n);
    rep(i, m) {
        ll a, b;
        cin >> a >> b;
        a--;  b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    
    ans.pb(0);
    dfs(0);
    reverse(all(ans));
    dfs(0);

    out(ans.size());
    for(auto p : ans) {
        cout << p+1 << " ";
    }

    cout << endl;
    re0;
}

Measured memory_bytes: 10868
from collections import defaultdict
from heapq import heappop, heappush


class Graph():

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return self.graph.keys()


class Dijkstra():

    def __init__(self, graph, start):
        self.g = graph.graph

        self.dist = defaultdict(lambda: float("inf"))
        self.dist[start] = 0

        self.prev = defaultdict(lambda: None)

        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            dist_u, u = heappop(self.Q)

            if self.dist[u] < dist_u:
                continue

            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(self.Q, (alt, v))

    def shortest_distance(self, goal):

        return self.dist[goal]

    def shortest_path(self, goal):
        path = []
        node = goal

        while node is not None:
            path.append(node)
            node = self.prev[node]

        return path[::-1]


g=Graph()
n,m=map(int,input().split())
from collections import defaultdict
e=defaultdict(int)
for _ in range(m):
    a,b,c=map(int,input().split())
    g.add_edge(a,b,c)
    g.add_edge(b,a,c)
    a,b=min(a,b),max(a,b)
    e[(a,b)]+=1



d=[0]*(n+1)
d[0]=1
for i in range(1,n+1):
    dd=Dijkstra(g,i)
    for j in range(i+1,n+1):
        l=dd.shortest_path(j)
        for k in range(1,len(l)):
            a,b=min(l[k-1:k+1]),max(l[k-1:k+1])
            e[(a,b)]=0
ans=0
for v in e.values():
    ans+=v

print(ans)


Measured memory_bytes: 61660
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>
typedef long long llint;
typedef long double ldouble;
// 小大
int compare(const void *a, const void *b){return *(llint *)a - *(llint *)b;}
typedef struct{
    llint aa;
    llint bb;
}frequent;
// 小大
int cmp( const void *p, const void *q ) {
    return ((frequent*)p)->bb - ((frequent*)q)->bb;
}


int main(void){
    llint n,i,sum=0;
    scanf("%lld",&n);
    llint a[n];
    for(i=0;i<n;i++){
        scanf("%lld",&a[i]);
    }
    for(i=0;i<n;i++){
        sum+=a[i]-1;
    }


    printf("%lld\n",sum);
    return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define TRACE(x) if(DEBUG) cerr << #x << " = " << x << endl;
#define TRACE2(x,y) if(DEBUG) cerr << #x << " = " << x << " | " << #y << " = " << y << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

bool c(string s)
{
	for (int i = 0; i < s.size(); ++i)
	{
		if(i%2 && s[i] == 'R')
			return false;
		if(i%2==0 && s[i] == 'L')
			return false;
	}
	return true;
}

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

	string s;
	cin >> s;

	if(c(s))
		cout << "Yes";
	else
		cout << "No";
}

Measured memory_bytes: 256
while True:
	size = map(int, raw_input().split())
	if sum(size) == 0: break
	size.remove(max(size))
	m = (size[0]**2 + size[1]**2) ** 0.5
	for i in range(input()):
		n = input()
		print "OK" if m < n * 2 else "NA"

Measured memory_bytes: 4272
from itertools import groupby

s = input()
A = [(key, sum(1 for _ in group)) for key, group in groupby(s)]
tmp = 0
ans = 0
for key, count in A:
    if key == '<':
        ans += count*(count+1)//2
        tmp = count
    else:
        if tmp < count:
            ans -= tmp
            ans += count
        ans += (count-1)*count//2
        tmp = 0
print(ans)


Measured memory_bytes: 85192
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int[] x = new int[N];
        int[] y = new int[N];

        for(int i=0; i<N; i++){
            x[i] = scan.nextInt();
            y[i] = scan.nextInt();
        }

        long a = x[0], b = y[0];
        for(int i=1 ;i<N;i++){

            long k = Math.max((a - 1)/x[i] + 1, (b - 1)/y[i] + 1);
            a = x[i] * k;
            b = y[i] * k;
        }

        System.out.println(a + b);
    }
}




Measured memory_bytes: 39608
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>

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 = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()
#define MP make_pair

int main() {
	int s[3][3];
	REP(i, 3) REP(j, 3) cin >> s[i][j];
	REP(i, s[0][0] + 1) {
		REP(j, s[1][1] + 1) {
			REP(k, s[2][2] + 1) {
				int a[3] = { i,j,k }, b[3] = { s[0][0] - i, s[1][1] - j,s[2][2] - k };
				bool m = {};
				REP(i, 3) REP(j, 3) if (s[i][j] != a[i] + b[j]) m = true;
				if (!m) {
					cout << "Yes" << endl;
					return 0;
				}
			}
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int lcs[3001][3001];
vector<char> res;
 
void GetLCS(string s, string t, int i, int j)
{
    if (i == 0 || j == 0)
        return;
 
    if (lcs[i][j] == lcs[i-1][j])
    {
        GetLCS(s, t, i-1, j);
    }
    else if (lcs[i][j] == lcs[i][j-1])
    {
        GetLCS(s, t, i, j-1);
    }
    else if (lcs[i][j] == lcs[i-1][j-1] + 1)
    {
        res.push_back(s[i-1]);
        GetLCS(s, t, i-1, j-1);
    }
}
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
 
    string s,t;
 
    cin >> s >> t;
    int l1 = s.length();
    int l2 = t.length();
 
    // base case
    for(int i=0; i<=l2; ++i)
        lcs[0][i] = 0;
    for(int i=0; i<=l1; ++i)
        lcs[i][0] = 0;
 
    for(int i=1; i<=l1; ++i)
    {
        for(int j=1; j<=l2; ++j)
        {
            if(s[i-1] == t[j-1])
            {
                lcs[i][j] = lcs[i-1][j-1] + 1;
            }
            else
                lcs[i][j] = max(lcs[i][j-1], lcs[i-1][j]);
        }
    }
    
    if (lcs[l1][l2] != 0)
    {
        int i = l1, j=l2;
    
    /*
        while(i != 0 && j != 0)
        {
            if(lcs[i][j] == lcs[i - 1][j]) 
            {
                i -= 1;
            } 
            else if (lcs[i][j] == lcs[i][j - 1]) 
            {
                j -= 1;
            } 
            else if (lcs[i][j] == lcs[i - 1][j - 1] + 1) 
            {
                res.push_back(s[i - 1]);
                i -= 1;
                j -= 1;
            }
        }*/
        
        /*
        while(i > 0 && j > 0)
        {
            if(lcs[i][j] == lcs[i - 1][j - 1] + 1) 
            {
                res.push_back(s[i - 1]);
                i -= 1;
                j -= 1;
            } 
            else if(lcs[i][j] == lcs[i][j - 1]) 
            {
                j -= 1;
            } 
            else if(lcs[i][j] == lcs[i - 1][j])
            {
                i -= 1;
            }
        }
    */
        GetLCS(s, t, l1, l2);
        reverse(res.begin(), res.end()); 
        for (auto it = res.begin(); it != res.end(); it++) 
            cout << *it; 
    }
    else
        cout << "";
        
    return 0;
}

Measured memory_bytes: 44928
//(|||.()(||||||)
 //.(|||.()(||||||)
      #include<bits/stdc++.h>
    #define FiO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
    #define PB push_back

    //using ll = long long;

    using namespace std;
    int main()
    {
         vector<int> v; int n,a,i,j,sum=0;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> a;

        v.PB(a);
    }
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            sum+= (v[i]*v[j]);
        }
    }
    cout << sum ;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int main(){cout<<fixed<<setprecision(20);
           ll ans=1;
           int n;
           cin>>n;
           rep(i,1,n+1){
            ans=ans*i%inf; 
           }
           cout<<ans<<endl;
}

Measured memory_bytes: 3648
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val (a, b, c) = listOfInt()

    for (i in 1..b) {
        if ((a * i) % b == c) {
            println("YES")
            return
        }
    }

    println("NO")
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 37928
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;
#define rep(i,r) for(int i = 0; i < (r); i++)
#define pb push_back
#define all(a) a.begin(), a.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define uint unsigned long long
#define endl '\n'
using namespace std;

signed main() {
    fastio;
    double n, x, t;
    cin >> n >> x >> t;

    int res = (int) ceil(n / x) * t;
    cout << res << endl;
}

Measured memory_bytes: 3256
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include<map>
#include<vector>
#define int long long
using namespace std;
int uiop[123456];
string test[123456];
signed main() {
	int n, b = 0, sum = 0, ans = 0; string s, t = "a", u = "a";
	for (int h = 0; h < 8; h++) {
		cin >> s; if (ans < s.size()) { ans = s.size(); t = s; }
		int a = 0;
		for (int i = 0; i < b; i++) {
			if (test[i] == s) {
				uiop[i]++; a++;
			}
		}
		if (a == 0) {
			test[b] = s; uiop[b]++; b++;
		}
	}
	for (int h = 0; h < b; h++) {
		sum = max(sum, uiop[h]);
	}
	for (int h = 0; h < b; h++) {
		if (uiop[h] == sum) {
			u = test[h];
		}
	}
	cout << u << ' ' << t << endl;
}


Measured memory_bytes: 4024
#include<iostream>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<cmath>
#include<string>
#include<iomanip>
#include<algorithm>
using namespace std;

int main()
{
	long long num;
	int cnt1,cnt2,temp,k,MAX,MIN = 99;//最大位数99 
	cin >> num;
	int t = sqrt(num);
	for(int i = t;i >= 1;i--)
	{
		if(num%i == 0)
		{
			k = i;
			cnt1 = 0;//记录位数 
			cnt2 = 0;
			MAX = 0;//记录本次位数最大 
			temp = num/i;
			while(k)
			{
				k /= 10;
				cnt1++;
			}
			while(temp)
			{
				temp /= 10;
				cnt2++;
			}
			MAX = max(cnt1,cnt2);//每次中的最大 
			MIN = min(MAX,MIN);	//每次保留最大中的最小	
		}	
	}
	cout << MIN << endl;
	return 0; 
}

Measured memory_bytes: 256