akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(){
	int n;
	int a[100];
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	for (int i = n - 1; i >-1; i--){
		if (i == n - 1){
			cout << a[i];
		}
		else{
			cout << " " << a[i];
		}
	}
	cout << endl;
	return 0;
}

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

using namespace std;

#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define PB push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

long double EPS = 1e-9;

const int MOD = 1e9+7;

int binExp(int x, int p){
	int ans = 1;
	while(p){
		if(p&1)
			ans = 1LL * ans * x % MOD;
		p >>= 1;
		x = 1LL * x * x % MOD; 
	}
	return ans;
}

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


	int n; cin >> n;
	ll ans = 0;
	for(int i = 1; i < n; i++){
		int aux = n-i;
		int cnt = 0;
		for(int j = 1; j * j <= aux; j++){
			if(aux%j == 0){
				if(j * j == aux) cnt++;
				else cnt += 2;
			}
		}
		ans = (ans + cnt) % MOD;
	}

	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
using namespace std;
int main()
{
	int n,m=100,a,s=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		s+=a;
		if(a%10)m=min(m,a);
	}
	if(s%10==0)s-=m;
	cout<<(s%10?s:0)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a;i < b;i++)
#define F first
#define S second
#define pb push_back
#define mk make_pair
#define debug(a) cerr << #a << " = " << a << endl;
#define debug2(a,b) cout << #a << " = " << a << " --- " << #b << " = " << b << endl;
#define debugP(a) cout << a.F << " " << a.S << endl;
#define debugV(v, n) { rep( i, 0, n ) { if(i) printf(" "); printf("%d", v[i]); } printf("\n"); }
#define debugM(mat,n,m) rep( i, 0, n ){ rep( j, 0, m ) { if(j) printf(" "); printf("%d", mat[i][j]); } printf("\n"); }
#define all(c) (c).begin(),(c).end()
typedef long long int ll;
typedef pair<ll,ll> ii;
const int INF = 0x3f3f3f3f;

ll pd[2020];

ll solve(int s){
	if(pd[s] != -1) return pd[s];
	if(s == 0) return 1;
	if(s < 3) return 0;
	ll ans=0;
	rep(i,3,s+1){
		ans = (ans + solve(s-i)%1000000007)%1000000007;
	}
	return pd[s] = ans;
}

int main(){
	int n;
	ll ans;
	while(cin >> n){
		memset(pd,-1,sizeof pd);
		printf("%lld\n",solve(n));
	}
 	return 0;
}

Measured memory_bytes: 3796
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int MAXN = 5000+9;
double A,B,C,D,E,F;
int dp[MAXN];
int sugar[MAXN];

void solve(){
	dp[0]=1;sugar[0]=1;
	for(double i=1;i<=F;i++){
		if(i>=100.0*A){
			dp[(int)i]|=dp[(int)i-100*(int)A];
		}
		if(i>=100.0*B){
			dp[(int)i]|=dp[(int)i-100*(int)B];
		}
	}
	for(double i=1;i<=F;i++){
		if(i>=C){
			sugar[(int)i]|=sugar[(int)i-(int)C];
		}
		if(i>=D){
			sugar[(int)i]|=sugar[(int)i-(int)D];
		}
	}
	double ans_w=0,ans_s=0;
	double val=0;
	double i,j;
	for(i=0;i<=F;i++){
		for(j=F-i;j>=0;j--){
			if(dp[(int)i] && sugar[(int)j]){
				if(E*i/100.0>=j){
					if(100.0*j/(i+j)>val){
						val=100.0*j/(i+j);
						ans_w=i+j;ans_s=j;
					}
				}
			}
		}
	}
	if(val!=0){
		printf("%.0lf %.0lf\n",ans_w,ans_s);
	}
	else
		printf("%.0lf 0\n",100.0*A);
}

int main(){
	scanf("%lf%lf%lf%lf%lf%lf",&A,&B,&C,&D,&E,&F);
	solve();
	return 0;
}


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

int MOD=1000000007;
int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}

int gyaku(int n){
    return modpow(n,MOD-2);
}

int n,m,k;

bool can(int x,vector<int>sa,vector<int>sb){
  int count=0;

  rep(i,x+1){
    if(i<=n&&x-i<=m){
    count=sa[i];
    count+=sb[x-i];
    if(count<=k) return true;
  }
  }

  return false;
}

signed main() {
  cin>>n>>m>>k;
  vector<int>sa(n+1);
  vector<int>sb(m+1);


rep(i,n){
  int t;
  cin>>t;
  if(sa[i]>1000000000){sa[i+1]=INF;}
  else sa[i+1]=sa[i]+t;
}
rep(i,m){
  int t;
  cin>>t;
  if(sb[i]>1000000000){sb[i+1]=INF;}
  else sb[i+1]=sb[i]+t;
}
int l=0,r=n+m+1;
while(r-l>1){
  int mid=(r+l)/2;
  if(can(mid,sa,sb)){l=mid;}
  else r=mid;
}
cout<<l<<endl;

}


Measured memory_bytes: 9588
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int L, R, d; cin >> L >> R >> d;
  int ans = 0;
  for(int i=L; i<=R; i++) {
    if(i%d == 0) ans++;
  }
  cout << ans << endl;

}

Measured memory_bytes: 3620
#include<cstdio>
#include<iostream>

using namespace std;

int main(){
	int i;
	char a[111], b[111], c[111];
	int n, m, k;
	while(~scanf("%s %s %s", a, b, c)){
		if(a[0] >= 'a' && a[0] <= 'z') n = a[0] - 32;
		if(b[0] >= 'a' && b[0] <= 'z') m = b[0] - 32;
		if(c[0] >= 'a' && c[0] <= 'z') k = c[0] - 32;
		printf("%c%c%c\n", n, m, k);
	}
	return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
L=[]
R=[]
for i in range(M):
    l,r=map(int,input().split())
    L.append(l)
    R.append(r)
max_l=max(L)
min_r=min(R)
if min_r-max_l>=0:
    print(min_r-max_l+1)
else:
    print(0)

Measured memory_bytes: 10980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n) for (int i = n; 0<i;i--)
#define print(out) cout<< out  << "\n";
#define mod 1000000007
const int INF = 1e9;

int main(){
  int N;string S;
  cin>>N>>S;
  if(N%2==1){
    print("No")
    return 0;
  }
  string pre=S.substr(0,S.size()/2),suf=S.substr(S.size()/2,S.size()/2);
  //print(pre<<suf)
  print((pre==suf?"Yes":"No"))
}


Measured memory_bytes: 256
<?php
$a = [];
while(true)
{
    $in = explode(" ", trim(fgets(STDIN)));
    if($in[0] == 0 && $in[1] == 0)
    {
        break;
    }
    else
    {
        $a[] = $in;
    }

}
for($i = 0; $i < count($a); $i++)
{
    if($a[$i][0] > $a[$i][1])
    {
        echo $a[$i][1] . " " . $a[$i][0] . "\n";
    }
    else
    {
        echo $a[$i][0] . " " . $a[$i][1] . "\n";
    }
}

Measured memory_bytes: 16524
import java.util.Scanner;


public class Main {
	static String S;
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
			 S = sc.next();
		sc.close();

		int ans = 0 ;
		for (int i = 0; i < S.length(); i++) {
			if(String.valueOf(S.charAt(i)).equals("1")){
				ans++;
			}
		}

		System.out.println(ans);

	}
}


Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#else
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
 public:
  void solve() {
    int n;
    cin >> n;
    map<i64, i64> mp;
    i64 ans = 0;
    for (int i = 1; i <= n; ++i) {
      i64 t;
      cin >> t;
      ans += mp[i - t];
      mp[i + t]++;
    }
    cout << ans << "\n";
  }
} NSPACE;
int main() {
  FPEN;
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  NSPACE.solve();
}

Measured memory_bytes: 26360
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


class BIT:
    def __init__(self, size):
        self.bit = [0] * size
        self.size = size
        self.total = 0

    def add(self, i, w):
        x = i + 1
        self.total += w
        while x <= self.size:
            self.bit[x - 1] += w
            x += x & -x
        return

    def sum(self, i):
        res = 0
        x = i + 1
        while x:
            res += self.bit[x - 1]
            x -= x & -x
        return res

    def interval_sum(self, i, j): # i <= x < j の区間
        return self.sum(j - 1) - self.sum(i - 1)

    def search(self, k):
        if k > self.total or k <= 0:
            return -1
        step = 1 << (self.size.bit_length() - 1)
        now_index = 0
        ret = 0
        while step:
            if now_index + step < self.size and ret + self.bit[now_index + step - 1] < k:
                ret += self.bit[now_index + step - 1]
                now_index += step
            step >>= 1
        # now_indexを伸ばしいって、sumがk以上に達する直前まで伸ばし続けるならreturnのところでnow_index - 1。
        # その場合、bit.sum(now_index - 1) <= k < bit.sum(now_index)
        # 達してすぐのindexであれば-1しない
        return now_index

n = I()
P = LI()
val_idx = {P[j]:j+1 for j in range(n)}
bit = BIT(n + 2)
bit.add(n + 1, 1)
bit.add(0, 1)
ans = 0
for k in range(n, 0, -1):
    idx = val_idx[k]
    m = bit.sum(idx)
    l1 = bit.search(m - 1)
    l2 = bit.search(m)
    r1 = bit.search(m + 1)
    r2 = bit.search(m + 2)
    if l1 >= 0:
        ans += (l2 - l1) * (r1 - idx) * k
    if r2 >= 0:
        ans += (idx - l2) * (r2 - r1) * k
    bit.add(idx, 1)

print(ans)

Measured memory_bytes: 62408
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> Point;

typedef map<int, pair<int, long long> > mipill;

int main()
{
	int n;
	scanf("%d", &n);
	
	rep(i, n){
		int out = 0;
		int point = 0;
		bool base[3] = {false};

		while(out < 3){
			char str[8];
			scanf("%s", str);
			if(strcmp(str, "HIT") == 0){
				point += base[2];
				for(int j=2; j>0; --j)
					base[j] = base[j-1];
				base[0] = true;
			}else if(strcmp(str, "HOMERUN") == 0){
				++point;
				rep(i, 3){
					point += base[i];
					base[i] = false;
				}
			}else
				++out;
		}
		printf("%d\n", point);
	}

	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
using namespace std;

#define MAX_H 30
#define MAX_W 30

#define INF (1<<28)

int w, h;
int F[MAX_H][MAX_W];
int cost[4];

int dp[MAX_H][MAX_W][4];
struct P {
    int y, x;
    int d;
    P() {}
    P(int y, int x, int d) : y(y), x(x), d(d) {}
};
#define N 0
#define E 1
#define S 2
#define W 3

#define Straight 0
#define Right 1
#define Reverse 2
#define Left 3
int C(int y, int x, int from, int to) { // calculate cost
    switch ((4+from-to) % 4) {
        case 0:
            if (F[y][x] == Straight) return 0;
            return cost[Straight];
        case 1:
            if (F[y][x] == Left) return 0;
            return cost[Left];
        case 2:
            if (F[y][x] == Reverse) return 0;
            return cost[Reverse];
        case 3:
            if (F[y][x] == Right) return 0;
            return cost[Right];
    }
}

const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int nd[] = {S, E, N, W};
void solve() {
    for (int i = 0; i < h; i++) 
        for (int j = 0; j < w; j++)
            for (int k = 0; k < 4; k++) 
                dp[i][j][k] = INF;
    queue<P> q;
    q.push(P(0, 0, E));
    dp[0][0][E] = 0;
    while (!q.empty()) {
        P p = q.front(); q.pop();
        for (int i = 0; i < 4; i++) {
            int ny = p.y + dy[i];
            int nx = p.x + dx[i];
            if (ny < 0 || h <= ny || nx < 0 || w <= nx) continue;
            int c = dp[p.y][p.x][p.d] + C(p.y, p.x, p.d, nd[i]);
            if (dp[ny][nx][nd[i]] <= c) continue;
            q.push(P(ny, nx, nd[i]));
            dp[ny][nx][nd[i]] = c;
        }
    }
}

int main() {
    while (scanf("%d %d", &w, &h), w || h) {
        for (int i = 0; i < h; i++) 
            for (int j = 0; j < w; j++)
                scanf("%d", &F[i][j]);
        for (int i = 0; i < 4; i++) 
            scanf("%d", &cost[i]);
        solve();
        int min_cost = INF;
        //for (int k = 0; k < 4; k++) {
        //    for (int i = 0; i < h; i++) {
        //        for (int j = 0; j < w; j++) {
        //            printf("%d ", dp[i][j][k]);
        //        }
        //        printf("\n");
        //    }
        //    printf("\n");
        //}

        for (int i = 0; i < 4; i++) 
            min_cost = min(dp[h-1][w-1][i], min_cost);
        printf("%d\n", min_cost);
    }
    return 0;
}

Measured memory_bytes: 1092
main :: IO()
main = getContents >>= mapM_ (putStrLn . unwords . map show . (\[x, y] -> [gcd x y, lcm x y])) . (mapMap read . wordsLines)

wordsLines :: String -> [[String]]
wordsLines = map words . lines

mapMap :: (a -> b) -> [[a]] -> [[b]]
mapMap f = map (map f)


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

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

    std::vector<int> input(3);
    for(auto& i : input){
        std::cin >> i;
    }
    std::sort(input.begin(), input.end());
    for(int i=0; i<3; ++i){
        std::cout << input[i] << ((i!=2)?" ":"\n");
    }
    return 0;
}

Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for( int i=a; i<b; i++ )
#define REP(i,n) rep(i,0,n)
#define INF 1000000
using lli = long long int;
using ulli = unsigned long long int;
typedef pair<int, int> P;

struct edge{ int u, v; lli cost; };
struct DirectedGraph
{
  int vertex_num;
  int edge_num;
  vector<edge> edge_list;
  vector< vector<int> > adj_list;
	vector< vector<lli> > distance_matrix;
};


template <typename T>
vector<int> argsort(const vector<T> &v) {

  // initialize original index locations
  vector<int> idx(v.size());
  iota(idx.begin(), idx.end(), 0);

  // sort indexes based on comparing values in v
  sort(idx.begin(), idx.end(),
       [&v](int i1, int i2) {return v[i1] < v[i2];});

  return idx;
}

template<typename T>
void displayVector(vector<T> v)
{
	lli n = v.size();
	REP(i,n){
		cout << v[i] << " " ;
	}
	cout << endl;
}

int main(){
  int l,r,d; cin >> l >> r >> d;
  int res = 0;
  rep(i,l,r+1){
    if(i%d==0){ res++; }
  }
  cout << res << endl;
	return 0;
}

Measured memory_bytes: 3628
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fi first
#define se second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>
 
using std::cin;
using std::cout;
using std::endl;
 
typedef long long ll;
typedef unsigned long long ull;
 
const int N = 100000 + 5;
const int M = 1000 + 5;
const int K = 1e7 + 5;
const int MOD = 1e9 + 7;
const int inv2 = 500000004;
const int LOG = 40;
const ull BASE = 19260817;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };
// const double PI = acos(-1);
const double PI = 3.14159;

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
 
template<class T>
inline T readT() {
    T res = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res * f;
}
#define read readT<int>

namespace Comb{
const int N = 10 + 5;
inline void exgcd(ll a, ll b, ll &g, ll &x, ll &y) {
    if (!b) g = a, x = 1, y = 0;
    else exgcd(b, a % b, g, y, x), y -= x * (a / b);
}
 
inline ll inv(ll a) {
    ll g, res, tmp;
    exgcd(a, MOD, g, res, tmp);
    return ((res % MOD) + MOD) % MOD;
}
 
ll f[N], invFact[N];
 
inline void prepare() {
    f[0] = 1;
    int n = 200000;
    for (int i = 1; i <= n; i++) f[i] = f[i - 1] * i % MOD;
    invFact[n] = inv(f[n]);
    for (int i = n - 1; i >= 1; i--) invFact[i] = invFact[i + 1] * (i + 1) % MOD;
}
 
inline ll C(int n, int m) {
    if (!m) return 1;
    if (n == m) return 1;
    if (m > n) return 0;
    if (m < 0) return 0;
    return f[n] * invFact[m] % MOD * invFact[n - m] % MOD;
}
}

int h, n;
int a[10005], b[10005];
int f[N];

int main() {
    cin >> h >> n;
    for (int i = 1; i <= n; i++) scanf("%d %d", &a[i], &b[i]);
    memset(f, 0x3f, sizeof(f));
    f[0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = a[i]; j <= 100000; j++) {
            chkmin(f[j], f[j - a[i]] + b[i]);
        }
    }
    int ans = 0x3f3f3f3f;
    for (int i = h; i <= 100000; i++) chkmin(ans, f[i]);
    printf("%d\n", ans);
    return 0;
}

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

int main() {
        int i, j;
        int n;
        cin >> n;
        deque<int> dq;
        for (int i = 0; i < n; i ++) {
                int a;
                cin >> a;
                if (n & 1) {
                        if (i & 1) dq.push_front(a);
                        else dq.push_back(a);
                } else {
                        if (i & 1) dq.push_back(a);
                        else dq.push_front(a);
                }
        }
        while (!dq.empty()) {
                int ans = dq.back();
                dq.pop_back();
                if (!dq.empty()) cout << ans << ' ';
                else cout << ans << endl;
        }
        return 0;
}



Measured memory_bytes: 2944
from fractions import gcd

def solve(N, M, S, T):
    d = gcd(N, M)
    n = N // d
    m = M // d
    
    for i in range(d):
        if S[n*i] != T[m*i]:
            return -1
    return n * m * d
	

N, M = list(map(int, input().split()))
S = input()
T = input()
print(solve(N, M, S, T))

Measured memory_bytes: 5432
#![allow(non_snake_case)]
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let S:String = sc.read();
    let mut ans:usize = 0;

    if S == "SUN"{
        ans = 7;
        println!("{}", ans);
    }else if S == "MON" {
        ans = 6;
        println!("{}", ans);
    }else if S == "TUE" {
        ans = 5;
        println!("{}", ans);

    }else if S == "WED" {
        ans = 4;
        println!("{}", ans);

    }else if S == "THU" {
        ans = 3;
        println!("{}", ans);

    }else if S == "FRI" {
        ans = 2;
        println!("{}", ans);

    }else if S == "SAT" {
        ans = 1;
        println!("{}", ans);
        
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
        .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}




Measured memory_bytes: 4352
#include <bits/stdc++.h>
 
using namespace std;
 
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }
 
typedef long long ll;
int const inf = INT_MAX / 2;
 
int main() {
  int N, K; cin >> N >> K;
  int sum = 0, max = 0;
  vector<int> p(N);
  rep(i, N) {
    cin >> p[i];
    sum += p[i];
    if (i - K >= 0) {
      sum -= p[i - K];
    }
    max = std::max(max, sum);
  }
  printf("%.20f\n", (max + K) / 2.0);
}

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

int main(){
	int n;
	cin >> n;
	for(int loop=0;loop<n;loop++){
		int y,m,d;
		cin >> y >> m >> d;
		
		int ans = 0;
		
		if(y%3 == 0){
			ans += 21 - d;
			m++;
			while(m<11){
				ans+=20;
				m++;
			}
		}else{
			if(m%2==0){
				ans += 20 - d;
				m++;
			}else{
				ans += 21 - d;
				m++;
			}
			while(m<11){
				if(m%2==0){
					ans+=19;
				}else{
					ans+=20;
				}
				m++;
			}
		}

		y++;

		int ty = 20*10;
		int ny = 19*5+20*5;

		for(;y<1000;y++){
			if(y%3==0){
				ans += ty;
			}else{
				ans += ny;
			}
		}
		
		cout << ans << endl;
	}
}

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

int main() {
    string S;
    cin >> S;
    int N = S.size();
    
    rep(i,N){
        cout << 'x' ;
      //  cout << endl;
    }
    cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s,t;
  int count =0;
  cin>>s;
  cin>>t;
  
  int l1 = s.length();
  int l2 = t.length();
  
  for( int i=0,j=0;i<l1,j<l2;i++,j++)
  {
    
      
      if(i!=j)
      {
        continue;
      }
      else if(s[i]!=t[j])
      {
        count++;
      }
    
    
  }
  cout<<count<<endl;
  count=0;
  return 0;
}


Measured memory_bytes: 3880
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
typedef long long ll;
using namespace std;

int main(void){
  int n,i,pi,mi;
  int ap[100000],am[100000];
  int a;
  cin>>n;
  pi=mi=0;

  if(n==2){
    cin>>ap[0]>>ap[1];
    if(ap[0]>ap[1]){
      cout<<ap[0]-ap[1]<<endl;
      cout<<ap[0]<<" "<<ap[1]<<endl;
      return 0;
    }
    else{
      cout<<ap[1]-ap[0]<<endl;
      cout<<ap[1]<<" "<<ap[0]<<endl;
      return 0;
    }
  }

  for(i=0;i<n;i++){
    cin>>a;
    if(a<0){
      am[mi]=a;
      mi++;
    }
    else{
      ap[pi]=a;
      pi++;
    }
  }

  sort(am,am+mi);
  sort(ap,ap+pi);

  if(mi==0){
    int tmp=ap[0]-ap[1];
    //out<<am[0]<<" "<<am[1]<<endl;
    for(i=2;i<n-1;i++){
      //cout<<tmp<<" "<<am[2]<<endl;
      tmp=tmp-ap[i];
    }
    //cout<<am[n-1]<<" "<<tmp<<endl;
    cout<<ap[n-1]-tmp<<endl;

    tmp=ap[0]-ap[1];
    cout<<ap[0]<<" "<<ap[1]<<endl;
    for(i=2;i<n-1;i++){
      cout<<tmp<<" "<<ap[i]<<endl;
      tmp=tmp-ap[i];
    }
    cout<<ap[n-1]<<" "<<tmp<<endl;
  }
  else if(pi==0){
    int tmp=am[n-1];
    for(i=n-2;i>=0;i--){
      //cout<<tmp<<" "<<am[i];
      tmp=tmp-am[i];
    }
    cout<<tmp<<endl;

    tmp=am[n-1];
    for(i=n-2;i>=0;i--){
      cout<<tmp<<" "<<am[i]<<endl;
      tmp=tmp-am[i];
    }
  }
  else{
    int tmp=am[0];
    for(i=0;i<pi-1;i++){
      //cout<<tmp<<" "<<ap[i]<<endl;
      tmp=tmp-ap[i];
    }
    //cout<<ap[pi-1]<<" "<<tmp<<endl;
    tmp=ap[pi-1]-tmp;

    for(i=1;i<mi;i++){
      //cout<<tmp<<" "<<am[i]<<endl;
      tmp=tmp-am[i];
    }
    cout<<tmp<<endl;

    tmp=am[0];
    for(i=0;i<pi-1;i++){
      cout<<tmp<<" "<<ap[i]<<endl;
      tmp=tmp-ap[i];
    }
    cout<<ap[pi-1]<<" "<<tmp<<endl;
    tmp=ap[pi-1]-tmp;

    for(i=1;i<mi;i++){
      cout<<tmp<<" "<<am[i]<<endl;
      tmp=tmp-am[i];
    }
  }



	return 0;
}

Measured memory_bytes: 2304
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){

  int N,gomi,hito[10];
  string c;

  while(1){
    
    cin >>N;
    
    if(N == 0)break;

    gomi=0;
   
    for(int i=0 ; i < 10 ; i++)hito[i]=0;
  
    cin >>c;
    
    for(int i=0 ; i < 100 ; i++){
      
      if(c[i] == 'M'){
	hito[i%N]++;
      }else if(c[i] == 'S'){
	gomi+=hito[i%N]+1;
	hito[i%N]=0;
      }else if(c[i] == 'L'){
	hito[i%N]+=gomi+1;
	gomi=0;
      }

    }

    sort(hito,hito+N);
      
    for(int i=0 ;i < N ; i++){
      cout <<hito[i]<<" ";
    }
    cout <<gomi<<endl;

  }
  return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 200005;
ll a[MAX_N],ans[MAX_N];

int main()
{
	int N;
	cin >> N;
	ll al = 0;
	rep(i,N)
	{
		cin >> a[i];
		al ^= a[i];
	}
	rep(i,N)
	{
		if (i != 0) cout << " ";
		ll ans = a[i] ^ al;
		cout << ans;
	}
	return 0;
}

Measured memory_bytes: 5188
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>

using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector <int> a(n+1,0);
    for (int i=1; i<=n; i++){
        cin >> a[i];
    }
    vector <int> b (20,0);
    int v;
    int dist;
    int prev = 0;
    int r;
    long long ans = 0;
    for (int i=1; i<=n; i++){
        v = a[i];
        r = 0;
        dist = 0;
        while (v!=0){
            if (v%2==1){
              dist = max(dist,b[r]);
            }
            v = v/2;
            r++;
        }
        long long q = min(i - dist, prev+1);
        prev = q;
        ans +=q;
        v = a[i];
        r = 0;
        while (v!=0){
            if (v%2==1){
                b[r] = i;
            }
            v = v/2;
            r++;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int n,X;
  cin>>n>>X;
  vin x(n);
  int mn=inf;
  rep(i,0,n) {
    cin>>x[i];
  mn=min(mn,x[i]);
    X-=x[i];
  }
  cout<<n+X/mn<<endl;
}

Measured memory_bytes: 3620
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		while(stdIn.hasNext())
		{
			int[] c = new int[3];
			for(int i = 0; i < c.length; ++i)
			{
				c[i] = stdIn.nextInt();
			}
			boolean[] flag = new boolean[11];
			for(int i = 0; i < flag.length; ++i)
			{
				flag[i] = true;
			}
			flag[c[0]] = flag[c[1]] = flag[c[2]] = false;
			int sum = c[0] + c[1];
			int count = 0;
			for(int i = 1; i < flag.length; ++i)
			{
				if(flag[i] && sum + i <= 20)
				{
					++count;
				}
			}
			if(count >= 4)
			{
				System.out.println("YES");
			}
			else
			{
				System.out.println("NO");
			}
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun May 24 17:49:37 JST 2020
 **/

signed main() {
    Int n;
    std::cin >> n;
    std::vector<Int> a(n);
    REP(i, n) std::cin >> a[i];
    Int Q;
    std::cin >> Q;
    REP(q, Q) {
        Int com, b, e;
        std::cin >> com >> b >> e;
        if (com == 0) {
            std::cout << *std::min_element(a.begin() + b, a.begin() + e) << "\n";
        } else {
            std::cout << *std::max_element(a.begin() + b, a.begin() + e) << "\n";
        }
    }
}



Measured memory_bytes: 3144
while True:
    try:
        s=input()
        s=s.replace(","," ")
        s=s.replace("."," ")
        s=s.split(" ")
        ans=[]
        for w in s:
            if len(w)>=3 and len(w)<=6:
                ans.append(w)
        print(" ".join(ans))
    except EOFError:
        break



Measured memory_bytes: 5556
from sys import stdin
from copy import deepcopy

INF = 1000000007

def partition(A, p, r):
    v = A[r]
    i = p
    for j in range(p, r):
        if A[j][1] <= v[1]:
            A[i], A[j] = A[j], A[i]
            i += 1
    A[i], A[r] = A[r], A[i]
    return i

def quicksort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quicksort(A, p, q-1)
        quicksort(A, q+1, r)

# l <= m < rの範囲をマージ
def merge(A, l, m, r):
    L = A[l:m] + [("?", INF)]
    R = A[m:r] + [("?", INF)]
    li = 0
    ri = 0
    for j in range(l, r):
        if L[li][1] <= R[ri][1]:
            A[j] = L[li]
            li += 1
        else:
            A[j] = R[ri]
            ri += 1

def mergeSort(A, l, r):
    if r-l > 1:
        mid = l + (r-l)//2
        mergeSort(A, l, mid)
        mergeSort(A, mid, r)
        merge(A, l, mid, r)

def isStable(A, sorted_A):
    stable_A = deepcopy(A)
    mergeSort(stable_A, 0, len(stable_A))
    for i in range(len(A)):
        if stable_A[i] != sorted_A[i]:
            return False

    return True

n = int(stdin.readline().rstrip())
cards = []
for _ in range(n):
    s, num = stdin.readline().rstrip().split()
    cards.append((s, int(num)))

sorted_cards = deepcopy(cards)
quicksort(sorted_cards, 0, n-1)
if isStable(cards, sorted_cards):
    print("Stable")
else:
    print("Not stable")

for card in sorted_cards:
    print(*card)



Measured memory_bytes: 19136
use proconio::input;

// use std::cmp::*;
use std::collections::HashMap;

fn main() {
    input! {
        s:String
    }

    let mut map: HashMap<char, i32> = HashMap::new();
    for c in s.chars() {
        *map.entry(c).or_insert(0) += 1;
    }
    let mut flg = true;
    for i in map.values() {
        if i % 2 == 1 {
            flg = false;
            break;
        }
    }

    println!("{}", if flg { "Yes" } else { "No" });
}


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

int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    int dp[n];
    dp[0] = 0;
    dp[1] = abs(a[1] - a[0]);
    for(int i = 2; i < n; i++)
    {
        dp[i] = min(dp[i-1]+abs(a[i] - a[i-1]), dp[i-2]+abs(a[i] - a[i-2]));
    }
    cout << dp[n-1] << endl;
    return 0;
}


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

int main() {
  vector<int> ans(101);
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  for (int i = A; i < B; i++) {
    ans.at(i)++;
  }
  for (int i = C; i < D; i++) {
    ans.at(i)++;
  }
  int cnt = 0;
  for (int i = 0; i < 101; i++) {
    if (ans.at(i) == 2) cnt++;
  }
  cout << cnt << "\n";
}

Measured memory_bytes: 3572
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	immutable MAX = 1000000;

	bool p[MAX];
	p[] = 1;
	p[0..1] = 0;
	foreach (i; 2..sqrt(MAX*1.0).ceil.to!int) {
		if (p[i]) {
			foreach (j; iota(i*2, MAX, i))
				p[j] = 0;
		}
	}

	int[] ps;
	foreach (i; 2..MAX) {
		if (p[i]) ps ~= i;
	}

	int n;
	while (n = readln.chomp.to!int, n) {
		int sum;
		ps[0..n].reduce!("a+b").writeln;
	}
}

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

int main(void){

    int A,B, C,D; cin>>A>>B>>C>>D;
    int ans = (min(B,D)-max(A,C))>0 ? (min(B,D)-max(A,C)) : 0;
    cout<<ans<<endl;

    return 0;
}

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

using namespace std;

#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)

int main() {
  set<int> s;
  Rep(i, 3) {
    int n;
    cin >> n;
    s.insert(n);
  }
  cout << ((s.size() == 2) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define ff first
#define ss second
 
#ifndef ONLINE_JUDGE
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif
 
const int inf = 2e18;
const int mod = 1e9 + 7;
 
int dp[1010][1010];
int arr[1010][1010];
 
signed main(){
 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif
 
	int h, w; cin>>h>>w;
	for(int i=0; i<h; i++){
		string s; cin>>s;
		int j=0;
		for(auto x: s){
			if(x=='.') arr[i][j]=0;
			else arr[i][j]=1;
			j++;
		}
	}
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(arr[i][j]) {
				dp[i][j]=0;
				continue;
			}
			if(i && j) dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
			else if(i) dp[i][j] = dp[i-1][j];
			else if(j) dp[i][j] = dp[i][j-1];
			else dp[i][j] = 1;
		}
	}
 
	cout<<dp[h-1][w-1]<<endl;
	
 
	return 0;
}

Measured memory_bytes: 19384
import math

a, b, H, M = map(int, input().split())
a_ = 360 / 12
a2_ = 30 / 60
b_ = 360 / 60

print(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(b_ * M - (a_* H + a2_ * M)))))


Measured memory_bytes: 9504
import java.util.Scanner;

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

        int n = Integer.parseInt(sc.nextLine());
        String[] input = sc.nextLine().split(" ");
        int[] array = new int[n];
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        int count = 0;

        for(int i = 0; i < n; i++){
            int minj = i;
            for(int j = i; j < n; j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                int tmp = array[i];
                array[i] = array[minj];
                array[minj] = tmp;
                count++;
            }
        }

        StringBuilder sb = new StringBuilder();
        for(int i : array){
            sb.append(i + " ");
        }

        System.out.println(sb.deleteCharAt(sb.length()-1));
        System.out.println(count);
        
    }
}


Measured memory_bytes: 26124
import numpy as np
a,b=map(int,input().split())
c=np.zeros(a)
for i in range(b):
  input()
  x=list(map(int,input().split()))
  for i in x:
    if c[i-1]==0:
      c[i-1]=1
    else:
      pass
print(int(a-sum(c)))

Measured memory_bytes: 27140
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
using namespace std;
int n;
int l[20];
bool vis[20];
int main(){
	int maxn=0,sum=0;
	cin>>n;
	for(int i=1;i<=n;i++) cin>>l[i];
	for(int i=1;i<=n;i++){
		if(l[i]>maxn){
			maxn=l[i];
		}
	}
	for(int i=1;i<=n;i++){
		if(l[i]==maxn){
			vis[i]=1;
			break;
		}
	}
	for(int i=1;i<=n;i++){
		if(!vis[i]) sum+=l[i];
	}
	if(maxn<sum) printf("Yes");
	else printf("No");
	return 0;
}


Measured memory_bytes: 256
from math import cos, pi, sqrt
A, B, H, M = map(int, input().split())

theta_h = H / 12 * 2*pi + (2*pi) / 12 * (M / 60)
theta_m = M / 60 * 2*pi
theta = abs(theta_h - theta_m)
print(sqrt(A**2 + B**2 - 2*A*B*cos(theta)))

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

using namespace std;

long long A[100001],B[100001];

int main(){
  int i,N,s=0;
  cin >> N;
  long long Asum=0,Bsum=0,Dsum=0,Esum=0;
  for (i=0;i<N;++i) {
    cin >> A[i];
    Asum+=A[i];
  }
  for (i=0;i<N;++i) {
    cin >> B[i];
    Bsum+=B[i];
    if (A[i] < B[i]) {
      s++;
      Dsum+=B[i] - A[i];
    }
    B[i] -= A[i];
    //cout << B[i] << endl;
  }
  if (Asum < Bsum) {
    cout << -1 << endl;
    return 0;
  } else if (Dsum==0){
    cout << 0 << endl;
    return 0;
  }
  //cout << Dsum << endl;
  sort(B,B+N);
  i=0;
  while(1) {
    Esum -= B[i];
    s++;
    if (Esum>=Dsum) {
      break;
    }
    i++;
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 1792
package main

import (
    "fmt"
    "sort"
)

type Score struct {
    px    int
    py    int
    pz    int
    score int
}

type Scores []Score

func (a Scores) Len() int {
    return len(a)
}

func (a Scores) Swap(i, j int) {
    a[i], a[j] = a[j], a[i]
}

func (a Scores) Less(i, j int) bool {
    return a[i].score > a[j].score
}

var xs, ys, zs []int
var ss Scores
var m map[int]map[int]map[int]bool

func main() {
    m = make(map[int]map[int]map[int]bool)

    var x, y, z, k int
    fmt.Scan(&x, &y, &z, &k)
    xs = make([]int, x)
    for i := 0; i < x; i++ {
        var t int
        fmt.Scan(&t)
        xs[i] = t
    }
    sort.Sort(sort.Reverse(sort.IntSlice(xs)))
    ys = make([]int, y)
    for i := 0; i < y; i++ {
        var t int
        fmt.Scan(&t)
        ys[i] = t
    }
    sort.Sort(sort.Reverse(sort.IntSlice(ys)))
    zs = make([]int, z)
    for i := 0; i < z; i++ {
        var t int
        fmt.Scan(&t)
        zs[i] = t
    }
    sort.Sort(sort.Reverse(sort.IntSlice(zs)))

    var px, py, pz int
    add(0, 0, 0)

    for i := 0; i < k; i++ {
        fmt.Println(ss[0].score)
        px = ss[0].px
        py = ss[0].py
        pz = ss[0].pz
        ss = ss[1:]
        if px < x-1 {
            add(px+1, py, pz)
        }
        if py < y-1 {
            add(px, py+1, pz)
        }
        if pz < z-1 {
            add(px, py, pz+1)
        }
        sort.Sort(ss)
    }
}

func add(x, y, z int) {
    if b, ok := m[x][y][z]; ok && b {
        return
    }
    ss = append(ss, ns(x, y, z))
    if _, ok := m[x]; !ok {
        m[x] = make(map[int]map[int]bool)
    }
    if _, ok := m[x][y]; !ok {
        m[x][y] = make(map[int]bool)
    }
    m[x][y][z] = true
}

func ns(x, y, z int) Score {
    return Score{
        px:    x,
        py:    y,
        pz:    z,
        score: xs[x] + ys[y] + zs[z],
    }
}


Measured memory_bytes: 2816
import java.util.*;

public class Main {
	public static void main(String[] args){
		//入力値を受け取る
		Scanner scanner = new Scanner(System.in);
		int input1 = scanner.nextInt();
		int input2 = scanner.nextInt();
		//受け取った値をかけ合わせ2で割った余りを出す
		int result = input1 * input2 % 2;
		//余りが0 OR 1で出力を切り分け
		if(result == 0){
			//偶数のとき
			System.out.println("Even");
		}else{
			//奇数のとき
			System.out.println("Odd");
		}
	}
}

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

typedef long long ll;
const int MOD = 1000000007;

const int MAX = 1000000;

ll fac[MAX], finv[MAX], inv[MAX];
//テーブルを作る前処理 MAX=510000 まで
void COMint(){
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for(int i = 2; i < MAX; i++){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}
//二項係数計算
ll COM(int n, int k){
  if(n < k) return 0;
  if(n < 0 || k < 0) return 0;
  return fac[n] * (finv[n-k] * finv[k] % MOD) % MOD;
}

int main(){
  COMint();
  int X,Y;
  cin >> X >> Y;
  if((X + Y) % 3 != 0 || Y > 2 * X || X > 2 * Y){
    cout << 0 << endl;
    return 0;
  }else{
    int n = (X + Y) / 3;
    int k = X - n;
    cout << COM(n, k) << endl;
  }
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<string> vs;

typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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;}

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll n,ans=0;
	cin >> n;
	vll a(n),l(n+1),r(n+1);
	rep(i,n) cin >> a[i];
	l[0]=0;
	r[n]=0;
	for(ll i=0;i<n;i++){
		l[i+1]=gcd(l[i],a[i]);
		r[n-1-i]=gcd(r[n-i],a[n-1-i]);
	}
	rep(i,n) chmax(ans,gcd(l[i],r[i+1]));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ea=[]
eb=[]
for i in range(3):
    if(a[i]<b[i]):
        ea.append((a[i],b[i]))
    elif(a[i]>b[i]):
        eb.append((b[i],a[i]))
ea.sort(reverse=True)
eb.sort(reverse=True)
def main(ea,n):
    if(len(ea)==1):
        fa=n%ea[0][0]+n//ea[0][0]*ea[0][1]
    elif(len(ea)==2):
        ga,gb=ea[0]
        ba,bb=ea[1]
        fa=n
        for i in range(n+1):
            if(ga*i>n):
                break
            k=n-ga*i
            tmp=i*gb+k%ba+(k//ba)*bb
            fa=max(tmp,fa)
    elif(len(ea)==3):
        ga,gb=ea[0]
        sa,sb=ea[1]
        ba,bb=ea[2]
        fa=n
        if(ga==sa):
            return main([ea[0],ea[2]],n)
        if(sa==ba):
            return main([ea[0],ea[1]],n)
        for i in range(n+1):
            if(ga*i>n):
                break
            for j in range(n+1):
                if(ga*i+sa*j>n):
                    break
                k=n-ga*i-sa*j
                tmp=i*gb+j*sb+k%ba+k//ba*bb
                fa=max(tmp,fa)
    else:
        fa=n
    return fa
n=main(ea,n)
n=main(eb,n)
print(n)

Measured memory_bytes: 39920
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	d = Dict{Array{Int,1},Int}()
	for i in 1:n
		s = readline() |> chomp
		a = [0 for j in 1:26]
		for j in 1:10
			a[Int(s[j])-96] += 1
		end
		if haskey(d,a)
			d[a] += 1
		else
			d[a] = 1
		end
	end
	k = 0
	for v in values(d)
		if v>1
			k += div(v*(v-1),2)
		end
	end
	println(k)
end

main()

Measured memory_bytes: 170648
while True:
    N, A, B, C, X = map(int, raw_input().split())

    if N == 0 and A == 0 and B == 0 and C == 0 and X == 0:
        break

    Y = map(int, raw_input().split())

    ans, i = 0, 0

    while True:
        if X == Y[i]:
            i += 1

        if i == N or ans > 10000:
            break

        X = (A*X + B) % C
        ans += 1

    print -1 if ans > 10000 else ans



Measured memory_bytes: 4648
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/10;
const ll MOD = 1e9+7;

long long mergecount(vector<long long> &a) {
  long long count = 0;
  int n = a.size();
  if (n > 1) {
    vector<long long> b(a.begin(), a.begin() + n/2);
    vector<long long> c(a.begin() + n/2, a.end());
    count += mergecount(b);
    count += mergecount(c);
    for (int i = 0, j = 0, k = 0; i < n; ++i)
      if (k == c.size())       a[i] = b[j++];
      else if (j == b.size())  a[i] = c[k++];
      else if (b[j] <= c[k])   a[i] = b[j++];
      else                   { a[i] = c[k++]; count += n/2 - j; }
  }
  return count;
}

int main(){
  ll N;cin >> N;
  vll a(N);
  repeat(i,N)cin >> a[i];
  ll low=0,high=1e9+1;
  while(high-low>1){
    ll mid = (low+high)/2;
    vll S(N+1,0);
    repeat(i,N){
      S[i+1] = S[i]+2*(a[i]>=mid)-1;
    }
    if(mergecount(S)<=N*(N+1)/4){
      low = mid;
    }else{
      high = mid;
    }
  }
  cout << low << endl;
}


Measured memory_bytes: 3424
S = input().strip()
L = len(S)
p = 0
for i in zip(S, "01"*L):
    if i[0] != i[1]:
        p += 1
q = 0
for i in zip(S, "10"*L):
    if i[0] != i[1]:
        q += 1
print(min(p, q))


Measured memory_bytes: 9256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef pair<l_l,ll> lll;
typedef vector<string> vs;
const ll dx[4]={1,-1,0,0};
const ll dy[4]={0,0,1,-1};
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
ll dp[1<<16];
ll cost[1<<16];
ll n;
ll a[16][16];
int main(){
    cin>>n;
    rep(i,n){
        rep(j,n){
            cin>>a[i][j];
        }
    }
    for(int s=1;s<1<<n;s++){
        rep(i,n){
            if(s>>i&1){
                for(int j=i+1;j<n;j++){
                    if(s>>j&1){
                        cost[s]+=a[i][j];
                    }
                }
            }
        }
    }
    dp[0]=0;
    for(int s=1;s<1<<n;s++){
        for(int t=s;t>0;t=(t-1)&s){
            dp[s]=max(dp[s],dp[s-t]+cost[t]);
        }
    }
    cout<<dp[(1<<n)-1]<<endl;
    return 0;
}

Measured memory_bytes: 4628