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

int a[26];

int main() {
   
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i++)
        a[s[i]-'a']++;
    
    for (int i = 0; i < 26; i++)
        if (a[i] > 1) {
            printf("no");
            return 0;
        }
    
    printf("yes");
    
    return 0;
}


Measured memory_bytes: 256
import collections


class Graph:
    def __init__(self, n_nodes):
        self.n_nodes = n_nodes
        self.edges = [[] for _ in range(n_nodes)]

    def add_edge(self, s, t):
        self.edges[s].append(t)
        self.edges[t].append(s)


n = int(input())
graph = Graph(n)
for i in range(n):
    s = input().rstrip()
    for j in range(i + 1, n):
        if s[j] == '1':
            graph.add_edge(i, j)


def check(node):
    for new_node in graph.edges[node]:
        if orders[new_node] == -1:
            q.append(new_node)
            orders[new_node] = orders[node] + 1
        elif abs(orders[new_node] - orders[node]) != 1:
            return False
    return True


res = []
for i in range(n):
    orders = [-1] * n
    q = collections.deque()
    q.append(i)
    orders[i] = 1
    while q:
        node = q.popleft()
        ok = check(node)
        if not ok:
            break
    else:
        res.append(max(orders))
if len(res) == 0:
    print(-1)
else:
    print(max(res))

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); ++i)
typedef long long ll;
ll lcm(ll x, ll y){ return x*y/__gcd(x, y);}
int main(){
  ll a,b,c,d; cin >> a >> b >> c >> d;
  ll cd = lcm(c, d);
  ll ans = b-a+1 -((b/c + b/d - b/cd) - ((a-1)/c + (a-1)/d - (a-1)/cd ));
  cout << ans << endl;

}


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

using namespace std;

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

    vector<string> B(N);
    vector<string> R(M);
    map<string,int> ans;

    for(int i=0; i<N; i++){
        string s; cin >> s;
        if(ans.count(s)){
            ans.at(s)++;
        }else{
            ans[s] = 1;
        }
    }

    cin >> M;
    for(int i=0; i<M; i++){
        string t; cin >> t;
        if(ans.count(t)){
            ans.at(t)--;
        }else{
            ans[t] = -1;
        }
    }

    int m=0;
    for(auto cnt : ans){  
        auto v = cnt.second;
        m = max(m,v);
         // cout << k << " " << v << endl;
    }

    cout << m << endl;
}

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

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

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

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

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

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

int main()
{
    IN(ll, n);
    AIN(string, S, n);
    vi C(26, INF);
    FOR(s, S)
    {
        vi c(26);
        FOR(x, s)
        {
            ++c[x - 'a'];
        }
        REP(i, 26)
        {
            CH(min, C[i], c[i]);
        }
    }
    string ans;
    REP(i, 26)
    {
        if (C[i] < INF)
        {
            REP(j, C[i])
            {
                ans.push_back('a' + i);
            }
        }
    }
    OUT(ans);
}

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

int main(){
    int n,k;
    string s;
    cin >> n >> k >> s;

    if (s[k-1] == 'A'){
        s[k-1] = 'a';
    }
     if (s[k-1] == 'B'){
        s[k-1] = 'b';
    }
     if (s[k-1] == 'C'){
        s[k-1] = 'c';
    }
    
    cout << s << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

LL N, H;
vector<LL>a, b;

int main(void)
{
	cin >> N >> H;
	for (int i = 0; i < N; ++i) {
		int aa, bb;
		cin >> aa >> bb;
		a.push_back(aa);
		b.push_back(bb);
	}
	LL D = 0;
	sort(b.rbegin(), b.rend());
	sort(a.rbegin(), a.rend());
	for (int i = 0; i < N; ++i) {
		b[i] = max(b[i], a[0]);
	}
	for (int i = 0; i < N; ++i) {
		D += b[i];
		if (D >= H) {
			cout << i + 1 << endl;
			return 0;
		}
	}
	LL tim = (H - D - 1) / a[0] + 1;
	cout << N + tim << endl;
	return 0;
}


Measured memory_bytes: 2036
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);        
        while(true){            
            int H = sc.nextInt();
            int L = sc.nextInt();
            if(H == 0 && L == 0) break;
            for(int i=0; i < H; i++){
                for(int j=0; j < L; j++){
                    System.out.print("#");
                }
                System.out.print("\n");
            }
            System.out.print("\n");
        }
        sc.close();
    }
}


Measured memory_bytes: 36756
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
  long long N;
  cin >> N;
  long long ans = 1000000000000;
  for(long long i = 1; i * i <= N; ++i) {
    if(N % i == 0) {
      long long x = i;
      long long y = N / i;
      long long candidate = x + y - 2;
      ans = candidate < ans ? candidate : ans;
    }
  }
  cout << ans << endl;
}


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

int main() {
    int n;
    while(cin >> n, n) {
        vector <pair <int, int>> a(n);
        rep (i, n) cin >> a[i].first >> a[i].second;
        vector <pair <int, int>> relativeA;
        range (i, 1, n) {
            relativeA.emplace_back(a[i].first  - a[0].first,
                                   a[i].second - a[0].second);
        }
        int m;
        cin >> m;
        set <pair <int, int>> pos;
        rep (i, m) {
            int y, x;
            cin >> y >> x;
            pos.emplace(y, x);
        }

        for (auto & i : pos) {
            bool flag = true;

            for (auto & j : relativeA) {
                flag &= pos.count(make_pair(i.first + j.first, i.second + j.second));
            }

            if (flag) {
                cout << i.first - a[0].first << " " << i.second - a[0].second << endl;
                break;
            }
        }

    }
    return 0;
}


Measured memory_bytes: 3164
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
from math import factorial

n,p=nii()
a=lnii()

x=0
y=0
for i in a:
  if i%2==0:
    x+=1
  else:
    y+=1

def solve(q):
  num=0
  while q<=y:
    num+=factorial(y)//(factorial(q)*factorial(y-q))
    q+=2
  return num

ans=2**x
if p==0:
  num=solve(0)
else:
  num=solve(1)

print(ans*num)

Measured memory_bytes: 9100
isPalindromic :: Int -> Int -> Bool
isPalindromic 0 _ = True
isPalindromic d n
  | q == r = isPalindromic (d `div` 100) ((n `mod` d) `div` 10)
  | otherwise = False
  where
    q = n `div` d
    r = n `mod` 10

main = do
  line <- getLine
  let
    [a,b] = map read $ words line :: [Int]
    ans = length $ filter (\x -> x == True) $ map (isPalindromic 10000) [a .. b]
  putStrLn $ show ans


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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();


        int[] test;
        test = new int[N];

        int tmp;
        int cnt = 0;

        for (int i = 0; i < N; i++) {
            test[i] = sc.nextInt();
        }

        for (int s = N-1; s>0; s--) {
            for (int j = N-1; j >0; j--) {
                if (test[j] < test[j-1]) {
                    tmp = test[j];
                    test[j] = test[j-1];
                    test[j-1] = tmp;
                    cnt++;
                }
            }
        }
        for (int j = 0; j < N; j++) {
            System.out.print(test[j]);
            if(j<N-1){
                System.out.print(" ");
            }
            if(j==N-1){
                System.out.println("");
            }
        }
        System.out.println(cnt);

    }
}


Measured memory_bytes: 26376
use proconio::input;
use proconio::marker::{Chars, Usize1};
use std::iter::Iterator;
use std::collections::*;
use std::cmp::*;
use itertools::Itertools;

#[allow(unused_macros)]
macro_rules! max {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      max($x,max!($($xs)+))
    };
  }
  
  #[allow(unused_macros)]
  macro_rules! min {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      min($x,min!($($xs)+))
    };
  }

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
    d: f64,
    t: f64,
    s: f64,
    }

    let time = d / s;
    if time > t {
      println!("{}", "No");

    }else{
      println!("{}", "Yes");

    }

}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

ll N;
vector<ll> A;
vector<vector<ll>> dp;

ll dfs(ll l, ll r) {
    if (dp[l][r] != INF) {
        return dp[l][r];
    }
    bool taro = N % 2 ? (r - l) % 2 : (r - l) % 2 == 0;
    if (r - l == 1) {
        return taro ? A[l] : -A[l];
    }
    ll res = 0;
    if (taro) {
        res = max(dfs(l, r - 1) + A[r - 1], dfs(l + 1, r) + A[l]);
    } else {
        res = min(dfs(l, r - 1) - A[r - 1], dfs(l + 1, r) - A[l]);
    }
    return dp[l][r] = res;
}

void solve() {
    cin >> N;
    A.resize(N);
    rep(i, N) cin >> A[i];
    dp.resize(N + 1, vector<ll>(N + 1, INF));
    cout << dfs(0, N) << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 73936
N = gets.chop.to_i
A = Array.new(N)
B = Array.new(N)

for i in 0..N - 1
  A[i], B[i] = gets.chop.split.map(&:to_i)
end

min = B[0]
id = 0

for i in 1..N - 1
  if min > B[i]
    min = B[i]
    id = i
  end
end

puts B[id] + A[id]

Measured memory_bytes: 3324
2
n = int(input())
a = [[] for _ in range(n)]
for i in range(n): # i人目
  num = int(input()) # i人目の証言の数
  for j in range(num):
    x,y = map(int,input().split())
    a[i].append([x,y])

#n = 3
#a = [[[2, 1]], [[1, 1]], [[2,0]]]

ans = 0
for candi in range(1,2**n): # 正直者・不明者の候補リスト candi

  ck = 1 # 必ず一人は正直者がいる

  for i in range(n): # i番目の人の証言

    if not candi >> i & 1:
      continue

    for x,y in a[i]: # x番目の人はyです
      if candi >> (x-1) & 1 != y :
        ck = 0
        break
  if ck:
    temp = format(candi,'b').count('1')
    ans = max(ans,temp)

print(ans)

Measured memory_bytes: 3064
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値

using namespace std;
using ll = long long int;
using Graph = vector<vector<int>>;

vector<int> dis;
vector<int> least;
void dfs(const Graph &G, int v){
    for(auto next_v:G[v]){
        if(dis[next_v]<=dis[v]+1) continue;        
        dis[next_v] = dis[v] + 1;
        dfs(G,next_v);
    }
}

int main(void){
    int N,X,Y;cin>>N>>X>>Y;
    Graph G(N);
    G[X-1].push_back(Y-1);
    G[Y-1].push_back(X-1);
    for(int i=0;i<N-1;i++){
        G[i].push_back(i+1);
        G[i+1].push_back(i);
    }
    least.assign(N,0);
    for(int i=0;i<N;i++){
        dis.assign(N,2000000000);
        dis[i] = 0;
        dfs(G,i);
        for(auto distance:dis){
            least[distance]++;
        }
    }
    for(int i=1;i<N;i++){
        cout << least[i]/2 << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.*;
 
public class Main {
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long n = sc.nextLong(); 
		long x = b-1;
		if(x>n){
			x = n;
		}
		long ans = (a*x)/b-a*(x/b);
		System.out.println(ans);

	}
}


Measured memory_bytes: 27080
#include <bits/stdc++.h>
#define ll long long 
#define ull unsigned long long 
#define f(i,x,n) for(ll int i=x;i<n;i++) 
#define re(j,x,n) for(ll int j=x;j>=n;j--)
#define f1(k,x,n) for(ll int k=x;k<=n;k++)
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define MAX 1000001
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll int n;
    cin>>n;
    ll int mn=n-1;
    f1(i,2,sqrt(n))
    {
      if(n%i==0)
      { 
      	if(mn<(i-1)+((n/i)-1))
      		break;
      	mn=min(mn,(i-1)+((n/i)-1));
      }
    }
    cout<<mn;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <stack> 
#include <map>
#include <queue>
#include <unordered_map>
#include <cassert>
#include <iomanip>
#include <cmath>
#include <cstring>
using namespace std;
#define pb 					push_back
#define FAST_IO          ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
template<typename T,typename S>
ostream& operator <<(ostream& os, pair<T, S> input) {
	os<<"("<<input.first<<", "<<input.second<<")";
	return os;
}
template<typename T>
ostream& operator <<(ostream& os, vector<T> input) {
	for(auto t: input)
		os << t <<" ";
	return os;
}
template<typename T>
ostream& operator <<(ostream& os, set<T> input) {
	for(auto t: input)
		os << t <<" ";
	return os;
}



int n, m;
vector<int> v;
int tot = 0;

int ans =0;

vector< pair< pair<int,int> , pair<int,int> > > q;
int solveVector() {
	int ians =0;

	for(auto qq: q) {
		int a = qq.first.first;
		int b = qq.first.second;
		int c = qq.second.first;
		int d = qq.second.second;
		if(v[b-1] - v[a-1] == c)
			ians +=d;
	}
	return ians;
}
void solve(int in =0, int pr =1) {
	if(in == n  +1) {
		vector<int> v1 = v;
		sort(v1. begin(), v1.end());
		if(v1==v) {
			int ians = solveVector();
			ans = max(ans, ians);
			// cout << v << " " << ians << "\n";
		}
		return ;
	}
	for(int i= pr; i<=m; i++) {
		v.push_back(i);
		solve(in +1 , i);
		v.pop_back();
	}
}
int main() {
	int Q;
	cin >> n >> m >> Q;
	
	while(Q--) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		q.push_back( { {a, b}, {c, d}});
	}
	solve();
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 3640
import math
n = int(input())
xy = [list(map(int,input().split())) for _ in range(n)]
sum_xy = 0
for i in range(n):
  for j in range(i,n):
    sum_xy += math.sqrt((xy[i][0]-xy[j][0])**2 + (xy[i][1] - xy[j][1])**2)
print(sum_xy * 2 / n)


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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

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

  vector<ll> a(n);
  for (ll i = 0; i < n; ++i) {
    cin >> a[i];
    a[i]--;
  }

  vector<ll> t = {0};
  vector<ll> seen(n, -1);
  seen[0] = 0;
  ll cycle = 0;
  while (true) {
    ll i = t[t.size()-1];
    if (seen[a[i]] >= 0) {
      cycle = seen[a[i]];
      break;
    }
    t.push_back(a[i]);
    seen[a[i]] = t.size() - 1;
  }

  if (k < t.size()) {
    cout << t[k]+1 << endl;
    return 0;
  }

  k -= cycle;
  ll m = t.size() - cycle;
  cout << t[cycle+(k%m)]+1 << endl;

  return 0;
}


Measured memory_bytes: 8496
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll ;
#define rep(i, a, b) for (int i = a; i <= b; ++ i) 
const int N = 1e5 + 5 ;
using namespace std ;

int n, e, ter[N << 1], lnk[N], nxt[N << 1] ;

void add(int x, int y) {
	ter[++ e] = y, nxt[e] = lnk[x], lnk[x] = e ;
}

int dfs(int p, int las) {
	int res = 0 ;
	for (int i = lnk[p] ; i; i = nxt[i]) if (ter[i] != las) {
		res ^= dfs(ter[i], p) + 1 ;
	}
	return res ;
}

int main() {
	scanf("%d", &n) ;
	int x, y ;
	rep(i, 1, n - 1) {
		scanf("%d%d", &x, &y) ;
		add(x, y), add(y, x) ;
	}
	puts(dfs(1, 0) ? "Alice" : "Bob") ;
	return 0 ; 
}

Measured memory_bytes: 6912
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) > *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

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

	return result;
}

static size_t countDivisors(const size_t n)
{
	size_t count = 1;

	for (size_t i = 2; i <= n; i++) {
		if (n%i == 0) {
			count++;
		}
	}

	return count;
}

int main(void) {
	char S[101];
	size_t K;

	scanf("%s\n%zu", S, &K);

	for (size_t idx = 0; idx < strlen(S); idx++) {
		if (S[idx] != '1') {
			printf("%c\n", S[idx]);
			return 0;
		}
		else if (idx == K - 1) {
			puts("1");
			return 0;
		}
	}

	puts("1");

	return 0;
}


Measured memory_bytes: 128
n = int(input())
p = list(map(int, input().split(" ")))

ans = 0
for i in range(1, n-1):
    if p[i-1] <= p[i] and p[i] < p[i+1] or p[i-1] > p[i] and p[i] >= p[i+1]:
        ans += 1
print(ans)

Measured memory_bytes: 3060
import java.io.*;
public class Main
{
  public static void main(String[] args)
    {
        BufferedReader reader = new BufferedReader (new InputStreamReader (System.in));
        try
        {
            String line = reader.readLine();
            String[] data = line.split(" ");
            char[] answer =new char[3];
            for(int i=0; i<3; i++)
            {
                answer[i]=data[i].charAt(0);
                System.out.print(answer[i]);
            }
            System.out.print("\n");
        }
        catch (IOException e)
        {
            System.out.println(e);
        }
    }
}

Measured memory_bytes: 21332
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
	ll n,sum=0,tmp=0,sa=0,sa2=0,c=0,tmp2=0,c2=0;
	bool chg=false;
	cin>>n;
	vector<ll>a(n);
	vector<ll>b(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
		b[i]=sum;
	}
	vector<ll>bb(b);
	for(int i=0;i<n;i++){
		b[i]+=sa;
		if(i%2==0 && b[i]<=0){
			tmp=abs(b[i])+1;
			chg=true;
		}
		if(i%2==1 && b[i]>=0){
			tmp=-(abs(b[i])+1);
			chg=true;
		}
		if(chg){
			c+=abs(tmp);
			sa+=tmp;
		}
		chg=false;
	}
	chg=false;
	for(int i=0;i<n;i++){
		bb[i]+=sa2;
		if(i%2==0 && bb[i]>=0){
			tmp2=-(abs(bb[i])+1);
			chg=true;
		}
		if(i%2==1 && bb[i]<=0){
			tmp2=abs(bb[i])+1;
			chg=true;
		}
		if(chg){
			c2+=abs(tmp2);
			sa2+=tmp2;
		}
		chg=false;
	}
	
	cout<<min(c,c2);
}

Measured memory_bytes: 2560
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
	#define lb lower_bound 
	#define ub upper_bound
	#define pii pair<pair<int,int>,pair<int,int> >
	#define se second
	#define endl "\n"
	#define pi pair<int, int>
	#define mi          map<int,int>
	#define mii         map<pi,int>
	#define vi vector<int> 
	#define vvi vector<vi>
	#define bs   binary_search
	#define rep(i,a,b) for(int i=a;i<b;i++)
	#define rep1(i,a,b) for(int i=a;i<=b;i++)	
	#define all(c) (c).begin(),(c).end()
	#define sz(x)       (int)x.size() 
	#define PI 3.14159265358979323846
	
	 const int N =2e5+5;
	
	 int mod= 1e9+7;
	 int dx[4]={0,0,+1,-1};
	 int dy[4]={+1,-1,0,0};  
	 
	 
	int po(int a, int b) {
		a %= mod;
		int res = 1;
		while (b > 0) {
			if (b & 1)
				res = (res * a) % mod;
			a =(a*a) % mod;
			b >>= 1;
		}
		 return res;	
	   }

	  
	 void solve() {		 
	         int n;
	         cin>>n;
	        
	         cout<<ceil((float)n/2)<<endl;        
	        
	 }
	
int32_t main() {
	cool;
	int t=1;
	//cin>>t;
	while(t--)
	   solve();
	   
	   
	   return 0;	   
}


Measured memory_bytes: 256
def main():
    R,G,B,N = map(int,input().split())
    cnt = 0

    for x in range(N//R+1):
        for y in range(N//G+1):
            z = N - R*x - G*y
            if z >= 0 and z % B == 0:
                cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()

Measured memory_bytes: 40684
# -*- coding: utf-8 -*-
from sys import stdin
import sys
import numpy as np

xy = stdin.readline().rstrip().split()
x = int(xy[0])
y = int(xy[1])

data = [stdin.readline().rstrip().split() for _ in range(x)]
#print(*data, sep='\n')
#print('----------------')

for i in range(x):
    data[i] = list(data[i][0])

arr = np.array(data)
#print(arr)
#print('----------------')

OK = True
for i in range(x):
    for j in range(y):

        if arr[i][j] == '#':
            can_paint = False

            if i != 0:
                if arr[i-1][j] == '#':
                    can_paint =True

            if j != 0:
                if arr[i][j-1] == '#':
                    can_paint = True

            if i != x-1:
                if arr[i+1][j] == '#':
                    can_paint = True

            if j != y-1:
                if arr[i][j+1] == '#':
                    can_paint = True

            if can_paint != True:
                OK = False

if OK == True:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 20772
/*
  AOJ 2700
  Title:Airport codes
  @kankichi573
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define max(x,y) (((x)>(y))?(x):(y))

int N;
const char *boin="aiueo";
char airport[100][51];
char abbrev[100][51];

int compare_str(const void *a, const void *b)
{
  return(strcmp((char *)a,(char *)b));
}

void make_abbr(char *from, char *to)
{
  char *p,*q;
  for(p=from,q=to;*p;p++)
    {
      if(p==from || strchr(boin,p[-1]))
	{
	  //printf("%c",*p);
	  *q=*p;
	  q++;
	}
    }
  q='\0';
  //printf("\n");
}

int strdiffpos(char * a,char * b)
{
  int i;
  for(i=0;i<50;i++)
    if(a[i]!=b[i])
      return(i+1);
  return(-1);
}

main()
{
  int i,ret,ret1;

  while(scanf("%d",&N)  && (N))
    {
      memset(airport,0,sizeof(airport));
      memset(abbrev ,0,sizeof(abbrev));
      for(i=0;i<N;i++)
	{
	  scanf("%s",&airport[i][0]);
	  make_abbr(&airport[i][0],&abbrev[i][0]);
	  //printf("%s\n",&abbrev[i][0]);
	}
      qsort(abbrev,N,51,compare_str);
      //for(i=0;i<N;i++)
      //	printf("%s\n",&abbrev[i][0]);
      if(N==1)
	ret=1;
      else
	ret=0;
	for(i=0;i<N-1;i++)
	  {
	    ret1=strdiffpos(&abbrev[i][0],&abbrev[i+1][0]);
	    //printf("%s %s [%d]\n",&abbrev[i][0],&abbrev[i+1][0],ret1);
	    if(ret1==-1)
	      {
		ret=-1;
		break;
	      }
	    ret=max(ret,ret1);
	  }
	printf("%d\n",ret);
    }
  return(0);
}

Measured memory_bytes: 628
import sys
input = sys.stdin.readline
k, q = map(int,input().split())
D = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(q)]

for i in range(q):
    n = A[i][0]
    x = A[i][1]
    m = A[i][2]
    ans = 0
    B = [x%m]
    BP = [0] * (k+1)
    n -= 1
    for j in range(k):
        B.append((B[-1] + D[j]) % m)
    ans0 = 0
    for j in range(len(B)-1):
        if B[j+1] > B[j]:
            BP[j+1] = 1
            ans0 += 1
    # print(B,BP)
    if B[-1] != B[0]:
        if B[-1] > B[0]:
            ans1 = [ans0-1, ans0]
        elif B[-1] < B[0]:
            # print("sage")
            ans1 = [ans0, ans0+1]
        d = (B[-1] - B[0]) % m
        kn = n // k
        c = (B[0] + d * kn) % m
        sag = (B[0] + d * kn) // m
        # print(((B[0] + d * kn) - c) % m,"zero")
        ans = ans1[0] * sag + ans1[1] * (kn-sag)
        # print("kn",kn,"sag",sag,"c",c)
        for ii in range(n%k):
            cm = c
            # print("plus")
            c += D[ii]
            if c >= m:
                c %= m
            
            if c>cm:
                ans += 1    
        print(ans)
        
    else:
        # print("eq")
        print(ans0 * (n//k) + sum(BP[:n%k+1]))  

Measured memory_bytes: 83804
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d=0;
        if(a>b){
            d=a;
            a=b;
            b=d;
        }
        if(b>c){
            d=b;
            b=c;
            c=d;
        }
        if(a>b){
            d=a;
            a=b;
            b=d;
        }
        System.out.printf("%d %d %d\n",a,b,c);
    }
}


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

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define endl '\n'

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

const ll INF = 2e18;
const int MOD = 1e9 + 7;
const int MAXN = 2e5 + 5;

int a, b, c, k;

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> a >> b >> c >> k;
	int ans = 0;
	if(a < k) {
		k -= a;
		ans += a;
		if(b < k) {
			k -= b;
			ans -= k;
			cout << ans;
		}
		else cout << ans;
	}
	else cout << k;
}


Measured memory_bytes: 3648
import java.util.Scanner;

// B - Papers, Please
// https://atcoder.jp/contests/abc155/tasks/abc155_b
public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());
        for (int i = 0; i < N; i++) {
            int num = Integer.parseInt(scanner.next());
            if (num % 2 == 0) {
                if (!(num % 3 == 0 || num % 5 == 0)) {
                    System.out.println("DENIED");
                    return;
                }
            }
        }
        scanner.close();

        System.out.println("APPROVED");
    }
}


Measured memory_bytes: 21844
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

vector<vector<pair<int, int>>> cities;
vector<pair<int, int>> ids;

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

    cities.resize(N);
    ids.resize(M);

    for (int i = 0; i < M; i++) {
        int p, y;
        cin >> p >> y;
        p--;
        cities[p].push_back({y, i});
    }
    for (int i = 0; i < N; i++) {
        sort(cities[i].begin(), cities[i].end());

        for (int j = 0; j < (int) cities[i].size(); j++) {
            ids[cities[i][j].second] = {i + 1, j + 1};
        }
    }

    for (int i = 0; i < M; i++) {
        printf("%06d%06d\n", ids[i].first, ids[i].second);
    }

    return 0;
}


Measured memory_bytes: 7808
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define ll long long
#define pr pair<int,int>
#define N 100005
#define mod 1000000007
#define INF 2147483647
using namespace std;
int main() {
	IOS;
	int n;
	cin >> n;
	int cnt = 0;
	bool fd = 0;
	for (int i = 1; i <= n; i++) {
		int a, b;
		cin >> a >> b;
		if (!fd) {
			if (a == b)cnt++;
			else {
				cnt = 0;
			}
			if (cnt >= 3)fd = 1;
		}
	}
	if (fd)cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <stdio.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
typedef pair<ll,ll> l_l;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back


ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}
ll gcd(ll x,ll y){
    if(x<y) return gcd(y,x);
    if(y==0) return x;
    return gcd(y,x%y);
}

int main(){
    ll n;cin>>n;
    if(n%2==1){
        cout<<0<<endl;
    }else{
        ll m=n/2;
        ll ans=0;
        ll c=1;
        while(m>0){
            ans=ans+(m/5)*c;
            m/=5;
        }
        cout<<ans<<endl;
    }
    
    return 0;
}




Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int w = sc.nextInt();
        if(s <= w){
        	System.out.println("unsafe");
        }else{
        	System.out.println("safe");
        }
    }
}

Measured memory_bytes: 35692
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<set>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

class UnionFind{
public:
	vector<int> par,num;

	int find(int v){
		return (par[v]==v)? v: (par[v]=find(par[v]));
	}
	explicit UnionFind(int N):par(N),num(N,1){
		iota(par.begin(),par.end(),0);
	}
	void unite(int u,int v){
		u=find(u),v=find(v);
		if(u==v)return ;
		if(num[u]<num[v])swap(u,v);
		num[u] += num[v];
		par[v] = u;
	}
	bool same(int u,int v){
		return find(u) == find(v);
	}
	bool ispar(int v){
		return v=find(v);
	}
	int size(int v){
		return num[find(v)];
	}
};

int main(){
	int n,m; cin >>n>>m;
	vector<int> p(n);
	cinf(n,p);
	UnionFind Uf(n);
	int x,y;
	for(int i=0;i<m;i++){
		cin >>x>>y;
		Uf.unite(x-1,y-1);
	}
	int ans=0;
	for(int i=0;i<n;i++){
		if(Uf.same(i,p[i]-1)) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1408
package main

import (
	"bufio"
	"fmt"
	"math/cmplx"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}
func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0
	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 3
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}
	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	x1 := getNextFloat64(scanner)
	y1 := getNextFloat64(scanner)
	x2 := getNextFloat64(scanner)
	y2 := getNextFloat64(scanner)

	v := complex(x2-x1, y2-y1)
	_, th := cmplx.Polar(v)
	q := getNextInt(scanner)
	for i := 0; i < q; i++ {
		x := getNextFloat64(scanner) - x1
		y := getNextFloat64(scanner) - y1
		vv := rotate(complex(x, y), -th)
		ans := rotate(complex(real(vv), -imag(vv)), th)
		fmt.Fprintln(writer, fmt.Sprintf("%.10f %.10f", real(ans)+x1, imag(ans)+y1))
	}
}

func rotate(v complex128, theta float64) complex128 {
	r, th := cmplx.Polar(v)
	th += theta
	return cmplx.Rect(r, th)
}



Measured memory_bytes: 1304
#include<iostream>
#include<string>
using namespace std;
int main(void){
int count=0;
char s[3];
cin>>s[0]>>s[1]>>s[2];
if(s[0]=='a'&&s[1]=='b'&&s[2]=='c')
cout<<"Yes"<<endl;
else if(s[0]=='a'&&s[2]=='b'&&s[1]=='c')
cout<<"Yes"<<endl;
else if(s[1]=='a'&&s[0]=='c'&&s[2]=='b')
cout<<"Yes"<<endl;
else if(s[1]=='a'&&s[2]=='c'&&s[0]=='b')
cout<<"Yes"<<endl;
else if(s[2]=='a'&&s[1]=='c'&&s[0]=='b')
cout<<"Yes"<<endl;
else if(s[2]=='a'&&s[0]=='c'&&s[1]=='b')
cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define all(x) (x).begin(), (x).end()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end());
const long long INF = 1LL << 60;
// map<int,int> mp;

int main() {
  vector<int> x(5);
  REP(i, 5) {
    cin >> x[i];
    if(x[i]==0){
      cout << i+1 << endl;
    }
  }

}

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

int main() 
{
    int a, b, k;
    cin >> a >> b >> k;
    int d = __gcd(a,b);
    vector<int> v;
    for (int i=1; i<=d/2; i++)
        if (d%i==0)
            v.push_back(i);
    v.push_back(d);
    cout << v[v.size()-k];
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		FastScanner sc=new FastScanner();
		PrintWriter pw=new PrintWriter(System.out);
		int N=sc.nextInt();
		int K=sc.nextInt();
		pw.println(K==1?0:(N-K));
		pw.close();
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public int nextInt() {
    	return Integer.parseInt(next());
    }
    
    public long nextLong() {
    	return Long.parseLong(next());
    }
}

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

int main()
{
    int A, B;
    cin >> A >> B;
    if(A > 9 || B > 9){
        cout << -1 << endl;
    }else{
        cout << A * B << endl;
    }
    return 0;
}

Measured memory_bytes: 256
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def main():
    from builtins import int, map
    n = int(input())
    if n == 1:
        print(0)
        exit()

    fn = factorization(n)
    cmax = max([f[1] for f in fn])
    z = set({})

    k = 1
    flag_get = True
    while flag_get and k <= cmax:
        flag = False
        for i in range(len(fn)):
            pi, ni = fn[i]
            if ni >= k:
                flag = True
                z.add(pi ** k)
                fn[i][1] -= k
        if not flag:
            break
        k += 1
    print(len(z))

if __name__ == '__main__':
    main()

Measured memory_bytes: 68264
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<stdio.h>
#include<stdlib.h>




using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a'+1;
    if((in < 1) || (in > 26)){
        ans = 100;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}





int main(){
  int N;
  cin>>N;
  int x[]={2,11,31,61,71,101,131,151,191,211,241,251,271,281,311,401,421,431,461,521,571,601,631,641,661,701,751,761,811,881,911,941,971,
  991,1021,1031,1051,1061,1091,1171,1181,1201,1231,1291,1301,1321,1361,1381,1451,1471,1481,1511,1531,1571,1601,1621,1721};
  for(int i=0;i<N;i++){
    printf("%d ",x[i]);
  }
  printf("\n");




  





  



}


  
  

  


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

int main()
{
  int a,b,c; cin >> a >> b >> c;
  if (a+b == c || a+c == b || b+c == a) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

template<typename T>
string to_string(const vector<T>& vc, int w) {
	if(vc.empty()) return "";
	if(w + 1 == vc.size()) return to_string(vc[w]);
	return to_string(vc[w]) + "," + to_string(vc, w + 1);
}

template<typename T>
string to_string(const vector<T>& vc) {
	return "{" + to_string(vc, 0) + "}";
}

void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	#endif

	int n;
	cin >> n;
	vector<int> h(n), p(n), inds(n);
	vector<int> dp(n + 1, MOD * 2);
	for(int i = 0; i < n; i++) {
		cin >> h[i] >> p[i];
	}

	iota(inds.begin(), inds.end(), 0);
	sort(inds.begin(), inds.end(), [&](int a, int b) {
		return h[a] - p[b] < h[b] - p[a];
	});

	dp[0] = 0;
	for(auto el: inds)
		for(int i = n - 1; i >= 0; i--)
			if(dp[i] <= h[el]) dp[i + 1] = min(dp[i + 1], dp[i] + p[el]);

	int w = n;
	while(dp[w] == MOD * 2) w--;
	cout << w << '\n';
}



Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n;
	cin >> n;
	bool ans = true;
	rep(_, n) {
		int a;
		cin >> a;
		if (a % 2 == 0) {
			if (a % 3 != 0 && a % 5 != 0) ans = false;
		}
	}
	cout << (ans ? "APPROVED" : "DENIED") << '\n';
}

Measured memory_bytes: 256
// Isaunoya
#include<bits/stdc++.h>
using namespace std ;
using LL = long long ;
using uint = unsigned int ;
#define int long long
#define fir first
#define sec second
#define pb push_back
#define mp(x , y) make_pair(x , y)
template < typename T > inline void read(T & x) { x = 0 ; int f = 1 ; register char c = getchar() ;
  for( ; ! isdigit(c) ; c = getchar()) if(c == '-') f = -1 ;
  for( ; isdigit(c) ; c = getchar()) x = (x << 1) + (x << 3) + (c & 15) ;
  x *= f ;
}
template < typename T > inline void print(T x) {
  if(! x) { putchar('0') ; return ; }
  static int st[105] ;
  if(x < 0) putchar('-') , x = -x ;
  int tp = 0 ;
  while(x) st[++ tp] = x % 10 , x /= 10 ;
  while(tp) putchar(st[tp --] + '0') ;
}
template < typename T > inline void print(T x , char c) { print(x) ; putchar(c) ; }
template < typename T , typename ...Args > inline void read(T & x , Args & ...args) { read(x) ; read(args...) ; }
template < typename T > inline void sort( vector < T > & v) { sort(v.begin() , v.end()) ; return ; }
template < typename T > inline void unique( vector < T > & v) { sort(v) ; v.erase(unique(v.begin() , v.end()) , v.end()) ; }
template < typename T > inline void cmax(T & x , T y) { if(x < y) x = y ; return ; }
template < typename T > inline void cmin(T & x , T y) { if(x > y) x = y ; return ; }
const int Mod = LLONG_MAX ;
inline int QP(int x , int y) { int ans = 1 ;
  for( ; y ; y >>= 1 , x = (x * x) % Mod)
    if(y & 1) ans = (ans * x) % Mod ;
  return ans ;
}
template < typename T > inline T gcd(T x , T y) { if(y == 0) return x ; return gcd(y , x % y) ; }
template < typename T > inline T lcm(T x , T y) { return x * y / gcd(x , y) ; }
template < typename T > inline void mul(T & x , T y) { x = 1LL * x * y ; if(x >= Mod) x %= Mod ; }
template < typename T > inline void add(T & x , T y) { if((x += y) >= Mod) x -= Mod ; }
template < typename T > inline void sub(T & x , T y) { if((x -= y) < 0) x += Mod ; }

signed main() { int n ; read(n) ;
  int f = 0 ;
  for(register int i = 1 ; i <= sqrt(n) ; i ++)
    if(! (n % i) && n / i <= 9 && i <= 9) f = 1 ;
  puts(f ? "Yes" : "No") ;
}


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

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

    int ans = 0;
    int tmp = 0;
    rep(i,s.size()) {
        char ch = s[i];
        if (ch == 'A' || ch == 'C' || ch == 'G' || ch == 'T') {
            tmp++;
            if (i!=s.size()-1) continue;
        }

        ans = max(ans, tmp);
        tmp = 0;
        
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> ans(n);
    rep(i, n - 1)
    {
        int c;
        cin >> c;
        c--;
        ans.at(c)++;
    }
    rep(i, n) cout << ans.at(i) << endl;
}

Measured memory_bytes: 3992