akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tommy6073
 */

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

class BCardGameForTwo {
public:
    void solve(std::istream& in, std::ostream& out) {
        int N;
        in >> N;
        vector<int> a;
        for (int i = 0; i < N; ++i) {
            int a_i;
            in >> a_i;
            a.push_back(a_i);
        }

        int alice_sum = 0;
        int bob_sum = 0;

        while (!a.empty()) {
            auto max_iter = max_element(a.begin(), a.end());
            alice_sum += *max_iter;
            a.erase(max_iter);
            if (!a.empty()) {
                max_iter = max_element(a.begin(), a.end());
                bob_sum += *max_iter;
                a.erase(max_iter);
            }
        }

        out << alice_sum - bob_sum;
    }
};


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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;

#define MAN 200000

int main(){
  int a,b,c,d;
  int n;
  string s;
  cin >> s;
  a=0;
  LOOP(i,4){
    if(s[i]=='2')a++;
  }
  cout << a;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long int
 
main() {
	int n, k, c;
	cin>>n>>k>>c;
	string s;
	cin>>s;
	vector<int>v;
	for(int i=0; i<s.size(); i++){
		if(s[i]=='o'){
			v.pb(i);
		}
	}
	int last=-1e9;
	vector<int>beg;
	vector<int>las;
	for(int i=0; i<v.size(); i++){
		if(v[i]-last>c){
			beg.pb(v[i]);
			last=v[i];
		}
	}
	last=1e9;
	for(int i=v.size()-1; i>=0; i--){
		if(last-v[i]>c){
			las.pb(v[i]);
			last=v[i];
		}
	}
	if(beg.size()>k){
		return 0;
	}
	reverse(las.begin(), las.end());
	vector<int>ans;
	for(int i=0; i<k; i++){
		if(las[i]==beg[i]){
			ans.pb(beg[i]+1);
		}
	}
	for(auto u:ans){
		cout<<u<<endl;
	}
	return 0;
}

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

#define VARNAME(x) #x
#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

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


constexpr ll MOD = (ll)1e9 + 7LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;

int N;
void query(vector<int>& p, const int k, vector<int>& op)
{
    op.push_back(k);
    for (int i = k; i < N; i++) {
        swap(p[i], p[i - k]);
    }
}

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

    cin >> N;
    vector<int> p(N);
    for (int i = 0; i < N; i++) {
        cin >> p[i];
    }

    vector<int> op;
    for (int i = 0; i < 2 * N * N; i++) {
        if (p[0] > 0 and p[N - 1] > 0 and p[0] < p[N - 1]) {
            query(p, N - 1, op);
        }
        query(p, 1, op);
    }
    while (p[0] > 0) {
        query(p, 1, op);
    }

    cout << op.size() << endl;
    for (const int o : op) {
        cout << o << endl;
    }
    show(p);

    return 0;
}


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

int main(void)
{
    string str;
    char ch;
    bool aBoolean = true;
    cin >> str;
    for (int i = 0; i < str.size(); i++)
    {
        ch = str[i];
        if ((i+1) % 2 == 0)
        {
            if (ch != 'L' && ch != 'U' && ch != 'D')
            {
                aBoolean = false;
            }
        }
        else
        {
            if (ch != 'R' && ch != 'U' && ch != 'D')
            {
                aBoolean = false;
            }
        }
    }
    cout << (aBoolean ? "Yes" : "No") << endl;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll k,a,b;
    cin >> k >> a >> b;
    
    //ビスケットを一枚増やす
    //A枚を1円に換金
    //1円をB枚に交換
    
    if(a + 1 >= b){
        cout << k + 1 << endl;
        return 0;
    }
    
    ll n = k - a + 1; //残りn回操作できる
    ll ans = 0;
    
    if(n%2==0) ans += n / 2 * (b - a) + a;
    else ans += n / 2 * (b - a) + a + 1;
    
    cout << ans << endl;
}


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

int main() {
  int n;
  cin>>n;
  int a=0;
  int l,r;
  for(int i=0;i<n;i++){
    cin>>l>>r;
    a+=r-l+1;
  }
  cout<<a<<endl;
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	long long ans=(long long)n; 
	int m=(int)floor(sqrt(n)+0.5);
	for(int i=2; i<=m; i++) {
		if(n%i==0) {
			ans = (long long)ans * (i - 1) / i;
			while(n%i==0) n/=i;
		}
	}
	if(n>1) ans=ans/n*(n-1);
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 3220
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
using namespace std;

int main(){
	int sum=0,max=0;
	for(int i=0;i<3;i++){
		int tmp;
		cin>>tmp;
		sum+=tmp;
		if(max<tmp){max=tmp;}
	}
	cout<<sum-max;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>


int main(void)
{
    int n,d,x,i,j,s,c=0;
    int a[100];
    
    scanf("%d",&n);
    scanf("%d%d",&d,&x);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }   
    for(i=0;i<n;i++){
        for(j=0;j<d;j++){
            if((a[i]*j+1)<=d) c++;
        }
    }   
    s=c+x;
    printf("%d\n",s);
    return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python
# coding: utf-8

# In[15]:


H,W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))


# In[17]:


c = 0
tmp = 1
for h in range(H):
    line = []
    for w in range(W):
        line.append(c+1)
        tmp += 1
        if tmp > a[c]:
            c += 1
            tmp = 1
    if h%2 == 0:
        print(" ".join(map(str,line)))
    else:
        print(" ".join(map(str,list(reversed(line)))))


# In[ ]:






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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

constexpr int INF = 1e9;
constexpr ll INFLL = 1e18;
constexpr int MOD = 1e9 + 7;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

int main(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    //cout << fixed << setprecision(6);
    int n; cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];

    list<int> b;
    for(int i = 0; i < n; i++){
        if(i % 2 == 0){
            b.push_back(a[i]);
        } else {
            b.push_front(a[i]);
        }
    }
    if(n % 2 == 1) reverse(all(b));
    
    for_each(all(b), [](int t){ cout << t << " "; });
    cout << endl;
    return 0;
}

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

int main() {
	int a, b;
	cin >> a >> b;

	if (a + b == 3) cout << 3 << endl;
	else if (a + b == 4) cout << 2 << endl;
	else cout << 1 << endl;

 	return 0;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[300005];
int n;
int main(){
    cin>>n;
    for (int i=1;i<=n;i++){
        char c;
        cin>>c;
        if (c=='E') a[i]=1;
        else a[i]=0;
    }
    int left=0,right=0;
    for (int i=2;i<=n;i++){
        if (a[i]==1) left++;
    }
    int minn=left+right;
    for (int i=2;i<=n;i++){
        if (a[i]==1) left--;
        if (a[i-1]==0) right++;
        minn=min(left+right,minn);
    }
    cout<<minn<<endl;
    return 0;
}


Measured memory_bytes: 1536
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


x, y = inpl()
for i in range(x + 1):
    if y == x * 2 + i * 2:
        print("Yes")
        exit()
print("No")


Measured memory_bytes: 68344
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

int main() {
    int n;
    string s;
    cin>>n>>s;
    for (int i = 0; i < s.size(); i++) {
        s[i]='A'+(s[i]-'A'+n)%26;
    }
    cout<<s<<endl;
}

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

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

int main() {
  int a, b;
  cin >> a >> b;

  cout << lcm(a, b) << endl;
}

Measured memory_bytes: 256
from collections import defaultdict

N = int(input())

A = list(map(int,input().split()))

C = defaultdict(int)

for a in A: C[a] += 1
    
ans = 0
for k in C:
    if C[k] < k:
        ans += C[k]
    elif C[k] > k:
        ans += C[k]-k
        
print(ans)

Measured memory_bytes: 18676
n, yen = map(int, input().split())
yen //= 1000

for noguchi in range(n + 1):
    for higuchi in range(n + 1 - noguchi):
        yukichi = n - noguchi - higuchi
        if noguchi + higuchi * 5 + yukichi * 10 == yen:
            print(yukichi, higuchi, noguchi)
            exit(0)
print("-1 -1 -1")

Measured memory_bytes: 3064
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    bool isStartZero = s[0] == '0';

    vector<pair<int,int>> starts;

    int cnt = 0;
    int begin = 0;
    starts.PB(MP(0, s[0] - '0'));
    for(int i=1;i<s.length();++i)
    {
        if(s[i-1] != s[i])
        {
            starts.PB(MP(i, s[i] - '0'));
        }
    }

    int ret = 0;
    for(int i=0;i<starts.size();++i)
    {
        if(starts[i].second == 0)
        {
            if (i + 2 * k >= starts.size())
            {
                ret = max(ret, (int)s.length() - starts[i].first);
            }
            else
            {
                ret = max(ret, starts[i + 2 * k].first - starts[i].first);
            }
        }
        else
        {
            if (i + 2 * k + 1 >= starts.size())
            {
                ret = max(ret, (int)s.length() - starts[i].first);
            }
            else
            {
                ret = max(ret, starts[i + 2 * k + 1].first - starts[i].first);
            }        
        }
    }

    cout << ret << endl;
}

Measured memory_bytes: 1528
#include <iostream>
#include <cmath>
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

#define ECHO(v) cout << v << endl;

int main(void){
    ll a,b,h;
    cin >> a;
    cin >> b;
    cin >> h;
    cout << ((a+b)*h/2) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
#include<atcoder/all>
using namespace atcoder;
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

void solve(ll N, ll M, ll A, ll B){
    cout << floor_sum(N, M, A, B) << endl; 
}

int main(){
    int T;
    cin >> T;
    vector<ll> N(T);
    vector<ll> M(T);
    vector<ll> A(T);
    vector<ll> B(T);
    rep(i,T)cin >> N[i] >> M[i] >> A[i] >> B[i];
    rep(i,T)solve(N[i], M[i], A[i], B[i]);
    return 0;
}

Measured memory_bytes: 5280
input_lst = []
for i in input():
    input_lst.append(int(i))

min_diff = 10**4
for i in range(len(input_lst)-2):
    diff = abs(753 - (input_lst[i]*100 + input_lst[i+1]*10 + input_lst[i+2]))
    if diff < min_diff:
        min_diff = diff
print(min_diff)

Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
	int i, N, h[200001];
	long long C;
	scanf("%d %lld", &N, &C);
	for (i = 1; i <= N; i++) scanf("%d", &(h[i]));
	
	int j, k, l[2] = {1, 2}, r[2] = {1, 2}, L, R, M;
	long long dp[200001] = {0, 0, (long long)(h[2] - h[1]) * (h[2] - h[1]) + C}, tmp;
	for (i = 3; i <= N; i++) {
		if (r[1] - l[1] > 100) {
			L = l[0];
			R = r[0];
			while (L < R) {
				M = (L + R) / 2;
				if (dp[M] + (long long)(h[i] - h[M]) * (h[i] - h[M]) > dp[M+1] + (long long)(h[i] - h[M+1]) * (h[i] - h[M+1])) L = M + 1;
				else R = M;
			}
			dp[i] = dp[L] + (long long)(h[i] - h[L]) * (h[i] - h[L]) + C;
		} else {
			for (j = l[0], dp[i] = (long long)1 << 60; j <= r[0]; j++) {
				tmp = dp[j] + (long long)(h[i] - h[j]) * (h[i] - h[j]) + C;
				if (tmp < dp[i]) dp[i] = tmp;
			}
		}
		
		L = l[1];
		R = r[1];
		while (L < R) {
			M = (L + R) / 2;
			if (dp[M] + (long long)(h[i] - h[M]) * (h[i] - h[M]) > dp[M+1] + (long long)(h[i] - h[M+1]) * (h[i] - h[M+1])) L = M + 1;
			else R = M;
		}
		if (dp[L] + (long long)(h[i] - h[L]) * (h[i] - h[L]) + C <= dp[i]) {
			dp[i] = dp[L] + (long long)(h[i] - h[L]) * (h[i] - h[L]) + C;
			l[0] = l[1];
			r[0] = r[1];
			l[1] = i;
			r[1] = i;
		} else r[1]++;
	}
	
	printf("%lld\n", dp[N]);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 4056
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[][] A = new int[3][3];
		for(int i = 0;i < 3;i++){
			for(int j = 0;j < 3;j++){
				A[i][j] = sc.nextInt();
			}
		}
		int N = sc.nextInt();
		int[] b = new int[N];
		boolean[][] bi = new boolean[3][3];
		for(int i = 0;i < N;i++){
			b[i] = sc.nextInt();
			for(int j = 0;j < 3;j++){
				for(int k = 0;k < 3;k++){
					if(b[i]==A[j][k]){
						bi[j][k] = true;
					}
				}
			}
		}
		sc.close();
		boolean ans = false;
		for(int i = 0;i < 3;i++){
			int cnt = 0;
			for(int j = 0;j < 3;j++){
				if(bi[i][j])cnt++;
			}
			if(cnt == 3){
				ans = true;
			}
		}
		for(int i = 0;i < 3;i++){
			int cnt = 0;
			for(int j = 0;j < 3;j++){
				if(bi[j][i])cnt++;
			}
			if(cnt == 3){
				ans = true;
			}
		}
		if((bi[0][0]&&bi[1][1]&&bi[2][2]) ||
				(bi[0][2]&&bi[1][1]&&bi[2][0])){
			ans = true;
		}
		System.out.println(ans ? "Yes" : "No");
	}

}

Measured memory_bytes: 21844
#![allow(dead_code)]
#![allow(non_snake_case)]
// Original macro is in https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
// Thanks @tanakh :bow:
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = || -> String {
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// for adhoc read (ex. https://atcoder.jp/contests/abc112/tasks/abc112_a)
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    input! { mut N: i32 }
    let mut ans = 0;
    N/=2;
    while N > 0 {
        ans += 1;
        N/=2;
    }
    println!("{}", 2_i32.pow(ans));
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(void){
  long long int a,b,tmp,r,x;
  scanf("%lld%lld",&a,&b);
  x=a*b;
  if(a<b){
    tmp=a;
    a=b;
    b=tmp;
  }
  r=a%b;
  while(r!=0){
    a=b;
    b=r;
    r=a%b;
  }
  printf("%lld",x/b);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vec vector
#define ll long long

int main(void)
{
	ll A, B, C, K;
	cin >> A >> B >> C >> K;
	
	if (K % 2) cout << B - A << endl;
	else cout << A - B << endl;
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <random>

using namespace std;
using namespace __gnu_pbds;

typedef
tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))
#define relaxMax(a, b) a = max(a, b)
#define relaxMin(a, b) a = min(a, b)

typedef long long ll;
typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("amusing.in", "r", stdin);
    //freopen("amusing.out", "w", stdout);
}

void solve() {
    vi a(3);
    forn(i, 3) cin >> a[i];
    Sort(a);
    if (a[0] != 5 || a[1] != 5 || a[2] != 7)
        cout << "NO\n";
    else
        cout << "YES\n";
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dbg puts("It's Just Begining.Wait For The End!!!!!\n")
#define CHECK(x) cout << (#x) << " is " << (x) <<"\n";
#define endl printf("\n")
typedef pair<ll,ll> pii;
#define pb push_back
#define ms(a,b) memset(a, b, sizeof(a))
#define in(x) scanf("%lld",&x)
#define out(x) printf("%lld",x)
#define X first
#define Y second
#define sps printf(" ")
#define dou(x) cout<<fixed<<setprecision(6)<<x
int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    cout<<c<<" "<<a<<" "<<b;endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <algorithm>

using namespace std;

int main(){
    int N;

    cin >> N;

    int min = 1000000;

    for(int i = 0; i < N; i++){
        int n;
        int num = 0;
        cin >> n;

        while(n%2 == 0){
            n /= 2;
            num++;
        }

        if(min > num){
            min = num;
        }
    }

    cout << min << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define pb push_back
#define pii pair<long long,long long>
#define endl '\n'
#define N 300001
int mod=1000000007;
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
vector<int> parent(N),sz(N),indegree(N),vis(N); char st[N];
vector<int> adj[N];
int modexp(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        
        return modexp((x*x)%M,n/2,M);
    else                             
        return (x*modexp((x*x)%M,(n-1)/2,M))%M;
}
void make_set(int s)
{
    parent[s]=s;
    sz[s]=1;
}
int find_parent(int p)
{
    if(p==parent[p])
    return p;
    return parent[p]=find_parent(parent[p]);
}
void union_set(int a,int b)
{
    a=find_parent(a);b=find_parent(b);
    if(a!=b)
    {
        if(a<b)
        swap(a,b);
        parent[b]=parent[a];
        sz[a]+=sz[b];
    }
}
int n,m,x;
int mat[20][20];
int cost[20];
int fun(vector<int>v,int idx){
	int ans=LLONG_MAX;
	for(int i=0;i<(1<<n);i++){
		vector<int>vv(m,0);
		int c=0;
		for(int j=0;j<n;j++){
			if(i&(1<<j)){
				c+=cost[j];
				for(int k=0;k<m;k++){
					vv[k]+=mat[j][k];
				}
			}
		}
		bool ok=1;
		for(int j=0;j<m;j++){
			if(vv[j]<x)ok=0;
		}
		if(ok)ans=min(ans,c);
	}
	return ans;
}
void solve()
{
    cin>>n>>m>>x;
    for(int i=0;i<n;i++)
    {
        cin>>cost[i];
        for(int j=0;j<m;j++)
        {
            cin>>mat[i][j];
        }
    }
    vector<int> a;
    int ans=fun(a,0);
    ans=ans==LLONG_MAX?-1:ans;
    cout<<ans;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test; test=1;
    while(test--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 19380
using System;

class ABC121_B
{
    static void Main(string[] args)
    {

        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int M = int.Parse(input[1]);
        int C = int.Parse(input[2]);

        input = Console.ReadLine().Split(' ');
        int[] B = new int[M];
        for (int i = 0; i < M; i++)
        {
            B[i] = int.Parse(input[i]);
        }

        int[][] A = new int[N][];
        for (int i = 0; i < N; i++)
        {
            input = Console.ReadLine().Split(' ');
            A[i] = new int[M];
            for (int j = 0; j < M; j++)
            {
                A[i][j] = int.Parse(input[j]);
            }
        }

        int count = 0;

        for (int i = 0; i < N; i++)
        {
            int sum = C;
            for (int j = 0; j < M; j++)
            {
                sum += A[i][j] * B[j];
            }

            if (sum>0)
            {
                count++;
            }
        }

        Console.WriteLine(count);
    }
}


Measured memory_bytes: 11220
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
       ArrayList<Integer> vList= new ArrayList<>();
         
		for(int i = 0; i < n; i++) {
          vList.add(sc.nextInt());
        }
        Collections.sort(vList);
        
        double ans = (double)vList.get(0);
        for (int i = 1; i < n; i++) {
          double sum = ans + (double)vList.get(i);
          ans = sum / 2;
        }
    
		// 出力
		System.out.println(ans);
	}
}

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

typedef long double ld;

int n;
priority_queue <ld> Q;

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        int a; scanf("%d", &a);
        Q.push(-a);
    }
    for (int i = 0; i < n - 1; i++) {
        ld a = -Q.top(); Q.pop();
        ld b = -Q.top(); Q.pop();
        Q.push(-(a + b) / 2.0l);
    }
    cout << fixed << setprecision(10) << -Q.top() << endl;
    return 0;
}


Measured memory_bytes: 256
N = list(map(int, input()))
ret = 0
N.reverse()
N.append(0)
N.append(0)
N.append(0)
L = len(N)
for i in range(L-1):
    if N[i] == 5:
        if N[i+1] >= 5:
            ret += 1
            N[i] += 1
    if N[i] > 5:
        ret += 10 - N[i]
        N[i+1] += 1
        if N[i+1] > 9:
            N[i+1] -= 10
            N[i+2] += 1            
    else:
        ret += N[i]
print(ret)

Measured memory_bytes: 116612
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INI(n) scanf("%d",&n)
#define INL(n) scanf("%lld",&n)
#define INS(s) scanf("%s",s)
#define INF 10000000000
#define mod 1000000007
#define X 1000000
typedef long long int ll;
ll finv[X];
ll fac[X];
ll inv[X];
ll usort(const void *a, const void *b){return *(ll*)a-*(ll*)b;}
ll dsort(const void *a, const void *b){return *(ll*)b-*(ll*)a;}
ll ssort(const void *a, const void *b){return strcmp((char*)a,(char*)b);}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll z(ll a){return max(a,-a);}
ll gcd(ll a,ll b){if(!b){return a;}else{return gcd(b,a%b);}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll kt(ll a){
  ll sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
ll ks(ll a){
  ll sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
void nCrReady(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for (int i=2;i<X;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;
  }
}
ll nCr(ll n,ll k){return fac[n]*(finv[k]*finv[n-k]%mod)%mod;}
ll modpow(ll a,ll b) {
  ll ret=1;
  for(;b>0;b>>=1,a=(ll)a*a%mod)if(b%2==1)ret=ret*a%mod;
  return ret;
}

int b[9];
int main(void){
  int a[9];
  FOR(9)INI(a[i]);
  int n;
  INI(n);
  int x;
  FOR(n){
    INI(x);
    FORJ(9)if(a[j]==x)b[j]=1;
  }
  int ans=0;
  if(b[0]*b[1]*b[2])ans=1;
  if(b[3]*b[4]*b[5])ans=1;
  if(b[6]*b[7]*b[8])ans=1;
  if(b[0]*b[3]*b[6])ans=1;
  if(b[1]*b[4]*b[7])ans=1;
  if(b[2]*b[5]*b[8])ans=1;
  if(b[0]*b[4]*b[8])ans=1;
  if(b[2]*b[4]*b[6])ans=1;
  char s[2][4]={"No","Yes"};
  PRS(s[ans]);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)



int main(){
    int n;
    cin>>n;
    int l[n];
    rep(i,n){
        cin>>l[i];
    }

    int cnt=0;

    for(int i=0;i+2<n;i++){
        for(int j=i+1;j+1<n;j++){
            for(int k=j+1;k<n;k++){
                if(l[i]!=l[j]&&l[j]!=l[k]&&l[k]!=l[i]){
                    if(l[i]<l[j]+l[k]&&l[j]<l[k]+l[i]&&l[k]<l[i]+l[j]){
                        cnt++;
                    }
                }
            }
        }
    }
    cout<<cnt<<endl;
}

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

move=[]
for i in range(0,N):
    move.append([])
    A[i]-=1
    move[i].append(A[i])


for j in range(1,64):
    for i in range(0,N):
        move[i].append(move[move[i][j-1]][j-1])
town=0
for i in range(0,64):
    if K%2==1:
        town=move[town][i]
    K//=2

print(town+1)


Measured memory_bytes: 339504
/* Simplicity and Goodness */
 
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int N = 2e5+2;


void solve()
{   
    ll n;
    lscn(n);

    string res = ""; 

    while(n > 26) {
        int d = n % 26;

        d = (d == 0)? 26: d;

        // cout << d << ' ';
        n -= d;
        n /= 26;

        res = (char)(d + 'a' - 1) + res;
    }

    // cout << n << ' ';

    res = (char)(n + 'a' - 1) + res;

    cout << res << '\n';
}

int main()
{
    int t = 1;
    // scn(t);

    while(t --) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3696
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=100005;
int n;
struct Seg
{
	int l,r;
}s[N];
int pre[N],nxt[N];
int main()
{
	scanf("%d",&n);
	int ans=0;
	for(int i=1;i<=n;i++)
		scanf("%d%d",&s[i].l,&s[i].r);
	sort(s+1,s+n+1,[=](const Seg &a,const Seg &b){return a.l==b.l?a.r<b.r:a.l<b.l;});
	pre[0]=1e9;
	for(int i=1;i<=n;i++)
		pre[i]=min(pre[i-1],s[i].r);
	nxt[n+1]=1e9;
	for(int i=n;i>=1;i--)
		nxt[i]=min(nxt[i+1],s[i].r);
	for(int i=1;i<n;i++)
		ans=max(ans,max(pre[i]-s[i].l+1,0)+max(nxt[i+1]-s[n].l+1,0));
	int L=s[n].l,R=pre[n];
	for(int i=1;i<=n;i++) ans=max(ans,s[i].r-s[i].l+1+max(R-L+1,0));
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 5344
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,p,a,i,c=0;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>p;
        if(i==1)
        {
            a=p;
        }
        if(p>a)
        {
            c++;
        }
        else
        {
            a=p;
        }
    }
    cout<<n-c<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int N;
    int K;
    cin >> N;
    cin >> K;
    
    int ret = 1;
    
    for (int i = 0; i < N; ++i)
    {
        ret = min(2 * ret, ret + K);
    }
   
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

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

    int t = 0;
    rrep(i, n) {
        a[i] += t;
        a[i] %= b[i];
        t += (b[i] - a[i]) % b[i];
    }
    cout << t << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
long long a,n,k,ans;
int main(){
	scanf("%lld%lld",&n,&k);
	while(k--){
		scanf("%lld",&a);
		ans+=a;
	}
	if(ans>=n)puts("Yes");
	else puts("No");
}

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

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
   for (int i = 0; i < N; i++) {
    cin >> L.at(i);
   }
  sort(L.begin(), L.end());
  int COUNT = 0;
  for (int i = 0; i < N-1; i++) {
    COUNT += L.at(i);
   }
  cout << ((COUNT > L.at(N-1)) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

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

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

const string YES = "Yes";
const string NO = "No";

void solve(long long n){
    for(int i=1;i<10;i++){
        for(int j=1;j<10;j++){
            if(i*j==n){
                cout<<YES<<endl;
                return;
            }
        }
    }
    cout<<NO<<endl;
}

int main(){
    long long n;
    scanf("%lld",&n);
    solve(n);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<bitset>
using namespace std;
typedef long long ll;
typedef bitset<160>bi;
ll maxi = 0;
ll d[211];
void get(ll y)
{
	bi x = y;
	for (int i = 1; i <= 33; i++)if (x[i])for (int j = i; j <= 100; j += i)x[j] = 1;
	ll ans = 0;
	for (int i = 1; i <= 33; i++)if (!x[i])ans += d[i];
	for (int i = 34; i <= 66; i++)
	{
		if (!x[i])
		{
			ll t = 0LL;
			if (!x[i])t = max(t, d[i]);
			if ((!x[i]) && (!x[i + i]))t = max(t, d[i] + d[i + i]);
			ans += t;
		}
	}
	for (int i = 67; i <= 99; i += 2)if (!x[i])ans += max(0LL, d[i]);
	maxi = max(maxi, ans);
}
void calc(ll now, int t)
{
	if (t == 34)get(now);
	else
	{
		calc(now, t + 1);
		if (!(now&(1LL << t)))
		{
			for (int i = t; i <= 33; i += t)now |= 1LL << i;
			calc(now, t + 1);
		}
	}
}
int main()
{
	int num;
	scanf("%d", &num);
	for (int i = 0; i < num; i++)scanf("%lld", &d[i + 1]);
	calc(0, 1);
	printf("%lld\n", maxi);
}

Measured memory_bytes: 128
#line 2 "../../library/template.hpp"
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define rep3(i, l, r) for(ll i = l; i < (ll)r; i++)
#define per(i, n) for(ll i = n-1; i >= 0; i--)
#define per3(i, l, r) for(ll i = r-1; i >= (ll)l; i--)
#define all(v) begin(v), end(v)
template<class T, class U>
inline void cmax(T& a, U b) { if (a < b) a = b; }
template<class T, class U>
inline void cmin(T& a, U b) { if (a > b) a = b; }

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
  }
} io_setup;

constexpr char el = '\n';
#line 2 "a2.cpp"

int main() {
  ll n, k;
  string s;
  cin >> n >> k >> s;
  s[k-1] = s[k-1]+('a'-'A');
  cout << s << el;
  cout << flush;
}


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

int main() {
  string c;
  cin >> c;
  
  if (c == "a" || c == "e" || c == "i" || c == "o" || c == "u") {
    cout << "vowel" << endl;
  }
  
  else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
	int d, g; scanf("%d %d", &d, &g);
	int p[10], c[10];
	for(int i = 0; i < d; i++) scanf("%d %d", &p[i], &c[i]);
	int res = 10000;
	for(int s = 0; s < 1 << d; s++){
		int tp = 0, tn = 0;
		for(int i = 0; i < d; i++) if((s >> i) & 1){
			tp += 100 * (i + 1) * p[i] + c[i];
			tn += p[i];
		}
		if(tp >= g){
			res = min(res, tn);
			continue;
		}
		for(int i = d - 1; i >= 0; i--) if(!((s >> i) & 1)){
			int t = (g - tp + 100 * (i + 1) - 1) / (100 * (i + 1));
			if(t < p[i]) res = min(res, tn + t);
			break;
		}
	}
	printf("%d\n", res);
	return 0;
}

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

int main () {
  int s = 0 ;
  cin >> s ;
  
  vector<int> line(1000000) ;
  
  line.at(0) = s ;
  
  int answer = 0 ;
  
  for ( int i = 1 ; i <= 1000000 ; i++ ) {
    if ( line.at( i - 1 ) % 2 == 0 ){
      line.at( i ) = line.at(i-1) / 2 ;
    } else {
      line.at( i ) = 3 * line.at(i-1) + 1 ;
    }
    for ( int j = 0 ; j < i ; j++ ){
      if ( line.at(i) == line.at(j) ){
        answer = i ;
      } 
    }
    if ( answer != 0 ) {
      break ;
    }
  }
  cout << answer + 1 << endl ;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define Inf 0x3f3f3f3f
#define rg register
using std::cin;
using std::cout;
typedef long long ll;
ll min(ll x, ll y) { return x < y ? x : y; }
ll max(ll x, ll y) { return x > y ? x : y; }
const int Maxn = 1e6 + 5;
inline ll read()
{
	rg ll res = 0, sign = 1;
	rg char ch = getchar();
	while (!isdigit(ch))
	{
		if (ch == '-')
			sign = -1;
		ch = getchar();
	}
	do
	{
		res = (res << 3) + (res << 1) + (ch ^ 48);
		ch = getchar();
	} while (isdigit(ch));
	return res * sign;
}
struct str
{
	int cnt, *addr;
	bool operator<(str A) const { return cnt < A.cnt; }
} d[Maxn];
int Disc(int t)
{
	rg int tmp = 0;
	std::sort(d + 1, d + t + 1);
	for (int i = 1; i <= t; i++)
	{
		if (i == 1 || d[i].cnt != d[i - 1].cnt)
			d[++tmp] = d[i];
		*d[i].addr = tmp;
	}
	return tmp;
}
int prime[Maxn], cnt, ans;
bool P[Maxn];
ll A, B;
ll gcd(ll x, ll y)
{
	ll z = x % y;
	while (z)
	{
		x = y;
		y = z;
		z = x % y;
	}
	return y;
}
int main()
{
	for (int i = 2; i <= 1000000; i++)
	{
		if (!P[i])
			prime[++cnt] = i;
		for (int j = 1; j <= cnt && i * prime[j] <= 1000000; j++)
		{
			P[i * prime[j]] = true;
			if (i % prime[j] == 0)
				break;
		}
	}
	rg ll x;
	cin >> A >> B;
	x = gcd(A, B);
	for (int i = 1; i <= cnt && x != 1; i++)
		if (x % prime[i] == 0)
		{
			ans++;
			while (x % prime[i] == 0)
				x /= prime[i];
		}
	if (x != 1)
		ans++;
	cout << ans + 1 << '\n';
	return 0;
}
//D


Measured memory_bytes: 1536
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define st first
#define nd second

using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set =
	tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#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 shandom_ruffle random_shuffle
 
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;

map<int, vector<string>> memo = {
	{3,
		{"a..",
		 "a..",
		 ".bb"}
	},
	{4,
		{"abcc",
		 "abdd",
		 "eegh",
		 "ffgh"}
	},
	{5,
		{"abbcc",
		 "ai..d",
		 "fi..d",
		 "f.jje",
		 "gghhe"}
	},
	{6,
		{"a.....",
		 "a.....",
		 ".bb...",
		 "...a..",
		 "...a..",
		 "....bb"}
	},
	{7,
		{"a..a..f",
		 "a..a..f",
		 ".bb.bbg",
		 "a..a..g",
		 "a..a..h",
		 ".bb.bbh",
		 "ccddee."}
	},
	{11,
		{"a..a..f....",
		 "a..a..f....",
		 ".bb.bbg....",
		 "a..a..g....",
		 "a..a..h....",
		 ".bb.bbh....",
		 "ccddee.....",
		 ".......abcc",
		 ".......abdd",
		 ".......eegh",
		 ".......ffgh"}
	}
};

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(11);
	cerr << fixed << setprecision(6);

	int n;
	cin >> n;

	if (n == 2) {
		cout << "-1\n";
	} else if (memo.count(n)) {
		for (auto x : memo[n]) {
			cout << x << "\n";
		}
	} else {
		int a4 = -1, a5 = -1;
		for (int i = 0;; ++i) {
			if ((n - i * 4) % 5 == 0) {
				a4 = i;
				a5 = (n - i * 4) / 5;
				break;
			}
		}
		assert(a4 >= 0);
		vector<string> res(n, string(n, '.'));

		int ptr = 0;
		while (a4) {
			for (int i = 0; i < 4; ++i) {
				for (int j = 0; j < 4; ++j) {
					res[ptr+i][ptr+j] = memo[4][i][j];
				}
			}
			--a4;
			ptr += 4;
		}
		while (a5) {
			for (int i = 0; i < 5; ++i) {
				for (int j = 0; j < 5; ++j) {
					res[ptr+i][ptr+j] = memo[5][i][j];
				}
			}
			--a5;
			ptr += 5;
		}

		for (auto x : res) { cout << x << "\n"; }
	}
}


Measured memory_bytes: 2304
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		String[] a={" ","'",",","-",".","?","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
		String[] b1={"101","000000","000011","10010001","010001","000001","100101","10011010","0101","0001","110","01001","10011011","010000","0111","10011000","0110","00100","10011001","10011110","00101","111","10011111","1000","00110","00111","10011100","10011101","000010","10010010","10010011","10010000"};
		String[] b2={"11010","11110","11100","11101","11011","11111","00000","00001","00010","00011","00100","00101","00110","00111","01000","01001","01010","01011","01100","01101","01110","01111","10000","10001","10010","10011","10100","10101","10110","10111","11000","11001"};
		Scanner sc=new Scanner(System.in);
		while(sc.hasNextLine()){
			char[] c1=sc.nextLine().toCharArray();
			String str="";
			for(int i=0;i<c1.length;i++){
				for(int j=0;j<a.length;j++){
					if(a[j].equals(c1[i]+"")){
						str+=b1[j];
						break;
					}
				}
			}
			char[] c2=str.toCharArray();
			String[] strArray=new String[c2.length%5==0?c2.length/5:c2.length/5+1];
			int ptr=0;
			for(int i=0;i<strArray.length;i++){
				strArray[i]="";
				for(int j=0;j<5;j++){
					try{
						strArray[i]+=(c2[ptr++]+"");
					}catch(ArrayIndexOutOfBoundsException e){
						strArray[i]+="0";
					}
				}
			}
			String answer="";
			for(int i=0;i<strArray.length;i++){
				for(int j=0;j<b2.length;j++){
					if(strArray[i].equals(b2[j])){
						answer+=a[j];
						break;
					}
				}
			}
			System.out.println(answer);
		}
	}
}

Measured memory_bytes: 66968
#include <stdio.h>
#define inf 10000000
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n;
int w[100][100];

int prim()
{

  int u, i, mincost, sum;
  int d[100], pi[100], color[100];

  sum = 0;
  
  for(i=0;i<n;i++){
    d[i] = inf;
    pi[i] = NIL;
    color[i] = WHITE;
  }
  
  d[0] = 0;

  while(1){
    mincost = inf;
    for(i=0;i<n;i++){
      if(color[i] != BLACK && d[i] < mincost){
	mincost = d[i];
	u = i;
      }
    }
    if(mincost == inf){
      break;
    }  
    color[u] = BLACK; 
    for(i=0;i<n;i++){
      if(color[i] != BLACK && w[u][i] < d[i]){
	pi[i] = u;
	d[i] = w[u][i];
	color[i] = GRAY;
      }
    }
  }
  
  for(i=0;i<n;i++){
    if(pi[i] != NIL){
      sum += w[i][pi[i]];
    }
  }
  
  return sum;

}


int main()
{

  int i, j, e;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&e);
      if(e == NIL){
	w[i][j] = inf;
      }
      else{
	w[i][j] = e;
      }
    }
  }

  printf("%d\n",prim());

  return 0;

}




Measured memory_bytes: 2104
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputStreamScanner in = new InputStreamScanner(System.in);
        new Main().solve(in, out);
        out.flush();
    }

    private void solve(InputStreamScanner in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();
        int k = in.nextInt();

        int c = 0;
        for (int i = Math.max(a, b); i >= 1; i--) {
            if (a % i == 0 && b % i == 0) {
                c++;
            }
            if (c == k) {
                out.println(i);
                return;
            }
        }

        out.println();
    }

    static class InputStreamScanner {

        private InputStream in;

        private byte[] buf = new byte[1024];
        private int len = 0;
        private int off = 0;

        InputStreamScanner(InputStream in)	{
            this.in = in;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); !isSpace(b);){
                sb.appendCodePoint(b);
                b = read();
            }
            return sb.toString();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return (char)skip();
        }

        int skip() {
            for (int b; (b = read()) != -1;) {
                if (!isSpace(b)) {
                    return b;
                }
            }
            return -1;
        }

        private boolean isSpace(int c) {
            return c < 33 || c > 126;
        }

        private int read() {
            if (len == -1) {
                throw new InputMismatchException("End of Input");
            }
            if (off >= len){
                off = 0;
                try {
                    len = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException(e.getMessage());
                }
                if (len <= 0) {
                    return -1;
                }
            }
            return buf[off++];
        }
    }
}

Measured memory_bytes: 22484