akhauriyash/Code-Regression huggingface dataset:
/**
 * B - Golden Apple
 * https://atcoder.jp/contests/abc134/tasks/abc134_b
 **/
#include<iostream>

using namespace std;

int N, D;

int main() {
    cin >> N >> D;
    int q = N / (2*D+1);
    if (N % (2*D+1) == 0) {
        cout << q << endl;
    } else {
        cout << q + 1 << endl;
    }
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ULL
#define cINF ((1ll<<62)-1)
#define cINFINT ((1<<30)-1)


int main()
{
	cin.tie( 0 ); ios::sync_with_stdio( false );
	ull n,a,b;
	cin >> n>>a>>b;
	
	cout << min(n*a,b) << endl;
	return 0;
}

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

int main() {

 string S,T;
 cin >> S;
 cin >> T;
  
 int i;
 
 for(int i=0; i< S.size(); i++){
 if(S.at(i) == T.at(i)){
 continue; 
 }
  else{
  cout << "No" << endl;
  exit(0);
  }  
 }
  cout << "Yes" << endl;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 200005;

int main(){
  FASTER;
  int n, m, k;
  cin >> n >> m >> k;
  vector<string> str(n);
  for (int i = 0; i < n; i++){
    cin >> str[i];    
  }
  int ans = 0;
  for (int r = 0; r < (1 << n); r++){
    for (int c = 0; c < (1 << m); c++){
      vector<string> tmp = str;
      for (int i = 0; i < n; i++){
        if (r & (1 << i)){
          for (int j = 0; j < m; j++){
            tmp[i][j] = '?';
          }
        }
      }
      for (int j = 0; j < m; j++){
        if (c & (1 << j)){
          for (int i = 0; i < n; i++){
            tmp[i][j] = '?';
          }
        }
      }
      int val = 0;
      for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
          val += (tmp[i][j] == '#');          
        }
      }
      ans += (val == k);
    }
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3644
import java.util.*;
public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		while(true){
			int n = Integer.parseInt(in.nextLine());
			if(n==0)break;
			new AOJ0242().doIt(n);
		}
	}
	
	class AOJ0242{
		void doIt(int n){
			HashMap<String,KeepString> map = new HashMap<String,KeepString>();
			for(int i=0;i<n;i++){
				String[] a = in.nextLine().split(" ");
				for(int s=0;s<a.length;s++){
					if(!map.containsKey(a[s]))map.put(a[s],new KeepString(a[s]));
					map.get(a[s]).cnt++;
				}
			}
			ArrayList<KeepString> list = new ArrayList<KeepString>();
			for(String str: map.keySet())list.add(map.get(str));
			Collections.sort(list);
//			for(int i=0;i<list.size();i++)System.out.println(list.get(i));//deba
			char[] target = in.nextLine().toCharArray();
			String result = "";
			int cnt = 0;
			for(int i=0;i<list.size();i++)if(list.get(i).word.charAt(0)==target[0]){
				if(result.length()>0)result+=" ";
				result+=list.get(i).word;
				cnt++;
				if(cnt>4)break;
			}
			if(result!="")System.out.println(result);
			else System.out.println("NA");
		}
		class KeepString implements Comparable<KeepString>{
			int cnt;
			String word;
			public KeepString(String word) {
				cnt = 0;
				this.word = word;
			}
			public int compareTo(KeepString o) {
				if(this.cnt>o.cnt)return -1;
				else if(this.cnt<o.cnt)return 1;
				else if(this.word.compareTo(o.word)>0)return 1;
				else return -1;
			}
			
			public String toString(){
				return this.word+" "+cnt;
			}
		}
	}
}

Measured memory_bytes: 36004
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,o;
    cin>>n>>m>>o;
    if(n==m)
        cout<<o<<"\n";
    else if(n==o)
        cout<<m<<"\n";
    else
        cout<<n<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <queue>
#include <climits>
#include <string.h>
#include <vector>

using namespace std;

typedef vector <vector<int>> Graph;
const int MAX_N = 10000;

int root;
bool visited[MAX_N];
bool finished[MAX_N];

void dfs(int u, int parent, const Graph &G, stack<int> &path) {
  visited[u] = true;
  path.push(u);

  for (int v : G[u]) {
    if (v == parent) continue;
    if (finished[v]) continue;

    if (visited[v] && !finished[v]) {
      root = v;
      return;
    }

    dfs(v, u, G, path);

    if (root != -1) return;
  }

  path.pop();
  finished[u] = true;
}

vector<int> cycle_detection(int start, const Graph &G) {
  root = -1;
  memset(visited, false, sizeof(visited));
  memset(finished, false, sizeof(finished));
  stack<int> path;

  dfs(start, -1, G, path);

  vector<int> res;

  while (!path.empty()) {
    res.push_back(path.top());
    path.pop();
  }

  return res;
}

int main() {
  int N, M;
  cin >> N >> M;
  Graph G(N + 1);

  int a, b;
  for (int i = 0; i < M; ++i) {
    cin >> a >> b;

    G[a].push_back(b);
  }

  int minV = INT_MAX;
  vector<int> ans;
  bool checked[N + 1];
  memset(checked, false, sizeof(checked));

  for (int i = 1; i <= N; ++i) {
    if (checked[i]) continue;

    vector<int> path = cycle_detection(i, G);

    if (path.empty()) continue;

    for (int root : path) {
      checked[root] = true;
      queue<int> que;
      que.push(root);
      memset(visited, false, sizeof(visited));
      int parents[N + 1];
      memset(parents, -1, sizeof(parents));

      while (!que.empty()) {
        int u = que.front();
        que.pop();

        visited[u] = true;

        for (int v : G[u]) {
          if (v == root) {
            int cur = u;
            vector<int> res;

            while (cur != -1) {
              res.push_back(cur);
              cur = parents[cur];
            }

            if (minV > res.size()) {
              minV = res.size();
              ans = res;
            }

            break;
          }

          if (visited[v]) continue;

          parents[v] = u;
          que.push(v);
        }
      }
    }
  }

  if (ans.empty()) {
    cout << -1 << endl;
  } else {
    cout << ans.size() << endl;
    for (int v : ans) {
      cout << v << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3772
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [a,b,c] <- getIntList
    k <- getInt
    let bk = f a b
        b' = (2 ^ bk) * b
        ck = f b' c
        k' = bk + ck
    putStrLn $ if k' <= k then "Yes" else "No"

f a b | a < b = 0
      | otherwise = 1 + (f a (2*b))

Measured memory_bytes: 3800
import Control.Monad

main = do
    [h1, w1] <- map read <$> words <$> getLine
    [h2, w2] <- map read <$> words <$> getLine
    putStrLn $ show $ solve h1 w1 h2 w2

solve :: Int -> Int -> Int -> Int -> Int
solve h1 w1 h2 w2 = (h1 - h2) * (w1 - w2)


Measured memory_bytes: 508
#include"bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
const int N = 1e5 + 5 ;
const int MOD = 1e9+7;
typedef long long int ll;
vector< pair< ll , ll > > vp;
map<ll , ll > mp , mpp;
vector < ll > v , v1 , v2 ;
ll dp[108][N] , visit[N] ;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<"  ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
int a[N] , b[N] , c[N] , k , n  ;
ll go(ll idx , ll val) {
	if(idx == n) return 0 ;
	if(dp[idx][val] != -1) return dp[idx][val] ;
	ll x = -1e18 , y = -1e18 ;
	if(a[idx] <= val) x =  b[idx] + go(idx + 1 , val - a[idx]) ;
	y = go(idx + 1 , val ) ;
	return dp[idx][val] = max(x , y ) ;
}
int main()
{ fast;
   ll  m, val, d, mi=1e9, mx(0) ;
   ll sum(0), ct(0), p(0), q(0);
   string s ;
   cin >> n >> k ;
   memset(dp , -1 ,sizeof(dp)) ;
   for(int i = 0 ; i < n ; i++ ) cin >> a[i] >> b[i];
   cout << go(0 , k) ;
}


Measured memory_bytes: 84608
#include <algorithm>
#include <cstdio>
#include <cstring>

using namespace std;
const int MAX_N = 100000 + 10;
int N, Q;
int P[MAX_N];
int vis[MAX_N];

void build(int N) {
    for (int i = 0; i <= N; i++)
        P[i] = 1;
}

int find(int x) {
    if (vis[x])
        return x;
    else
        return find(P[x]);
}

void Unite(int parent, int child) {
    P[child] = parent;
}

int main() {
    while (~scanf("%d %d", &N, &Q) && (N || Q)) {
        memset(vis, 0, sizeof(vis));
        vis[1] = 1;
        build(N);
        int x;
        for (int i = 2; i <= N; i++) {
            scanf("%d", &x);
            Unite(x, i);
        }
        char s;
        long long sum = 0;
        getchar();
        for (int i = 0; i < Q; i++) {
            scanf("%c %d", &s, &x);
            getchar();
            if (s == 'M')
                vis[x] = 1;
            else
                sum += find(x);
        }
        printf("%lld\n", sum);
    }
    return 0;
}

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

using namespace std;

string s;
int main() {
  cin >> s;
  int n = s.length();

  if(n % 2 == 0) {
    int ans = n / 2;
    int l = n / 2 - 1;
    int r = n / 2;
    char c = s[l];
    while(l >= 0 && r < n && c == s[l] && c == s[r]) {
      l--; r++;
      ans++;
    }
    cout << ans << endl;
  }

  else {
    int ans = n / 2 + 1;
    int l = n / 2 - 1;
    int r = n / 2 + 1;
    char c = s[n / 2];
    while(l >= 0 && r < n && c == s[l] && c == s[r]) {
      l--; r++;
      ans++;
    }
    cout << ans << endl;
  }
}
  


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
const int INF = 1e9 + 7;
     
int main(){
      IOS;
      int N;
      cin>>N;
      int A[N], B[N], C[N], dp[N][3];
      for(int i=0;i<N;i++){
            cin>>A[i]>>B[i]>>C[i];
      }
      dp[0][0] = A[0];
      dp[0][1] = B[0];
      dp[0][2] = C[0];
      for(int i=1;i<N;i++){
            dp[i][0] = A[i] + max(dp[i-1][1], dp[i-1][2]);
            dp[i][1] = B[i] + max(dp[i-1][0], dp[i-1][2]);
            dp[i][2] = C[i] + max(dp[i-1][0], dp[i-1][1]);
      }
      int mex = INT_MIN;
      if(mex < dp[N-1][0])
            mex = dp[N-1][0];
      if(mex < dp[N-1][1])
            mex = dp[N-1][1];
      if(mex < dp[N-1][2])
            mex = dp[N-1][2];
      cout<<mex;
      return 0;
}

Measured memory_bytes: 5908
'''
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineering College

'''
from os import path
import sys
from heapq import heappush,heappop
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd 
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input().rstrip()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
mod=1000000007
# mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')

file=1




def solve():
    
    
    

    s = si()
    s1 = 0
    for i in s:
        s1 += int(i)

    print('Yes' if s1%9==0 else 'No')














        
if __name__ =="__main__":

    if(file):

        if path.exists('input.txt'):
            sys.stdin=open('input.txt', 'r')
            sys.stdout=open('output.txt','w')
        else:
            input=sys.stdin.readline
    solve()


Measured memory_bytes: 69428
#include <stdio.h>

int main(void)
{
        long a,b,k;

        scanf("%ld%ld%ld",&a,&b,&k);

        if(a>k)
                printf("%ld %ld",a-k,b);
        else if(a+b>=k)
                printf("0 %ld",a+b-k);
        else
                printf("0 0");

        return 0;
}


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


L = input().split()
for i in range(N):
	L[i] = int(L[i])

lenmax = 0
for i in range(N):
	if (lenmax < L[i]):
		lenmax = L[i]
		intmax = i

sumother=0
for i in range(N):
	if (i!= intmax):
		sumother += L[i]

if(sumother > lenmax):
	print('Yes')
else:
	print('No')



Measured memory_bytes: 3064
t = int(input())

best = 0
cur = 0

for i in range(t):
  a,b = map(int,input().split())
  if a == b:
    cur += 1
  else:
    best = max(best,cur)
    cur = 0
best = max(best,cur)
print("Yes" if best >= 3 else "No")

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

using namespace std;

#define int long long

int n, l;
vector<int> a;

signed main(){
	ios::sync_with_stdio(false); cin.tie(0);
	cin>>l>>n;
	int L = l;
	a.resize(n);
	for(int i = 0; i < n; i++) cin>>a[i];
	
	if(n == 1){
		int cans = max(a[0], L-a[0]);
		cout<<cans<<endl;
		return 0;
	}
	
	int best = max(a[n-1], l - a[0]);
	//first go positive then negative
	for(int T = 0; T < 2; T++){
		vector<int> pref(n+1);
		for(int i = 0; i < n; i++){
			if(i > 0)pref[i] = pref[i-1] + a[i];
			else pref[i] = a[i];
		}
		
		for(int i = 0; i < n-1; i++){
			//do tak tak from here
			int cur = 2*a[i];
			int mid = i+(n-i-1)/2; 
			cur += (pref[mid] - pref[i])*2;
			cur += (L*(n-mid-1) - (pref[n-1] - pref[mid]))*2;
			if((n-i-1)%2 == 1) cur -= L - a[mid+1];
			else cur -= a[mid];
			
			//cout<<T<<": "<<i<<" "<<cur<<endl;
			best = max(best, cur);
		}
		
		
		reverse(a.begin(), a.end());
		for(int i = 0; i < n; i++) a[i] = L - a[i];
		
	}
	cout<<best<<endl;
	
}

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

#define MAX_N 100001
#define MAX_M 200001

using namespace std;

struct Node {
    int num, dst;
};

struct Edge {
    int num, to;
};

int n, m, q, r;
int ans = 0;
int u[MAX_M], v[MAX_M];
int d[MAX_N] = { 0 };

bool is_cut[MAX_M] = { false };

vector<Edge> init_edge[MAX_N];
vector<Edge> edge[MAX_N];

int cnt[MAX_N] = { 0 };

int dfs(int to) {
    --cnt[to];
    if(cnt[to] == 0) {
        int ret = 0;
        for(int i = 0; i < edge[to].size(); ++i) {
            if(edge[to][i].to) {
                ret += dfs(edge[to][i].to);
            }
        }
        return ret + 1;
    } else {
        return 0;
    }
}

int bfs(int to) {
    int ret = 0;
    queue<int> que;
    que.push(to);
    while(!que.empty()) {
        int now = que.front(); que.pop();
        --cnt[now];
        if(cnt[now] == 0) {
            ++ret;
            for(int i = 0; i < edge[now].size(); ++i) {
                if(edge[now][i].to) {
                    que.push(edge[now][i].to);
                }
            }
        }
    }
    return ret;
}

int main() {

    cin >> n >> m >> q;

    for(int i = 1; i <= m; ++i) {
        cin >> u[i] >> v[i];
        init_edge[u[i]].push_back((Edge){i, v[i]});
        init_edge[v[i]].push_back((Edge){i, u[i]});
    }

    // BFS
    queue<Node> que;
    fill(d + 1, d + 1 + n, -1);
    d[1] = 0;
    que.push((Node){1, d[1]});

    // CREATE DAG
    while(!que.empty()) {

        Node now = que.front(); que.pop();

        vector<Edge>::iterator e = init_edge[now.num].begin();
        while(e != init_edge[now.num].end()) {
            if(d[e->to] == -1) {
                d[e->to] = now.dst + 1;
                que.push((Node){e->to, d[e->to]});
            }
            if(d[e->to] == now.dst + 1) {
                //edge[now.num].push_back(*e);
                ++cnt[e->to];
            }
            ++e;
        }

    }

    for(int i = 0; i < q; ++i) {
        cin >> r;

        is_cut[r] = true;

        if(d[u[r]] != d[v[r]]) {
            if(d[u[r]] > d[v[r]]) {
                swap(u[r], v[r]);
            }

            --cnt[v[r]];
            if(cnt[v[r]] == 0) {

                queue<int> que;
                que.push(v[r]);
                while(!que.empty()) {

                    int now = que.front(); que.pop();

                    ++ans;

                    vector<Edge>::iterator e = init_edge[now].begin();
                    while(e != init_edge[now].end()) {
                        if(!is_cut[e->num]) {
                            // in nearest root
                            if(d[e->to] == d[now] + 1) {
                                --cnt[e->to];
                                if(cnt[e->to] == 0) {
                                    que.push(e->to);
                                }
                            }
                        }
                        ++e;
                    }

                    // exclusive
                    d[now] = 1 << 30;

                }
            }
        }

        cout << ans << endl;
    }

}

Measured memory_bytes: 16708
from math import sqrt

q = int(input())

nums = [i for i in range(2, 10**5+1)]
primes = []
while nums[0] < sqrt(10**5):
    n = nums.pop(0)
    primes.append(n)
    new_nums = []
    for num in nums:
        if num % n != 0:
            new_nums.append(num)
    nums = new_nums
primes.extend(nums)
primes_set = set(primes)


flags = []
for i in range(10**5+1):
    flags.append(int(i in primes_set and (i+1)/2 in primes_set))
cum_flags = [0]*len(flags)
cum_flags[0] = flags[0]
for i in range(1, len(flags)):
    cum_flags[i] = cum_flags[i-1]+flags[i]

for _ in range(q):
    l, r = map(int, input().split())
    print(cum_flags[r]-cum_flags[l-1])

Measured memory_bytes: 8984
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

ll gcd(ll k, ll l) {
    if(k%l == 0) {
        return(l);
    } else {
        return(gcd(l, k%l));
    }
}

ll lcm(ll k, ll l) {
    return k * l / gcd(k, l);
}

int main() {
    ll A, B, C;

    cin >> A >> B;

    C = lcm(A,B);

    cout << C << endl;

    return 0;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,M,X,Y;
    int x,y,war[300]={};
    cin>>N>>M>>X>>Y;
    if(Y<=X){
        cout<<"War"<<endl;
        return 0;
    }
    for(int i=X+100+1;i<=Y+100;i++){
        war[i]=1;
    }
    int mxx=0;
    for(int i=0;i<N;i++){
        cin>>x;
        mxx=max(x+100,mxx);
    }
    int mny=1000;
    for(int i=0;i<M;i++){
        cin>>y;
        mny=min(y+100,mny);
    }
    if(mny<=mxx){
        cout<<"War"<<endl;
        return 0;
    }
    bool flag=false;
    for(int i=mxx+1;i<=mny;i++){
        if(war[i]==1) flag=true;
    }
    //cout<<mxx<<endl;
    //cout<<mny<<endl;
    if(flag) cout<<"No War"<<endl;
    else cout<<"War"<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<limits.h>
#define max 500000
int sum=0;

void margeSort(int s[],int l,int r){
  int m;
  if(l+1<r){
    m = (l+r)/2;
    margeSort(s,l,m);
    margeSort(s,m,r);
    marge(s,l,m,r);
  }
}

void marge(int s[],int l1,int m,int r1){
  int i,j,k,n1,n2;
  n1 = m - l1;
  n2 = r1 - m;
  int l[n1+1],r[n2+1];
  for(i=0;i<n1;i++) l[i]=s[l1+i];
  for(i=0;i<n2;i++) r[i]=s[m+i];
  l[n1] = INT_MAX;
  r[n2] = INT_MAX;
  i=0;
  j=0;
  for(k=l1;k<r1;k++){
    sum++;
    if(l[i] <= r[j]){
      s[k] = l[i];
      i++;
    }
    else {
      s[k] = r[j];
      j++;
    }
  }
}

int main(){
  int i,s[max],n;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&s[i]);
  margeSort(s,0,n);
  for(i=0;i<n-1;i++) printf("%d ",s[i]);
  printf("%d",s[n-1]);
  printf("\n%d\n",sum);
  return 0;
}

Measured memory_bytes: 4504
from bisect import bisect_left

def main():
	n, m, q = list(map(int, input().split()))
	trains = [list(map(int, input().split())) for _ in range(m)]
	queries = [list(map(int, input().split())) for _ in range(q)]
	
	xmt = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
	cmt = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
	
	for train in trains:
		xmt[train[0]][train[1]] += 1

	for i in range(1, n + 1):
		for j in range(1, n + 1):
			cmt[i][j] = cmt[i][j - 1] + (cmt[i - 1][j] - cmt[i - 1][j - 1]) + xmt[i][j] 
	
	for query in queries:
		i, j = query
		ans = cmt[j][j] - cmt[i - 1][j] - cmt[j][i - 1] + cmt[i - 1][i - 1]
		print(ans)

if __name__ == '__main__':
	main()

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

int main(void) {
	int i, j;
	int N;
	//long long int *A;
	int *A;
	long long int ans, temp;
	long long int naive_ans;
	long long int module = 1000000000 + 7;
	char buf[128], *ch;
	char *great_buf;

	fgets(buf, sizeof(buf), stdin);
	ch = strtok(buf, " ");
	N = atoi(ch);

	//A = (long long int *)calloc(N, sizeof(long long int));
	A = (int *)calloc(N, sizeof(int));
	great_buf = (char *)calloc(N*12, sizeof(char));
	fgets(great_buf, N*12, stdin);
	ch = strtok(great_buf, " ");
	A[0] = atoi(ch);
	for(i = 1; i < N; i += 1) {
		ch = strtok(NULL, " ");
		A[i] = atoi(ch);
	}
	free(great_buf);
	/*
	for(i = 0; i < N; i += 1) {
		A[i] = rand()%100000000;
	}
	*/

	/*
	naive_ans = 0;
	for(i = 0; i < N; i += 1) {
		for(j = i + 1; j < N; j += 1) {
			temp = A[i] * A[j];
			temp = temp % module;
			naive_ans += temp;
			naive_ans = naive_ans % module;
		}
	}
	printf("%lld\n", naive_ans);
	*/

	ans = 0;
	temp = 0;
	for(i = 0; i < N; i += 1) {
		temp += A[i];
	}
	for(i = 0; i < N - 1; i += 1) {
		temp -= A[i];
		ans += ((temp % module) * A[i]) % module;
		ans = ans % module;
	}
	printf("%lld\n", ans);

	free(A);
	return 0;
}


Measured memory_bytes: 4624
#include <bits/stdc++.h>
using namespace std;
// #define cerr if(false)cerr
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> ii;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vii;
typedef long double ld;
typedef vector<ld> vld;
typedef vector<vector<ld>> vvld;
typedef vector<bool> vbl;
typedef vector<vbl> mbl;
#define ff first
#define ss second
#define pb emplace_back
#define mp make_pair
#define all(s) (s).begin(), (s).end()
#define minel(a) *min_element(all(a))
#define maxel(a) *max_element(all(a))
#define pq(t) priority_queue<t, vector <t>, greater <t>>
#define pqd(t) priority_queue<t>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))      // Used to iterate over the types

const ll mod = 1e9 + 7;
const ll mx = 1e18;
const ll inf = 1e7;

// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// For printing variables and their respective values

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}

template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

auto mods() { return 0; }

template<typename T, typename... Args>
auto mods(T a, Args... args) { return (a + mods(args...) + mod) % mod; }

auto modp() { return 1; }

template<typename T, typename... Args>
auto modp(T a, Args... args) { return ( a * modp(args...) )% mod; }
// ! inputs should be positive and less than `mod`.

// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// !Taking `int` input

template<typename T>
T nxt(){
    T x;
    cin >> x;
    return x;
}

//  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

inline void solve()
{
   int n = nxt<int>();
   if (n < 30)
    cout << "No\n";
    else
        cout << "Yes\n";
}

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

    int t = 1;
    // cin >> t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 3636
/*
Miles Morales : When will I know I'm ready?
Peter B. Parker : You won't. It's a leap of faith. That's all it is, Miles. A leap of faith.
*/
//KEEP IT SIMPLE STUPID

#include<bits/stdc++.h>

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define print(v) for(auto it=(v).begin();it!=(v).end();it++) {cout<<*it<<" ";}
#define ll long long
#define w(t) ll t;cin>>t;while(t--)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
using namespace std;


int main()
{
    int k;
    string s;
    cin>>k>>s;
    if(s.length()<=k)
    {
        cout<<s<<"\n";
    }
    else{
        string t= s.substr(0,k);
        cout<<t<<"...\n";
    }
	return 0;
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/



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

int seiyaku_check(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	
	int a,b,c;
	cin >> a >> b >> c;
	seiyaku_check(a,1,20);
	seiyaku_check(b,1,20);
	seiyaku_check(c,1,20);
	
	cout << (c/a)*b << endl;

return 0;
}


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

int main(){
  ll a;
  string s;
  ll b=0;
  cin >> a >> s;
  b+=(s[0]-'0')*100;
  b+=(s[2]-'0')*10;
  b+=(s[3]-'0');
  cout << a*b/100 << endl;
}


Measured memory_bytes: 3600
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as MP
import qualified Data.Set as ST
import qualified Data.Sequence as SQ
import Data.Array
import Data.Array.Unboxed
import Data.Array.ST
import Data.Array.IO
import Data.Maybe
import Data.Ratio
import Data.Char
import Data.Bits
import Data.List
import Data.Tuple
import Data.Functor
import Data.IORef
import Data.STRef
import Control.Applicative
import Control.Monad
import Control.Monad.ST

main = do
  [n,k] <- map read . words <$> getLine :: IO [Int]
  print $ ceiling $ (n-1) % (k-1)

Measured memory_bytes: 508
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll h,w;
  cin>>h>>w;
  vvc t(h,vc(w));
  queue<pll> p;
  vvll ans(h,vll(w,INF)); 
  rep(i,h){
    rep(j,w){
      cin>>t[i][j];
      if(t[i][j]=='#'){
        ans[i][j]=0;
        p.pu(pll(i,j));
      }
    }
  }
  
  while(p.size()){
    pll ppp=p.front();
    p.pop();
    rep(i,4){
      ll nx=ppp.F+dx[i];
      ll ny=ppp.S+dy[i];
      if(nx>=0&&nx<h&&ny>=0&&ny<w&&t[nx][ny]!='#'&&ans[ppp.F][ppp.S]+1<ans[nx][ny]){
        ans[nx][ny]=ans[ppp.F][ppp.S]+1;
        p.pu(pll(nx,ny));
      }
    }
  }
  ll k=0;
  rep(i,h){
    rep(j,w){
      k=max(ans[i][j],k);
    }
  }
  COUT(k);
}


Measured memory_bytes: 25524
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i<b; i++)
#define rep(i, n) FOR(i, 0, n)
#define rFOR(i, a, b) for(int i = a;i >= b; i--)
#define rrep(i, a) rFOR(i, a, 0)
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<char> vc;
typedef vector<vc> vvc;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ld PI = acos(-1);
const ll INF = 1e18;
struct edge{ll to, cost;};
struct EDGE{ll u, v, cost;};

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

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

class UnionFind {
public:
    vector<int> par;
    vector<int> rnk;
    vector<ll> siz;
    UnionFind(int N):par(N),rnk(N),siz(N){
        for(int i=0;i<N;i++){
            par[i]=i,rnk[i]=0,siz[i]=1;
        }
    }
    //根
    int find(int x){
        if(par[x]==x)return x;
        return par[x]=find(par[x]);
    }
    void unite(int x,int y){
        int rx=find(x);
        int ry=find(y);
        if (rx==ry) return;
        if(rnk[rx]<rnk[ry]){
            par[rx]=ry;
            siz[ry]+=siz[rx];
            siz[rx]=0;
        }
        else{
            par[ry]=rx;
            siz[rx]+=siz[ry];
            siz[ry]=0;
            if(rnk[rx]==rnk[ry]){
                rnk[rx]++;
            }
        }
    }
    //集合が同じか
    bool same(int x, int y){
        return find(x)==find(y);
    }
    //集合の大きさ
    int size(int x){
        return siz[find(x)];
    }
};

int N;

priority_queue<pair<ll,P>,vector<pair<ll,P>>,greater<pair<ll,P>>> que;

ll kruskal() {
    UnionFind uf(N);
    ll cost=0;
    while(que.size()){
        pair<ll,P> x=que.top();
        que.pop();
        if(uf.same(x.second.first,x.second.second))continue;
        else{
            uf.unite(x.second.first,x.second.second);
            cost+=x.first;
        }
    }
    return cost;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N;
    vector<pair<P,int>> p(N),q(N);
    rep(i,N){
        cin >> p[i].first.first >> p[i].first.second;
        q[i].first.second=p[i].first.first;
        q[i].first.first=p[i].first.second;
        p[i].second=q[i].second=i;
    }
    sort(p.begin(),p.end());
    sort(q.begin(),q.end());
    rep(i,N-1){
        que.push({p[i+1].first.first-p[i].first.first,{p[i].second,p[i+1].second}});
        que.push({q[i+1].first.first-q[i].first.first,{q[i].second,q[i+1].second}});
    }
    cout << kruskal() << '\n';
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 14192
class SegmentTree:
    def __init__(self, data):
        # 初期値
        self.default_value = 0
        # num: n以上の最小の2のべき乗
        self.power = 2 ** (N - 1).bit_length()
        self.node = [self.default_value] * 2 * self.power
        for i in range(N):
            self.node[i + self.power - 1] = 1 << (ord(data[i]) - 97)
        for i in range(self.power - 2, -1, -1):
            self.node[i] = self.node[2 * i + 1] | self.node[2 * i + 2]

    def update(self, k, x):
        k += self.power - 1
        self.node[k] = 1 << (ord(x) - 97)
        while k:
            k = (k - 1) // 2
            self.node[k] = self.node[k * 2 + 1] | self.node[k * 2 + 2]

    def query(self, left, right):
        if right <= left:
            return self.default_value
        left += self.power - 1
        right += self.power - 2
        ret = self.default_value
        while right - left > 1:
            if left & 1 == 0:
                ret = ret | self.node[left]
            if right & 1 == 1:
                ret = ret | self.node[right]
                right -= 1
            left = left // 2
            right = (right - 1) // 2
        if left == right:
            ret = ret | self.node[left]
        else:
            ret = (ret | self.node[left]) | self.node[right]
        return ret


N = int(input())
S = list(input().strip())
Q = int(input())
MAX_DIGIT = 26

st = SegmentTree(S)

for i in range(Q):
    q, a, b = map(str, input().split())
    if int(q) == 1:
        a = int(a) - 1
        st.update(a, b)
    if int(q) == 2:
        a = int(a) - 1
        b = int(b)
        res = st.query(a, b)
        ans = 0
        for d in range(MAX_DIGIT):
            if res >> d & 1:
                ans += 1
        print(ans)


Measured memory_bytes: 47400
while 1:
    S = input()
    if S == "#":
        break

    S = S.split("/")
    board = []
    for S_row in S:
        row = []
        for s in S_row:
            if s == "b":
                row.append("b")
            else:
                for _ in range(int(s)):
                    row.append(".")
        board.append(row)

    a, b, c, d = map(int, input().split())
    board[a-1][b-1], board[c-1][d-1] = board[c-1][d-1], board[a-1][b-1]

    ans = ""
    for b_row in board:
        cnt = 0
        for b in b_row:
            if b == ".":
                cnt += 1
            else:
                if cnt != 0:
                    ans += str(cnt)
                    cnt = 0
                ans += "b"
        if cnt != 0:
            ans += str(cnt)
        ans += "/"

    print(ans[:-1])


Measured memory_bytes: 5600
S = input()
ot = S[:2]
tf = S[2:]

isotMM = 0
istfMM = 0

if 0 < int(ot) and int(ot) < 13:
    isotMM = 1
if 0 < int(tf) and int(tf) < 13:
    istfMM = 1
    
if isotMM == 1:
    if istfMM == 1:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if istfMM == 1:
        print('YYMM')
    else:
        print("NA")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
#define ers erase
#define ins insert
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
#define kill(x) return cout << x, 0;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;


const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll MAXN = 2e5 + 10;
const ll INF = 1e18;

ll dp[MAXN], a[MAXN], k, n;
int main(){
	IOS;
	cin >> n >> k;
	for (int i = 1; i <= n; i++){
		cin >> a[i];
	}
	sort(a + 1, a + n + 1);
	for (int i = 0; i < a[1]; i++){
		dp[i] = 0;
	}
	for (int i = a[1]; i <= k; i++){
		for (int j = 1; j <= n; j++){
			if (i >= a[j] && dp[i - a[j]] == 0){
				dp[i] = 1;
			}
		}
	}
	if (dp[k] == 0){
		kill("Second");
	}
	kill("First");
	
	
	return 0;
}






/*
     ,---,           ___                 ,--,
    '  .' \        ,--.'|_             ,--.'|                             ,--,
   /  ;    '.      |  | :,'            |  | :                           ,--.'|    ,---.        ,---,
  :  :       \     :  : ' :            :  : '                 .--.--.   |  |,    '   ,'\   ,-+-. /  |
  :  |   /\   \  .;__,'  /    ,--.--.  |  ' |     ,--.--.    /  /    '  `--'_   /   /   | ,--.'|'   |
  |  :  ' ;.   : |  |   |    /       \ '  | |    /       \  |  :  /`./  ,' ,'| .   ; ,. :|   |  ,"' |
  |  |  ;/  \   \:__,'| :   .--.  .-. ||  | :   .--.  .-. | |  :  ;_    '  | | '   | |: :|   | /  | |
  '  :  | \  \ ,'  '  : |__  \__\/: . .'  : |__  \__\/: . .  \  \    `. |  | : '   | .; :|   | |  | |
  |  |  '  '--'    |  | '.'| ," .--.; ||  | '.'| ," .--.; |   `----.   \'  : |_|   :    ||   | |  |/
  |  :  :          ;  :    ;/  /  ,.  |;  :    ;/  /  ,.  |  /  /`--'  /|  | '.'\   \  / |   | |--'
  |  | ,'          |  ,   /;  :   .'   \  ,   /;  :   .'   \'--'.     / ;  :    ;`----'  |   |/
  `--''             ---`-' |  ,     .-./---`-' |  ,     .-./  `--'---'  |  ,   /         '---'
                            `--`---'            `--`---'                 ---`-'
*/




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

using namespace std;
int main(){
	int n;
	while(cin>>n,n){
		int table[n];
		
		for(int i=0;i<n;i++)cin>>table[i];
		sort(table,table+n);
//		cout<<table[1];
		for(int i=2;i<n-1;i++){
			table[1]+=table[i];
//			cout<<" "<<table[i];
		}
//		cout<<endl;
		cout<<table[1]/(n-2)<<endl;
	}
}

Measured memory_bytes: 1176
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n,a,b;cin>>n>>a>>b;
  ll count=0;
  rep(i,n){
    ll a1,b1;cin>>a1>>b1;
    if(a1>=a&&b1>=b)count++;
  }
  cout<<count<<endl;
}

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

int main(){
    string S;
    cin >> S;
    if(S[0] == S[1] && S[2] == S[3]　&& S[0]!=S[2]){
        cout << "Yes" << endl;
        return 0;
    }
    if(S[0] == S[2] && S[1] == S[3] && S[0] != S[1]){
        cout << "Yes" << endl;
        return 0;
    }
    if(S[0] == S[3] && S[1] == S[2] && S[0] != S[1]){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <string>
#include <set>
#include <map>

using namespace std;

int main() {
	long long n, k;
	cin >> n >> k;

	if (k == 1) {
		cout << n*n*n << endl;
		return 0;
	}

	long long ans = 0;
	if (k % 2 == 0) {
		long long v = (n + k / 2) / k;
		ans += v * v * v;
	}

	long long v = n / k;
	ans += v * v * v;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
ans = 0

n.times do |i|
  if b[i] >= a[i]
    ans += a[i]
    if b[i]-a[i] >= a[i+1]
      ans += a[i+1]
      a[i+1] = 0
    else
      ans += b[i]-a[i]
      a[i+1] -= b[i]-a[i]
    end
  else
    ans += b[i]
  end
end
puts ans

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

using namespace std;

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

#define int ll

const ll mod = 1e9 + 7;

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


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<string>
#include<cmath>
typedef long long int ll;
#define VI vector<int>

#define rep(i,a) for(int i=0;i<(a);i++)

int n,m;

using namespace std;

bool calc(int N[101],int M[101],int a,int b){
	int nc[101],mc[101];
	rep(i,101)nc[i]=N[i];
	rep(i,101)mc[i]=M[i];
	swap(nc[a],mc[b]);
	int sumN=0,sumM=0;
	rep(i,n)
		sumN+=nc[i];
	rep(i,m)
		sumM+=mc[i];
	if(sumN==sumM){
		return true;
	}
	return false;
}

int main(){
	while(1){
		int nc[101],mc[101];
		cin>>n>>m;
		if(n==0 && m==0)break;
		rep(i,n){
			int tmp;
			cin>>tmp;
			nc[i]=tmp;
		}
		rep(i,m){
			int tmp;
			cin>>tmp;
			mc[i]=tmp;
		}
		int ansN=1000,ansM=1000;
		rep(i,n){
			rep(j,m){
				if(calc(nc,mc,i,j) && ansN+ansM>nc[i]+mc[j]){
					ansN=nc[i],ansM=mc[j];
				}
			}
		}
		if(ansN!=1000 && ansM!=1000)cout<<ansN<<" "<<ansM<<endl;
		else cout<<"-1"<<endl;
	}

	return 0;
}

Measured memory_bytes: 1160
// https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_b

#include "algorithm"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N;
  cin >> N;

  rep(num, N + 1) {
    double taxed = num * 1.08;
    if (floor(taxed) == N) drop(num);
  }

  drop(":(");
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
N, M = map(int, input().split())
graph = [[] for n in range(N + 1)]
for _ in range(M):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)
# 入力例 1の場合
# graph : [[], [2], [1, 3, 4], [2, 4], [3, 2]] graphのインデックスが部屋名
# graph[2] : 部屋2は、1,3,4と繋がっている
# graph[4] : 部屋4は、3,2と繋がっている

# 次に探索をする部屋番号をストックしておく。まずは部屋番号1から探索を始めるので、１を入れておく
q = [1]

# ans[部屋番号]=道標が指す部屋番号とする。探索していない部屋を全て'No'として表す。道標が存在しなかった場合、'No'が残る
ans = ['No' for n in range(N + 1)]
ans[0] = 1  # 部屋番号0は存在しないのでテキトーに1を入れておく
ans[1] = 1  # 部屋番号1の道標が指す部屋番号は1になるので、最初から1を入れておく

while q:  # qの中身がなくなったらbreak
    now = q.pop(0) # 現在地を指定（キューの先頭）するとともに、qから先頭を削除する。　一番最初の現在地は1になる。
    for edge in graph[now]:
        if ans[edge] != 'No': 
            continue
        ans[edge] = now
        q.append(edge)

if not 'No' in ans:
    print('Yes')
    for n in range(2, N + 1):
        print(ans[n])
else:
    print('No')


Measured memory_bytes: 33836
import sys
import math
import heapq
import bisect
import collections

S = input()
T = input()
lenS = len(S)
lenT = len(T)
F1 = [False]*26
F2 = [False]*26
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(lenS):
    F1[alpha.index(S[i])] = True
for i in range(lenT):
    F2[alpha.index(T[i])] = True
for i in range(26):
    if not F1[i] and F2[i]:
        print(-1)
        sys.exit()

ind = S.index(T[0])
ans = ind+1
for i in range(1,lenT):
    S = S[ind+1:] + S[:ind+1]
    ind = S.index(T[i])
    ans += ind+1

print(ans)

Measured memory_bytes: 3972
// ConsoleApplication9.cpp : アプリケーションのエントリ ポイントを定義します。
//


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
//#define int long long


using namespace std;


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




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

ll pow2(ll a, ll n) {//aのn乗を計算します。
	ll x = 1;
	while (n > 0) {//全てのbitが捨てられるまで。
		if (n & 1) {//1番右のbitが1のとき。
			x = x * a;
		}
		a = a * a;
		n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
	}
	return x;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

bool arr[100000100];
vector<ll>sosuu;
void Eratosthenes() {
	ll N = 10000010;
	int c = 0;
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (ll i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (ll j = 0; i * (j + 2) < N; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for (int  i = 2; i < N; i++) {
		if (arr[i]) {
			sosuu.pb(i);
			//cout << sosuu[c] << " ";
			c++;
		}
	}
	//cout << endl;
	//cout << c << endl;
}

ll stoL(string s) {
	ll n = s.length();
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ans += pow2(10, n - i-1)*(ll)(s[i]-'0');
	}
	return ans;
}

int A[26][51];
int main() {
	int n; cin >> n;
	REP(i, n) {
		string S; cin >> S;
		int l = S.length();
		REP(j, l) {
			int c = S[j] - 'a';
			A[c][i]++;
		}
	}
	string ans;
	REP(i, 26) {
		int mini = 10000000;
		REP(j, n) {
			mini = min(mini, A[i][j]);
		}char c = 'a' + i;
		REP(j, mini) {
			ans += c;
		}
	}
	p(ans);
}



Measured memory_bytes: 256