akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <vector>
using namespace std;
#define PB push_back

constexpr int kN = int(1E6 + 10);

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

vector<int> prime, fac[kN];
int mu[kN];

void pre() {
	for (int i = 2; i < kN; i++) mu[i] = -2;
	for (int i = 2; i < kN; i++) {
		if (mu[i] == -2) {
			mu[i] = -1;
			prime.PB(i);
		}
		for (int j : prime) {
			if (i * j >= kN) break;
			if (i % j == 0) {
				mu[i * j] = 0;
				break;
			}
			mu[i * j] = mu[i] * mu[j];
		}
	}
	for (int i : prime) for (int j = i; j < kN; j += i) fac[j].PB(i);
	return ;
}


int a[kN], sz[kN];

int main() {
	pre();
	int n, all = 0;
	bool pairwise = true;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	for (int i = 1; i <= n; i++) all = gcd(all, a[i]);
	for (int i = 1; i <= n; i++) {
		for (int j : fac[a[i]]) if (sz[j]++) pairwise = false;
	}

	if (pairwise) printf("pairwise coprime\n");
	else if (all == 1) printf("setwise coprime\n");
	else printf("not coprime\n");
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

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

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }


signed main() {
  vi abc;
  REP(i, 3) {
    abc.PB(read());
  }
  sort(ALL(abc), greater<int>());
  int ans;
  ans = abc[0] * 10 + abc[1] + abc[2];
  print(ans);
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	private static class Card {
		private char suit;
		private int value;
	}
	
	public static void printResult(Card[] c, Card[] org) {
		for (int i = 0; i < c.length - 1; i++) {
			System.out.print(String.valueOf(c[i].suit) + c[i].value + " ");
		}
		System.out.println(String.valueOf(c[c.length - 1].suit) + c[c.length - 1].value);
		
		String isStable = "Stable";
		for (int i = 0; i < c.length - 2; i++) {
			int orgi;
			for (orgi = 0; !(org[orgi].suit == c[i].suit && org[orgi].value == c[i].value); orgi++);
			for (int j = i + 1; j < c.length && c[j].value == c[i].value; j++) {
				int orgj;
				for (orgj = 0; !(org[orgj].suit == c[j].suit && org[orgj].value == c[j].value); orgj++);
				if (orgj < orgi) isStable = "Not stable";
			}
		}
		System.out.println(isStable);
	}
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt();
		
		Card[] c = new Card[n], cb, cs;
		
		for (int i = 0; i < n; i++) {
			String sv = scanner.next();
			c[i] = new Card();
			c[i].suit = sv.charAt(0);
			c[i].value = Integer.valueOf(sv.substring(1));
		}
		
		scanner.close();
		
		cb = c.clone();
		for (int i = 0; i < n; i++) {
			for (int ｊ = n - 1; ｊ >= i + 1; ｊ--) {
				if (cb[ｊ].value < cb[ｊ - 1].value) {
					Card temp = cb[ｊ];
					cb[ｊ] = cb[ｊ - 1];
					cb[ｊ - 1] = temp;
				}
			}
		}
		printResult(cb, c);
		
		cs = c.clone();
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (cs[j].value < cs[minj].value) {
					minj = j;
				}
			}
			if (i != minj) {
				Card temp = cs[i];
				cs[i] = cs[minj];
				cs[minj] = temp;
			}
		}
		printResult(cs, c);
	}
} 



Measured memory_bytes: 26448
input = input().split()
x1 = int(input[0])
y1 = int(input[1])
x2 = int(input[2])
y2 = int(input[3])
x3 = 0
y3 = 0
x4 = 0
y4 = 0


if x1 < x2 :
    if y1 < y2 :
        x3 = x2 - (y2 - y1)
        y3 = y2 + (x2 - x1)
        x4 = x3 - (x2 - x1)
        y4 = y3 - (y2 - y1)
    else:
        x3 = x2 + (y1 - y2)
        y3 = y2 + (x2 - x1)
        x4 = x3 - (x2 - x1)
        y4 = y3 + (y1 - y2)
else:
    if y1 < y2 :
        x3 = x2 - (y2 - y1)
        y3 = y2 - (x1 - x2)
        x4 = x3 + (x1 - x2)
        y4 = y3 - (y2 - y1)
    else:
        x3 = x2 + (y1 - y2)
        y3 = y2 - (x1 - x2)
        x4 = x3 + (x1 - x2)
        y4 = y3 + (y1 - y2)


print(str(x3)+" "+str(y3)+" "+str(x4)+" "+str(y4))

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

using namespace std;

struct Scanner {
    string s;
    int pos;
    Scanner(string s) {
        this->s = s;
        pos = 0;
    }

    char head() {
        if(pos<s.size())
            return s[pos];
        else
            return '\0';
    }

    void next() {
        ++pos;
    }
};

bool formula(Scanner& scanner, int in) {
    char h = scanner.head();
    scanner.next();
    switch(h) {
    case 'T':
        //cout << "T" << endl;
        return true;
    case 'F':
        //cout << "F" << endl;
        return false;
    case 'a':
    case 'b':
    case 'c':
    case 'd':
    case 'e':
    case 'f':
    case 'g':
    case 'h':
    case 'i':
    case 'j':
    case 'k':
        //cout << h << "=" << ((in & (1<<(h-'a'))) != 0) << endl;
        return (in & (1<<(h-'a'))) != 0;
    case '-':
    {
        bool a = formula(scanner, in);
        //cout << "Not " << a << endl;
        return !a;
    }
    case '(':
    {

        bool a = formula(scanner, in);
        char op = scanner.head();
        scanner.next();
        if(op=='-') scanner.next();
        bool b = formula(scanner, in);
        scanner.next(); // for )
        switch(op) {
        case '*':
            //cout << a << "*" << b << endl;
            return a && b;
        case '+':
            //cout << a << "+" << b << endl;
            return a || b;
        case '-':
            //cout << a << "->" << b << endl;
            return !a || b;
        }
    }
    }
}

bool check(const string& eq, int in) {
    Scanner scanner(eq);
    bool a = formula(scanner, in);
    scanner.next();
    bool b = formula(scanner, in);
    return a==b;
}

int main() {
    while(1) {
        string in;
        cin >> in;
        if(in=="#") break;

        bool f = true;
        for(int i=0;i<(1<<11);++i) {
            f = f && check(in, i);
        }
        if(f) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

Measured memory_bytes: 932
#include <stdio.h>

int main(void)
{
	int n, min = 100000, num[3];
	int i;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%d", &num[i]);
		if (min > num[i]){
			min = num[i];
		}
	}
	
	for (i = 1; i <= min; i++){
		if (n == 2 && num[0] % i == 0 && num[1] % i == 0){
			printf("%d\n", i);
		}
		if (n == 3 && num[0] % i == 0 && num[1] % i == 0 && num[2] % i == 0){
			printf("%d\n", i);
		}
	}
	
	return (0);
}

Measured memory_bytes: 596
from collections import deque
N, M = map(int,input().split())
signs = [set() for _ in range(N)]
for i in range(M):
    A, B = map(int,input().split())
    signs[A-1].add(B-1)
    signs[B-1].add(A-1)
Q = deque()
check = [0]*N
ans = [10**6]*N
x = 0
for gen in signs[x]:
    check[gen] = 1
    ans[gen] = x
    Q.append(gen)
while len(Q) != 0:
    v = Q.popleft()
    for gen in signs[v]:
        if check[gen] == 0:
            check[gen] = 1
            ans[gen] = v
            Q.append(gen)
if 10**6 in ans:
    print('No')
else:
    print('Yes')
    for i in ans[1:]:
        print(i+1)


Measured memory_bytes: 64284
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz=1e3+5;

char s[11][sz];

int box[11];

int main()
{
    int h,w,k;
    cin >> h >> w >> k;
    for(int i=0; i<h; i++) scanf("%s", s[i]);

    int ans = h*w;
    for(int m=0; m<(1<<(h-1)); m++) {
        memset(box, 0, sizeof box);
        bool imp = 0;
        int cnt = 0;
        for(int j=0, last=0; j<w; ) {
            for(int i=0, b=0; i<h; i++) {
                if(s[i][j]=='1') box[b]++;
                if(i<h && (m&(1<<i))) b++;
            }

            bool no = 0;
            for(int i=0; i<h; i++) {
                if(box[i]>k) no = 1;
            }

            if(no) {
                cnt++;
                if(j==last) {
                    imp = 1;
                    break;
                }
                last=j;
                memset(box, 0, sizeof box);
            }
            else j++;
        }
        if(!imp) ans = min(ans, cnt + __builtin_popcount(m));
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
const long long mod = 1000000007;

int main() {
	int N;
	scanf("%d", &N);
	int *d = new int[N];
	for (int i = 0; i < N; i++) {
		scanf("%d", &d[i]);
	}
	std::sort(d, d + N);
	int res = d[N / 2] - d[N / 2 - 1];
	printf("%d", res < 0 ? 0 : res);
	return 0;
}

Measured memory_bytes: 640
import java.util.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;
public class Main {

	static Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		while (read())
			solve();
	}
	
	static int N;
	static int[] n, d;
	static boolean read() {
		N = sc.nextInt();
		if (N == 0) return false;
		n = new int[N - 1];
		d = new int[N - 1];
		for (int i = 0; i < N - 1; i++) {
			n[i] = sc.nextInt();
			d[i] = sc.nextInt();
		}
		return true;
	}

	static int[] dx = {-1, 0, 1, 0};
	static int[] dy = {0, 1, 0, -1};
	static void solve() {
		int[][] pos = new int[N][2];
		pos[0][0] = pos[0][1] = 0;
		for (int i = 0; i < N - 1; i++) {
			pos[i + 1][0] = pos[n[i]][0] + dx[d[i]];
			pos[i + 1][1] = pos[n[i]][1] + dy[d[i]];
		}
		
		int bx = 0, ux = 0, by = 0, uy = 0;
		for (int i = 1; i < N; i++) {
			int x = pos[i][0], y = pos[i][1];
			if (x < bx) bx = x;
			if (x > ux) ux = x;
			if (y < by) by = y;
			if (y > uy) uy = y;
		}
		System.out.println((ux - bx + 1) + " " + (uy - by + 1));
	}	
	
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];
int s[11][11];

int main() {
	int n, m;
	cin >> n >> m;
	vector<int>k(m), p(m);
	rep(i, m) {
		cin >> k[i];
		rep(j, k[i]) {
			cin >> s[i][j];
			s[i][j]--;
		}
	}
	rep(i, m) {
		cin >> p[i];
	}
	int ans = 0;
	for (int bit= 0;bit < (1 << n);++bit) {
		bool flag = true;
		rep(i, m) {
			int res = 0;
			rep(j, k[i]) {
				if (bit & (1 << s[i][j]))res++;
			}
			if (res % 2 != p[i])flag = false;
		}
		if (flag)ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
v = list(map(int,input().split()))
v.sort(reverse = True)

for i in range(n-1):
  temp = (v[n-1-i] +v[n-2-i])/2
  v.pop()
  v.pop()
  v.append(temp)
  
print(v[0])

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
using namespace std;
const int N = 200050;
const int inf = 0x3f3f3f3f;
const ll mod = 998244353LL;
clock_t TIME_START, TIME_END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME_END - TIME_START) / CLOCKS_PER_SEC);
    system("pause");
#endif
}
int n, k, c;
char s[N];
int vis[N];

void solve()
{
    scanf("%d%d%d", &n, &k, &c);
    scanf("%s", s + 1);
    int cnt = 0;
    int now = 0;
    for (int i = 1; i <= n; ++i)
    {
        if (s[i] == 'o' && now == 0)
        {
            cnt++;
            now = c;
            vis[i]++;
        }
        else
            now = max(now - 1, 0);
    }
    if (cnt > k)
        return;
    now = 0;
    cnt = 0;
    for (int i = n; i >= 1; --i)
    {
        if (s[i] == 'o' && now == 0)
        {
            cnt++;
            now = c;
            vis[i]++;
        }
        else
            now = max(now - 1, 0);
    }
    if (cnt > k)
        return;
    for (int i = 1; i <= n; ++i)
    {
        if (vis[i] == 2)
            printf("%d\n", i);
    }
}

int main()
{
    TIME_START = clock();
    int Test = 1;
    // cin >> Test;
    while (Test--)
        solve();
    TIME_END = clock();
    program_end();
    return 0;
}

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

// #define int long long
#define rep(i, n) for (ll i = (ll)(0); i < (ll)(n); ++i)
#define reps(i, n) for (ll i = (ll)(1); i <= (ll)(n); ++i)
#define rrep(i, n) for (ll i = ((ll)(n)-1); i >= 0; i--)
#define rreps(i, n) for (ll i = ((ll)(n)); i > 0; i--)
#define irep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); ++i)
#define ireps(i, m, n) for (ll i = (ll)(m); i <= (ll)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) ll(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

const ll INF = 1e15;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,m,l; cin>>n>>m>>l;
  ll G[n][n];
  rep(i,n){
    rep(j,n) G[i][j]=INF;
    G[i][i]=0;
  }
  rep(i,m){
    ll a,b,c; cin>>a>>b>>c;
    a--,b--;
    G[a][b]=G[b][a]=c;
  }
  ll q; cin>>q;
  vector<pll> Q(q);
  rep(i,q){
    ll a,b; cin>>a>>b;
    a--,b--;
    Q[i]={a,b};
  }
  
  
  vector<vector<pll>> dist(n,vector<pll>(n,{INF,INF}));
  rep(s,n){
    dist[s][s]={0,0};
    priority_queue<pair<pll,ll>, vector<pair<pll,ll>>, greater<pair<pll,ll>>> q;
    q.push({{0,0},s});
    while(!q.empty()){
      auto p=q.top(); q.pop();
      ll v=p.second;
      if(dist[s][v]<p.first) continue;
      ll cnt=p.first.first;
      ll used=p.first.second;
      for(ll nv=0; nv<n; nv++){
        if(nv==v) continue;
        if(G[v][nv]>l) continue;
        ll nused=used+G[v][nv];
        pll np;
        if(nused>l){
          nused=G[v][nv];
          np={cnt+1,nused};
        }else{
          np={cnt,nused};
        }
        if(chmin(dist[s][nv],np)){
          q.push({np,nv});
        }
      }
    }
  }
  
  rep(i,q){
    ll a=Q[i].first, b=Q[i].second;
    ll ans=dist[a][b].first;
    if(ans!=INF) cout<<ans<<endl;
    else cout<<-1<<endl;
  }
}

Measured memory_bytes: 7148
var
  n:longint;
begin
  read(n);
  if n<=111 then write(111);
  if (n>111)and(n<=222) then write(222);
  if (n>222)and(n<=333) then write(333);
  if (n>333)and(n<=444) then write(444);
  if (n>444)and(n<=555) then write(555);
  if (n>555)and(n<=666) then write(666);
  if (n>666)and(n<=777) then write(777);
  if (n>777)and(n<=888) then write(888);
  if (n>888)and(n<=999) then write(999);
end.

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

int main(){
  int n;cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  bool f=true;
  int ans=0;
  while(f){
    for(int i=0;i<n;i++){
      if(v[i]%2==0)v[i]=v[i]/2;
      else f=false;
    }
    if(f)ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
	#ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int ans=0,ans1=0;
    for(int i=0;i<3;++i){
    	int n;
    	cin>>n;
    	if(n==5) ++ans;
    	else if(n==7) ++ans1;
    }
    (ans==2 && ans1==1)?cout<<"YES":cout<<"NO";
	return 0;
}

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

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

using namespace std;

typedef long long ll;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    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;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//これを使うときにはCOMinit();を忘れずに
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    COMinit();
    int S; cin >> S;
    ll ans = 0;
    for(int i = 1; i <= 2000; i++){
        //長さiの数列
        int rem = S - i*3;
        if(rem < 0) break;
        //rem個をi人に分ける
        ans = (ans + COM(i-1 + rem, rem)) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 15564
{-# LANGUAGE OverloadedLists     #-}
{-# LANGUAGE OverloadedStrings   #-}
{-# LANGUAGE ScopedTypeVariables #-}

import           Control.Monad
--import           Control.Monad.Loops
import           Data.IORef
import           Data.Maybe
import qualified Data.Text     as T
import qualified Data.Text.IO  as T
import           GHC.Base
import           System.IO

import qualified Data.Array    as A
import qualified Data.IntMap   as I
import           Data.List
import qualified Data.Map      as M
import qualified Data.Set      as S
import qualified Data.Vector   as V

-- for Text
(+.+) = T.append
(!.!) = T.index

-- for Vector
count :: (a -> Bool) -> V.Vector a -> Int
count p = V.length . V.filter p

-- for IO
readT :: Read a => T.Text -> a
readT = read . T.unpack

getLineSpc :: Read a => IO [a]
getLineSpc = do
  t <- T.getLine
  let xs = map readT $ T.split (== ' ') t
  return xs

getLineSpcVec :: Read a => IO (V.Vector a)
getLineSpcVec = do
  t <- T.getLine
  let xs = V.fromList $ map readT $ T.split (== ' ') t
  return xs

----------
-- main --
----------
main :: IO ()
main = product2

product2 :: IO ()
product2 = do
  ab <- getLineSpcVec
  if V.all odd ab
    then
    putStrLn "Odd"
    else
    putStrLn "Even"

Measured memory_bytes: 508
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	long X, K, D;
	long result = 0;

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		X = Long.parseLong(tokens[0]);
		K = Long.parseLong(tokens[1]);
		D = Long.parseLong(tokens[2]);
	}

	void calc() {
		long times = Math.abs(X) / D;
		if (times >= K) {
			if (X >= 0) {
				result = X - D * K;
			} else {
				result = X + D * K;
			}
		} else {
			if (X >= 0) {
				X = X - D * times;
			} else {
				X = X + D * times;
			}
			K -= times;
			if (K % 2 != 0) {
				if (X >= 0) {
					result = Math.abs(X - D);
				} else {
					result = Math.abs(X + D);
				}
			} else {
				result = X;
			}
		}
		result = Math.abs(result);
		System.out.println(result);
	}

	void showResult() {
	}
}

Measured memory_bytes: 25384
x=int(input())
l=[]

for i in range(300):
    a=i**5
    l.append(a)
    l.append(-a)
        

for j in l:
    for k in l:
        aa=j-k
        if j!=k and aa==x:
            ans=[]
            for z in [j,k]:
                aaa=abs(z)**(1/5)
                if z>=0:
                    ans.append(int(aaa))
                else:
                    ans.append(int(-aaa))
            print(*ans)                
            exit()


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

int main() {
  int n,l;
  cin>>n>>l;
  vector<int>a(n);
  int sum=l;
  a[0]=l;
  int kotae=abs(l);
  int kazu=0;
  rep2(i,1,n){
    a[i]=l+i;
    if(kotae>abs(a[i])){
      kotae=abs(a[i]);
      kazu=i;
    }
    sum+=a[i];
  }
  cout<<sum-a[kazu]<<endl;
  return 0;
}

Measured memory_bytes: 256
'''
A - Right Triangle
https://atcoder.jp/contests/abc116/tasks/abc116_a

>>> main(3, 4, 5)
6
>>> main(5, 12, 13)
30
>>> main(45, 28, 53)
630
'''


def main(ab, bc, ca):
    print((ab * bc) // 2)


if __name__ == '__main__':
    ab, bc, ca = map(int, input().split(' '))

    main(ab, bc, ca)


Measured memory_bytes: 2940
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var n, a, b int

	fmt.Scan(&n, &a, &b)

	answer := 0
	ch := make(chan int)

	for i := 1; i <= n; i++ {
		go sum(i, a, b, ch)
	}

	for i := 1; i <= n; i++ {
		answer += <-ch
	}

	fmt.Println(answer)
}

func sum(i int, a int, b int, ch chan int) {
	iStr := strconv.Itoa(i)
	splitedIStr := strings.Split(iStr, "")

	sum := 0
	for _, j := range splitedIStr {
		jInt, _ := strconv.Atoi(j)
		sum += jInt
	}

	if (a <= sum) && (sum <= b) {
		ch <- i
	} else {
		ch <- 0
	}
}


Measured memory_bytes: 32500
#include <algorithm>
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

bool check(int n) { // 753 数になっているかどうか
    int num3 = 0, num5 = 0, num7 = 0;
    while (n > 0) {
        if (n%10 == 3) num3++;
        else if (n%10 == 5) num5++;
        else if (n%10 == 7) num7++;
        n /= 10;
    }
    if (num3 > 0 && num5 > 0 && num7 > 0) return true;
    else return false;
}

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

    // 753 数の候補を入れる
    vector<int> cand_all, cand[10];
    cand_all = {3, 5, 7}; cand[1] = {3, 5, 7};
    // 桁数のループ
    for (int d = 2; d <= 9; d++) {
        vector<int> add;
        for (int i = 0; i < cand[d - 1].size(); i++) {
            int add3 = 3*pow(10, d - 1) + cand[d - 1][i];
            int add5 = 5*pow(10, d - 1) + cand[d - 1][i];
            int add7 = 7*pow(10, d - 1) + cand[d - 1][i];
            cand[d].push_back(add3); cand[d].push_back(add5); cand[d].push_back(add7);
        }
        cand_all.insert(cand_all.end(), cand[d].begin(), cand[d].end());
    }

    // cand をソートして N 以下の個数を数える
    sort(cand_all.begin(), cand_all.end());
    int ans = 0;
    for (int i = 0; i < cand_all.size(); i++) {
        if (cand_all[i] <= N && check(cand_all[i])) {
            ans++;
        }
        else if (cand_all[i] > N) break;
    }

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

Measured memory_bytes: 640
import collections
n=int(input())
a=[int(_) for _ in input().split()]
c=collections.Counter(a)
l=len(c.keys())
k=list(c.keys())
v=list(c.values())
if l > 3:
    print("No")
elif l == 3:
    if k[0]^k[1]^k[2] == 0 and v[0]==v[1]==v[2] and n%3==0:
        print("Yes")
    else:
        print("No")
elif l == 2:
    if k[0] == 0:
        if v[1] == v[0]*2 and n%3==0:
            print("Yes")
        else:
            print("No")
    elif k[1] == 0:
        if v[0] == v[1]*2 and n%3==0:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif l == 1:
    if k[0] == 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 14468
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

template <typename T>
struct SegTreeMax{
    vector<T> dat;
    int n;
    const T Default;
    SegTreeMax(int n_, const T& def) : Default(def){init(n_);}
    void init(int n_){
        n = 1;
        while(n < n_) n *= 2;
        dat = vector<T>(2*n-1, Default);
    }
    T f(const T& a, const T& b) {
    	return max(a, b);
    }
    void update(int k, const T& a){
        k += n-1;
        dat[k] = a;
        while(k > 0){
            k = (k - 1) / 2;
            dat[k] = f(dat[k * 2 + 1], dat[k * 2 + 2]);
        }
    }
    T query(int a, int b, int k, int l, int r ){
        if(r <= a || b <= l) return Default;
        if(a <= l && r <= b) return dat[k];
        T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
        T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
        return f(vl, vr);
    }
    T query(int a, int b) {
    	return query(a, b, 0, 0, n);
    }
};
template <typename T>
struct SegTreeMin{
    vector<T> dat;
    int n;
    const T Default;
    SegTreeMin(int n_, const T& def) : Default(def){init(n_);}
    void init(int n_){
        n = 1;
        while(n < n_) n *= 2;
        dat = vector<T>(2*n-1, Default);
    }
    T f(const T& a, const T& b) {
    	return min(a, b);
    }
    void update(int k, const T& a){
        k += n-1;
        dat[k] = a;
        while(k > 0){
            k = (k - 1) / 2;
            dat[k] = f(dat[k * 2 + 1], dat[k * 2 + 2]);
        }
    }
    T query(int a, int b, int k, int l, int r ){
        if(r <= a || b <= l) return Default;
        if(a <= l && r <= b) return dat[k];
        T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
        T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
        return f(vl, vr);
    }
    T query(int a, int b) {
    	return query(a, b, 0, 0, n);
    }
};
int main(){
	int n, d;
	cin >> n >> d;
	vector<pair<int, pii>> v(n);
	rep(i, n) cin >> v[i].se.fi >> v[i].se.se >> v[i].fi;
	sort(all(v));
	SegTreeMax<int> xMax(n, -INF), yMax(n, -INF);
	SegTreeMin<int> xMin(n, INF), yMin(n, INF);
	rep(i, n) {
		xMax.update(i, v[i].se.fi);
		xMin.update(i, v[i].se.fi);
		yMax.update(i, v[i].se.se);
		yMin.update(i, v[i].se.se);
	}
	ll ans = 0LL;
	rep(i, n) {
		int idx = upper_bound(all(v), make_pair(v[i].fi+d, make_pair(INF, INF))) - v.begin();
		ll sx = xMin.query(i, idx);
		ll gx = xMax.query(i, idx);
		ll sy = yMin.query(i, idx);
		ll gy = yMax.query(i, idx);
		ans = max(ans, (gx-sx)*(gy-sy));
		// cout << sx << " " << gx << " " << sy << " " << gy << endl;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 13404
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
typedef unsigned long long ull;
const int inf=1039074182;
using namespace std;
int dp[100005];
int n,k;
int a[105];

int main()
{
//	freopen("input.txt","r",stdin);
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	dp[0]=false;
	for(int i=0;i<k;i++)
	{
		if(dp[i]) continue;
		for(int j=0;j<n;j++)
		{
			if(i+a[j]>k) continue;
			dp[i+a[j]]=true;
		}
	}
	if(dp[k]) cout<<"First\n";else cout<<"Second\n";
	return 0;
}

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

int main(){
long long int n;
cin >> n;
vector <int> a,b ;
for(int i =0; i < n; i++){
int tmp;
cin >> tmp;
b.push_back (tmp);
a.push_back(abs (n-2*i-1));
}
sort(a.begin(), a.end ());
sort(b.begin(), b.end ());
bool flag = true;

for(int i = 0; i <n; i++){
if(a[i]!=b[i]) flag = false;
}
long long int ans = 1;
if(!flag) ans=0;

if(n%2!=0) n--;
n/=2;

for(int i = 0; i <n; i++){
ans *= 2;
ans %= 1000000007;
}
cout << ans << endl ;
}

Measured memory_bytes: 1276
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <iterator>
#include <cmath>
#include <map>
using namespace std;


void func162a() {
  string n;
  cin >> n;
  for(int i = 0; i < n.length(); i++){
    if(n.at(i) == '7'){
      cout << "Yes\n";
      return;
    }
  }
  cout << "No\n";
}


int main(void) {
  func162a();
  return 0;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)







int main() {
    ll n, m;
    cin >> n >> m;
    vector<ll> x(m);
    REP(i, m){
        cin >> x[i];
    }
    sort(x.begin(), x.end());
    vector<ll> a(m - 1);
    REP(i, m - 1){
        a[i] = x[i + 1] - x[i];
    }
    sort(a.begin(), a.end(), greater<ll>());
    ll ans = 0;
    for(ll i = n - 1; i < m - 1; i++){
        ans += a[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <utility>
using namespace std;
#define MAX 100005

int main(){
	int n, m, a[1005], t;
	cin >> n >> m;
	for(int i = 0;i < m;i++)cin >> a[i] >> t;
	sort(a, a+m);
	int ans = 0;
	for(int i = m-1;i > 0;i--){
		if(a[i] < n)ans += n-a[i];
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
    //A
    double n;
    cin>>n;
    if(int(n)%2==0)
    {
        cout<<(n/2)/n<<endl;
    }
    else
    {
        cout<<((n+1)/2)/n<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 2000005
int main(){
    string s;
    cin >> s;
    const int p = 2019;
    long ans = 0;
    int l = s.size();
    vector<int> list(N), mod(N);
    list[0] = 1;
    mod[0] = (s.at(l - 1) - '0') % p;
    for(int i = 1; i < l; i++){
        list[i] = (list[i - 1] * 10) % p;
        mod[i] = ((s.at(l - i - 1) - '0') * list[i] + mod[i - 1]) % p;
    }
    for(int i = 0; i < p; i++)
        list[i] = 0;
    for(int i = 0; i < l; i++){
        if(mod[i] == 0)
            ans ++;
        ans += list[mod[i]];
        list[mod[i]] ++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 19196
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

int n;
int ans;

int main() { 

  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    while (x % 2 == 0) {
      ans++;
      x /= 2;
    }
  }

  cout << ans << endl;

  return 0;
}


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

  string S;
  cin >> S;
  
  if(S.at(2)==S.at(3) && S.at(4)==S.at(5)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC147A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b,c;
            var word = Console.ReadLine().Split(' ');
            a =int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);
            if ((a + b + c)<22) 
            {
                Console.WriteLine("win");
            }
            else
            {
                Console.WriteLine("bust");
            }
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11092
#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;

    int sa=a,sb=b,sc=c;

    int cnt=0;

    while(!(sa%2||sb%2||sc%2))
    {
        int aa=sa/2,bb=sb/2,cc=sc/2;
        sa=bb+cc;
        sb=cc+aa;
        sc=aa+bb;
        cnt++;
        if(sa==a&&sb==b&&sc==c)
        {
            cout<<"-1\n";
            return 0;
        }
    }

    cout<<cnt<<"\n";

    return 0;
}


Measured memory_bytes: 3504
import sys
L,R = map(int,input().split())
ans = 2018
for i in range(L,R):
    for j in range(i+1,R+1):
        tmp = (i*j)%2019
        if tmp == 0:
            print(0)
            sys.exit()
        elif tmp < ans:
            ans = tmp
print(ans)

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

int main(){
    int n,d;
    cin >> n >> d;
    int range=1+2*d;
    if(n%range!=0) cout << n/range+1 << endl;
    else cout << n/range << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define INF 1000000007
#define elif else if
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int jo(int n) {
	int ans = 1;
	rep(i, n) {
		ans *= 2;
	}
	return ans;
}
char c[1010][1010];
int dp[1010][1010];
signed main() {
	int h, w;
	cin >> h >> w;
	dp[0][0] = 1;
	rep(i, h)rep(j, w)cin >> c[i][j];
	rep(i, h) {
		rep(j, w) {
			if (c[i][j] == '#')continue;
			else if (i == 0 && j != 0)dp[i][j] = dp[i][j - 1];
			else if (i != 0 && j == 0)dp[i][j] = dp[i - 1][j];
			else if (i != 0 || j != 0)dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
			dp[i][j] %= INF;
		}
	}
	cout << dp[h-1][w-1] << endl;
	ggr
}


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

bool solve();

int main()
{
	if (solve()) puts("Yes");
	else puts("No");

	return 0;
}

bool solve()
{
	int N;
	scanf("%d", &N);
	for (int i{1}; i <= 9; i++)
		for (int j{1}; j <= 9; j++)
			if (i * j == N)
				return true;
	return false;
}

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

int main() {
	int a, b;
	cin >> a >> b;
	if (a*b % 2 == 0) cout << "Even" << endl;
	else cout << "Odd" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define vd vector<ld>
#define vvd vector<vector<ld>>
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
#define SORT(a) stable_sort(ALL(a))
#define RSORT(a) stable_sort(RALL(a))
#define REV(a) reverse(ALL(a))
#define lambda(i) [](auto& i)
#define compare(i, j) [](auto& i, auto& j)
#define min_of(a) *min_element(ALL(a))
#define max_of(a) *max_element(ALL(a))
#define sum(a) accumulate(ALL(a), 0)
#define pb push_back
#define mp make_pair
#define SZ(a) ll((a).size())
#define REP(i, n) for (decltype(n) i = 0; i < (n); i++)
#define RREP(i, n) for (auto i = n - 1; i != static_cast<decltype(i)>(-1); i--)
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define RFOR(i, a, b) for (auto i = b - 1; i != a; i--)
#define EACH(i, a) for (auto&& i: (a))
using namespace std;

const ll INF = 1e18;
const ll mod = 1e9 + 7;

vi cum(vi V) {
  vi U(SZ(V));
  partial_sum(ALL(V), begin(U));
  return U;
}

void solve() {
  ll n, m;
  ll ans = 0;

  cin >> n >> m;
  ll a = 1, b = n;
  REP(i, m) {
    ll l, r;
    cin >> l >> r;
    a = max(a, l);
    b = min(b, r);
  }

  cout << max(0LL, b - a + 1) << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  solve();
}


Measured memory_bytes: 256
from itertools import accumulate

n, k = map(int, input().split())
k2 = k * 2
req_b = [[0] * k for _ in range(k)]
req_w = [[0] * k for _ in range(k)]
bc, wc = 0, 0
for i in range(n):
    x, y, c = input().split()
    x, y = int(x), int(y)
    rx, ry = x % k2, y % k2
    b = c == 'B'
    if rx >= k:
        rx -= k
        if ry >= k:
            ry -= k
        else:
            b = not b
    elif ry >= k:
        ry -= k
        b = not b
    if b:
        req_b[rx][ry] += 1
        bc += 1
    else:
        req_w[rx][ry] += 1
        wc += 1

req_b[0] = list(accumulate(req_b[0]))
req_w[0] = list(accumulate(req_w[0]))

for i in range(1, k):
    req_b[i][0] += req_b[i - 1][0]
    req_w[i][0] += req_w[i - 1][0]
    for j in range(1, k):
        req_b[i][j] += req_b[i][j - 1] + req_b[i - 1][j] - req_b[i - 1][j - 1]
        req_w[i][j] += req_w[i][j - 1] + req_w[i - 1][j] - req_w[i - 1][j - 1]

ans = 0
for dx in range(k):
    dxk_b = req_b[dx][-1]
    dxk_w = req_w[dx][-1]
    for dy in range(k):
        b1 = req_b[dx][dy]
        b2 = bc - req_b[k - 1][dy] - dxk_b + b1
        w1 = req_w[dx][dy]
        w2 = wc - req_w[k - 1][dy] - dxk_w + w1
        b, w = b1 + b2, w1 + w2
        ans = max(ans, b + wc - w, w + bc - b)
        # print(dx, dy, b, w, b + wc - w, w + bc - b)
print(ans)


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

using namespace std;

#define f first
#define s second
#define mp make_pair
#define all(x) x.begin(), x.end()
#define MOD 1000000007
#define EPS 1e-9
#define X real()
#define Y imag()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using point = pair<double, double>;
using Vector = complex<double>;

int main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a, b;
	cin >> a >> b;
	if(a * 500 >= b) cout << "Yes\n";
	else cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

void solve(long long N, vector<long long> a){
	ll o = 0, t = 0, f = 0;
	rep(i, N) {
		if (a[i]%4 == 0) {
			f++;
		} else if (a[i]%2 == 0) {
			t++;
		} else {
			o++;
		}
	}	
	if (f >= o || (f+1 == o && t == 0)) cout << "Yes" << endl; else cout << "No" << endl;
}

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> a(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&a[i]);
	}
	solve(N, a);
	return 0;
}



Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    String str = sc.next();
    
    if (str.length() <= n)
      System.out.println(str);
    else {
      String temp = str.substring(0, n);
      System.out.println(temp + "...");
    }
    
  }
}
      

Measured memory_bytes: 38644
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

int k;
double okl, okr;
double p, e, t;

double calc(int c, double l, double r) {
    double m = (l + r) / 2;
    if (k == c) {
        if (okl < m && m < okr) {
            return 1;
        }
        else return 0;
    }
    if (r < okl || okr < l) {
        return 0;
    }
    if (okl < l && r < okr) {
        return 1;
    }
    if (t < m) {
        return calc(c + 1, l, m) * (1 - p) + calc(c + 1, m, r) * p;
    }
    else
        return calc(c + 1, l, m) * p + calc(c + 1, m, r) * (1 - p);
}

int main() {
    int l, r;
    cin >> k >> l >> r;
    cin >> p >> e >> t;
    okl = t - e;
    okr = t + e;
    printf("%.9lf\n", calc(0, l, r));
    return 0;
}

Measured memory_bytes: 3248
n = gets(chomp:true).to_i
  array = gets(chomp:true).split.map(&:to_i)

  puts array.join(" ")

  for ope_index in 1...n

    cmp_index = ope_index - 1
    cmp_elem = array[cmp_index]
    pool_elem = array[ope_index]
    

      while cmp_index >= 0 && cmp_elem > pool_elem

        array[cmp_index + 1] = cmp_elem

        cmp_index -= 1
        cmp_elem = array[cmp_index]
      end

    array[cmp_index + 1] = pool_elem

    puts array.join(" ")

  end



Measured memory_bytes: 6892
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

int w, h;
int c[51][51];
bool f[51][51];
int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
bool contain(int y, int x){
   return (0 <= y && y < h && 0 <= x && x < w);
}

void dfs(int y, int x){
    f[y][x] = true;
    rep(i, 0, 8){
        int ny = y + dy[i];
        int nx = x + dx[i];
        if(!contain(ny, nx)) continue;
        if(f[ny][nx] || c[ny][nx] == 0) continue;
        dfs(ny, nx);
    }
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    while(cin >> w >> h, w, h){
        rep(i, 0, h){
            rep(j, 0, w){
                cin >> c[i][j];
                f[i][j] = false;
            }
        }
        int ans = 0;
        rep(i, 0, h){
            rep(j, 0, w){
                if(c[i][j] == 1 && f[i][j] == false){
                    dfs(i, j);
                    ans++;
                }
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3244
#include<stdio.h>
#ifdef DEBUG
#include<conio.h>
#endif // DEBUG

int nums[105];

int main () {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif // DEBUG

    int num;
    scanf("%d", &num);
    
    for (size_t i = 0; i < num; i++)
    {
        scanf("%d", &nums[i]);
    }

    for (int i = num - 1; i > 0; i--)
    {
        printf("%d ",nums[i]);
    }
    printf("%d\n",nums[0]);

#ifdef DEBUG
    getch();
#endif // DEBUG
    return 0;
}



Measured memory_bytes: 2048
H, W, M = map(int, input().split())
target = []
Height = [0] * H
Width = [0] * W
for m in range(M):
  h, w = map(lambda x: int(x)-1, input().split())
  target.append((h, w))
  Height[h] += 1
  Width[w] += 1
max_H, max_W = max(Height), max(Width)

cH, cW = 0, 0
for i in range(H):
  if Height[i] == max_H:
    cH +=1
for i in range(W):
  if Width[i] == max_W:
    cW +=1
max_cross = cH * cW

double_count = 0
for h, w in target:
  if Height[h] == max_H and Width[w] == max_W:
    double_count += 1

if double_count == max_cross:
  print(max_H + max_W - 1)
else:
  print(max_H + max_W)

Measured memory_bytes: 54172
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <queue>
using namespace std;

int A[3][3];
bool used[3][3];

int main() {
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) cin >> A[i][j];
	}
	int N; cin >> N;
	for (int i = 0; i < N; i++) {
		int p; cin >> p;
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				if (A[j][k] == p) used[j][k] = true;
			}
		}
	}

	bool flag = false;
	for (int i = 0; i < 3; i++) {
		if (used[i][0] == true && used[i][1] == true && used[i][2] == true) flag = true;
		if (used[0][i] == true && used[1][i] == true && used[2][i] == true) flag = true;
	}
	if (used[0][0] == true && used[1][1] == true && used[2][2] == true) flag = true;
	if (used[0][2] == true && used[1][1] == true && used[2][0] == true) flag = true;

	if (flag == true) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <stdio.h>
#include <algorithm>


using namespace std;

int main(int argc, char *argv[]){

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


  // sort し効率良く探す。
  sort(D.begin(), D.end());
  for(int i = 0; i < M; i++){
    cin >> T[i];
  }
  sort(T.begin(), T.end());
  int dcounter = 0;
  int tcounter = 0;
  while(1){
    if(D[dcounter] == T[tcounter]){
      dcounter++;
      tcounter++;
    }else{
      dcounter++;
    }
    if(M == tcounter) break;
    if((N-dcounter) < (M-tcounter) || N == dcounter)
      goto NO;
  }

  cout << "YES" << endl;
  return 0;

  NO:
  cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 1792