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

int main(){
  int N,a,b=0,c=0,d=0,e=0;
  cin >>N;
  
  for (int i=1;i<N;i++){
    string A;
    cin >> A;
    if (A =="P"){
      b=1;
    }
    if (A =="W"){
      c=1;
    }
    if (A =="G"){
      d=1;
    }
    if (A =="Y"){
      e=1;
    }
  }
  a=b+c+d+e;
  if (a==3){
    cout <<"Three"<<endl;
  }
  else if (a==4){
    cout <<"Four"<<endl;
  }
}
  

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

int main() {
	int a[3][3], n, b, i, j,k;
	for (i = 0; i < 3; i++) {
		for (j = 0; j < 3; j++) {
			cin >> a[i][j];
		}
	}
	cin >> n;
	for (k = 0; k < n; k++) {
		cin >> b;
		for (i = 0; i < 3; i++) {
			for (j = 0; j < 3; j++) {
				if (b == a[i][j]) {
					a[i][j] = 0;
					i = 3;
					break;
				}
			}
		}
	}
	for (i = 0; i < 3; i++) {
		if (a[i][0] == a[i][1] && a[i][1] == a[i][2]) {
			cout << "Yes" << endl;
			return 0;
		}
		if (a[0][i] == a[1][i] && a[1][i] == a[2][i]) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	if (a[0][0] == a[1][1] && a[1][1] == a[2][2]) {
		cout << "Yes" << endl;
		return 0;
	}
	if (a[0][2] == a[1][1] && a[1][1] == a[2][0]) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
    constexpr int A_MAX = 1000000;
    vector<int> min_factor(A_MAX + 1);
    vector<int> q(A_MAX + 1, 1);
    vector<int> primes;
    primes.reserve(A_MAX);
    for (int i = 2; i <= A_MAX; ++i) {
        if (!min_factor[i]) {
            min_factor[i] = i;
            primes.push_back(i);
        }
        int min_factor_i = min_factor[i];
        for (int p : primes) {
            int n = i * p;
            if (n > A_MAX) {
                break;
            }
            min_factor[n] = p;
            if (p == min_factor_i) {
                q[n] = q[i];
                break;
            } else {
                q[n] = i;
            }
        }
    }
 
    int N = 0;
    char c = getchar_unlocked();
    do {
        N = 10 * N + c - '0';
    } while ((c = getchar_unlocked()) >= '0');
    vector<int> a(A_MAX + 1);
    for (int i = 0; i < N; ++i) {
        int A = 0;
        c = getchar_unlocked();
        do {
            A = 10 * A + c - '0';
    	} while ((c = getchar_unlocked()) >= '0');
        ++a[A];
    }
 
    bool is_pairwise_coprime = true;
    for (int n = A_MAX; n > 1; --n) {
        int a_n = a[n];
        if (a_n) {
            if (a_n > 1) {
                if (a_n == N) {
                    printf("not coprime\n");
                    return 0;
                }
                is_pairwise_coprime = false;
            }
            a[min_factor[n]] += a_n;
            a[q[n]] += a_n;
        }
    }
    if (is_pairwise_coprime) {
        printf("pairwise coprime\n");
    } else {
        printf("setwise coprime\n");
    }
 
    return 0;
}

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

vector<int> s;

void maxHeapify(vector<int>& A, int i) {
    int largest;

    int l = i*2;
    int r = i*2+1;
    if (l <= A.size()-1 && A[l] > A[i])
        largest = l;
    else
        largest = i;

    if (r <= A.size()-1 && A[r] > A[largest])
        largest = r;

    if (largest != i) {
        int tmp = A[i];
        A[i] = A[largest];
        A[largest] = tmp;
        maxHeapify(A, largest);
    }
}

int extract(vector<int>& A) {
    int max = A[1];
    A[1] = A[A.size()-1];
    A.erase(A.end()-1);
    maxHeapify(A, 1);

    return max;
}

void insertKey(vector<int>& A, int key) {
    A.push_back(-1);

    int i = A.size() - 1;
    A[i] = key;
    while (i > 1 && A[i/2] < A[i]) {
        int tmp = A[i];
        A[i] = A[i/2];
        A[i/2] = tmp;
        i = i/2;
    }
}

int main() {
    string op;
    s.push_back(0);
    while (true) {
        cin >> op;
        if (op == "insert") {
            int key;
            cin >> key;
            insertKey(s, key);
        } else if (op == "extract") {
            int max = extract(s);
            cout << max << endl;
        } else if (op == "end") {
            break;
        }
    }

    return 0;
}



Measured memory_bytes: 6932
#include<cstdio>
#include<cstring>
int h,w,k,num,num1,ans;
char map[10][10],map1[10][10],map2[10][10];

void check(int x,int y,int x1) {
	int num1=0;
	for (int i=0;i<h;++i) for (int j=0;j<w;++j) if (map2[i][j]=='#') num1++;
	if (num1==k) ans++;
	if (num1<k) return;
	for (int i=x;i<h;++i) {
		for (int j=0;j<w;++j) map1[i][j]='.';
		for (int j=0;j<w;++j) map2[i][j]='.';
		check(i+1,y,i+1);
		for (int j=0;j<w;++j) map1[i][j]=map[i][j];
		for (int j=0;j<w;++j) map2[i][j]=map[i][j];
	}
	for (int j=y;j<w;++j) {
		for (int i=0;i<h;++i) map2[i][j]='.';
		check(h+1,j+1,x);
		for (int i=0;i<h;++i) map2[i][j]=map1[i][j];
	}
}
int main() {
	scanf("%d%d%d",&h,&w,&k);
	for (int i=0;i<h;++i) scanf("%s",map[i]);
	for (int i=0;i<h;++i)
		for (int j=0;j<w;++j) if (map[i][j]=='#') num++;
	memcpy(map1,map,sizeof map);
	memcpy(map2,map,sizeof map);
	check(0,0,0);
	printf("%d",ans);
	return 0;
} 

Measured memory_bytes: 1728
#include<iostream>

using namespace std;

int main(){
    int n,b,f,r,v,T[5][4][11];
// ここから定義
    for(int A=0;A<5;A++){
        for(int B=0;B<4;B++){
            for(int C=0;C<11;C++){
                T[A][B][C]=0;
            }
        }
    }
// ここまで：そしてここから入力
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>b>>f>>r>>v;
        T[b][f][r]+=v;
    }
    // ここまでデータの読み取り

    for(int A=1;A<5;A++){
        for(int B=1;B<4;B++){
            for(int C=1;C<11;C++){
                if(C==10){
                  if(B==3&&(A==1||A==2||A==3)){
                    cout<<" "<<T[A][B][C]<<endl<<"####################"<<endl;
                  }else{
                    cout<<" "<<T[A][B][C]<<endl;
                  }
                }else{
                  cout<<" "<<T[A][B][C];}
            }
        }
    }

    return 0;
}



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

using namespace std;

int main(){
	
	string n;
	
	cin >> n;
	
	for(int i=0;i<3;i++){
		if(n[i]=='1'){
			n[i]='9';
		}else{
			n[i]='1';
		}
	}
	
	cout << n << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int n,f=0;
	while(cin>>n,n){
		if(f)cout<<endl; f=1;
		pair<int,pair<int,char[29]> > team[10];
		int w,l,d;
		rep(i,n){
			cin>>team[i].second.second>>w>>l>>d;
			team[i].first=-w*3-d;
			team[i].second.first=i;
		}
		sort(team,team+n);
		rep(i,n)cout<<team[i].second.second<<","<<-team[i].first<<endl;
	}
	return 0;
}

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

int main(){
  int n;
  cin>>n;
  int a[4]={0,0,0,0};
  rep(i,0,n){
    string s;
    cin>>s;
    if(s=="AC") a[0]++;
    else if(s=="WA") a[1]++;
    else if(s=="TLE") a[2]++;
    else a[3]++;
  }
  cout<<"AC x "<<a[0]<<endl;
  cout<<"WA x "<<a[1]<<endl;
  cout<<"TLE x "<<a[2]<<endl;
  cout<<"RE x "<<a[3]<<endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

constexpr int MAX_N = 500'000;
constexpr int MAX_VAL = 1e9+1;

int merge(int* A, const int& left, const int& mid, const int& right) {
    const int n1 = mid - left;
    const int n2 = right - mid;

    auto L = new int[n1+1];
    auto R = new int[n2+1];
    for (int i = 0; i < n1; i++) {
        L[i] = A[left + i];
    }
    for (int i = 0; i < n2; i++) {
        R[i] = A[mid + i];
    }

    L[n1] = MAX_VAL;
    R[n2] = MAX_VAL;

    int i = 0, j = 0;
    for (int k = left; k < right; k++) {
        if (L[i] <= R[j]) {
            A[k] = L[i];
            i++;
        } else {
            A[k] = R[j];
            j++;
        }
    }
    delete[] L;
    delete[] R;
    return right - left;
}

int mergeSort(int* A, const int& left, const int& right) {
    int count = 0;
    if (left + 1 < right) {
        const int mid = (left + right) / 2;
        count += mergeSort(A, left, mid);
        count += mergeSort(A, mid, right);
        return count + merge(A, left, mid, right);
    }
    return 0;
}

int main() {
    ios::sync_with_stdio(false);

    int A[MAX_N];

    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }

    int count = mergeSort(A, 0, n);
    for (int i = 0; i < n; i++) {
        if (i > 0) { cout << " "; }
        cout << A[i];
    }
    cout << endl;
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 6824
/*Lucky_Glass*/
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int n;
int totA;
vector< pair<int,int> > ans;

int main(){
//	freopen("tree.in","r",stdin);
//	freopen("tree.out","w",stdout);
	scanf("%d",&n);
	if(n<3) printf("No\n"),exit(0);
	for(int i=2;i<n;i+=2)
		ans.emplace_back(i,i+1),
		ans.emplace_back(i+n,i+1+n),
		ans.emplace_back(i,1),
		ans.emplace_back(i+1+n,1);
	ans.emplace_back(3,n+1);
	if(n%2==0){
		int x=(n&-n);
		if(x==n) printf("No\n"),exit(0);
		ans.emplace_back(x+1+n,n);
		ans.emplace_back(n-x,n+n);
	}
	printf("Yes\n");
	for(auto it : ans)
		printf("%d %d\n",it.first,it.second);
	return 0;
}

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

char in[110];

int main() {
    scanf("%s", in+1);
    vector<char> odd;
    vector<char> even;
    int n = (int)strlen(in+1);
    for (int i = 1; i <= n; i++) {
        if (i % 2) odd.push_back(in[i]);
        else even.push_back(in[i]);
    }
    bool flag = true;
    for (int i = 0; i < (int)odd.size(); i++) {
        if (odd[i] == 'R' || odd[i] == 'U' || odd[i] == 'D') continue;
        else {
            flag = false;
            break;
        }
    }
    if (!flag) {
        printf("No\n");
        return 0;
    }
    for (int i = 0; i < (int)even.size(); i++) {
        if (even[i] == 'L' || even[i] == 'U' || even[i] == 'D') continue;
        else {
            flag = false;
            break;
        }
    }
    if (!flag) {
        printf("No\n");
        return 0;
    } else {
        printf("Yes\n");
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
/*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog ender-zzm.enbar.cn
*/
#include <bits/stdc++.h>
using namespace std;

inline int read(){
    register int x = 0, flag = 1;
    register char ch;
    while (!isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), isdigit(ch = getchar()));
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10); 
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define For(i, x, y) for (int i = (x); i <= (y); i++) 
#define Rep(i, x, y) for (int i = (x); i >= (y); i--) 

#define int long long
int n;
signed main() {
	n = read();
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int p = n / i;
		int fi = i, la = p * i;
		int sum = (la + fi) * p / 2;
		ans += sum;
	}
	cout << ans;
}


Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cstring>
#define SIZE 100000
using namespace std;

char s[SIZE];

int main() {
	long long ans = 0;
	scanf("%s", s);
	for (long long i = 1; i < strlen(s); i++) {
		if (s[i - 1] != s[i]) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
a,b = (int(x) for x in input().split())

if a > b:
    print("a > b")
elif a == b:
    print("a == b")
else:
    print("a < b")


# <?php

# fscanf(STDIN,"%d %d",$a,$b);

# if ($a > $b) {
#     echo "a > b".PHP_EOL;
# } elseif ($a == $b) {
#     echo "a == b".PHP_EOL;
# } else {
#     echo "a < b".PHP_EOL;
# }

# ?>


Measured memory_bytes: 5604
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
count = 0
for i in range(n):
    if a[i] <= b[i]:
        count+=a[i]
        b[i]-=a[i]
        if a[i+1] <= b[i]:
            count += a[i+1]
            a[i+1]=0
        else:
            count += b[i]
            a[i+1] -=b[i]
    else:
        count += b[i]
print(count)

Measured memory_bytes: 18476
n = gets.to_i
c = ('.' + gets.chomp).chars
left = [0, 0]
right = [c.count(?.), c.count(?#)]
p (n+1).times.map{|i|
  if c[i] == ?.
    left[0] += 1
    right[0] -= 1
  else
    left[1] += 1
    right[1] -= 1
  end
  left[1] + right[0]
}.min


Measured memory_bytes: 18556
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

template<typename T>
istream& operator >> (istream& is, vector<T>& vs){
  for(T& v: vs) is >> v;
  return is;
}

int main() {
  int n; cin >> n;
  vector<int> p(n); cin >> p;
  int cnt = 0;
  for (int i = 1; i < n-1; ++i) {
    int a = min({p[i-1], p[i], p[i + 1]});
    int b = max({p[i-1], p[i], p[i + 1]});
    if (a != p[i] && b != p[i]) ++cnt;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3624
n,k = map(int, input().split())

ans=[False]*n

for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(d):
        ans[a[j]-1]=True

pr=0
for i in range(n):
    if not ans[i]:
        pr+=1

print(pr)


Measured memory_bytes: 67852
from itertools import permutations


N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for i, xys in enumerate(permutations(XY), 1):
    last = xys[0]
    dist = 0
    for xy in xys[1:]:
        dist += ((xy[0] - last[0]) ** 2 + (xy[1] - last[1]) ** 2) ** 0.5
    ans += dist
print(ans / i)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}

vector<pair<char, int>> run_length_compress(string S)
{
    vector<pair<char, int>> res;
    int n = S.size(), cnt = 1;
    for (int i = 0; i < n - 1; i++)
    {
        if (S[i] == S[i + 1])
        {
            cnt++;
        }
        else
        {
            res.push_back({S[i], cnt});
            cnt = 1;
        }
    }
    res.push_back({S.back(), cnt});
    return res;
}
int main()
{
    string S;
    cin >> S;
    auto run = run_length_compress(S);
    cout << run.size() - 1;
    return 0;
}

Measured memory_bytes: 1608
N, M = map(int, input().split(' '))
A = list(map(int, input().split(' ')))
A.sort(reverse=True)

box = []
_sum = sum(A)
for a in A:
    if a >= 1/(4*M) * _sum:
      box.append(a)

if len(box) >= M:
    print('Yes')
else:
    print('No')


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

int main(){
  int n,m;
  string s[105];
  string t[105];
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> s[i];
  }
  cin >> m;
  for(int i=0;i<m;i++){
    cin >> t[i];
  }

  int ans = 0;
  int x,y;
  for(int i=0;i<n;i++){
    x = 0;
    y = 0;
    //printf("i = %d\n",i);
    for(int j=0;j<max(n,m);j++){
      if(j<n){
        if(s[i] == s[j]) x += 1;
      }
      if(j<m){
        if(s[i] == t[j]) y += 1;
      }
    }
    //printf("plus : %d\n",x);
    //printf("minus : -%d\n",y);
    ans = max(ans,x-y);
    //printf("score = %d\n",ans);
  }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005


int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        
        string a;
        cin >> a;
        int n=a.size();
        string s="";
        while(n--){
            s+='x';
        }
        cout << s;
        
        

}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
int h, w, x[100][100], y[100][100], z[100][100], p, q, BL, WH; char a;
queue<int>Q;

void A(int B, int C, int P) { 
	if (x[B][C] == 3 && z[B][C] == 0) { 
		Q.push(B * 100 + C); z[B][C] = 1; 
		if ((P == 1 && y[B][C] % 2 == 0) || (P == 2 && y[B][C] < 2)) { 
			y[B][C] += P; 
		} 
	} 
}

int main() {
	while (true) {
		BL = 0; WH = 0;
		cin >> w >> h; if (!w) { break; }
		for (int i = 0; i < 10000; i++) { x[i / 100][i % 100] = 4; }
		for (int i = 1; i <= h; i++) {
			for (int j = 1; j <= w; j++) {
				cin >> a;
				if (a == '.') { x[i][j] = 3; }
				if (a == 'B') { x[i][j] = 1; }
				if (a == 'W') { x[i][j] = 2; }
			}
		}
		//BFS.(BLUE=1,WHITE=2)
		memset(y, 0, sizeof(y));
		for (int i = 1; i <= h; i++) {
			for (int j = 1; j <= w; j++) {
				if (x[i][j] == 1) {
					memset(z, 0, sizeof(z));
					z[i][j] = 1;
					Q.push(i * 100 + j);
					while (!Q.empty()) {
						p = Q.front() / 100;
						q = Q.front() % 100;
						A(p - 1, q, 1);
						A(p + 1, q, 1);
						A(p, q - 1, 1);
						A(p, q + 1, 1);
						Q.pop();
					}
				}
				if (x[i][j] == 2) {
					memset(z, 0, sizeof(z));
					Q.push(i * 100 + j);
					z[i][j] = 1;
					while (!Q.empty()) {
						p = Q.front() / 100;
						q = Q.front() % 100;
						A(p - 1, q, 2);
						A(p + 1, q, 2);
						A(p, q - 1, 2);
						A(p, q + 1, 2);
						Q.pop();
					}
				}
			}
		}
		for (int i = 1; i <= h; i++) {
			for (int j = 1; j <= w; j++) {
				if (y[i][j] == 1) { BL++; }
				if (y[i][j] == 2) { WH++; }
			}
		}
		cout << BL << ' ' << WH << endl;
	}
}

Measured memory_bytes: 1336
from operator import mul
from functools import reduce

n,m = map(int,input().split())

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

ans = 0

if n >= 2:
    ans = ans + cmb(n, 2)

if m >= 2:
    ans = ans + cmb(m, 2)
    
print(ans)

Measured memory_bytes: 38256
//k_tourist
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define mx 105
#define mm 100005
#define non __builtin_popcount
#define ml map<ll, ll> 
#define uml unordered_map<ll, ll>
#define ms map<string , ll> 
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define pl pair<ll, ll>
#define vl vector<ll>
#define vll vector<pl>
#define tpl pair<ll, pl>
#define vlll vector<tpl>
#define vs vector<string>
#define pb push_back
#define mk make_pair
#define M_PI 3.14159265358979323846
#define endl '\n'
#define fst ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%I64d",&x)
#define inf ((ll)1e18 + 1)
#define bs binary_search
#define pq priority_queue
#define ub upper_bound
#define lb lower_bound
#define pow powr
#define sp(a) setprecision(a)
#define rep(i,a,b)  for (i=(a);i<(b);i++)
#define nrep(i,a,b) for (i=(a);i>(b);i--)
using namespace std;
using namespace __gnu_pbds;  

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>  ordered_set;
 
ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

void flag(ll fl){

	if(fl)
	cout<<"Second";
	else
	cout<<"First";
}

ll n, a[mx], dp[mm][2];

ll stone(ll k, ll fl){

	if(k < a[0])
	return !fl;

	if(dp[k][fl] != -1 )
	return dp[k][fl];

	ll mila=0, i;

	rep(i, 0, n){

		if(a[i] > k)
		break;

		if(stone(k - a[i], !fl) == fl)
		mila= 1;
	}

	if(mila)
	return dp[k][fl]= fl;

	return dp[k][fl]= !fl;
}
void bta_de_yarr(){

	ll i, j, fl=0, ans, m, k;

	cin>>n>>k;

	rep(i, 0, n)
	{
		cin>>a[i];
		// dp[i][0] = -1;
		// dp[i][1]= -1;
	}

	// dp[i][0]= -1;
	// dp[i][1]= -1;

	rep(i, 0, mm)
	rep(j, 0, 2)
	dp[i][j]= -1;


	// rep(i, 0, n)
	// fl|= stone(k, )
	
	fl= stone(k, 0);

	// cout<<ans;
	flag(fl);
	cout<<endl;
}

int main(){
    fst

	// freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
	ll t;
    t= 1;
	//cin>>t;
    while(t--){
        bta_de_yarr();
    }
    return 0;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

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

    vector<int> ms(N);
    for (int i = 0; i < N; i++) {
        cin >> ms[i];
    }
    sort(ms.begin(), ms.end());

    int cnt = 0;
    int rem = X;
    for (auto &m : ms) {
        rem -= m;
        cnt++;
    }

    cnt += rem / ms[0];

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3560
object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n, k = sc.nextInt
    val p = new Array[Int](n)
    val acc = new Array[Double](n + 1)
    acc(0) = 0
    for (i <- 0 until n) {
      p(i) = sc.nextInt

      acc(i + 1) = acc(i) + (1 to p(i)).sum.toDouble / p(i)
    }

    var index = 0
    var max = 0d
    for (i <- 0 to n - k) {
      val sum = acc(i + k) - acc(i)
      if (sum >= max) {
        max = sum
        index = i
      }
    }

    var ans = 0d
    for (i <- index to index + k - 1) {
      ans += (1 to p(i)).sum.toDouble / p(i)
    }

    //7.000000000000
    printf("%.12f\n", max)
  }
}


Measured memory_bytes: 70476
n = int(input())
t = 1; a = 1;
for _ in range(n):
    ti,ai = map(int,input().split())
    if t%ti != 0 : t = (t//ti+1)*ti
    if a%ai != 0 : a = (a//ai+1)*ai
    r = max(t//ti,a//ai)
    t = ti*r
    a = ai*r

print(a+t)

Measured memory_bytes: 3064
N = int(input())
list_aaa = [input() for i in range(N)]

cnt_A=0
cnt_B=0

for i in range(N-1):
    if not list_aaa[i][-1:] ==list_aaa[i+1][:1]:
        cnt_A +=1
    if list_aaa.count(list_aaa[i]) >=2 or list_aaa.count(list_aaa[i]) >=2 :
        cnt_B +=1


if cnt_A >=1 or cnt_B>=1:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
	int a,b,x,y,z,i;
	x=2001;
	y=2001;
	for(i=0;i<3;i++){
		scanf("%d",&a);
		if(x>a)	x=a;
	}
	for(i=0;i<2;i++){
		scanf("%d",&b);
		if(y>b)	y=b;
	}
	z=x+y-50;
	printf("%d\n",z);
	return 0;
}


Measured memory_bytes: 2120
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int i;
        int s;
        int total = 0;
        for (i = 0; i < 10; i++) {
            s = scan.nextInt();
            total += s;

        }
        System.out.println(total);
    }
}



Measured memory_bytes: 26212
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)

int main(){
  ll h, w; cin >> h >> w; ll ans=0;
  if(h==1 || w==1) {cout << 1 << endl; return 0;}
  if(h%2==0 && w%2==0)ans =   h*w/2;//(w+1)/2 * (h+1)/2
  if(h%2==1 || w%2==1)ans =   h*w/2;
  if(h%2==1 && w%2==1)ans =   (w+1)/2 * (h+1)/2+ (w/2) * (h/2);
  cout <<  ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
	int a, b;
	cin >> a >> b;
	int res = a - b * 2;
	if (res >= 0)cout << res << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
//   Rishabh Agarwal
#include <bits/stdc++.h>
#define F first
#define S second
#define MAX 10000003
using namespace std;

typedef long long int ll;
const ll mod = 1e9+7;
const ll INF= 1e18;
long double PI=3.1415926;

ll power(ll a,ll b){
    if(b==0){
        return 1;
    }
    ll temp=power(a,b/2)%mod;
    if(b%2==0){
        return (temp*temp)%mod;
    }
    else{
        return ((a*temp)%mod*temp)%mod;
    }
}

ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 

vector<pair<ll,ll>>v;
vector<ll>::iterator it;
map<ll,ll>mp;

void primeFactors(ll n)  
{  
    while (n % 2 == 0)  
    {  
        mp[2]++;
        n = n/2;  
    }  
    for (ll i = 3; i <= sqrt(n); i = i + 2)  
    {  
        while (n % i == 0)  
        {  
            mp[i]++;
            n = n/i;  
        }  
    }  
    if (n > 2){ 
        mp[n]++; 
    } 
}  

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t;
    //cin>>t;
    t=1;
    //ll c=1;
    while(t--){
        ll n;
        cin>>n;
        long double p[n];
        for(ll x=0; x<n; x++){
            cin>>p[x];
        }
        long double dp[n+1][n+1];
        //memset(dp,0,sizeof(dp));
        for(ll x=0; x<=n; x++){
            for(ll y=0; y<=n; y++){
                dp[x][y]=0.00000000;
                if(x==0){
                    dp[x][y]=0;
                }
                else if(y==0){
                    dp[x][y]=p[x-1]*dp[x-1][y];
                }
                else if(x>=y){
                    dp[x][y]=dp[x-1][y]*p[x-1]+dp[x-1][y-1]*(1.0000-p[x-1]);
                }
                else{
                    continue;
                }
                dp[1][0]=p[0];
                dp[1][1]=1.000000000-p[0];
                //cout<<dp[x][y]<<" ";
            }
            //cout<<"\n";
        }
        long double ans=0;
        for(ll x=0; x<=n/2; x++){
            ans+=dp[n][x];
        }
        cout<<setprecision(10);
        cout<<fixed<<ans<<"\n";
        mp.clear();  
        v.clear();
        //cout<<"Case #"<<c<<": "<<ans<<"\n";
        //c++;
    }
    return 0;
}

Measured memory_bytes: 140928
n,m = (int(num) for num in input().split())
list_drink = []
for i in range(n):
    list_drink.append([int(num) for num in input().split()])
list_drink.sort(key=lambda array: array[0])

num_drink = 0
cost = 0
while m>0:
    price = list_drink[num_drink][0]
    quantity = list_drink[num_drink][1]
    if quantity < m:
        cost += price*quantity
        m -= quantity
        num_drink += 1
    else:
        cost += price*m
        m = 0
        num_drink += 1
print(cost)

Measured memory_bytes: 64728
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main() {
  ll N;

  cin >> N;

  ll ans;
  for (ll i = 0; i * i <= N; i++) {
    ans = i*i;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

int A[2010];
int N;

bool solve(int deep, int m) {

	if (m == 0) return true;
	if (deep == N || m < 0) return false;
	bool res = solve(deep + 1, m) || solve(deep + 1, m - A[deep]);
	return res;
}

int main() {

	cin >> N;
	for (int i = 0; i < N; i++)	{
		scanf("%d", &A[i]);
	}
	int q; cin >> q;

	for (int i = 0; i < q; i++)	{
		int m; scanf("%d", &m);
		if (solve(0, m)) {
			printf("yes\n");
		}
		else {
			printf("no\n");
		}
	}

	return 0;
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

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

    vector<vector<ll>> box(N, vector<ll>(2));
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < 2; j++)
        {
            cin >> box[i][j];
        }
    }
    sort(box.begin(), box.end());

    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        ans += min(M, box[i][1]) * box[i][0];
        M -= min(M, box[i][1]);
        if (M == 0)
        {
            break;
        }
    }
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 5760
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    string S;
    cin >> S;
    
    int a, b;
    rep(i, S.size()) {
        if (S[i] == 'A') {
            a = i;
            break;
        }
    }
    for (int i = (int)S.size(); i > 0; --i) {
        if (S[i - 1] == 'Z') {
            b = i;
            break;
        }
    }
    cout << b - a << endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n;
    cin >> n;
    int A[200];
    for (int i = 0;i < n;i++) cin >> A[i];
    sort(A, A + n, greater<int>());
    int Alice = 0,Bob = 0;
    for (int i = 0;i < n;i++){
        if (i % 2 == 0) Alice += A[i];
        else Bob += A[i];
    }
    cout << Alice - Bob << endl;
    return 0;
}

Measured memory_bytes: 3612
fun main(args: Array<String>) {
    abc145c()
}

fun abc145c() {
    val n = readLine()!!.toInt()
    val xyList = (1..n).map { readLine()!!.split(' ').map { it.toDouble() } }
        .map { Pair(it[0], it[1]) }.toMutableList()

    var sum = 0.0
    for (i in 0..xyList.lastIndex) {
        val copy = xyList.toMutableList()
        val point = copy[i]
        copy.removeAt(i)
        copy.map {
            sum += Math.sqrt(
                Math.pow(it.first - point.first, 2.0) + Math.pow(
                    it.second - point.second,
                    2.0
                )
            )
        }
    }

    val answer = sum / n

    println(answer)
}


Measured memory_bytes: 38308
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,k,x,y,ans,curr,temp;
    int n,m;
    scanf("%d",&n);
    int maxi = 0;
    int sum = 0;
    for(i=0;i<n;i++)
    {
        scanf("%d",&curr);
        sum += curr;
        maxi = max(maxi,curr);
    }
    if(sum - maxi > maxi)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
h=list(map(int, input().split()))
v=[0]*n
for i in range(1,n):
	u = h[i]
	v[i] = min([v[j] + abs(h[j]-u) for j in range(max(0, i-k), i)])
print(v[n-1])

Measured memory_bytes: 13980
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int y = sc.nextInt();
		sc.close();

		boolean flg = false;
		for (int i = 0; i <= n; i++) {
			for (int j = 0; j <= n; j++) {
				if (n - i - j < 0) {
					continue;
				}
				if (10000 * i + 5000 * j + 1000 * (n - i - j) == y) {
					System.out.println(i + " " + j + " " + (n - i - j));
					flg = true;
					break;
				}

			}
			if (flg) {
				break;
			}
		}
		if (!flg) {
			System.out.println("-1 -1 -1");
		}

	}

}


Measured memory_bytes: 23764
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int r;
    cin>>r;
    string output;
    if(r<1200){
        output="ABC";
    }else if(r<2800){
        output="ARC";
    }else{
        output="AGC";
    }
    cout<<output<<"\n";
    return 0;
}


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

template <class T1> void write(T1 e)
{
    cout << e << endl;
}
template <class T1,class T2> void write(T1 e1,T2 e2)
{
    cout << e1 << " "<< e2 << endl;
}
template <class T1,class T2,class T3> void write(T1 e1,T2 e2,T3 e3)
{
    cout << e1 << " " << e2 << " " << e3 << endl;
}

#define oo          (1<<30)
#define SZ(a)       (int)a.size()
#define LL          long long int
#define ULL         unsigned long long
#define ISS         istringstream
#define OSS         ostringstream
#define VS          vector <string>
#define VI          vector <int>
#define VD          vector <double>
#define VLL         vector <long long>
#define SII         set<int>::iterator
#define SI          set<int>
#define mem(a,b)    memset(a,b,sizeof(a))
#define fs          first
#define sc          second
#define pii         pair < int , int >

#define EQ(a,b)     (fabs(a-b)<ERR)
#define all(a,b,c)  for(int I=0;I<b;I++)    a[I] = c
#define CROSS(a,b,c,d) ((b.x-a.x)*(d.y-c.y)-(d.x-c.x)*(b.y-a.y))
#define sqr(a)      ((a)*(a))
#define FORE(i,a)   for(typeof((a).begin())i=(a).begin();i!=(a).end();i++)
#define BE(a)       a.begin(),a.end()
#define RBE(a)      a.rbegin(),a.rend()
#define rev(a)      reverse(BE(a));
#define sorta(a)    sort(BE(a))
#define pb          push_back
#define popb        pop_back
#define Round(i,a)  i = ( a < 0 ) ? a - 0.5 : a + 0.5;

#define makeint(n,s)  istringstream(s)>>n
#define string_to_int(str) atoll(str.c_str());

#define LCM(A,B)    ((__gcd(A,B))/A)*B
#define GCD(A,B)     __gcd(A,B)

#define YES     write("YES")
#define Yes     write("Yes")
#define yes     write("yes")
#define NO      write("NO")
#define No      write("No")
#define no      write("no")

#define read()      freopen("test.txt","r",stdin)
#define write_file()     freopen("WA.txt", "w", stdout);
#define Faster      {ios_base::sync_with_stdio(false); cin.tie(0);}

#define PI          3.141592653589793
#define pi          2*acos(0)
#define gama        0.57721566490
#define ERR         1e-5
#define PRE         1e-8
#define MAX         1000009

#define Scan(A)         scanf("%lld", &A)
#define Scan2(A, B) 	scanf("%lld %lld",&A, &B)
#define Scan3(A, B, C) 	scanf("%lld %lld %lld",&A, &B, &C)
#define Scan4(A, B, C, D) 	scanf("%lld %lld %lld %lld",&A, &B, &C, &D)

int dx[] = {-1, -1, -1,  0, 0,  1, 1, 1};
int dy[] = {-1,  0,  1, -1, 1, -1, 0, 1};
int dx4[] = {0, 1, 0, -1};
int dy4[] = {-1, 0, 1, 0};

bool isvowel(char ch)
{
    ch = tolower(ch);
    return ch == 'a' or ch == 'e' or ch == 'i' or ch == 'o' or ch == 'u';
}

struct myStruct
{
    LL Sum;
    string name;
    string Party;
};

bool cmp(myStruct a, myStruct b)
{
    return a.Sum > b.Sum ? 0 : 1;
}

map <char, int> Mp;

void Method()
{
    int j = 0;
    for(char i = 'a'; i <= 'z'; i++)
    {
        char temp = (char) i;
        Mp[temp] = j;
        j++;
    }
}

LL sums__of_digits(LL N)
{
    LL sum = 0;
    while(N)
    {
        sum += N%10;
        N /= 10;
    }
    return sum;
}
int main()
{
    LL N, A, B;
    while(cin >> N)
    {
        if(N % sums__of_digits(N) == 0)
            Yes;
        else
            No;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		for(int i = 0;; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			if(x > y) {
				System.out.println(y + " " + x);
			} else if(x < y) {
				System.out.println(x + " " + y);
			} else if(x == 0 && y == 0) {
				break;
			} else {
				System.out.println(x + " " + y);
			}
		}
	}
}

Measured memory_bytes: 35804
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
using namespace std;
typedef long long int ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, a, cnt[100010] = {}, ma = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		cnt[a]++;
		ma = max(a, ma);
	}
	ll ans = cnt[0] + cnt[1] + cnt[2], num = ans;
	for (int i = 3; i <= ma; i++) {
		num += cnt[i] - cnt[i - 3];
		ans = max(ans, num);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_ARRAY_MAX		200000									// 最大配列数
#define D_DCNT_MAX		30										// 最大桁数

// 内部変数
static FILE *szpFpI;											// 入力
static int si1Array[D_ARRAY_MAX];								// 配列
static int siACnt;												// 配列数
static int si1Res[D_ARRAY_MAX];									// 結果
static char sc1Out[D_ARRAY_MAX * 10];							// 出力内容
static char *scpOut;											// 出力位置

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 出力内容 - 追加
int
fOutAdd(
	int piVal					// <I> 値
)
{
	char lc1Buf[1024];
	sprintf(lc1Buf, "%d ", piVal);
	int liLen = strlen(lc1Buf);
	memcpy(scpOut, lc1Buf, liLen);
	scpOut += liLen;

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i, j;
	char lc1Buf[1024];

	// データ - 初期化
	memset(si1Res, 0, sizeof(si1Res));
	scpOut = sc1Out;

	// 配列数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &siACnt);

	// 配列 - 取得
	for (i = 0; i < siACnt; i++) {
		fscanf(szpFpI, "%d", &si1Array[i]);
	}
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);

	// 桁数別にセット
	for (i = 0; i < D_DCNT_MAX; i++) {
		int liTgt = 1 << i;

		// 個数 - 取得
		int liCnt = 0;
		for (j = 0; j < siACnt; j++) {
			if (liTgt & si1Array[j]) {
				liCnt++;
			}
		}
		if (liCnt == 0) {
			continue;
		}

		// 結果 - 加算
		liCnt = liTgt * ((liCnt + 1) % 2);
		for (j = 0; j < siACnt; j++) {
			if ((liTgt & si1Array[j]) == liCnt) {
				si1Res[j] += liTgt;
			}
		}
	}

	// 出力
	for (i = 0; i < siACnt; i++) {
		fOutAdd(si1Res[i]);
	}
	*scpOut = '\0';
	scpOut--;
	*scpOut = '\n';
	fOutLine(sc1Out);

	return 0;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 5996
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
using namespace std;
typedef long long int lli;
int main(void)
{
    int N;
    string s;
    cin >> s;
    N = s.length();
    if (s[N - 1] == '3')
    {
        cout << "bon" << endl;
    }
    else if (s[N - 1] == '0' || s[N - 1] == '1' || s[N - 1] == '6' || s[N - 1] == '8')
    {
        cout << "pon" << endl;
    }
    else
    {
        cout << "hon" << endl;
    }

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  map<int, int> A;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A[a]++;
  }
  int ans = 0;
  for (int x = 0; x <= 100000; x++) {
    ans = max(ans, A[x - 1] + A[x] + A[x + 1]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4992
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        long a = Read.Long();
        string str=""+a+"";
        long ans = 0;
        for(int i = 0; i < str.Length; i++)
        {
            ans += long.Parse(str.Substring(i,1));
        }
        Console.WriteLine(a%ans==0?"Yes":"No");
    }
    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b) { return a / gcd(a, b) * b; }
    public static bool IsPrime(int num)
    {
        if (num < 2) return false;
        else if (num == 2) return true;
        else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2)
        {
            if (num % i == 0)
            {
                // 素数ではない
                return false;
            }
        }

        // 素数である
        return true;
    }
}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long() { return long.Parse(Console.ReadLine()); }
    public static long[] longs() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); }
    public static int Int() { return int.Parse(Console.ReadLine()); }
    public static int[] ints() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Measured memory_bytes: 11220
using System;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using static System.Math;

class P
{
    static void Main()
    {
        //反対に回る例もある
        //
        long[] nc = Console.ReadLine().Split().Select(long.Parse).ToArray();
        //xメートル(時計)、vカロリー
        //時計回りで与えられる
        Sushi[] sushis = Enumerable.Repeat(0, (int)nc[0]).Select(_ => new Sushi(Console.ReadLine().Split().Select(long.Parse).ToArray())).ToArray();

        //取れるカロリー
        long[] calDPClock = new long[sushis.Length];
        long[] ClockMax = new long[sushis.Length];
        calDPClock[0] = sushis[0].Cal - sushis[0].Dist;
        ClockMax[0] = Max(0, calDPClock[0] - sushis[0].Dist);
        for (long i = 1; i < calDPClock.Length; i++)
        {
            calDPClock[i] = calDPClock[i - 1] + sushis[i].Cal - (sushis[i].Dist - sushis[i - 1].Dist);
            ClockMax[i] = Max(ClockMax[i - 1], calDPClock[i] - sushis[i].Dist);
        }

        long[] calDPAntiClock = new long[sushis.Length];
        long[] antiClockMax = new long[sushis.Length];
        calDPAntiClock[calDPAntiClock.Length - 1] = sushis[sushis.Length - 1].Cal - (nc[1] - sushis[sushis.Length - 1].Dist);
        antiClockMax[calDPAntiClock.Length - 1] = Max(0, calDPAntiClock[sushis.Length - 1] - (nc[1] - sushis[sushis.Length - 1].Dist));
        for (int i = calDPAntiClock.Length - 2; i >= 0; i--)
        {
            calDPAntiClock[i] = calDPAntiClock[i + 1] + sushis[i].Cal - ((nc[1] - sushis[i].Dist) - (nc[1] - sushis[i + 1].Dist));
            antiClockMax[i] = Max(antiClockMax[i + 1], calDPAntiClock[i] - (nc[1] - sushis[i].Dist));
        }


        long max = Max(0, Max(calDPClock.Last(), calDPAntiClock.First()));
        for (int i = 0; i < sushis.Length - 1; i++)
        {
            max = Max(max, calDPClock[i] + antiClockMax[i + 1]);
        }
        for (int i = sushis.Length - 1; i >= 1; i--)
        {
            max = Max(max, calDPAntiClock[i] + ClockMax[i - 1]);
        }
        Console.WriteLine(max);
    }
}
struct Sushi
{
    public long Dist;
    public long Cal;
    public Sushi(long dist,long cal)
    {
        Dist = dist;
        Cal = cal;
    }
    public Sushi(long[] a) : this(a[0], a[1]) { }
}

Measured memory_bytes: 25648
#include <bits/stdc++.h>
#define PI acos(-1)
#define falcon ios_base::sync_with_stdio(false) ; cin.tie(NULL) ;
typedef long long ll ;
using namespace std ;

int main()
{
    falcon ;

    vector <ll> weights , costs ;

    ll n , w ;
    cin >> n >> w ;
    ll dp[w + 1][n + 1] ;
    weights.push_back(0) ;
    costs.push_back(0) ;
    for(int i = 0 ; i < n ; i++)
    {
        ll weight , cost ;
        cin >> weight >> cost ;
        weights.push_back(weight) ;
        costs.push_back(cost) ;
    }
    for(int i = 0 ; i <= w ; i++)
    {
        for(int j = 0 ; j <= n ; j++)
        {
            if(i == 0 || j == 0) dp[i][j] = 0 ;
            else
            {
                dp[i][j] = dp[i][j - 1] ;
                if(i >= weights[j]) dp[i][j] = max(dp[i][j] , dp[i - weights[j]][j - 1] + costs[j]) ;
            }
        }
    }
    cout << dp[w][n] ;
}

Measured memory_bytes: 82524
nums = [int(e) for e in input().split()]
c=[]
i=0
k=0
j=0
while(i<nums[0]):
    row = input()
    c.append(row)
    i+=1

while(k<nums[0]):
    j=0
    while(j<2):
        print(c[k],'\n')
        j+=1
    k+=1

Measured memory_bytes: 38256
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  x, y, z = map(int, readline().split())
  print(z, x, y)
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 5716
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
    int N;
    cin >> N;
    int a;
    int ap, am;
    vector<int> as;

    for (int i = 0; i < N; i++) {
        cin >> a;
        ap = a + 1;
        am = a - 1;
        as.push_back(a);
        as.push_back(ap);
        as.push_back(am);
    }
    sort(as.begin(), as.end());

    int count = 0;
    int tmp = 1;
    for (int i = 0; i < as.size() - 1; ++i) {
        if (as[i] != as[i + 1]) {
            count = max(count, tmp);
            tmp = 1;
        } else {
            ++tmp;
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 2420