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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

namespace pb_ds {   
	namespace io {
		const int MaxBuff = 1 << 15;
		const int Output = 1 << 23;
		char B[MaxBuff], *S = B, *T = B;
#define getc() ((S == T) && (T = (S = B) + fread(B, 1, MaxBuff, stdin), S == T) ? 0 : *S++)
		char Out[Output], *iter = Out;
		inline void flush() {
			fwrite(Out, 1, iter - Out, stdout);
			iter = Out;
		}
	}

	template<class Type = int> inline Type read() {
		using namespace io;
		register char ch; register Type ans = 0; register bool neg = 0;
		while(ch = getc(), (ch < '0' || ch > '9') && ch != '-')     ;
		ch == '-' ? neg = 1 : ans = ch - '0';
		while(ch = getc(), '0' <= ch && ch <= '9') ans = ans * 10 + ch - '0';
		return neg ? -ans : ans;
	}

	template<class Type> inline void Print(register Type x, register char ch = '\n') {
		using namespace io;
		if(!x) *iter++ = '0';
		else {
			if(x < 0) *iter++ = '-', x = -x;
			static int s[100]; register int t = 0;
			while(x) s[++t] = x % 10, x /= 10;
			while(t) *iter++ = '0' + s[t--];
		}
		*iter++ = ch;
	}
}

void File() {
#ifdef zjp_shadow
	freopen ("F.in", "r", stdin);
	freopen ("F.out", "w", stdout);
#endif
}

const int N = 18, S = 1 << N, Mod = 998244353;

inline int fpm(int x, int power) {
	int res = 1;
	for (; power; power >>= 1, x = 1ll * x * x % Mod)
		if (power & 1) res = 1ll * res * x % Mod;
	return res;
}

int n, len, p[S], s[S], sum, pre[S + 1], inv[S + 1];

void FWT(int *P, int opt) {
	for (int i = 2, p; p = i >> 1, i <= len; i <<= 1)
		for (int j = 0; j < len; j += i) Rep (k, p) {
			int u = P[j + k], v = P[j + k + p];
			P[j + k] = (u + v) % Mod; P[j + k + p] = (u + Mod - v) % Mod;
		}
	if (!~opt) {
		int invn = fpm(len, Mod - 2);
		Rep (i, len) P[i] = 1ll * P[i] * invn % Mod;
	}
}

using namespace pb_ds;

int main() {

	File();

	len = 1 << (n = read());
	Rep (i, len) (sum += p[i] = read()) %= Mod;
	sum = fpm(sum, Mod - 2);
	Rep (i, len) p[i] = 1ll * sum * p[i] % Mod; -- p[0];
	Rep (i, len) s[i] = (i ? 0 : len) - 1;

	FWT(p, 1); FWT(s, 1); 

	pre[0] = 1;
	For (i, 1, len)
		pre[i] = 1ll * max(1, p[i - 1]) * pre[i - 1] % Mod;
	inv[len] = fpm(pre[len], Mod - 2);
	Fordown (i, len - 1, 0)
		inv[i] = 1ll * inv[i + 1] * max(1, p[i]) % Mod;
	Rep (i, len) if (p[i])
		p[i] = 1ll * s[i] * inv[i + 1] % Mod * pre[i] % Mod; 

	FWT(p, -1);

	Rep (i, len) 
		Print((p[i] - p[0] + Mod) % Mod);
	io :: flush();

	return 0;

}

Measured memory_bytes: 11008
n, m, x, y = map(int, input().split())
if x>y :
    print('War')
else  :
    X = sorted(list(map(int, input().split())))
    Y = sorted(list(map(int, input().split())))
    a = 0
    for i in range(x+1, y+1):
        if X[-1]<i and i <= Y[0] and x < i and i <= y:
            print('No War')
            break
        else :
            a += 1
    if a == y-x:
        print('War')


Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(ll i=0;i<n;++i)
#define END(x) (*(x.end()-1))
#define INF (INT_MAX / 2)

using namespace std;
typedef long long ll;


template<typename T>
T gcd(T a, T b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

template<typename T>
T lcm(T a,T b){
    return a/gcd(a,b)*b;
}

int main(void){
    int a,b;
    cin>>a>>b;
    if(a>=13){
        cout<<b;
    }
    else if(a>=6){
        cout<<b/2;
    }
    else{
        cout<<0;
    }
}
/*

*/


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define for1(i, m, n) for(int i = m;i < n;i++)
#define ll long long
#define endl '\n'
using namespace std;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int k, t;
    cin >> k >> t;
    int a[110], m = -1;
    rep(i, t) {
        cin >> a[i];
        if (a[i] > m) {
            m = a[i];
        }
    }
    sort(a, a+t);
    cout << max(a[t-1] - 1 - k + a[t-1], 0) << endl;
	return 0;
}

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

namespace AtCoder {
    class _159a {
        static void Main() {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int result = n * (n - 1) / 2 + m * (m - 1) / 2;
            Console.WriteLine(result);
        }
    }
}

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = (1 << 30);
constexpr ll L_INF = (1ll << 62);

//==================================

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

    char z;
    cin >> z;

    cout << (char)(z + 1) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;



#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

ll debugFlag = false;
template<typename T> void debug(T&);
template<typename T> void debug(T&, bool);
template<typename T> void debug(vector<T>&);
template<typename T> void debug(vector<T>&, bool);
template<typename T, typename U> void debug(pair<T, U>&);
template<typename T, typename U> void debug(pair<T, U>&, bool);

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

void solve() {

	ll M, D;
	cin >> M >> D;

	ll ans = 0;

	rep(i, M) rep(j, D) {

		ll ii = i + 1;
		ll j1 = (j + 1)/10;
		ll j2 = (j + 1) % 10;

		if (j1 >= 2 && j2 >= 2 && ii == j1 * j2) {
			ans++;
		}

	}

	cout << ans;

}


int main(int argc, char* argv[]) {
	if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 888
#include<stdio.h>

int main(){
	int n,i;
	long long h[100000];
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%lld",&h[i]);
	for(i=n-1;i>0;i--){
		if(h[i]-h[i-1]<-1){
			puts("No");
			return 0;
		}else if(h[i]-h[i-1]==-1)h[i-1]--;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
const int mo=998244353;
int ksm(int a,int b){
  int ans=1;
  while (b){
	if (b&1) ans=1ll*ans*a%mo;
	b>>=1;a=1ll*a*a%mo;
  }
  return ans;
}
struct point {
  int x,y;
  point operator-(const point &a){
   return (point){x-a.x,y-a.y};
  }
  bool operator==(const point &a){
    return x==a.x && y==a.y;
  }
};

int cross(point a,point b){
  return a.x*b.y-a.y*b.x;
}

void add(int &x,int y){
  x+=y;
  if (x>=mo) x-=mo;
  if (x<0) x+=mo;
}

int dot(point a,point b){
  return a.x*b.x+a.y*b.y;
}
bool cmp(point a,point b){
   if (a.x==0 && b.x==0) return a.y<b.y;
   if (a.x==0) return 0;
   if (b.x==0) return 1;
   if (cross(a,b)==0) {
	 if (a.x*b.x<0) return a.x<b.x;
	 else return dot(a,a)<dot(b,b);
   }
   if (a.x<0) {a.x*=-1;a.y*=-1;}
   if (b.x<0) {b.x*=-1;b.y*=-1;}
   return cross(a,b)>0;
}
point p[210],t[210];
int main()
{
    int i,j;
    int n;
    cin>>n;
    for (i=1;i<=n;i++) scanf("%d %d",&p[i].x,&p[i].y);
    int ans=ksm(2,n);
    add(ans,-1-n);
    int cnt;
    for (i=1;i<=n;i++){
      cnt=0;
      for (j=1;j<=n;j++){
        if (j==i) continue;
        t[cnt++]=p[j]-p[i];
      }
      sort(t,t+cnt,cmp);
      int last=0;
      for (j=1;j<cnt;j++){
		if (cross(t[j-1],t[j])){
			if (t[last].x<0 || (t[last].x==0 && t[last].y<0)) {last=j;continue;}
			add(ans,-(ksm(2,j-last+1)-(j-last+1)-1));
			last=j;
		}
      }
      if (cnt && !(t[last].x<0 || (t[last].x==0 && t[last].y<0))){
		add(ans,-(ksm(2,j-last+1)-(j-last+1)-1));
      }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <queue>
#include <iomanip>
#include <algorithm>
using namespace std;

string s;

int main()
{
	cin >> s;
	for (int i = 0; i < 8; i++) {
		int cur = s[0] - '0';
		for (int j = 0; j < 3; j++)
			if (i & 1 << j) cur += int(s[j + 1] - '0');
			else cur -= int(s[j + 1] - '0');
		if (cur == 7) {
			printf("%c", s[0]);
			for (int j = 0; j < 3; j++) {
				if (i & 1 << j) printf("+");
				else printf("-");
				printf("%c", s[j + 1]);
			}
			printf("=7\n");
			return 0;
		}
	}
	return 0;
}

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

int main()
{
	int i, j;
	
	for(i = 1; i <= 9; ++i){
		for(j = 1; j <= 9; ++j){
			printf("%dx%d=%d\n", i, j, i*j);
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 3e6 + 5;
const int mod = 1e9 + 7;
int a[maxn];
int main(){
	int a,b;
	cin >> a >> b;
	if (a - 2 * b > 0) cout << a - 2 * b << endl;
	else cout << "0" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int i,j=0;
    char n[4];
    for(i=0;i<4;i++){
    scanf("%c",&n[i]);
        if(n[i]=='+')
            j=j+1;
        else
            j=j-1;
        }
    printf("%d\n",j);
    return 0;
}

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

void solve(){
	int x;
	cin >> x;
	if(x == 0) cout<<1;
	else cout<<0;
}
	

int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int q;
    // cin>>q;
	q=1;
    while(q--) solve();


    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
struct edge
{
    int l,r;
    bool operator < (const edge& ope)
    {
        return this->r<ope.r;
    }
}a[100005];
int i,j,k,n,m;
int main()
{
    cin>>n>>m;
    for(i=1;i<=m;i++)scanf("%d%d",&a[i].l,&a[i].r);
    sort(a+1,a+m+1);
    i=j=k=1;
    while(i<=m)
    {
        while(j<=m&&a[i].r>a[j].l)j++;
        if(j>m)break;
        i=j;
        k++;
    }
    cout<<k<<endl;
    return 0;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.Iterator;

public class Main {

	static BufferedReader reader;
	final static boolean MODE_DEBUG = false;
	//static field here
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		int[] NM = readLineInt();
		int N = NM[0];
		int M = NM[1];
		int MIN = 1;
		int MAX = N;
		for(int k=0;k<M;k++) {
			int[] LR = readLineInt();
			int L = LR[0];
			int R = LR[1];
			MIN = Math.max(L,MIN);
			MAX = Math.min(R,MAX);
		}
		print(Math.max(MAX-MIN+1,0));
	}
	
	//functions here
	//note that all methods should be STATIC


	private static <T> int arraySearch(T needle, T[] heystack) {
		for(int i=0;i<heystack.length;i++) {
			if(needle.equals(heystack[i])) {
				return i;
			}
		}
		return -1;
	}
	private static int[] sort(int[] base) {
		int[] copy = array_copy(base);
		Arrays.sort(copy);
		return copy;
	}
	private static int[] array_copy(int[] base) {
		int[] copy = new int[base.length];
		for(int i=0;i<base.length;i++) {
			copy[i] = base[i];
		}
		return copy;
	}
	private static int[] asArray(ArrayList<Integer> ints) {
		int[] intlist = new int[ints.size()];
		for(int i=0;i<intlist.length;i++) {
			intlist[i] = ints.get(i);
		}
		return intlist;
	}
	private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	}
	private static int[] readLineInt(){
		try{
			String[] s = readLine();
			int[] ints = new int[s.length];
			for(int i=0;i<ints.length;i++) {
				ints[i] = Integer.parseInt(s[i]);
			}
			return ints;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static byte[] readLineByte(){
		try{
			String[] s = readLine();
			byte[] bytes = new byte[s.length];
			for(int i=0;i<bytes.length;i++) {
				bytes[i] = Byte.parseByte(s[i]);
			}
			return bytes;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static char[] readLineChar(){
		try{
			String[] s = readLine();
			char[] chars = new char[s.length];
			for(int i=0;i<chars.length;i++) {
				chars[i] = (char)Integer.parseInt(s[i]);
			}
			return chars;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static void print(Object o){
		System.out.println(o);
	}
	private static void print(){
		System.out.println();
	}
	private static void printd(Object o){
		if(MODE_DEBUG)System.err.println(o);
	}
	private static void printd(){
		if(MODE_DEBUG)System.err.println();
	}
}


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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)

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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 109, M = 2e3 + 9, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;

int n, ne, head[N], nxt[M], to[M], cost[M];

void initGraph(){
    memset(head, -1, n * sizeof head[0]);
    ne = 0;
}

void addEdge(int f, int t, int c){
    to[ne] = t;
    cost[ne] = c;
    nxt[ne] = head[f];
    head[f] = ne++;
}

void addBiEdge(int u, int v, int c){
    addEdge(u, v, c);
    addEdge(v, u, c);
}

int dist[N];
map<pii, int> edges;

void dijkstraSparse(int src){
    memset(dist, OO, sizeof dist);
    dist[src] = 0;
    priority_queue<pair<int, pii>> q;
    q.push({0, {src, -1}});
    while(q.size()){
        int d = -q.top().first;
        int u = q.top().second.first;
        src = q.top().second.second;
        q.pop();
        if(d != dist[u])    continue;

        if(~src) edges[{min(u ,src), max(u, src)}] = 1;

        for(int e = head[u] ; ~e ; e = nxt[e]){
            int v = to[e];
            int dd = d + cost[e];
            if(dist[v] > dd){
                dist[v] = dd;
                q.push({-dd, {v, u}});
            }
        }
    }
}

int m, u, v, c;

int main(){
    init();

    cin >> n >> m;  initGraph();

    for(int i = 0;i < m;i++){
        cin >> u >> v >> c;  --u, --v;
        addBiEdge(u, v, c);
    }

    for(int i = 0;i < n;i++)    dijkstraSparse(i);

    cout << m - edges.size();
}

Measured memory_bytes: 256
//#include <atcoder/modint>
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
typedef long long ll;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(x) ll(x.size()) 
using P = pair<int, int>;
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 int INF = 2e9;
const ll LINF = (1LL<<60);

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  map<int, int> mp;
  REP(i,n){
    int d; cin >> d;
    mp[d]++;
  }
  
  int m; cin >> m;
  REP(i,m){
    int t; cin >> t;
    if(mp[t]==0){
      cout << "NO\n";
      return 0;
    }
    mp[t]--;
  }
  cout << "YES\n";
  return 0;
}


Measured memory_bytes: 13000
// AOJ Volume 0 Problem 0062

#include <stdio.h>
#include <string.h>

int main(void)
{
    char in_str[11];
	int num[10];
	int i;
	int j;
	

	while (scanf("%s", &in_str) != EOF){
		for (i = 0; i < 10; i++){
			num[i] = in_str[i] - '0';
		}
		
		for (i = 9; i >= 0; i--){
			for (j = 0; j < i; j++){
				num[j] = (num[j] + num[j + 1]) % 10;
			}
		}
		printf("%d\n", num[0]);
	}

	return (0);
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int p[]=new int[n];
		for(int i=0;i<n;i++) {
			p[i]=scan.nextInt();
		}
		scan.close();
		int cnt=0;
		for(int i=1;i<n-1;i++) {
			if(Math.max(p[i-1], Math.max(p[i], p[i+1])) != p[i]
					&& Math.min(p[i-1], Math.min(p[i], p[i+1])) != p[i]) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int shu(int n){
	int s=0;
	while(n!=0){
		n/=10;
		s++;
	}
	return s;
}
int main(){
	long long n,i;
	cin>>n;
	i=sqrt(n)+1;
	while(i>0){
		if(n%i==0){
			cout<<shu(n/i)<<endl;
			return 0;
		}
		i--;
	}
	return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        l: i32,
        r: i32,
        d: i32,
    }
    println!("{}", r / d - l / d - (l % d != 0) as i32 + 1);
}

Measured memory_bytes: 2104
#include <iostream>
#include <cstdio>
#include <bitset>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
#include <limits>

using namespace std;
using ll=long long;
using vint=vector<int>;
using pint=pair<int,int>;

const double EPS = 1e-9;
const ll neg_inf = numeric_limits<ll>::min() / 2;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

void solve(){
    const ll MAX_N=1e5 + 5;
    ll N, a[MAX_N * 3] ={};
    ll before_score[MAX_N] = {}, after_score[MAX_N] = {};
    priority_queue<ll, vector<ll>, greater<ll> > before;
    priority_queue<ll, vector<ll>, less<ll> >    after;

    cin >> N;
    rep(i,3*N) cin >> a[i];


    ll before_sum = 0, after_sum = 0;
    rep(i,N){ before_sum += a[i]; before.push(a[i]); }
    REP(i, 2*N, 3*N){ after_sum += a[i]; after.push(a[i]); }


    rep(k,N+1){
        before_score[k] = before_sum;
        before.push(a[N+k]);
        before_sum += a[N+k] - before.top(); before.pop(); 
    }

    rep(k,N+1){
        after_score[k] = after_sum;
        after.push(a[2*N-k-1]);
        after_sum += a[2*N-k-1] - after.top(); after.pop(); 
    }


    ll ret = neg_inf;
    rep(i, N+1){
        ll val;
        val = before_score[i] - after_score[N-i];
        ret = max(ret, val);
    }

    cout << ret << endl;
}

int main(){
    solve();
    return 0;
}

Measured memory_bytes: 6516
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int n,m;cin>>n>>m;

    VL h(n);
    REP(i,n){
        cin>>h[i];
    }

    VVI e(n);

    REP(i,m){
        int a,b;cin>>a>>b;
        a--;
        b--;
        e[a].PB(b);
        e[b].PB(a);
    }

    LL result = 0;

    REP(i,n){
        bool f = true;
        for(auto x : e[i]){
            if(h[i] <= h[x]){
                f = false;
                break;
            }
        }
        if(f){
            result++;
        }
    }

    cout<<result<<endl;
    
    return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 9272
S = input()
N = len(S)
P = 2019

num = [0] * P
num[0] = 1
now, ans = 0, 0
_10 = 1
for i in range(N-1, -1, -1):
    now = (now + int(S[i]) * _10) % P
    _10 *= 10
    _10 %= P
    ans += num[now]
    num[now] += 1
 
print(ans)

Measured memory_bytes: 9272
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int gcd(int m,int n){
  return n?gcd(n,m%n):m;
}
int main(void){
  int n;
  cin>>n;
  cin.ignore();
  while(n--){
    string line;
    stringstream ss;
    getline(cin,line);
    int decode[26];
    char t1[] = "that";
    char t2[] = "this";
    char test[] = "that";
    bool finde = false;
    for(int a = 3; a<=1126; a++){
      if(a==1126) puts("a");
      if(gcd(26,a)!=1) continue; 
      for(int b=0; b<26; b++){

        for(int i=0; i<26; i++){
          decode[i] = (a*i+b)%26;
        }
        
        for(int i=0;i<4; i++){
          test[i] = 'a' + decode[t1[i]-'a'];
        }
        if(line.find(test)!=string::npos){
          //cout<<test<<endl;
          finde = true;
          break;
        }
        for(int i=0;i<4; i++){
          test[i] = 'a' + decode[t2[i]-'a'];
        }
        if(line.find(test)!=string::npos){
          //cout<<test<<endl;
          finde = true;
          break;
        }
      }
      if(finde) break;
    }
    ss<<line;
    bool f = false;
    while(ss>>line){
      if(f) cout<<" ";
      f = true;
      for(int i=0;i<(int)line.size();i++){
        for(int j=0; j<26; j++){
          if(decode[j]+'a'==line[i]){
            line[i] = 'a' + j;
            break;
          }
        }
      }
      cout<<line;
    }
    cout<<endl;
    //for(int i=0;i<26; i++) cout<<decode[i]<<" ";
  } 
  return 0;
}

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

using namespace std;
#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 998244353;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

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

ll n, a, b, k;
ll f[N];
ll rn[N];
ll inv[N];
ll left[N];

ll C(int n, int k) {
	if (k > n) return 0;
	return (f[n] * inv[k] % mod) * inv[n-k] % mod; 
}

ll bpow (ll a, ll b) {
	ll res = 1;
	while (b > 0) {
		if (b & 1) res = (res * a) % mod;
		a = (a * a) % mod;
		b /= 2;
	}
	return res;
}

int main () {
	SpeedForce;

	cin >> n >> a >> b >> k;

	f[0] = 1;
	rn[1] = 1;
	inv[0] = 1;
	f[1] = inv[1] = 1;
	for (int i = 2; i <= n; ++ i)
		rn[i] = mod - (mod / i * rn[mod % i]) % mod;
		
	for (int i = 2; i <= n; ++ i) {
		f[i] = f[i-1] * i % mod;
		inv[i] = inv[i-1] * rn[i] % mod;
	}

	ll res = 0;
	for (int i = 0; i <= n; i ++) if (k >= a * i && (k - a * i) % b == 0) {
		ll j = (k - a * i) / b;
		if (j <= n) {
			res = (res + C(n, j) * C(n, i) % mod) % mod;
		}
	}
	cout << res << '\n';


   	return Accepted;
}

// B...a

Measured memory_bytes: 14592
list_cell = ["#", "."]
while True:
    H, W = map(int, input().split(" "))
    if H == 0 & W == 0:
        break
    
    for h in range(H):
        if h % 2 == 0:
            selector = 0
        else:
            selector = 1
        for w in range(W):
            output_char = list_cell[selector]
            print(output_char, end='')
            selector = (selector + 1) % 2
        print()
    print()


Measured memory_bytes: 7004
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func allAtoi(num []string) []int {
	conv := make([]int, len(num))
	for i, item := range num {
		conv[i], _ = strconv.Atoi(item)
	}
	return conv
}

func main() {
	nm := allAtoi(strings.Split(nextLine(), " "))
	n := nm[0]
	m := nm[1]
	foods := map[int]int{}
	for i := 1; i <= m; i++ {
		foods[i] = 0
	}
	for i := 0; i < n; i++ {
		input := allAtoi(strings.Split(nextLine(), " "))
		for j := 1; j <= input[0]; j++ {
			num := input[j]
			foods[num]++
		}
	}
	ans := 0
	for _, v := range foods {
		if v == n {
			ans++
		}
	}
	fmt.Println(ans)
}


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

int main(){
    /*
    string a;
    int b = 0;
    cin >> a;
    for(int i =0; i<4; i++){
        if(a[i] == '+'){
            ++b;
        }else{
            --b;
        }
    }
    cout << b << endl;
    */
   string s; cin >> s;
   int sum=0;
   rep(i,4){
       if(s[i] == '+'){
           ++sum;
       }else{
           --sum;
       }
   }
   cout << sum << endl;
}

Measured memory_bytes: 3624
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10


def main():
    a, b = map(int, input().split())
    if a <= 0 <= b:
        print("Zero")
    elif a >= 1:
        print("Positive")
    else:
        minus = abs(min(0, b) - a + 1)
        print("Positive" if minus % 2 == 0 else "Negative")

if __name__ == '__main__':
    main()


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

int main()
{
  int n;
  cin >> n;
  long long int a[n], sum[n], sum2[n];
  cin >> a[0];
  sum[0] = a[0];
  long long int ans = 0;
  for(int i = 1; i < n; i++) cin >> a[i];
  if(sum[0] > 0){
    long long int ans2 = 0, ans3 = 0;
    for(int i = 1; i < n; i++){
      sum[i] = sum[i-1] + a[i];
      if(i & 1){
        if(sum[i] >= 0){
          ans2 += sum[i] + 1;
          sum[i] = -1;
        }
      }else{
        if(sum[i] <= 0){
          ans2 += 1 - sum[i];
          sum[i] = 1;
        }
      }
    }
    ans3 += sum[0] + 1;
    sum[0] = -1;
    for(int i = 1; i < n; i++){
      sum[i] = sum[i-1] + a[i];
      if(i & 1){
        if(sum[i] <= 0){
          ans3 += 1 - sum[i];
          sum[i] = 1;
        }
      }else{
        if(sum[i] >= 0){
          ans3 += sum[i] + 1;
          sum[i] = -1;
        }
      }
    }
    ans = min(ans2,ans3);
  }else if(sum[0] < 0){
    long long int ans2 = 0, ans3 = 0; 
    for(int i = 1; i < n; i++){
      sum[i] = sum[i-1] + a[i];
      if(i & 1){
        if(sum[i] <= 0){
          ans2 += 1 - sum[i];
          sum[i] = 1;
        }
      }else{
        if(sum[i] >= 0){
          ans2 += sum[i] + 1;
          sum[i] = -1;
        }
      }
    }
    ans3 += 1 - sum[0];
    sum[0] = 1;
    for(int i = 1; i < n; i++){
      sum[i] = sum[i-1] + a[i];
      if(i & 1){
        if(sum[i] >= 0){
          ans3 += sum[i] + 1;
          sum[i] = -1;
        }
      }else{
        if(sum[i] <= 0){
          ans3 += 1 - sum[i];
          sum[i] = 1;
        }
      }
    }
    ans = min(ans2, ans3);
  }else{
    long long int ans2 = 1, ans3 = 1;
    sum[0] = 1;
    for(int i = 1; i < n; i++){
      sum[i] = sum[i-1] + a[i];
      if(i & 1){
        if(sum[i] >= 0){
          ans2 += sum[i] + 1;
          sum[i] = -1;
        }
      }else{
        if(sum[i] <= 0){
          ans2 += 1 - sum[i];
          sum[i] = 1;
        }
      }
    }
    sum2[0] = -1;
    for(int i = 1; i < n; i++){
      sum2[i] = sum2[i-1] + a[i];
      if(i & 1){
        if(sum2[i] <= 0){
          ans3 += 1 - sum2[i];
          sum2[i] = 1;
        }
      }else{
        if(sum2[i] >= 0){
          ans3 += sum2[i] + 1;
          sum2[i] = -1;
        }
      }
    }
    ans = min(ans2,ans3);
  }
  cout << ans << endl;
}

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

using namespace std;
using ll = long long;

template <typename K,typename V>
using umap = unordered_map<K,V>;
template <typename V>
using uset = unordered_set<V>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i,n) for(int i=0;i<n;i++)
#define REPD(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(v) v.begin(),v.end()

#define endl "\n"
#define INF 1'000'000'000'000 //10^12
#define MOD 1'000'000'007
//グリッドグラフの範囲チェック
bool range_validation(int y,int x,int h,int w){
    return y>=0 && y<h && x>=0 && x < w;
}
//ビットカウント
int popcount(long bits){
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

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

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n;
  cin >> n;
  
  vector<int> arr(n);
  
  REP(i,n){
    cin >> arr[i];
  }

  sort(ALL(arr));
  int res = 0;
  REP(i,n){
    FOR(j,i+1,n){
      FOR(k,j+1,n){
        if(arr[i] != arr[j] && arr[j] != arr[k]){
          if(arr[j]-arr[i] < arr[k] && arr[k] < arr[i] + arr[j]){
            res++;
          }
        }
      }
    }
  }
  cout << res << endl;
  return 0;
}


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

int main() {
    int N, t, ans = 0;
    cin >> N;
    for(int i = 1; i <= N; i++){
        cin >> t;
        if((t % 2 == 1) && (i % 2 == 1)){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  string S;
  cin >> S;
  int c0 = 0, c1 = 0;
  REP(i, S.length()) {
    if (S[i] == '0') {
      c0++;
    } else {
      c1++;
    }
  }
  cout << 2 * min(c0, c1);
  return 0;
}

Measured memory_bytes: 512
'use strict';
function main(input) {
  input = input.split(" ");
  const p = Number(input[0]) + Number(input[1]);
  const m = Number(input[0]) - Number(input[1]);
  const t = Number(input[0]) * Number(input[1]);

  if(p > m && p > t){
  	console.log(p);
  }else if(m > t){
  	console.log(m);
  }else{
    console.log(t);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 9420
#include <bits/stdc++.h>
#define int long long
using namespace std;
struct cell
{
	int first, second;
};
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin >> n;
	int arr[n];
	for (int i = 0; i < n; i++)cin >> arr[i];
	cell dp[n][n];

	for (int i = 0; i < n; i++)
	{
		dp[i][i].first = arr[i];
		dp[i][i].second = 0;
	}
	for (int len = 2; len <= n; len++)
	{
		for (int i = 0; i < n - len + 1; i++)
		{
			int j = i + len - 1;
			if (arr[i] + dp[i + 1][j].second > arr[j] + dp[i][j - 1].second)
			{
				dp[i][j].first = arr[i] + dp[i + 1][j].second;
				dp[i][j].second = dp[i + 1][j].first;
			}
			else
			{
				dp[i][j].first = arr[j] + dp[i][j - 1].second;
				dp[i][j].second = dp[i][j - 1].first;
			}
		}
	}
	cout << dp[0][n-1].first - dp[0][n-1].second;

	return 0;
}

Measured memory_bytes: 140672
import java.util.*;

public class Main {
    static ArrayList<Integer> packages = new ArrayList<>();
    static int trucks;
    static int total;

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

        total = inp.nextInt();
        trucks = inp.nextInt();

        int sum = 0;

        for(int i = 0; i < total; i++){
            int item = inp.nextInt();
            packages.add(item);
            sum += item;
        }

        int lower = 0;

        int answer = sum;
        while (lower <= sum) {
            int mid = (sum+lower)/2;

            if (check(mid)) {
                answer = mid;
                sum = mid - 1;
            } else { lower = mid + 1;}
        }

        System.out.println(answer);
    }

    static boolean check(int p) {
        int cntTruck = 1, currentTruck = 0;
        for (int i = 0; i < total; i++) {
            if (currentTruck + packages.get(i) <= p) {
                currentTruck += packages.get(i);
            } else {
                if (cntTruck >= trucks) return false;
                cntTruck++;
                if (packages.get(i) > p) return false;
                currentTruck = packages.get(i);
            }
        }

        return true;
    }
}



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

typedef long long ll;

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

    ll d[n+1];
    d[0] = 0;
    map<ll, int> pos;
    pos[0] = 0;
    int ans = 0;

    for(int i = 1; i <= n; i++){
        cin >> d[i];
        d[i] += d[i-1];
        if(pos.count(d[i]) == 1){
            ans = max(ans, i - pos[d[i]]);
        }else{
            pos[d[i]] = i;
        }
    }  

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


Measured memory_bytes: 17156
#include<stdio.h>
#define N 45

int main(){
    int i, m;
    int F[N];
    
    scanf("%d", &m);
    F[0] = 1;
    F[1] = 1;
    
    for(i = 2; i <= m; i++){
        F[i] = F[i - 1] + F[i - 2];
    }
    
    printf("%d\n", F[m]);
    return 0;
}


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

const long long INF = 1e9;

long long h, w;
long long calc1(long long h1, long long w1) {
  long long a = h1 * w;
  long long b = (h - h1) * w1;
  long long c = (h - h1) * (w - w1);
  long long max_s = max(a, max(b, c));
  long long min_s = min(a, min(b, c));
  return max_s - min_s;
}
long long calc2(long long h1, long long w1) {
  long long a = h * w1;
  long long b = h1 * (w - w1);
  long long c = (h - h1) * (w - w1);
  long long max_s = max(a, max(b, c));
  long long min_s = min(a, min(b, c));
  return max_s - min_s;
}

int main() {
  cin>>h>>w;
  if (h % 3 == 0 || w % 3 == 0) {
    cout<<0<<endl;
    return 0;
  }

  long long ans = min(h, w);

  long long h1 = h / 3;
  long long h2 = h / 3 + 1;
  ans = min(ans, min(calc1(h1, w/2), calc1(h2, w/2)));

  long long w1 = w / 3;
  long long w2 = w / 3 + 1;
  ans = min(ans, min(calc2(h/2, w1), calc2(h/2, w2)));
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
string L="ABCDEFGHIJKLMNOPQRSTUVWXYZ",A=" ',-.?"+L,C=L+" .,-'?";
string B = "101 000000 000011 10010001 010001 000001 100101 10011010 "
	"0101 0001 110 01001 10011011 010000 0111 10011000 "
	"0110 00100 10011001 10011110 00101 111 10011111 1000 "
	"00110 00111 10011100 10011101 000010 10010010 10010011 10010000";
int bin2dec(string s){
	int x=0,i;
	for(i=0;i<s.size();i++){
		x*=2;
		if(s[i] =='1')x++;
	}
	return x;
}
int main(){
	vector<string>x(32);
	stringstream ss(B);
	string s,s1,s0;
	int i,n,p;
	for(i=0;i<32;i++){
		ss>>s;
		x[i]=s;
	}
	while(getline(cin,s)){
		s1="";
		for(i=0;i<s.size();i++)s1+=x[A.find(s[i])];
		n=s1.size()%5;
		if(n!=0)s1+=string(5-n,'0');
		s="";
		for(i=0;i<s1.size();i+=5){
			p=bin2dec(s1.substr(i,5));
			s+=C[p];
		}
		cout<<s<< endl;
	}
}

Measured memory_bytes: 1212
#include <iostream>
using namespace std;
int main()
{
	int A[30] = {};
	int P[1000000] = {};
	int i = 0, k;
	while (cin >> k) A[i++] = k;
	int c = 0, j;
	for (int k = 2; k < 1000000; ++k){
		if (P[k] == 0){
			P[k] = ++c;
			for (j = 2; j * k < 1000000; ++j)
				P[j * k] = -1;
		}
		else if (P[k] == -1)
			P[k] = c;		
	}
	for (j = 0; j < i; ++j)
		cout << P[A[j]] << "\n";
	return 0;
}

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

using namespace std;
using ll = long long int;

int N;

void solve(string s, char m){
    if (N == s.length()){
        cout << s << endl;
    }else{
        for(char c = 'a'; c <= m; c++){
            solve(s + c, ((c == m) ? char(m + 1) : m));
        }
    }
}

int main() {
    cin >> N;
    solve("", 'a');

    return 0;
}

Measured memory_bytes: 1536
#import <stdio.h>

int main(int argc, char *argv[]) {
	int N,S;
	scanf("%d %d",&N,&S);
	int E = S + N - 1;
	int a;
	if (S<0&&E>0) {
		a = (S+E)*N/2;
	}else if (S>=0){
		a = (S+1+E)*(N-1)/2;
	} else {
		a = (S+E-1)*(N-1)/2;
	}
	printf("%d",a);
}

Measured memory_bytes: 7500
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int a, b, c;
	cin >> a >> b >> c;
	if((a == 1 && b == 1 || c==1))cout << "Open"<<endl;
	else cout << "Close" << endl;

	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

Measured memory_bytes: 1160
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
// 293206GT
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
#include <stack>
#include <string>
#include<algorithm>
#include <random>
#include <bitset>
#include <chrono>

typedef long long ll;
#define int ll
using namespace std;
#define put(a) cout << (a) << '\n'
#define sqr(x) (x) * (x)
typedef pair<int, int> pii;
typedef long double ld;
typedef pair<ld, ld> pld;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<pii> vpii;
#define rep(x, y, a) for (int x = (y); x < (int)(a); ++x)
#define all(a) a.begin(), a.end()
#define chkmax(a, b) a = max(a, (b))
#define chkmin(a, b) a = min(a, (b))
#define prev asasdasd
#define next aasdasda
#define left asdasdasdasd
#define right asnabsdkasdl
#define rank asdasdknlasd
#define move asdasdas

namespace IO {
    template<class A, class B>
    ostream &operator<<(ostream &out, pair<A, B> a) {
        out << a.first << " " << a.second;
        return out;
    }

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> a) {
        for (pair<A, B> x: a)
            out << x.first << " " << x.second << '\n';
        return out;
    }

    template<class A>
    ostream &operator<<(ostream &out, vector<A> a) {
        for (A x: a) out << x << ' ';
        return out;
    }

    template<class A, class B>
    istream &operator>>(istream &in, pair<A, B> &a) {
        in >> a.first >> a.second;
        return in;
    }

    template<class A>
    istream &operator>>(istream &in, vector<A> &a) {
        for (A &x: a) in >> x;
        return in;
    }
}
using namespace IO;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


void solve() {
    int n;
    cin >> n;
    vi a(n);
    cin >> a;
    int ans = 0;
    rep(i, 0,n) ans += (i%2==0)*(a[i]%2);
    put(ans);
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(30);
//    freopen("input.txt", "r", stdin);
    int q = 1;
//    cin >> q;

    while (q--) solve();
}


Measured memory_bytes: 3204
#include <iostream>
using namespace std;
template <typename T>
T gcd(T a,T b){
  if(a%b==0)return b;
  else return gcd(b,a%b);
}
int main(){
	int x,y;cin>>x>>y;
	cout << x+y-gcd(x,y)+1 << endl;
}


Measured memory_bytes: 3092
N = int(input()) # 青いカードの枚数
s = [input() for _ in range(N)] # 青いカードに書かれている文字列
M = int(input()) # 赤いカードの枚数
t = [input() for _ in range(M)]

sset = list(set(s)) # set型のままではインデックスを選べないので注意,この文はなくても良いがforループの短縮に繋がる
count = [s.count(sset[i]) - t.count(sset[i]) for i in range(len(sset))] # sにある要素で得点をリストに入れる(tのみにある文字列は答えになり得ない)
ans = max(0, max(count)) # countの最大値が負だったら0を返す

print(ans)


Measured memory_bytes: 3060
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var N = int.Parse(ReadLine());
            var A = new int[N];
            for (int i = 0; i < N; i++)
            {
                A[i] = int.Parse(ReadLine());
            }

            var sortA = A.OrderByDescending(x => x).ToArray();
            foreach (var item in Enumerable.Range(0, N))
            {
                WriteLine(sortA[0] == A[item] ? sortA[1] : sortA[0]);
            }
        }
    }
}


Measured memory_bytes: 22484
N,C,K=map(int,input().split())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A.sort()
k=K
a=0
c=C-1
j=1
while j<N:
    k-=A[j]-A[j-1]
    c-=1
    if k>=0 and c>=0:    
        j+=1
    else:     
        a+=1
        c=C-1
        k=K
        j+=1
print(a+1)   

Measured memory_bytes: 7384
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>

#define sint(i) scanf("%d",&i);
#define sintt(i,j) scanf("%d%d",&i,&j);
#define sinttt(i,j,k) scanf("%d%d%d",&i,&j,&k);
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int masu[17][17];
int ura[17][17];
int xx,yy;

int saiki(int x,int y){
	if(x<1||y<1){
		return 0;
	}
	if(ura[x][y]==1){
		return masu[x][y]=0;
	}
	
	if(masu[x][y]!=-1){
		return masu[x][y];
	}
	
	if(x==1 && y==1){
		return 1;
	}
	
	return masu[x][y]=saiki(x-1,y)+saiki(x,y-1);
}

int main(){
	while(1){
		sintt(xx,yy);
		if(xx==0)break;
		int n;
		sint(n);
		rep(i,17)rep(j,17){
			ura[i][j]=0;
			masu[i][j]=-1;
		}
		rep(i,n){
			int a,b;
			sintt(a,b);
			ura[a][b]=1;
		}
		
		printf("%d\n",saiki(xx,yy));
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
char s[101];
cin >> s;
int size = strlen(s);
string ans = "Yes";
REP(i,size) {
  if(i%2==0&&s[i]=='L') {
    ans = "No";
  } else if(i%2==1&&s[i]=='R') {
    ans = "No";
  }
}
cout << ans << endl;
return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();


// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

int main()
{
    int h, w; cin >> h >> w;
    int count = 0;
    char c;
    rep(i,h) {
        rep(j,w) {
            cin >> c;
            if (c == '#')
                count++;
        }
    }

    if (count == h + w - 1) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
    return 0;
}


Measured memory_bytes: 3500