akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
#define M 500
using namespace std;

int n,q;
int c[300100],x;

int main(){
  scanf("%d%d",&n,&q);
  int lim = 0;
  for(int i=0;i<n;i++){ scanf("%d",&c[i]); lim = max(lim,c[i]); }
  sort(c,c+n);
  int m[M] = {0};
  for(int i=1;i<=M;i++){
    for(int j=0;j<n;j++)m[i] = max(m[i],c[j]%i);
  }

  for(int i=0;i<q;i++){
    scanf("%d",&x);
    if(x<=M)printf("%d\n",m[x]);
    else{
      int res = 0;
      for(int j=1;j*x<=lim;j++){
	int tmp = lower_bound(c,c+n,j*x) - c;
	if(tmp)res = max(res,c[tmp-1]%x);
      }
      printf("%d\n",res);
    }
  }
}

Measured memory_bytes: 2212
x1, x2, x3, x4, x5 = map(int, input().split())
if x1 == 0:
    print(1)
elif x2 == 0:
    print(2)
elif x3 == 0:
    print(3)
elif x4 == 0:
    print(4)
elif x5 == 0:
    print(5)

Measured memory_bytes: 9116
#include <stdio.h>
#include <stdlib.h>

int inputdata(int num){
	if (scanf("%d", &num) == 1);
  	else { 
  		printf("Failed to read integer.\n"); 
  	}
  	
  	return num;
}

int main(void){
  int a,b,t;
  int sum=0;

  a = inputdata(a);
  b = inputdata(b);
  t = inputdata(t);

  for(;a>20||a<1||b>20||b<1||t>20||t<1;){
  		printf("入力は1~20の範囲でおこなってください．\n"); 
  		a = inputdata(a);
  		b = inputdata(b);
  		t = inputdata(t);
  }

  
  for(int i=0; i < t/a; i++){
    sum += b;
  }
  printf("%d\n", sum);
 
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,d;
	cin>>n>>d;
	ll a[n+5][d+5];
	for(ll i=0;i<n;i++)
	{
		for(ll j=0;j<d;j++)
			cin>>a[i][j];
	}
	ll ans=0;
	for(ll i=0;i<n;i++)
	{
		for(ll j=i+1;j<n;j++)
		{
			ll Ans =0 ;
			for(ll k=0;k<d;k++)
			{
				Ans += (a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
			}
			ll val = sqrt(Ans);
			if(val*val==Ans)
				ans++;
		}

	}
	cout<<ans;
}

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

using namespace std;

int main(){
 int n;
 cin >> n;
 string a, b;
 cin >> a >> b;
 for(int i = 0;i < n;i++){
  if(a.substr(i) == b.substr(0, n - i)){
   cout << n + i << endl;return 0;
  }
 }
cout << n * 2 << endl;
}

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

using namespace std;

int n, ans;

vector < int > a;

int main() {
    cin >> n;
    a.resize(n * 2);
    for (int i = 0; i < n * 2; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < n * 2; i += 2) {
        ans += a[i];
    }
    cout << ans;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 998244353;
const int N = 10003;
const int K = 1000000;
int f[N], invf[N];
int binpow(int x, int y){
    if (y == 0) return 1;
    if (y % 2) return x * binpow(x, y - 1) % mod;
    int z = binpow(x, y / 2);
    return z * z % mod;
}
int c(int n, int k){
    if (k > n) return 0;
    if (k < 0) return 0;
    return f[n] * invf[k] % mod * invf[n - k] % mod;
}
int solve(int x, int k, int n){
    int res = 0;
    for (int i = 0; i <= x; i++){
        int y = binpow(2, x - i);
        int z = c(n - (x - i) + k - i - x - 1, k - i - x - 1);
        res = (res + z * y % mod * c(x, i)) % mod;
    }
    return res;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int k, n;
    cin >> k >> n;
    f[0] = 1;
    invf[0] = 1;
    for (int i = 1; i < N; i++) f[i] = f[i - 1] * i % mod;
    for (int i = 1; i < N; i++) invf[i] = binpow(f[i], mod - 2);
    for (int i = 2; i <= k + k; i++){
        int x = min((i - 1) / 2, (k + k - i + 1) / 2);
        if (i % 2 == 0){
            cout << (solve(x, k - 1, n) + solve(x, k - 1, n - 1)) % mod << endl;
        } else{
            cout << solve(x, k, n) << endl;
        }
    }
}


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

int ans[505][505] = {0};
int n, m, q;

int main() {
  int i, j, l, r, k;
  cin >> n >> m >> q;
  for(i = 0; i < m; ++i) {
    cin >> l >> r;
    for(k = 1; k <= l; ++k) ++ans[k][r];
  }
  for(i = 1; i <= n; ++i)
    for(j = i; j <= n; ++j) ans[i][j] += ans[i][j - 1];

  for(i = 0; i < q; ++i) {
    cin >> l >> r;
    cout << ans[l][r] << endl;
  }

  return 0;
}

Measured memory_bytes: 1920
n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(1,n-1):
    if ((p[i-1]<=p[i]) or (p[i+1]<=p[i])) and ((p[i-1]>=p[i]) or (p[i+1]>=p[i])):
        count += 1
print(count)


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(){
 int a,b,c;
  int min=999;
  cin >> a >> b >> c;
  
  int arr[10];
  arr[0]=a+b;
  arr[1]=b+c;
  arr[2]=c+a;
  arr[3]=b+a;
  arr[4]=c+b;
  arr[5]=a+c;
  
  for(int i=0;i<6;i++){
    if(arr[i]<min){
		min=arr[i];
    }
  }
  cout << min << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a, b, c, d;
    int eval;

    cin >> a >> b >> c >> d;
    
    eval = min(b, d) - max(a, c);

    if(eval >= 0) {
        cout << eval << endl;
    }
    else {
        cout << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
# Date [ 2020-08-29 21:10:46 ]
# Problem [ c.py ]
# Author Koki_tkg

import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def Main():
    n = read_int()
    a = read_int_list()
    
    ans = 0

    total = sum(a)
    floatcnt = 0
    for i in range(n):
        ans += a[i] * (total - a[i])
        ans %= MOD
        total -= a[i]

    print(int(ans % MOD))

if __name__ == '__main__':
    Main()

Measured memory_bytes: 33036
#include <stdio.h>
typedef long long ll;

int N, C;
int D[31][31];
int c[501][501];

int origColors[3][31]; //slot,colors
int main(void){
    scanf("%d %d",&N,&C);
    
    for(int i = 1; i <= C; i++){
        for(int j = 1; j <= C; j++){
            scanf("%d", &(D[i][j]) );
        }
    }
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= N; j++){
            scanf("%d", &(c[i][j]) );
        }
    }
    
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= N; j++){
            origColors[(i+j) % 3][c[i][j]] ++;
        }
    }
    
    ll iwakan_min = 1000000000;
    for(int colX = 1 ; colX <= C; colX++){
        for(int colY = 1; colY <= C; colY++){
            if(colY == colX) continue;
            
            for(int colZ = 1; colZ <= C; colZ++){
                if(colZ == colX || colZ == colY) continue;
                
                ll iwakan = 0; 
                
                for(int t = 1; t <= C; t++){
                    iwakan += origColors[0][t] * D[t][colX];
                    iwakan += origColors[1][t] * D[t][colY];
                    iwakan += origColors[2][t] * D[t][colZ];
                }
                if(iwakan_min > iwakan) iwakan_min = iwakan;
            }
        }
    }
    
    printf("%lld\n",iwakan_min);
}


Measured memory_bytes: 1152
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;
#define erep(i, x, n) for (auto i = x; i<=(ll)(n); i++)
#define rep(i, x, n) for(auto i = x; i<(ll)(n); i++)
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define mod(n, m) (((n%m) + m)%m)
#define reset(n, m) memset(n, m, sizeof n)
#define endl '\n'



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

	int n;
	cin >> n;
	vi vec(n);
	rep(i, 0, n)
		cin >> vec[i];

	ll mn = LLONG_MAX;

	erep(i, 1, 100)
	{
		ll cnt = 0;
		rep(j, 0, n)
		{
			ll dist = (vec[j] - i) * (vec[j] - i);
			cnt += dist;
		}
		mn = min(mn, cnt);
	}

	cout << mn << endl;

	return 0;
}


Measured memory_bytes: 256
function main(input) {
  var a = input[0].split(" ")[0]-0;
  var b = input[0].split(" ")[1]-0;
  var ans = a%3==0||b%3==0||(a+b)%3==0;
  console.log(ans?"Possible":"Impossible");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


Measured memory_bytes: 7372
n,k=[int(i) for i in input().split()]

a_list=[int(i) for i in input().split()]

a_dic={}
for i in range(n):
    if a_list[i] not in a_dic:
        a_dic[a_list[i]]=1
    else:
        a_dic[a_list[i]]+=1
        


if len(a_dic)<=k:
    print(0)
else:
    #値を取り出す
    a_value=list(a_dic.values())
    
    a_value.sort(reverse=True)
    
    print(sum(a_value[k:]))
    

Measured memory_bytes: 34584
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n;
     cin>>n;

      vector<pair<int,int>>vect;

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

              vect.push_back(make_pair(x,i+1));
        }

        
    sort(vect.begin(),vect.end());
    for(int i=0;i<vect.size();i++)
     cout<<vect[i].second<<" ";

}


Measured memory_bytes: 1780
while 1:
        n = input()
        if n == 0:
                break
        x = []
        y = []
        for i in range(n):
                a,b = map(float,raw_input().split(','))
                x.append(a)
                y.append(b)
        ys = y.index(min(y))
        s = ys
        vx = 1.0
        vy = 0.0
        ans = n
        while 1:
                cx = -1.0
                t = -1
                for i in range(n):
                        if i != s:
                                tx = x[i] - x[s]
                                ty = y[i] - y[s]
                                d = (tx**2 + ty**2) ** 0.5
                                c = (vx*tx + vy*ty) / d
                                if cx < c:
                                        cx = c
                                        t = i
                ans -= 1
                if t == ys:
                        break
                vx = x[t] - x[s]
                vy = y[t] - y[s]
                s = t
        print ans

Measured memory_bytes: 6476
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>


using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 

long long int mi=0;
long long int N,res=0,abssum=0;
long long int A,B,C,K;
string S;

pll clo[200020],revclo[200020];
int main()
{
    cout << fixed << setprecision(18);
    cin>>A>>B>>C>>K;
    if(K%2==0){
        res=A-B;
    }else{
        res=B-A;
    }
    cout<<res<<endl;
}    


Measured memory_bytes: 256
N,M=map(int, input().split()) 
if M == 1 or M==0:
    answer = N * (N-1)//2
elif N == 1 or N==0:
    answer = M * (M-1)//2    
else:
    answer = (N * (N-1))//2 + (M * (M-1))//2
print(answer)

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

void start() {
	ios::sync_with_stdio(false); cin.tie(0);
	cout<<fixed<<setprecision(10);
}

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define ii pair<int, int>
#define ll long long
#define endl '\n'
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()

int main() {
	start();
	
	int a,b,c,k;
	cin>>a>>b>>c>>k;

	if (k <= a) cout<<k;
	else if (k <= a+b) cout<<a;
	else cout<< a - (k - (a+b));


}

// by Freyam

Measured memory_bytes: 3656
package main

import "fmt"

func main() {
	var A, B, ans int
	fmt.Scan(&A, &B)
	if A <= 5 {
		ans = 0
	} else if 6 <= A && A <= 12 {
		ans = B / 2
	} else {
		ans = B
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
from math import floor
N = int(input())
ans = 0
# for j in range(1, N+1):
#     for i in range(1, N+1):
#         if i % j == 0: # iがjの倍数なら
#             ans += i
for j in range(1, N+1):
    n = N//j
    ans += j*n*(n+1)//2
print(ans)

Measured memory_bytes: 62876
#include <iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include <set>
#include <cassert>
#include<cmath>
#include<climits>
#include<iomanip>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define all(hoge) hoge.begin(),hoge.end()
const long long INF = 1LL << 60;


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

class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int find(vector<long long> &arr, long long obj) {
	if (arr[arr.size() - 1] < obj)return arr.size()-1;
	if (arr[0] > obj)return -1;

	int min = 0; int max = arr.size() - 1;
	for (int i = 0; i < arr.size(); i++) {
		if (arr[min+(max-min) / 2] > obj) {
			max = min + (max - min) / 2;
		}
		else {
			min = min + (max - min) / 2;
		}
		if (max - min == 1) {
			return min;
		}
	}


}

//約数求める //約数
void divisor(ll n,vector<ll> &ret) {
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(ret.begin(), ret.end());
	
}
//階乗
long long factorial(long long n, long long mod) {
	long long ret = 1;
	for (long long i = 1; i <= n; i++) {
		ret = (ret * i) % mod;
	}
	return ret;
}
//モジュラ逆数
long long inv_mod(long long n, long long mod) {
	long long a = n % mod, b = mod - 2, ret = 1;
	while (b > 0) {
		if (b & 1) ret = (ret * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return ret;
}

long long nPr(long long n, long long r, long long mod) {
	long long ret = 1;
	for (long long i = n; i >= n - r + 1; i--) {
		ret = ret * (i % mod) % mod;
	}
	return ret;
}

long long nCr(long long n, long long r, long long mod) {
	return nPr(n, r, mod) * inv_mod(factorial(r, mod), mod) % mod;
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {//降順second
	if (a.second != b.second) {
		return a.second > b.second;
	}
	else {
		return a.first > b.first;
	}
}

bool compare_by_a(pair<ll, ll> a, pair<ll, ll> b) {//降順first
	if (a.first != b.first) {
		return a.first > b.first;
	}
	else {
		return a.second > b.second;
	}
}

ll gcd(ll m, ll n){
	if (n == 0)return m;
	return gcd(n, m%n);
}//gcd


int main() {
	ll n, k;
	cin >> n >> k;
	map<ll, ll> ma;
	rep(i, n) {
		ll temp;
		cin >> temp;
		ma[temp]++;
	}
	vector<ll> min;
	for (auto itr : ma) {
		min.push_back(itr.second);
	}
	sort(all(min));
	ll cnt = 0;
	ll type = ma.size();
	rep(i, min.size()) {
		if (type <= k)break;
		cnt += min[i];
		type--;
	}
	cout << cnt;
	return 0;
}


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;


string S;
int main(){

    cin >> S;
    bool ok = false;
    for(int i = 1; i < 4; i++){
        if(S[i] == S[i-1]){
            ok = true;
        }
    }
    if(ok) cout << "Bad" << endl;
    else cout << "Good" << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
p = [int(x) for x in input().split()]
l = [0] * n
#f = [int(0) for _ in range(n)]
#k = 1

for i in range(0, n):
  if p[i] != i + 1:
    l[i] = 1
  #k = p[i]

sum = 0
for i in range(0, n):
  if l[i]:
    sum += 1

if sum > 2:
  print('NO')
else:
  print('YES')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000009
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;



int main()
{
string s ;
getline(cin,s);

sort(s.begin(),s.end());
if(s!="  557")
    cout<<"NO"<<endl;
else
    cout<<"YES"<<endl;




 return 0;
}


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

long long dp[100001];

int main(void){
	int N;
	cin >> N;
	int h[N];
	for(int i=0;i<N;i++)cin >> h[i];
	//足場iに行くまでの最小のコストを計算する
	//現在地は0
	dp[1]=0;
	dp[2]=abs(h[0]-h[1]);
	dp[3]=abs(h[0]-h[2]);
	for(int i=3;i<N;i++){
		dp[i+1]= min(dp[i-1]+abs(h[i-2]-h[i]),dp[i]+abs(h[i-1]-h[i]));
	}
	cout << dp[N];
}

Measured memory_bytes: 1408
#include <stdio.h>
int main(void){
    long long x, ans = 100;
    int  cnt = 0;
    
    scanf("%lld", &x);
    
    while(ans < x){
        ans = ans + (ans / 100);
        //printf("%d\n", ans);
        cnt = cnt + 1;
    }
    printf("%d\n", cnt);
    
}


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

int main(void){
    int n, tmp;
    int ans = 0;
    while(cin >> n && n) {
        vector<int> in;
        rep(i, n) {
            cin >> tmp;
            in.push_back(tmp);
        }
        sort(in.begin(), in.end());
        ans = 0;
        for(int i=1; i<n-1; ++i) ans += in[i];
        cout << ans/(n-2) << endl;
    }
}


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

typedef long long ll;
typedef long double ld;

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

ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}

int main(){

    ll a, b;

    cin >> a >> b;

    cout << ((a * b) % 2 ? "Odd" : "Even") << endl;

    return 0;
}

Measured memory_bytes: 256
#input
N, K = map(int, input().split())
S = str(input())

#output
#最初にhappyな人の数を計算
happy = 0

for i in range(N-1):
    if S[i] == S[i+1]:
        happy += 1

#happyになれる人数の最大値はN-1
#1回の操作で+2人happyにできる
if happy + 2*K < N-1:
    print(happy + 2*K)
else:
    print(N-1)

Measured memory_bytes: 39408
double s[2],t,v;i;main(m){for(;scanf("%d",&m)*m;s[i]+=sin(t),++i>1?*s=s[1]=i=!puts(*s>s[1]+1e-8?"1":*s+1e-8<s[1]?"2":"0"):0)for(t=asin(1)*4;--m;t-=v)scanf("%lf",&v),s[i]+=sin(v*=asin(1)/90);}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

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

	ll a = s;

	vector<ll> a_log;
	a_log.push_back(a);

	for (ll m = 2; ; ++m)
	{
		if (a % 2 == 0)
		{
			a = a / 2;
		}
		else
		{
			a = 3 * a + 1;
		}

		if (find(a_log.begin(), a_log.end(), a) != a_log.end())
		{
			cout << m;
			return 0;
		}

		a_log.push_back(a);
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct node{
	int v,c;
	bool operator<(const node&p)const{
		return c>p.c;
	}
};
int d[100005];
vector<node> e[100005];
bool ok[100005];
int n;
void solve(){
	priority_queue<node> q;
	ok[0]=1;
	for(int i=0;i<e[0].size();i++)q.push(e[0][i]);
	int k=1;
	while(k!=n){
		node v=q.top();q.pop();
		if(ok[v.v])continue;
		d[v.v]=v.c;
		ok[v.v]=1;
		k++;
		for(int j=0;j<e[v.v].size();j++)
			q.push({e[v.v][j].v,e[v.v][j].c+v.c});
	}
	for(int i=0;i<n;i++)
		cout<<i<<' '<<d[i]<<"\n";
}
int main(){
//	freopen("a.txt","r",stdin);
	cin.tie(0);
	int u,v,k,c;
	cin>>n;
	while(cin>>u>>k){
		for(int i=0;i<k;i++){
			cin>>v>>c;
			e[u].push_back({v,c});
		}
	}
	solve();
	return 0;
}


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


void swap (int *x, int *y) {
  int temp;    

  temp = *x;
  *x = *y;
  *y = temp;
}

int gcd(int a,int b){
  if(a<b){
    swap(&a,&b);
  }

  if(b==0){
    return a;
  }

  int r=a%b;
  while(r!=0){
    a = b;
    b = r;
    r = (a%b);
  }

  return b;
}

/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}


int modpow(int a,int n,int mod){
  int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  int r,g,b;
  scanf("%d%d%d",&r,&g,&b);
  int k;
  scanf("%d",&k);

  int cnt=0;
  while(r>=g){
    g*=2;
    cnt++;
  }
  while(g>=b){
    b*=2;
    cnt++;
  }

  if(cnt<=k){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }

  return 0;
}

Measured memory_bytes: 1648
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mx 1000025
using namespace std;
bool a[mx];
ll prime[mx];
void seive()
{
    ll i, j;
    for(i = 2; i * i <= mx; i++)
    {
        if(!a[i])
        {
            for(ll j = i * i; j <= mx; j+=i)
            {
                a[j] = 1;
            }
        }
    }
    for(i = 2, j = 0; i <= mx; i++)
    {
        if(!a[i])prime[j++] = i;
    }
}
ll chck(ll x)
{
    for(int i = 1; i <= 64; i++)
    {
        if((i*(i+1))/2 > x)return i-1;
    }
}
int main()
{
    seive();
    vector <ll> res;
    ll n, j = 0, cnt, ans = 0;
    cin>>n;
    for(int i = 0; prime[i] * prime[i] <= n; i++)
    {
        if(n % prime[i] == 0)
        {
            cnt = 0;
            while(n%prime[i]== 0)
            {
                n /= prime[i];
                cnt++;
            }
            res.pb(cnt);
        }
    }
    if(n > 1)res.pb(1);
    for(int i = 0; i < res.size(); i++)
    {
        ans += chck(res[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5192
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename F>
struct FixPoint : F{
  FixPoint(F&& f):F(forward<F>(f)){}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const{
    return F::operator()(*this,forward<Args>(args)...);
  }
};

template<typename F>
inline decltype(auto) MFP(F&& f){
  return FixPoint<F>{forward<F>(f)};
}

//INSERT ABOVE HERE
int one=1;
int two=2;
int three=3;

int get_one(){
  one+=3;
  return one-3;
}
int get_two(){
  two+=3;
  return two-3;
}
int get_three(){
  three+=3;
  return three-3;
}

signed main(){
  int n;
  cin>>n;
  vector<vector<int>> G(n);
  for(int i=1;i<n;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }

  vector<vector<int>> I(2);
  MFP([&](auto dfs,int v,int p,int d)->void{
        I[d].emplace_back(v);
        for(int u:G[v]){
          if(u==p) continue;
          dfs(u,v,d^1);
        }
      })(0,-1,0);

  if(I[0].size()>I[1].size()) swap(I[0],I[1]);

  int cnt=(n/3);
  int num=(n/3)+(n%3>0);
  vector<int> ans(n,0);
  if((int)I[0].size()<=(n/3)){
    for(int v:I[0]) ans[v]=get_three(),cnt--;
    for(int v:I[1]){
      if(cnt) ans[v]=get_three(),cnt--;
      else if(num) ans[v]=get_one(),num--;
      else ans[v]=get_two();
    }
  }else{
    for(int v:I[0]){
      if(num) ans[v]=get_one(),num--;
      else ans[v]=get_three(),cnt--;
    }
    for(int v:I[1]){
      if(cnt) ans[v]=get_three(),cnt--;
      else ans[v]=get_two();
    }
  }

  for(int i=0;i<n;i++){
    if(i) cout<<" ";
    cout<<ans[i];
  }
  cout<<endl;
  return 0;
}


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

struct Card {
    char suit, value;
};

int selectionSort(Card A[], int N) {
    int Count = 0;
    
    for (int i = 0; i < N; i++) {
        int minKey = i;
        for (int j = i + 1; j < N; j++) {
            if (A[minKey].value > A[j].value) {
                minKey = j;
            }
        }
        if (minKey != i) {
            swap(A[i], A[minKey]);
            Count++;
        }
    }
    
    return Count;
}

int bubbleSort(Card A[], int N) {
    int Count = 0;
    
    for (int i = 0; i < N; i++) {
        for (int j = N - 1; j > i; j--) {
            if (A[j].value < A[j-1].value) {
                swap(A[j], A[j-1]);
                Count++;
            }
        }
    }
    
    return Count;
}

void printCards(Card A[], int N) {
    for (int i = 0; i < N; i++) {
        if (i) {
            cout << " ";
        }
        cout << A[i].suit << A[i].value;
    }
}

bool isStable(Card A[], Card B[], int N) {
    for (int i = 0; i < N; i++) {
        if (A[i].suit != B[i].suit) {
            return false;
        }
    }
    
    return true;
}

int main(void) {
    int N;
    cin >> N;
    Card* A1 = new Card[N];
    Card* A2 = new Card[N];
    
    for (int i = 0; i < N; i++) {
        cin >> A1[i].suit >> A1[i].value;
    }
    for (int i = 0; i < N; i++) A2[i] = A1[i];

    bubbleSort(A1, N);
    selectionSort(A2, N);
    
    printCards(A1, N);
    cout << endl;
    cout << "Stable" << endl;
    printCards(A2, N);
    cout << endl;
    if (isStable(A1, A2, N)) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }
}


Measured memory_bytes: 3120
<?php 
    fscanf(STDIN, "%s", $s);
    fscanf(STDIN, "%s", $t);

    $s_lentgh = strlen($s);

    $rest = substr($t, 0, $s_lentgh);

    if($rest == $s){
        echo "Yes";
    } else {
        echo "No";
    }

Measured memory_bytes: 16232
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

int main()
{
  int n,m;
  cin>>n>>m;
  int low = 1, high = n;
  REP(i,m) {
    int l,r;
    cin>>l>>r;
    low = max(low, l);
    high = min(high, r);
  }
  cout<<max(0, high-low+1)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int N, M, Q;;
int S[2010][2010];
int V[2010][2010], E1[2010][2010], E2[2010][2010];



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> M >> Q;
    
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= M; j++){
            char c;
            cin >> c;
            S[i][j] = c - '0';
        }
    }
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= M; j++){
            V[i][j] += S[i][j];
        }
    }
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= M; j++){
            if(S[i - 1][j] && S[i][j]){
                E1[i][j]++;
            }
            if(S[i][j - 1] && S[i][j]){
                E2[i][j]++;
            }
        }
    }
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= M; j++){
            V[i + 1][j] += V[i][j];
            E1[i + 1][j] += E1[i][j];
            E2[i + 1][j] += E2[i][j];
        }
    }
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= M; j++){
            V[i][j + 1] += V[i][j];
            E1[i][j + 1] += E1[i][j];
            E2[i][j + 1] += E2[i][j];
        }
    }

    for(int i = 0; i < Q; i++){
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        int v = V[x2][y2] - V[x2][y1 - 1] - V[x1 - 1][y2] + V[x1 - 1][y1 - 1];
        int e1 = E1[x2][y2] - E1[x2][y1 - 1] - E1[x1][y2] + E1[x1][y1 - 1];
        int e2 = E2[x2][y2] - E2[x2][y1] - E2[x1 - 1][y2] + E2[x1 - 1][y1];
        cout << v - e1 - e2 << endl;
    }
    return 0;
}

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> G[m+1];
    int p[m+1];
    int k, s;
    for(int i = 1; i <= m; i++){
        cin >> k;
        for(int j = 0; j < k; j++){
            cin >> s;
            G[i].push_back(s);
        }
    }
    for(int i = 1; i <= m; i++){
        cin >> p[i];
    }

    int ans = 0;
    for(int bit = 0; bit < (1<<n); bit++){
        vector<int> a;
        for (int i = 0; i < n; i++) {
            if (bit & (1<<i)) {
                a.push_back(i+1);
            }
        }
        int isOn = 0;
        for(int i = 1; i <= m; i++){
            int b = 0;
            for(int j = 0; j < a.size(); j++){
                for(int l = 0; l < G[i].size(); l++){
                    if(a.at(j) == G[i].at(l)){
                        b++;
                        break;
                    }
                }
            }
            if(b % 2 == p[i]){
                isOn++;
            }
        }
        if(isOn == m){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n, m;
  cin >> n >> m;
  
  ll mini = 0;
  ll maxi = 1e5 +1;
  
  ll l, r;
  rep(i, 0, m) {
    cin >> l >> r;
    if(l > mini) mini = l;
    if(r < maxi) maxi = r;
  }  
  cout << max(ll(0), maxi -mini +1) << "\n";
}


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

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

    int a,b,c;
    cin>>a>>b>>c;

    if(a-b<0)puts(a<c&&c<b?"Yes":"No");
    else puts(b<c&&c<a?"Yes":"No");

    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
	ll A, B, K;
	cin >> A >> B >> K;

	REP(i, K)
	{
		if (i % 2 == 0)
		{
			if (A % 2 == 1)
			{
				A--;
			}
			ll a = A / 2;
			A /= 2;
			B += a;
		}
		else
		{
			if (B % 2 == 1)
			{
				B--;
			}
			ll b = B / 2;
			B /= 2;
			A += b;
		}
	}
	cout << A << " " << B << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <string>

#define repd(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
	int a;
	cin >> a;
	return a;
}

void inputArray(int *p,int a){
	rep(i,a){
		cin >> p[i];
	}
}

void inputVector(vector<int> *p,int a){
	rep(i,a){
		int input;
		cin >> input;
		p -> push_back(input);
	}
}

template <typename T>
void output(T a,int precision){
	if(precision > 0){
		cout << setprecision(precision) << a << "\n";
	}else{
		cout << a << "\n";
	}
}

int main(){
	//source
	int N,Q;
	cin >> N >> Q;
	string S;
	cin >> S;

	int l[Q];
	int r[Q];

	rep(i,Q){
		int l_temp,r_temp;
		cin >> l_temp >> r_temp;
		l[i]=l_temp-1;
		r[i]=r_temp-1;
	}
	
	vector<int> judge;
	int counter=0;
	rep(i,N-1){
		if(S[i]=='A' && S[i+1]=='C'){
			counter++;
		}
		judge.push_back(counter);
	}

	rep(i,Q){
		cout << judge[r[i]-1]-judge[l[i]-1] << endl;
	}
		
	return 0;
}


Measured memory_bytes: 2296
import sys

M,D = map(int, input().split())
Ans = 0

if M < 4 or D < 22:
  print('0')
  sys.exit()

  
for i in range(4,M + 1):
  for j in range(22, D + 1):
    str_j = str(j)
    d_t = int(str_j[-2])
    d_o = int(str_j[-1])
    if d_o < 2:
      continue
    if i == d_t * d_o:
      Ans = Ans + 1

print(Ans)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<cmath>
using namespace std;
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
ll dp[55][55][3000],a[3000];
int main() {
    int n,aa;
    cin>>n>>aa;
    for(int i=1;i<=n;i++)
    cin>>a[i];
    memset(dp,0,sizeof(dp));
    dp[0][0][0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=i;j>=0;j--)
        {
            for(int k=aa*n+1;k>=0;k--)
            {
                dp[i][j][k]+=dp[i-1][j][k];
                if(k>=a[i]&&j>=1) dp[i][j][k]+=dp[i-1][j-1][k-a[i]];
            }
        }
    }
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        ans+=dp[n][i][i*aa];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 71168
#include <bits/stdc++.h>
 
int main(){
    using namespace std;
    string S;
    int K, A, B;

    cin >> K;
    cin >> A >> B;

    for(int i =A;i<=B;i++){
        if(i%K==0){
            cout << "OK" << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 3628
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

void main() {
    auto s = readln.split.map!(to!int);
    auto X = s[0];
    auto Y = s[1];
    auto Z = s[2];
    auto N = X + Y + Z;
    auto A = new Tuple!(long, long, long)[](N);
    foreach (i; 0..N) {
        s = readln.split.map!(to!int);
        A[i] = tuple(s[0], s[1], s[2]);
    }
    A.sort!"a[1] - a[0] < b[1] - b[0]"();

    auto pq = new BinaryHeap!(Array!long, "a < b")();
    auto ans1 = new long[](N);
    long tmp = 0;

    foreach (i; 0..N) {
        ans1[i] = tmp;
        tmp += A[i][0];
        pq.insert(A[i][2] - A[i][0]);
        if (i + 1 > X) {
            auto t = pq.front;
            pq.popFront;
            tmp += t;
        }
    }

    
    pq.clear;
    auto ans2 = new long[](N);
    tmp = 0;
    
    foreach (i; 0..N) {
        ans2[i] = tmp;
        tmp += A[N-i-1][1];
        pq.insert(A[N-i-1][2] - A[N-i-1][1]);
        if (i + 1 > Y) {
            auto t = pq.front;
            pq.popFront;
            tmp += t;
        }
    }


    long ans = 0;
    foreach (i; 0..N) {
        if (i >= X && N - i >= Y) ans = max(ans, ans1[i] + ans2[N-i]);
    }

    ans.writeln;
}


Measured memory_bytes: 6052
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

LL dp[18][10];

int main() {
  int K; cin >> K;
  if (K < 10) {
    cout << K << endl;
    return 0;
  }

  for (int i = 0; i < 10; ++i) dp[0][i] = 1LL;
  LL sum = 9LL;

  int k, i;
  for (k = 1; k < 18; ++k) {
    dp[k][0] = dp[k-1][0] + dp[k-1][1];

    for (i = 1; i <= 8; ++i) {
      dp[k][i] = dp[k-1][i-1] + dp[k-1][i] + dp[k-1][i+1];
      sum += dp[k][i];
      if (sum >= K) break;
    }
    if (sum >= K) break;

    ++i;
    dp[k][9] = dp[k-1][8] + dp[k-1][9];
    sum += dp[k][9];
    if (sum >= K) break;

  }

  sum -= dp[k][i];
  cout << i;
  for (; k > 0; --k) {
    if (i != 0) {
      if (sum + dp[k-1][i-1] >= K) {
        --i; cout << i;
        continue;
      }
      sum += dp[k-1][i-1];
    }

    if (sum + dp[k-1][i] >= K) {
      cout << i;
      continue;
    }

    sum += dp[k-1][i];
    ++i; cout << i;
  }
  cout << endl;
}


Measured memory_bytes: 256
import sys, math
from collections import defaultdict
from copy import deepcopy
import itertools
input = sys.stdin.readline
# 文字列の場合は普通のinput()を使うか下を使う
# input = sys.stdin.readline().rstrip()

N = int(input())
#print('pre={}, post={}'.format(N/1.08, (N+1)/1.08))

if math.floor(N / 1.08) == N / 1.08:
    print(math.floor(N / 1.08))
elif math.floor((N + 1) / 1.08) == (N + 1) / 1.08:
    X = math.floor((N + 1) / 1.08) - 1
    Y = N / 1.08
    if Y < X:
        print(X)
    else:
        print(':(' )
else:
    X = math.floor((N + 1) / 1.08)
    Y = N / 1.08
    if Y < X:
        print(X)
    else:
        print(':(' )

Measured memory_bytes: 38256
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
#define MOD_BIG2 998244353
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using std::vector;

template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}

//////////////////////////////////////

//////////////////////////////////////

int main() {
    
    int N;
    cin >> N;
    
    ll ans = 0;
    for (int i = 1; i <= N/2; i++) {
        if (N - i > 1 && N-i != i) {
            ans += 1;
        } else {
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>
#include <unordered_map>
#include <bitset>

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

struct dish{
  LL a;
  LL b;
};

int xcomp(dish& a, dish& b) {
  return a.a + a.b > b.a+b.b;
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

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

  LL N;
  cin >> N;
  vector<dish> v(0);
  REP(i,N){
    LL a, b;
    cin >> a >> b;
    v.push_back(dish{a, b});
  }
  XSORT(v);

  LL ans = 0;
  REP(i,N){
    if(i%2==0){
      ans += v[i].a;
    }
    else
    {
      ans -= v[i].b;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string x;

	cin>>x;
 /*  for(int i=0;i<4;i++)
   {
       x=a%10;
       a/=a;
       arr[i]=x;
   }*/
if((x[0]==x[1]&&x[1]==x[2]&&x[2]==x[3])||(x[1]==x[2]&&x[2]==x[3])||(x[0]==x[1]&&x[1]==x[2]))
    cout<<"Yes";
else
    cout<<"No";
	return 0;
	}





Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 2000000000
#define InfLL 4000000000000000000LL
#define mod 998244353
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	string S;
	int K, M;
	cin >> S >> K;
	S.push_back('0');
	M = S.length();
	vi count1;
	int N = 0;
	int counttmp = 0;
	rep(i, M) {
		if (S[i] == '0') {
			count1.push_back(counttmp);
			counttmp = 0;
			N++;
		}
		else
			counttmp++;
	}
	reverse(count1.begin(), count1.end());
	vector<vector<vl>> DP(N + 1);
	vector<vector<vl>> DPsumk(N + 1);
	int summax = 310;
	rep(i, N + 1) {
		DP[i].resize(summax);
		DPsumk[i].resize(summax);
		rep(s, summax) {
			DP[i][s].resize(summax, 0);
			DPsumk[i][s].resize(summax, 0);
		}
	}
	DP[0][0][0] = 1;
	int sumtmp = 0;
	rep(i, N - 1) {
		sumtmp += count1[i];
		rep(sprev, sumtmp + 1) {
			rep(snext, sumtmp + 1) {
				int s = snext - sprev;
				if (s < 0)
					continue;
				rep(kprev, sumtmp + 1) {
					int knext = kprev;
					knext += max(0, count1[i] - s);
					DP[i + 1][snext][knext] += DP[i][sprev][kprev];
					DP[i + 1][snext][knext] %= mod;
				}
			}
		}
	}
	ll ans = 0;
	K = min(K, sumtmp);
	rep(s, sumtmp + 1) {
		rep(k, K + 1) {
			ans += DP[N - 1][s][k];
			ans %= mod;
		}
	}

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

Measured memory_bytes: 462728
# アライグマがN種の必殺技を2回以上使わずに体力Hのモンスターを倒せるか

H, N = map(int, input().split())
A = list(map(int, input().split()))
attack = sum(A)

if H > attack:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 20572
def gcd(a,b):
    if a == 0:
        return b
    return gcd(b%a,a)

K = input()
K = int(K)
ans = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            ans += gcd(a,gcd(b,c))

print(ans)

Measured memory_bytes: 76464
#include <iostream>
#include <stack>

using namespace std;

int main()
{
  int val;
  stack<int> stk;

  while(cin>>val){
    if(val == 0){
      cout << stk.top() << endl;
      stk.pop();
    }
    else stk.push(val);
  }

  return 0;
}

Measured memory_bytes: 1200
s=input()
n=int(input())
rev=1
pre=''
suf=''

for i in range(n):
  q=input().split()
  if q[0]=='1':
    rev+=1
  elif (rev+int(q[1]))%2==0:
    pre=q[2]+pre
  else:
    suf=suf+q[2]
    
ans=pre+s+suf
  
if rev%2==0:
  print(ans[::-1])
else:
  print(ans)

Measured memory_bytes: 4612
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int n,a,sum=0;
  cin>>n;
  a=n;
  while(n>0){
    sum+=n%10;
    n/=10;
  }
  if(a%sum==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}






Measured memory_bytes: 256
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]

dp = [[0, 0, 0] for _ in range(n + 1)]

for i in range(n):
    for j in range(3):
        dp[i + 1][j] = max(dp[i][(j + 1) % 3] + a[i][j], dp[i][(j + 2) % 3] + a[i][j])

print(max(dp[n]))

Measured memory_bytes: 78424
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.StringBuilder;

/*Question
/?????????????????????????¨??????????????????§?????????????°????????????????????????????????????´???????????¢?????´???????????§??????
/1 selectionSort(A, N) // N??????????´??????????0-?????????????????????A
/2 for i ??? 0 ?????? N-1 ?????§
/3 minj = i
/4 for j ??? i ?????? N-1 ?????§
/5 if A[j] < A[minj]
/6 minj = j
/7 A[i] ??¨ A[minj] ?????????
/??°???A??????????????????????????????????????¢?????´???????????§?????????????????????????????????????????°????????????????????????????????????
/????????????????????????????????¢?????´????????????????£??????????????????????
/??????????????? 7 ????????§???i ??¨ minj ?????°?????????????????????????????????????????°?????????????????????????????? 
*/

/*Input
/??\??????????????????????????°?????????????????¨?????´??° N ???????????????????????????????????????N ????????´??°????????????????????§????????????????????? 
*/

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		//???????????°????¢??????¨
		int k;
		/*??\???
		/??????????´???°?????\???????¬??????°????????\???
		*/
		int n = Integer.parseInt(sc.readLine());
		int[] a = new int[n];
		String[] st = sc.readLine().split(" ");
		for(int i = 0;i < n;i++){
			a[i] = Integer.parseInt(st[i]);
		}
		/*??°??????Selection???????????????
		/????????????????????§?????????????????????
		/??????????????£??????????????§??????
		*/
		k = Selection(a);
		System.out.println(k);
	}

	/*Selection????????????
	/???????????????????????????
	/?????????????????????????????????????????????????????°??¨??????????????????????±?????°????????????°????????????????¨???¶??????
	/??¨???????????´???????????°??¨????????????????¨???¶?????????????????????????????¨??\????????????
	@return int
	*/

	public static int Selection(int[] a) {
		//????????¨
		StringBuilder br = new StringBuilder();
		//?????°???????????????
		int s = 0;
		//????????????????????????????????\????????¨
		int min,t;
		for (int i = 0;i < a.length;i++) {
			min = i;
			for (int j = i + 1;j < a.length;j++) {
				if (a[j] < a[min]) min = j;
			}
			if (min != i){
				t = a[i];
				a[i] = a[min];
				a[min] = t;
				s++;
			}
		}
		//??????
		for (int n:a)
			br.append(n+" ");
		br.deleteCharAt(br.lastIndexOf(" "));
		System.out.println(br);
		return s;
	}
}

Measured memory_bytes: 24348