akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  FOR(i, v.size() - 1) { ret += to_string(v[i]) + ","; }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GI(N);
  GVI(t, N);
  GVI(v, N);
  int len = accumulate(ALL(t), 0);
  debug(t, v, len);
  vector<double> vs(len * 2 + 1, 100);
  int start = 0, end = 0;
  FOR(i, N) {
    end += t[i];
    for (int x = 0; x < len * 2 + 1; ++x) {
      if (start * 2 <= x && x < end * 2 + 1) {
        vs[x] = min(vs[x], (double)v[i]);
      } else if (x < start * 2) {
        vs[x] = min(vs[x], (double)v[i] + (start * 2 - x) / 2.0);
      } else {
        vs[x] = min(vs[x], (double)v[i] + (x - end * 2) / 2.0);
      }
    }
    start = end;
  }
  for (int x = 0; x < len * 2 + 1; ++x) {
    vs[x] = min(vs[x], (double)(x) / 2.0);
    vs[x] = min(vs[x], (double)(len * 2 - x) / 2.0);
  }
  debug(vs);
  double ans = 0;
  for (int x = 0; x < len * 2 + 1; ++x) {
    ans += (vs[x] + vs[x + 1]) * 0.25;
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 1796
# frozen_string_literal: true

cell_num = gets.chomp!.to_i
cell_contents = gets.chomp!.split(' ').map!(&:to_i)
# pp cell_contents
target_count=0

cell_contents.each_with_index do |cell_content,i|
    target_count+=1 if  cell_content%2==1 and (i+1)%2==1
end 
puts target_count

Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

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

using namespace std;
int main() {
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;

    int x[N]; rep(i, N) cin >> x[i];
    sort(x, x+N, greater<int>());
    int y[M]; rep(i, M) cin >> y[i];
    sort(y, y+M);

    for (int i = -100; i < 101; ++i) {
        bool f = true;
        f &= x[0] < i && i <= y[0];
        f &= X < i && i <= Y;
        if (f) {
            cout << "No War" << endl;
            return 0;
        }
    }
    cout << "War" << endl;
}


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

#define ll long long
#define ld long double
#define all(x) (x).begin(), (x).end()

// ----- Tools ----- //
template <typename Key, typename Value, typename Arg>
bool containsKey(const unordered_map<Key, Value>& m, const Arg& value) {return m.find(value) != m.end();}
template <typename Key, typename Value, typename Arg>
bool containsKey_tm(const map<Key, Value>& m, const Arg& value) {return m.find(value) != m.end();}
bool startsWith(string str, string tar) {return (str.rfind(tar, 0) == 0);}
bool contains(string str, string tar) {return (str.find(tar) != std::string::npos);}
vector<string> split(string str, char ch) {vector<string> res; stringstream ss(str); string s; while (getline(ss, s, ch)) res.push_back(s); return res; }
char toLower(char& ch) {if ('A' <= ch && ch <= 'Z') return ch - 'A' + 'a'; else return ch;}
char toUpper(char& ch) {if ('a' <= ch && ch <= 'z') return ch - 'a' + 'A'; else return ch;}

// -------- Main Code -------- //

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

int ok(ll x, ll y, ll r) {
    ll A = x * x + y * y;
    ll B = r * r;
    return A <= B;
}

void runcase() {
    ll N, D, x, y;
    cin >> N >> D;
    
    int res = 0;
    for (int i=0; i<N; i++) {
        cin >> x >> y; 
        res += ok(x, y, D);
    }

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

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

    // int t;
    // cin >> t;
    // while (t-- > 0)
        runcase();

    return 0;
}


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

int n,m;
char ar[200005];
vector<int> G[200005];
bool V[200005];

void dfs(int node){
    int a=0,b=0;
    for(int i=0;i<G[node].size();i++){
        if(ar[G[node][i]]=='A')a++;
        if(ar[G[node][i]]=='B')b++;
    }
    if(a>=1&&b>=1)return;
    ar[node] = 0;
    for(int i=0;i<G[node].size();i++){
        if(ar[G[node][i]]!=0)dfs(G[node][i]);
    }
}

int main() {
    cin >> n >> m;
    for(int i=1;i<=n;i++){
        cin >> ar[i];
    }
    for(int i=0;i<m;i++){
        int u,v;
        cin >> u >> v;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    for(int node=1;node<=n;node++){
        if(ar[node]==0)continue;
        dfs(node);
    }
    for(int i=1;i<=n;i++){
        if(ar[i]!=0){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 13312
import sys
input = sys.stdin.readline

x,y,a,b,c = map(int,input().split())
s = x+y
tank = []
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
r = tuple(map(int,input().split()))

for e in r:
    tank.append((e,2))
for e in p:
    tank.append((e,0))
for e in q:
    tank.append((e,1))

tank.sort(reverse = True)

res = 0
cnt = 0

for e,cl in tank:
    if cl == 2:
        res += e
        cnt += 1
    elif cl == 0:
        if x > 0:
            res += e
            cnt += 1
            x -= 1
    else:
        if y > 0:
            res += e
            cnt += 1
            y -= 1
    if cnt >= s:
        break
print(res)



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

for h in range(1, 3501):
    for n in range(1, 3501):
        if ((4 * h * n) - (N * n) - (N * h)) > 0:
            if (N * h * n) % ((4 * h * n) - (N * n) - (N * h)) == 0:
                print(h, n, (N * h * n) // ((4 * h * n) - (N * n) - (N * h)))
                exit()

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

int main(void){
  int n,m;cin>>n>>m;
  vector<int> p(m),y(m);
  vector<vector<int>> py(n,vector<int>(0));
  for(int i=0; i<m; ++i){ cin>>p[i]>>y[i]; py[p[i]-1].push_back(y[i]);}
  for(int i=0; i<n; ++i) sort(py[i].begin(), py[i].end());
  for(int i=0; i<m; ++i) y[i]=1+lower_bound(py[p[i]-1].begin(),py[p[i]-1].end(),y[i])-py[p[i]-1].begin();
  for(int i=0; i<m; ++i){
    int cnt=100000/(1+p[i])*10;
    while(cnt/=10) cout<<0;
    cout<<p[i];
    cnt=100000/(1+y[i])*10;
    while(cnt/=10) cout<<0;
    cout<<y[i]<<endl;
  }
  return 0;
}


Measured memory_bytes: 9520
n = int(input())
l = [0 for _ in range(100001)]
a = list(map(int, input().split()))
for i in a:
    l[i] += 1
maxc = 0
for i in range(1, len(l) - 1):
    maxc = max(maxc, l[i - 1] + l[i] + l[i + 1])
print(maxc)

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

int main() {
  string s;
  cin >> s;
  if(s == "Sunny"){
    cout<<"Cloudy"<<endl;
  }
  else if(s=="Cloudy"){
    cout<<"Rainy"<<endl;
  }
  else{
    cout<<"Sunny"<<endl;
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    int ans = 0;
    int x = 0;
    int y = 0;
    int z = 0;
    rep(i, n) {
        string s;
        cin >> s;
        if (s.front() == 'B' && s.back() == 'A') z++;
        else if (s.front() == 'B') x++;
        else if (s.back() == 'A') y++;
        
        rep(j, sz(s) - 1) {
            if (s[j] == 'A' && s[j+1] == 'B') ans++;
        }
    }
    if (x == 0 && y == 0 && z > 0) {
        ans += z-1;
    } else {
        ans += min(x+z, y+z);
    }
    cout << ans << endl;
}

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

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll, ll> pii;

#define REP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define PER(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)

int main(){
    int N;
    string S, T;
    cin >> N;
    cin >> S >> T;
    string ret = "";
    REP(i,0,N){
        ret += S[i];
        ret += T[i];
    } 
    cout << ret;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
typedef long long ll;
int N,L;
const int MN = 500000;
ll a[MN];
ll b[MN+1];
ll c[MN+1];
bool ans[MN];

ll nxt(ll x,ll d){
	if(x>=d) return x-d;
	if(x<d && d<2*x) return d-x;
	return x;
}
int main(){
	cin>>N>>L;
	rep(i,N) cin>>a[i];
	b[0]=L;
	rep(i,N) b[i+1] = nxt(b[i],a[i]);
	c[N]=1;
	for(int i=N-1;i>=0;i--){
		ll d = a[i];
		if(c[i+1]<=d/2) c[i] = c[i+1];
		else c[i] = c[i+1] + d;
		ans[i] = (b[i]<c[i+1]);
	}
	int Q;
	cin>>Q;
	rep(i,Q){
		int q;
		cin>>q;
		q--;
		if(ans[q]) puts("NO");
		else puts("YES");
	}
}


Measured memory_bytes: 14208
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const long double EPS = 1E-10;

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




int main(){
    int N; std::cin >> N;
    std::vector<int> A(N), B(N), C(N);
    for(int i(0); i < N; ++i) std::cin >> A[i];
    for(int i(0); i < N; ++i) std::cin >> B[i];
    for(int i(0); i < N; ++i) std::cin >> C[i];
    std::sort(A.begin(), A.end());
    std::sort(C.begin(), C.end());
    long long ans(0);
    for(int i(0); i < N; ++i){
        int a_num(std::distance(A.begin(),
                                std::lower_bound(A.begin(), A.end(), B[i])));
        int c_num(std::distance(std::upper_bound(C.begin(), C.end(), B[i]),
                                C.end()));
        ans += (long long)a_num * c_num;
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 1408
#!/usr/bin/env python3

import sys
import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
from fractions import gcd                    # for Python3.4.3


def main():
    mod = 10000007                  # 10^9+7
    inf = float('inf')
    input = sys.stdin.readline      # 改行文字が残ることに注意
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def ii():  return int(input())
    def mi():  return map(int, input().rstrip().split())
    def lmi(): return list(map(int, input().rstrip().split()))
    def li():  return list(input().rstrip())
    
    
    def my_divide(num, count=0):
        if num % 2 == 0:
            return my_divide(num//2, count+1)
        else:
            return count
    
    def calc_lcm(x, y):
        return (x * y) // gcd(x, y)
        

    n, m = mi()
    a = lmi()
    b = [elm//2 for elm in a]
    num_two = [None] * n
    divided_by_pow_two = [None] * n
    # print(b)

    for i in range(n):
        num = my_divide(b[i])
        num_two[i] = num
        divided_by_pow_two[i] = b[i] // (2 ** num)
    # print(num_two)
    # print(divided_by_pow_two)

    if len(set(num_two)) != 1:
        print(0)
    else:
        lcm = divided_by_pow_two[0]
        for elm in divided_by_pow_two:
            lcm = calc_lcm(lcm, elm)
        lcm *= (2 ** num_two[0])
        # print(lcm)
        print(math.ceil((m // lcm) / 2))
            

if __name__ == "__main__":
    main()

Measured memory_bytes: 17728
def is_biparate(links):
    '''
    0=white,1=blackとする
    2部グラフなら黒に塗られている頂点の数を返す
    2部グラフでないなら-1を返す。
    '''
    
    colors = [-1] * n
    colors[0] = 0
    q = [(0, 0)]  #0=white, 1=blackとする
    visited = set()
    while q:
        v, c = q.pop()
        if v in visited:
            if colors[v] != c: #最初に塗られた色とは反対の色が塗られるなら
                return -1
            continue
        visited.add(v)
        colors[v] = c
        for u in links[v]:
            q.append((u, c ^ 1))  #0^0=1 1^1=0 vとは反対の色を塗る
    return sum(colors)  #1の数 = blackの数
 
 
n, m = map(int, input().split())
links = [set() for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    links[a].add(b)
    links[b].add(a)
 
bp1 = is_biparate(links)

if bp1 == -1:
    '''
    2部グラフではない場合
        結論：完全グラフになるまで辺を追加できる
        →why
            奇サイクル上のある点をvとする
            s → v → tが偶数長でも、 奇サイクルの他の頂点を余計に経由することで奇数長になる
            s → tが奇数長になれば線が引ける
            つまり、任意の頂点間において奇数長が存在することになる
        完全グラフの辺の数は、n * (n - 1) // 2
        これには元あった辺の数まで含まれているので、 -m する
    '''
    max_m = n * (n - 1) // 2
else:
    '''
    2部グラフの場合
        結論:(blackの数*whiteの数)本、線ができる
        why
            奇数閉路が存在しない => 異なる色間は必ず奇数長、同色間は必ず偶数長 
            1. whiteとblackの間は奇数長のパスが存在する ->線が引ける
            2. 同じ色どうしには奇数長のパスは存在しない -> 線は引かれない
            black=3, white=2の時の線の引き方 = b*w
        b*wにはパスの長さが1つまりもともとのパスが含まれてるので、-m　する
    '''
    max_m = bp1 * (n - bp1)
    
print(max_m - m)

Measured memory_bytes: 43368
#include <stdio.h>

int main(void) {
	int n;
	int v[50], c[50];
	int ans = 0;

	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &v[i]);
	}
	for (int i = 0; i < n; ++i) {
		scanf("%d", &c[i]);
	}

	for (int i = 0; i < n; ++i) {
		ans += v[i] - c[i] > 0 ? v[i] - c[i] : 0;
	}
	printf("%d", ans);


	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a.at(i);
  }
  for( int r = k; r < n; r++){
    int l = r-k;
    if(a.at(l) < a.at(r)) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
     
}

Measured memory_bytes: 4044
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <limits>
#include <string>
#include <algorithm>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include "math.h"
#include "assert.h"

using namespace std;

#define ll long long

#define BUFF ios::sync_with_stdio(false)
#define epsilon 1e-07
#define pi 2 * acos(0.0);
#define mod 1000000007   // 1e9+7
#define cerr if(false)cerr
#define watch(x) cerr << #x << " = " << x << endl;

#define inf std::numeric_limits<int>().max()

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

	ll ans = 0;
	int iter = 0;
	for(int i=1; i<=n; i++) {
		for(int j=i; j<=n; j+=i) {
			ans += j;
			iter++;
		}	 
	}
	cout << ans << endl;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
#define lld long long
int ispal(string s){
	int n=s.length();
	int st=0;
	int en=n-1;
	while(st<en){
		if(s[st]!=s[en])return 0;
		st++,en--;
	}
	return 1;
}
int main()
{
   int n; cin>>n;
   int a[n];
   for(int i=0;i<n;++i)cin>>a[i];
   	map<int,lld> m;
   for(int i=0;i<n;++i)m[a[i]]++;
   int cnt=0;
   lld res=0;
   for(auto x: m){
   	if(x.second<2)continue;
   	   lld zz=x.second;
   	   res=res+(zz*(zz-1))/2;
   }
   for(int i=0;i<n;++i){
   	if(m[a[i]]<=1){
   		cout<<res<<endl;
   	}
   	else
   	{
   		lld zz=m[a[i]];
   		zz=(zz*(zz-1))/2;
   		lld xx=m[a[i]]-1;
   		xx=(xx*(xx-1))/2;
   		cout<<res-zz+xx<<endl;
   	}
   }
}

Measured memory_bytes: 10240
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if(a+b+c>21){
    cout << "bust" << endl;
  }
  else{
    cout << "win" << endl;
  }
  return 0;
  
}


Measured memory_bytes: 3600
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int n, m;
    cin >> n >> m;
    vi ret(n, 0);
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        ret[a]++;
        ret[b]++;
    }
    for (int i = 0; i < n; ++i) {
        cout << ret[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    int k;
    cin >> k;
    vector<int> a{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int ans = a[k - 1];

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mod 1e9+7
#define all(x) x.begin(),x.end()
int main() {
	ios_base::sync_with_stdio(false);
	cout.tie(0); cin.tie(0);
	ll n,x,t;
  cin>>n>>x>>t;
  ll d;
  d=n/x;
  if(n%x==0)
    cout<<d*t;
  else
    cout<<(d*t)+t;
}

Measured memory_bytes: 3636
#!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
a.sort()
try:
    for i, a_i in enumerate(a):
        if n % 2 == 1:
            assert a_i == (i + 1) // 2 * 2
        else:
            assert a_i == i // 2 * 2 + 1
    answer = pow(2, n // 2, 10 ** 9 + 7)
except AssertionError:
    answer = 0
print(answer)


Measured memory_bytes: 13880
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

ll  dp[6000][6000];

int main(){
  ll N,K,A[10000],sum=0;
  cin >> N  >> K;
  rep(i,N){
    cin >> A[i];
    sum+=A[i];
  }
  if(sum<K){
    cout << N << endl;
    return 0;
  }
  sort(A,A+N);
  reverse(A,A+N);
  dp[0][0] = 1;
  ll T = 0;
  ll ma =0;
  Rep(i,1,N+1){
    if(ma + A[i-1]>= K){
        T = i ;
    }
    rep(j,K){
      if(j-A[i-1]>=0){
        if(dp[i-1][j-A[i-1]]==1 || dp[i-1][j] == 1){
          dp[i][j]=1;
          ma = max(j,ma);
        }
      }
      if(dp[i-1][j]==1){
        dp[i][j]=1;
        ma = max(j,ma);
      }
    }
  }
  cout << N-T << endl;
}

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

int main(){
  ll n,a;
  cin >> n;
  vector<ll> A(n);
  rep(i,n){
    cin >> A[i];
    if(A[i] % 2 == 1){
      ++a;
    }
  }
  if(a%2 == 0) puts("YES");
  else puts("NO");
  return 0;
}


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

ll a(int x) {
    if (x == 0) return 1;
    return x * a(x - 1) % n;
}

int main() {
    int N;
    cin >> N;
    cout << a(N) << endl;
    return 0;
}

Measured memory_bytes: 5144
#include<stdio.h>

int main()
{
  int cnt=0,lenm=0,lens=0;
  char s[11];

  scanf("%s",s);
  
  for(int i=0;i<12;i++)
  {
    if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G')
       cnt++;
    else{
      lens=cnt;
      cnt=0;
    }
    
    if(lens>lenm)
      lenm=lens;
  }
  
  printf("%d",lenm);
  
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

#define MAX 1000000

int main(){
  int n, m;
  while(~scanf("%d%d",&n,&m)){
    int road[n][n];
    REP(i,n) REP(j,n) road[i][j] = MAX;
    REP(i,m){
      int a,b,c,d;
      scanf("%d,%d,%d,%d",&a,&b,&c,&d);
      road[a-1][b-1] = c;
      road[b-1][a-1] = d;
    }
    int x1,x2,y1,y2;
    scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);
    REP(k,n) REP(i,n) REP(j,n)
      road[i][j] = min(road[i][j], road[i][k] + road[k][j]);
    //cout << road[x1-1][x2-1] + road[x2-1][x1-1] << endl;
    cout << y1 - y2 - road[x1-1][x2-1] - road[x2-1][x1-1] << endl;
  }
  return 0;
}

Measured memory_bytes: 0
import numpy

a, b, c, d = (int(i) for i in input().split()) 

def distance(i, j, distance):
    if numpy.abs(i - j) <= distance:
        return True
    else:
        return False

if distance(a, c, d):
    print("Yes")
elif distance(a, b, d) and distance(b, c, d):
    print("Yes")
else:
    print("No")

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

d = {}

for i in range(n):
    a = input()
    if a in d:
        d[a] += 1
    else:
        d[a] = 1

m = max(d.values())
d = sorted(d.items())

for j in d:
    if j[1] == m:
        print(j[0])

Measured memory_bytes: 42456
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
using namespace std;

const int INT__MAX = 2147483647;
const int MOD = 1000000007;

int main() {

	int n, m, ans;

	cin >> n >> m;

	cout << (n - 1)*(m - 1) << endl;

	return 0;
}

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

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

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

    int T, X;
    cin >> T >> X;
    
    cout << double(T) / X << endl;
}


Measured memory_bytes: 256
#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>
#define INF 1000000009
#define LINF 1000000000000000009
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmax(T &a, const T&b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T&b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

int main() {
	int n;
	cin >> n;
	vector<int> x(n), l(n);
	for (int i = 0; i < n; i++) cin >> x[i] >> l[i];
	vector<P> p(n);
	for (int i = 0; i < n; i++) {
		p[i].first = x[i] + l[i];
		p[i].second = x[i] - l[i];
	}
	sort(all(p));
	int ans = 0;
	int st = -INF;
	for (int i = 0; i < n; i++) {
		if (p[i].second >= st) {
			ans++;
			st = p[i].first;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
void print_int(int n)
{
    printf("%d\n",n);
}

void swap(int * a, int * b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

void sort(int a[], int n)
{
    for(int i = 1; i < n; i++)
    {
        int j = i-1;
        while(j >= 0 && a[j+1] > a[j])
        {
            swap(&a[j+1],&a[j]);
            j--;
        }
        
    }
    
}

void print_list(int a[], int n)
{
    for(int i = 0; i < n; i++)
    {
        print_int(a[i]);
    }
    
}



int main(void)
{
    int a[6];
    int i,j;
    int flag = 0;
    for (i = 0; i < 6; i++)
    {
        scanf("%d", &a[i]);
    }
    
    for (i = 0; i < 5; i++)
    {
        for (j = 0; j < 5; j++)
        {
            int abso = a[i] - a[j] < 0 ? a[j] - a[i] : a[i] - a[j];
            if(abso > a[5])
            {
                flag = 1;
                goto b;
            }

        }
        
    }
    b:
    if(flag)
        printf(":(");
    else
        printf("Yay!");
    
    

    
    return 0;
}



Measured memory_bytes: 128
n = int(input())
a = []
mx = 0
mn = 0
for i in range(n):
    x = int(input())
    a.append(x)
    if i == 0:
        mn = a[i]
    elif i == 1:
        mx = a[i] - a[i-1]
        mn = a[i] if a[i] < a[i-1] else a[i-1]
    else:
        if mx < a[i] - mn:
            mx = a[i] - mn
        mn = a[i] if a[i] < mn else mn
print(str(mx))



Measured memory_bytes: 13584
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i+100*j+50*k == X:
                ans += 1

print(ans)

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

#define rep(i,n) for(int i=0; i<(n); ++i)
#define rrep(i,n) for(int i=1; i<=(n); ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define foreach(it, v) for(typeof(v.begin()) it=v.begin(); it!=v.end(); ++it)
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second

typedef unsigned int uint;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef set<int> si;

string S;

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

  cin >> S;
  int N = S.size();

  long int ans = 0;
  long int as = 0;
  int mode = 0; //0...AAA 1...AAAB
  rep(i,N){
    if (mode==0) {
      if (S[i]=='A') {
        ++as;
      } else if (S[i]=='B') {
        mode = 1;
      } else if (S[i]=='C') {
        as = 0;
      }
    } else if (mode==1) {
      if (S[i]=='A') {
        as = 1; mode = 0;
      } else if (S[i]=='B') {
        as = 0;
      } else if (S[i]=='C') {
        ans += as; mode = 0;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 720
from collections import Counter
N = int(input())
A = [input() for i in range(N)]
ans_dict = {
    'AC' :0,
    'WA' :0,
    'TLE' :0,
    'RE' :0
}
ct = dict(Counter(A))
for i in ct:
    ans_dict[i] = ct[i]
for k,v in ans_dict.items():
    print(f'{k}  x {v}')

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

int ans=0;
string st1,st2;

int main()
{
	cin>>st1>>st2;
	for(int i=0;i<st1.size();i++)
	{
		int cnt=0;
		if(i+st2.size()-1>=st1.size()) break;
		for(int j=0;j<st2.size();j++)
		{
			if(st1[i+j]==st2[j])
				cnt++;
		}
		ans=max(ans,cnt);
	}
	cout<<st2.size()-ans<<endl;
	return 0;
}

Measured memory_bytes: 3640
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; cin >> n;
  ll ans = 0;
  REP(l, n) ans += 1LL * (n - l) * (n - l + 1) / 2;
  REP(_, n - 1) {
    int u, v; cin >> u >> v;
    if (u > v) swap(u, v);
    ans -= 1LL * u * (n + 1 - v);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"

struct aEdge {
	int u;
	int v;
};
typedef  pair<int, int> Edge;



vector<int>gettimes(const int N,const vector<Edge>&alles) {
	vector<vector<Edge>>es(N);
	for (auto e : alles) {
		es[e.first].push_back(e);
		es[e.second].push_back(Edge{ e.second,e.first });
	}
	vector<int>times(N,1e9);
	queue<int>que;
	que.push(0);
	times[0] = 0;
	while (!que.empty()) {
		int now = que.front();
		que.pop();
		for (const auto& e : es[now]) {
			if(times[now]+1<times[e.second]){
				times[e.second] = times[now] + 1;
				que.push(e.second);
			}
		}
	}
	return times;
}

int main() {
	int N, M, Q; cin >> N >> M >> Q;
	vector<Edge>alles;
	for (int i = 0; i < M; ++i) {
		int u, v; cin >> u >> v; u--; v--;
		alles.push_back(Edge{ u, v });
	}
	vector<int>times = gettimes(N, alles);
	vector<int>qs(Q);
	vector<int>used(M);
	for (int i = 0; i < Q; ++i) {
		int n; cin >> n; n--;
		qs[i] = n;
		used[n] = true;
	}
	vector<vector<Edge>>es(N);
	for (int i = 0; i < M; ++i) {
		if (!used[i]) {
			Edge e = alles[i];
			es[e.first].push_back(e);
			es[e.second].push_back(Edge{ e.second,e.first });
		}
	}
	vector<int>canmove(N);
	canmove[0] = true;
	queue<int>que;
	que.push(0);
	int monku = N - 1;
	vector<int>anss;
	
	for (int q = Q - 1; q >= 0; --q) {
		while (!que.empty()) {
			int now = que.front();
			que.pop();
			if (canmove[now]) {
				vector<Edge>newes;
				for (const auto& e : es[now]) {
					if (!canmove[e.second]&&times[e.second]==times[e.first]+1) {
						canmove[e.second] = true;
						que.push(e.second);
						monku--;
					}
					else {
						newes.emplace_back(e);
					}
				}
				es[now] = newes;
			}
			
		}
		anss.emplace_back(monku);
		Edge e = alles[qs[q]];
		es[e.first].push_back(e);
		es[e.second].push_back(Edge{ e.second,e.first });
		if (canmove[e.first] ^ canmove[e.second]) {
			if (canmove[e.first]) {
				que.push(e.first);
			}
			if (canmove[e.second]) {

				que.push(e.second);
			}
		}
		
	}
	for (int i = anss.size()-1; i>=0; --i) {
		cout << anss[i] << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 15696
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
    return divisors
 
N=int(input()) 
div = make_divisors(N)

A = div[-1]
B = N//A
print(max(len(str(A)),len(str(B))))

Measured memory_bytes: 3188
from collections import Counter

MOD = 10 ** 9 + 7

def factorize(n):
    """ Simple factorize
    :param n: number to factorize
    :return: list of factors
       time complexity : O(n√n)
       space complexity : O(n)
    """
    factors = []
    for i in range(2, n+1):
        while n % i == 0:
            n = n // i
            factors.append(i)
    return factors

def main():
    N = int(input())

    factors = []
    for i in range(1, N+1):
        factors += factorize(i)
    factor_counts = list(Counter(factors).values())

    ans = 1
    for v in factor_counts:
        ans = ans * (v+1) % MOD

    print(ans)

main()

Measured memory_bytes: 68124
n,a,b=map(int,input().split());k=10**9+7;c=(1<<n)%k-1;X=Y=1
for i in range(b):X=X*(n-i)%k;Y=Y*(i+1)%k;c-=X*pow(Y,k-2,k)if i+1in(a,b)else 0
print(c%k)

Measured memory_bytes: 263412
#include<bits/stdc++.h>
using namespace std;
int a[105],b[105],n,ans=-1;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>a[i];
	for(int i=0;i<n;i++)
	cin>>b[i];
	for(int i=1;i<n;i++)
	a[i]+=a[i-1];
	for(int i=n-2;i>=0;i--)
	b[i]+=b[i+1];
	for(int i=0;i<n;i++)
	ans=max(ans,a[i]+b[i]);
	cout<<ans<<endl;
	return 0;
	
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int A,B,K; cin>>A>>B>>K;
  for(int i=0;i<K;i++){
    if(i%2==0){
      if(A%2!=0){
        A--;
      }
      int num=A/2;
      A-=num; B+=num;
    }
    else{
      if(B%2!=0) B--;
      int num=B/2;
      B-=num; A+=num;
    }
  }
  cout<<A<<'\t'<<B<<endl;

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n, m, R;
  cin >> n >> m >> R;
  vi32 r(R);
  cin >> r;
  rep(i, R) r[i]--;
  vector<vi32> g(n, vi32(n, 1e9));
  rep(i, n) g[i][i] = 0;
  rep(i, m) {
    int u, v, c;
    cin >> u >> v >> c;
    u--, v--;
    g[u][v] = g[v][u] = c;
  }
  rep(k, n) rep(i, n) rep(j, n) {
    amin(g[i][j], g[i][k] + g[k][j]);
  }
  sort(all(r));
  int ans = 1e9;
  do {
    int sum = 0;
    rep(i, R - 1) {
      sum += g[r[i]][r[i + 1]];
    }
    amin(ans, sum);
  } while (next_permutation(all(r)));
  cout << ans << endl;
}

Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<unordered_map>

using namespace std;

#define pa pair<int,int>
#define sc(n) scanf("%d",&n)
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define mem(a,b) memset(a,b,sizeof a)

const  int N = 1e6 + 5;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;

typedef long long ll;
typedef long double ld;

int t, n, m;
int a[N][20];

int main()
{
	cin >> n >> m;
	fo(i, 1, n)
		fo(j, 1, m)
		cin >> a[i][j];
	int cnt = 0;
	fo(i,1,n)
		fo(j, i + 1, n)
	{
		double sum = 0;
		fo(k, 1, m)
			sum += (a[i][k] - a[j][k])*(a[i][k] - a[j][k]);
		double tmp = sqrt(sum);
		if (tmp - (int)tmp == 0)
			cnt++;
	}
	cout << cnt << endl;
	return 0;
}

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

int main() {
    
    while (true) {
        
        int x, y = 0;
        std::cin >> x;
        std::cin >> y;
        
        if (x == 0 && y == 0) {
            break;
        } 
        
        int minNumber = std::min(x, y);
        int maxNumber = std::max(x, y);
        
        std::cout << minNumber << " " << maxNumber << std::endl;
        
    }
    
    return 0;
}


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

int main(){
    int N;
    string S;
    cin >> N >> S;
    for (int i = 0; i < S.size();i++)
    {
        if(N+S[i] <= 'Z'){
            S[i] = S[i] + N;
        }
        else{
            S[i] = S[i] + N - 26;
        }
    }
    cout << S << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
 #include<string.h>

 int main(void)
 {
     char O[50],E[50];
     int i,o=0;

     scanf("%s",O);
     scanf("%s",E);
     o=strlen(O);

     for(i=0;i<o;i++){
       printf("%c",O[i]);
       if(E[i]=='\0') printf("");
       else printf("%c",E[i]);
     }
     printf("\n");

     return 0;
 }




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

int main(){
    int N;
    cin >> N;
    vector<int> X(N);
    for(int i = 0;i < N; i++) cin >> X[i];
    int MIN = *min_element(begin(X), end(X));
    int MAX = *max_element(begin(X), end(X));
    int m = (MIN + MAX) / 2;
    cout << max(abs(MIN - m), abs(MAX - m)) << endl;
}


Measured memory_bytes: 3112
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <array>
#include <deque>
#include <bitset>
typedef long long ll;
using namespace std;
#define trace(x) cerr << #x << " is " << x << endl;

int dp[210][210];
int gcd(int a, int b) {
    if (dp[a][b]) return dp[a][b];
    if (b == 0) return a;
    return dp[a][b] = gcd(b, a % b);
}
int gcd(int a, int b, int c) {
    return gcd(gcd(a, b),c);
}
ll f(int k) {
    ll res = 0;
    for (int a = 1; a <= k; a++) {
        for (int b = 1; b <= k; b++) {
            for (int c = 1; c <= k; c++) {
                res += gcd(a, b, c);
            }
        }
    }
    return res;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k;
    cin >> k;
    cout << f(k) <<endl;
    return 0;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define  show for(int j=0;j<v.size();j++) cout<<v[j]<<" ";
#define ld long double
#define e endl
#define bc __builtin_popcount
#define MOD 1000000007
#define INT_SIZE 32
#define me(x) memset(x,0,sizeof(x))
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
int main()
{
    ll a,b,k;
    cin>>a>>b>>k;
    ll a1=a;
    a=max((ll)0,a-k);
    k-=a1;
    //cout<<k<<e;
    if(k>0)
    b=max((ll)0,b-k);
  cout<<a<<" "<<b;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

class ConsoleApp1
{
    public static void Main(string[] args)
    {
        var nums = Console.ReadLine()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
            .Select(x => int.Parse(x))
            .ToList();
        var rag1 = new Range(nums[1], nums[0]);
        var rag2 = new Range(nums[3], nums[2]);
        var result = rag1.Superimpose(rag2);
        if (result==null)
            Console.WriteLine(0);
        else
            Console.WriteLine(result.Max - result.Min);
        Console.ReadKey();
    }

    public class Range
    {
        public int Max { get; }
        public int Min { get; }
        public Range(int max, int min)
        {
            Max = max;
            Min = min;
        }
        public bool IsContain(int param)
        {
            return param <= Max && param >= Min ? true : false;
        }
        public Range Superimpose(Range range)
        {
            int max;int min;
            max = range.Max >= Max ? Max : range.Max;
            min = range.Min <= Min ? Min : range.Min;
            if ((IsContain(max) && range.IsContain(max) && (IsContain(min) && range.IsContain(min))))
                return new Range(max, min);
            else
                return null;
        }
    }
}

Measured memory_bytes: 11348
#include <iostream>
using namespace std;
int main() {
 int N;
  int A;
  int B;
  
  cin >> N;
  
  if (N==1) {
    cout << "Hello World";
   cout << endl; 
  }
  
  if (N==2) {
  cin >> A;
    cin >> B;
    cout << A+B;
    cout << endl;
  
  }
  
}


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

if "." not in s or "#" not in s:
    print(0)
else:
    ans = len(s)

    s = s[s.find("#"):n-s[::-1].find(".")]
    if s == "":
        print(0)
    else:
        cnt_b = [0 for i in range(len(s))]
        cnt = 0
        for i in range(len(s)):
            if s[i] == "#":
                cnt += 1
            cnt_b[i] = cnt
        ans = min(ans, len(s)-cnt_b[-1])
        for i in range(len(s)):
            ans = min(ans, cnt_b[i] + (len(s)-cnt_b[-1])-(i+1-cnt_b[i]))
        print(ans)


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


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

  for(int i=0; ch[i+1]; i++){
    if(ch[i] == 'A' && ch[i+1] == 'C'){
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
p = [[0 for i in xrange(17)] for j in xrange(17)]
while 1:
    a,b = map(int, raw_input().split())
    if a==b==0: break
    n = input()
    for i in xrange(b):
        for j in xrange(a):
            p[i][j] = 0
    for i in xrange(n):
        x,y = map(int, raw_input().split())
        p[y-1][x-1] = -10**6
    p[0][0] = 1
    for i in xrange(b):
        for j in xrange(a):
            if p[i][j]<0: continue
            p[i+1][j] += p[i][j]; p[i][j+1] += p[i][j];
    print p[b-1][a-1]

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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
#include <iomanip>
// #include <regex> //正規表現
using namespace std;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007ll
#define INF 1000000000
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
// グリッドグラフの移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int N, K; cin >> N >> K;
VI h(N); rep(i, 0, N) cin >> h[i];

int cnt = 0;
rep(i, 0, N){
    if (h[i] >= K) ++cnt;
}
cout << cnt << "\n";


}

// 境界，出力文字列 チェック



Measured memory_bytes: 640