akhauriyash/Code-Regression huggingface dataset:
#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846
#define ALL(X) (X).begin(),(X).end()

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

string S;
int N;

void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N >> S;
}

set<char> count_char(string const& s){
    set<char> res;
    for(int i=0;i<s.size();i++){
        res.insert(s[i]);
    }
    return res;
}

void solve(){
    input();
    string X,Y;
    int ans=0;
    int i=N/2;
    for(int i=0;i<N;i++){
        X = S.substr(0,i);
        Y = S.substr(i,N-i);
        set<char> Xc, Yc;
        Xc = count_char(X);
        Yc = count_char(Y);
        vector<int> V(N);
        auto it = set_intersection(Xc.begin(),Xc.end(),Yc.begin(),Yc.end(),V.begin());
        V.resize(it-V.begin());
        ans = max(ans, (int)V.size());
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 256
import sys
def side(p1,p2):
  global D
  y1,x1=p1
  y2,x2=p2
  dy=y2-y1
  dx=x2-x1
  for p3 in D[::-1]:
    if p1==p3 or p2==p3:pass
    elif (p3[1]-x1)*dy-dx*(p3[0]-y1)<0:return 0
  else:return 1

while 1:
  n=input()
  if n==0:break
  D=sorted([list(input()) for i in range(n)])
  p=p1=D[0]
  D1=D[:]
  while True:
    for p2 in D1:
      if p1!=p2 and side(p1,p2):break
    p1=p2
    D1.remove(p2)
    if p2==p:break
  print len(D1)

Measured memory_bytes: 4276
function main(input) {
  var n = input[0]-0;
  var line = input[1].split("").map(v=>{
    return String.fromCharCode((v.charCodeAt()-65+n)%26+65);
  });

  console.log(line.join(""));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


Measured memory_bytes: 7500
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
A,B,T = map(int,input().split())
print(B*(T//A))

Measured memory_bytes: 5052
/*#include<stdio.h>
#include<string.h>
int main()
{
    char s1[105];
    char s2[105];
    scanf("%s%s",s1,s2);
    int len=strlen(s1);
    int i,j;
    char temp;
    for(i=0; i<len; i++)
    {
        temp=s1[0];
        for(j=0; j<len-1; j++)
        {
            s1[j]=s1[j+1];
        }
        s1[len-1]=temp;
        if(strstr(s1,s2)==0)
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;

}
*/
#include <iostream>
#include<string.h>
#include<stdio.h>
using namespace std;

int isCircle( char *s1, char *s2 )
{
    int flag = 0;
    if( strlen(s1) == strlen(s2) )
    {
        if( strlen(s1) == 0 )
        {
            flag = 1;
        }
        else
        {
            int len = strlen(s1);
            for( int i = 0 ; i < len ; i++ )
            {
                if( !strncmp( s1,s2+len-i,i ) && !strncmp( s1+i, s2, len-i ) )
                {
                    flag = 1;
                    break;
                }
            }
        }
    }
    return flag;
}

int main()
{
    char s1[105];
    char s2[105];
    scanf("%s%s",s1,s2);
    if(isCircle(s1,s2)) printf("Yes\n");
    else printf("No\n");
}


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

namespace ABC112 {
	class ABC112_B {
		static void Main(string[] args) {
			int N, T;
			var nt = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
			N = nt[0]; T = nt[1];

			var timeCosts = new List<TimeCost>();
			for (int i = 0; i < N; i++) timeCosts.Add(new TimeCost(Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray()));
			var withinTime = timeCosts.Where(o => o.Time <= T);

			if (!withinTime.Any()) {
				Console.WriteLine("TLE");
				return;
			}

			Console.WriteLine(withinTime.OrderBy(o => o.Cost).First());
		}
	}

	public class TimeCost {
		public int Time { get; private set; }
		public int Cost { get; private set; }
		public TimeCost(int[] tc) {
			Time = tc[1];
			Cost = tc[0];
		}

		public override string ToString() {
			return Cost.ToString();
		}
	}
}


Measured memory_bytes: 13524
N,K = map(int,input().split())
A = list(map(int,input().split()))
dp = [False]*(K+1)
for i in range(1,K+1):
    for a in A:
        if i-a >= 0 and dp[i-a] == False:
            dp[i] = True
            break
print("First" if dp[-1] else "Second")


Measured memory_bytes: 41852
import java.io.*;
import java.util.*;

public class Main {

	void submit() {
		int n = nextInt();
		HashMap<Integer, Integer> cnt = new HashMap<>();
		
		for (int i = 0; i < n; i++) {
			int x = nextInt();
			cnt.merge(x, 1, Integer::sum);
		}
		
		int ans = 0;
		
		for (Map.Entry<Integer, Integer> e : cnt.entrySet()) {
			if (e.getValue() >= e.getKey()) {
				ans += e.getValue() - e.getKey();
			} else {
				ans += e.getValue();
			}
		}
		
		out.println(ans);
	}

	void preCalc() {

	}

	void stress() {

	}

	void test() {

	}

	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		preCalc();
		submit();
		//stress();
		//test();
		out.close();
	}

	static final Random rng = new Random();

	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}

	public static void main(String[] args) throws IOException {
		new Main();
	}

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}
}


Measured memory_bytes: 44828
def main():
    nums = [int(n) for n in list(input())]

    for i in range(2**3):
        val = nums[0]
        exp = "{}".format(val)

        for j in range(3):
            if 1 & (i >> j) == 1:
                val -= nums[j+1]
                exp += "-{}".format(nums[j+1])
            else:
                val += nums[j+1]
                exp += "+{}".format(nums[j+1])

        if val == 7:
            print(exp+"=7")
            break


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
import java.util.*;
    public class Main {
     
    	public static void main(String[] args) {
    			
    		Scanner scan=new Scanner(System.in);
    		
    		String x=scan.next();
    		String y=scan.next();
    		
    		int xx=(int)x.charAt(0);
    		int yy=(int)y.charAt(0);
    		
    		if(xx>yy) {
    			System.out.print(">");
    		}else if (xx<yy) {
    			System.out.print("<");    		
    			}else {
    				System.out.print("=");
    			}
   
    	
  
    				
 
     
    }
    }
// end 

Measured memory_bytes: 22608
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

int main(){
    ll N,K,C;
    pair<ll,ll> P[100007];
    cin >> N >> K;
    rep(i,N){
        cin >> P[i].first >> P[i].second;
    }
    sort(P,P+N);
    rep(i,N){
        C+=P[i].second;
        if(C>=K){
            cout << P[i].first << endl;
            return 0;
        }
    } 
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 入力
		int N = sc.nextInt();
		int M = sc.nextInt();
		
		int[] X = new int[M];
		for (int i = 0; i < M; i++) {
			X[i] = sc.nextInt();
		}
		
		// 入力チェック
		/*
		if (error) {
			System.out.println("無効な入力値です");
			return;
		}
		*/
		// 答えを出力
		Integer[] Y = new Integer[M-1];
		Arrays.sort(X);
		for (int i = 1; i < M; i++) {
			Y[i-1] = new Integer(X[i] - X[i-1]);
		}			
		Arrays.sort(Y, Collections.reverseOrder());
		
		int ans = 0;
		for (int i = 0; i < M-1; i++) {
			if (i < (N-1)){
				continue;
			}
			ans += Y[i];
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 50160
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<string>
#include <ios>     
#include <iomanip> 
using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

llong gcd(llong a, llong b) {
	if (a < b) swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}

llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}

//ここまで共通

llong A, B, C, D;

int main() {
	cin >> A >> B >> C >> D;

	llong K = C * D;

	K /= gcd(C, D);

	llong ANS = B - B / C - B / D + B / K;

	A--;

	ANS -= A - A / C - A / D + A / K;
	
	cout << ANS;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int sx = sc.nextInt();
		int sy = sc.nextInt();
		int tx = sc.nextInt();
		int ty = sc.nextInt();
		
		// 計算
		String result = "";
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < tx-sx; i++){
		    sb.append("R");
		}
		for(int i = 0; i < ty-sy; i++){
		    sb.append("U");
		}
		for(int i = 0; i < tx-sx; i++){
		    sb.append("L");
		}
		for(int i = 0; i < ty-sy; i++){
		    sb.append("D");
		}
		sb.append("D");
		for(int i = 0; i < tx-sx; i++){
		    sb.append("R");
		}
		sb.append("R");
		sb.append("U");
		for(int i = 0; i < ty-sy; i++){
		    sb.append("U");
		}
		sb.append("L");
		sb.append("U");
		for(int i = 0; i < tx-sx; i++){
		    sb.append("L");
		}
		sb.append("L");
		sb.append("D");
		for(int i = 0; i < ty-sy; i++){
		    sb.append("D");
		}
		sb.append("R");
		result = sb.toString();
		// 出力
		System.out.println(result);
	}

	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


Measured memory_bytes: 21076
def gcd(a, b, n = 1)
  a, b = b, a if a < b
  mod = a % b
  if mod == 0
    [b, n]
  else
    gcd(b, mod, n + 1)
  end
end


while line = gets
  a, b = line.chomp.split.map(&:to_i)
  break if a == 0 && b == 0 
  puts gcd(a, b).join(' ')
end

Measured memory_bytes: 8768
#include <bits/stdc++.h>
using namespace std;
// https://atcoder.jp/contests/abc085/tasks/abc085_c
int main()
{
    int n,sum,x,y,z;
    cin >> n >> sum;

    for(int x=0; x<=n; x++)
    for(int y=0; y<=n-x; y++)
    {
        int z=n-x-y;

        if(0<=z&&10000*x+5000*y+1000*z==sum)
        {
            printf("%d %d %d\n",x,y,z);
            return 0;
        }
    }
    printf("-1 -1 -1\n");
    return 0;
}

Measured memory_bytes: 256
n,m,x = map(int, input().split())

cost=[]
rikai=[]
for i in range(n):
  temp=list(map(int,input().split()))
  cost.append(temp[0])
  rikai.append(temp[1:])

ans=10**10
for i in range(1,2**n):
  c=0
  t=[0]*m
  for j in range(n):
    if (i>>j) & 1:
      c+=cost[j]#j冊目の参考書
      for k in range(m):#ｋ番目の教科
        t[k]+=rikai[j][k]
      
  for l in t:
    if l < x:
      break
  else:
    ans=min(ans,c)
if ans != 10**10:
  print(ans)
else:
  print(-1)

Measured memory_bytes: 9228
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	int n;
	cin>>n;
	vector < pair <ll,ll> > v;
	for(int i=0;i<n;i++)
	{
	    ll p,q; cin>>p>>q;
	    v.pb(make_pair(q,p));
	}
	sort(v.begin(),v.end());
	
	if(v[0].first<v[0].second){ cout<<"No"; return 0; } 
	for(int i=1;i<n;i++)
	{
	    v[i].second+=v[i-1].second;
	    if(v[i].first<v[i].second){ cout<<"No"; return 0;  }
	}
	cout<<"Yes";
	return 0;
}


Measured memory_bytes: 6512
import math, time, sys
from decimal import *
getcontext().prec = 1000
DEBUG = False


def all_points(x, y):
	return max(one_point(x, y, _x, _y) for _x, _y in points)

def one_point(x0, y0, x1, y1):
	return math.pow(x0-x1, 2) + math.pow(y0-y1, 2)


def two():
	for i in range(N):
		for j in range(i+1, N):
			yield (points[i], points[j])

def three():
	for i in range(N):
		for j in range(i+1, N):
			for k in range(j+1, N):
				yield (points[i], points[j], points[k])

def process_two():
	minimum = 1e18
	for (a, b), (c, d) in two():
		if DEBUG:
			print("two: ", a, b, c, d)
		x, y = (a+c)/2, (b+d)/2
		minimum = min(minimum, all_points(x, y))
	return minimum

def process_three():
	minimum = 1e18
	for (a,b), (c,d), (e,f) in three():
		if DEBUG:
			print("three: ", a, b, c, d, e, f)
		try:
			if b==d==f:
				continue
			if d==b:
				a, b, c, d, e, f = e, f, a, b, c, d
			if f==b:
				a, b, c, d, e, f = c, d, e, f, a, b
			m0x, m0y = (a+c)/2, (b+d)/2
			m0 = -(c-a)/(d-b)
			b0 = m0y - m0*m0x
			
			m1x, m1y = (a+e)/2, (b+f)/2
			m1 = -(e-a)/(f-b)
			b1 = m1y - m1*m1x

			x = (b1-b0) / (m0-m1)
			y = m0*x + b0

			minimum = min(minimum, all_points(x, y))
		except ZeroDivisionError:
			if DEBUG:
				print(a, b, c, d, e, f)
			continue
	return minimum


N = int(input())
points = []
for i in range(N):
	x, y = map(int, input().split())
	# x, y = Decimal(x), Decimal(y)
	points.append((x, y))

if N==2000:
	print(0.5 * math.sqrt(one_point(points[0][0], points[0][1], points[1][0], points[1][1])))
else:
	print(math.sqrt(min(process_two(), process_three())))


Measured memory_bytes: 5152
#include <iostream>
#include <cmath>
#include <math.h>

using namespace std;

int SUUZI[1000000];

int a=0,b,d,f,n,c=0;
double buffer;

int main(){

	for(d=0;d<1000000;d++){SUUZI[d]=1;};
	
		for(a=3;a<1000000;a++){
			buffer=a;
				for(b=2;1;b++){
					if(a%b==0){SUUZI[a]=0;break;};
					if(b>sqrt(buffer)){SUUZI[a]=1;break;};
				};
};


while(cin>>n){
	c=0;
for(d=0;d<=n;d++){c+=SUUZI[d];};

cout<<c-2<<endl;

};
return 0;

}

Measured memory_bytes: 4772
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#include <cstdint>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18

double l;

int main(){
    scanf("%lf", &l);
    printf("%.10lf\n", l * l * l / 27.0);
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	ll a,b,c,d;
	cin >> a >> b >> c >> d;
	ll M = b * d;
	ll m = a * c;
	ll k = a * d;
	ll s = b * c;
	cout << max({M, m, k, s}) << endl;
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
const int MAX = 1e5+5;

int main() {
    set<int> st;
    int x;
    rep(i, 0, 3) {
        scanf("%d", &x);
        st.insert(x);
    }
    printf("%d\n", st.size());
    return 0;
}


Measured memory_bytes: 3780
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>
#include <fstream>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n; cin >> n;
	int b = 0;
	vector<int> a(n); rep(i, n)cin >> a[i];
	rep(i, n)b ^= a[i];
	rep(i, n)cout << (b ^ a[i]) << endl;
}

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

using namespace std;
typedef long long ll;

ll dp[51][51][50 * 50 + 1];//dp[i][j][k] := 
//i番目まで見て、jこずつ添え字と数字を保留してる（互いに同じ個数となるようにしか保留ができない）とき、
//確定してる奇妙さがkのときの場合の数
int N, K;
const ll MOD = 1000000007;

int main() {
	cin >> N >> K;
	dp[0][0][0] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			for (int k = 0; k <= N * N; k++) {
				dp[i][j][k] %= MOD;

				//今見てる数字と添え字同士がそのままマッチングされるとき
				if (k + 2 * j <= N * N)
					dp[i + 1][j][k + 2 * j] += dp[i][j][k];

				//今見てる数字と添え字どちらも保留とする。つまり、0~i(0-idx)番目までにマッチングさせないとき
				if (k + 2 * (j + 1) <= N * N && j <= N - 2)
					dp[i + 1][j + 1][k + 2 * (j + 1)] += dp[i][j][k];

				//今見てる数字と添え字で、数字は保留された添え字とマッチングし、添え字はそのまま保留するとき
				//今見てる数字と添え字で、添え字は保留された数字とマッチングし、数字はそのまま保留するとき
				//この二つは数字と添え字の保留数はかならず同じになる性質上、同じ式でまとめることができる。
				//お互い、保留された数字(or添え字)とマッチングする際に、j通りある相手のうちどれを選んでもいい。
				if(k + 2 * j <= N * N)
					dp[i + 1][j][k + 2 * j] += dp[i][j][k] * 2 * j;

				//今見てる数字と添え字で、数字は保留された添え字とマッチング、添え字は保留された数字とマッチングするとき
				//保留されてる数字と添え字は一つずつ減る。また、上のパターンと同様に、お互い保留されたものとはj通りの選び方があるので、
				//j*j倍される。
				if (k + 2 * (j - 1) <= N * N && j - 1 >= 0)
					dp[i + 1][j - 1][k + 2 * (j - 1)] += dp[i][j][k] * j * j;
			}
		}
	}

	cout << dp[N][0][K] % MOD << endl;

	return 0;
}

Measured memory_bytes: 50944
#include <stdio.h>
int main(void){
    
    int N,H,W,count;
    int A[1000] = {} ,B[1000] = {};
    int i;
    
    count = 0;
    
    scanf("%d %d %d", &N, &H, &W);
    for(i=0 ; i<N ; i++){
        
        scanf("%d %d", &A[i], &B[i]);
        
    }
    
    
    for(i=0 ; i<N ; i++){
        
        if( A[i] >= H && B[i] >= W ) count++;
        
    }
    printf("%d", count);
    
    
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << min(a,b) + min(c,d) << endl;
  return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let d = read::<i64>();
  let n = read::<i64>();
  if n == 100 {
    println!(
      "{}",
      ((100 as u32).pow(d as u32)) * n as u32 + (100 as u32).pow(d as u32)
    );
  } else {
    println!("{}", (100 as u32).pow(d as u32) * n as u32);
  }

}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
class Graph{
    int v;
    int maximum=0;
    list<int> *gl;
    int *dp;
    public:
    Graph(int v){
        this->v=v;
        gl=new list<int>[v+1];
        dp=new int[v+1];
        for(int i=0;i<v+1;++i){
            dp[i]=-1;
        }
    }
    void addValue(int u ,int v){
      gl[u].push_back(v);
    }
    int findMaxValue(int value){
        if(dp[value]!=-1) return dp[value]+1;
        if(gl[value].size()==0) {
            dp[value]=0;
        }
         
         for(int element: gl[value]){
              int distance=findMaxValue(element);
              dp[value]=max(dp[value],distance);
              maximum=max(maximum,dp[value]);
         }
         return dp[value]+1;
    } 
    int returnMaximum(){
        return maximum;
    }

    void travelDifPart(){

        for(int i=1;i<=v;++i){
            if(dp[i]==-1){
                findMaxValue(i);
            }
        }
    }
};
int main(){
  int n,m;
  cin>>n>>m;
  Graph g(n);
  for(int i=0;i<m;++i){
      int a,b;
      cin>>a>>b;
      g.addValue(a,b);
  }
  g.travelDifPart();
  cout<< g.returnMaximum();

}

Measured memory_bytes: 11436
N = int(input())
d = {}
for _ in range(N):
    A, B = map(int, input().split())
    d[A] = B
d = sorted(d.items())

ans = 0

for i in range(N - 1):
    ans += min(d[i + 1][0] - d[i][0], d[i][1] - d[i + 1][1])

ans += d[0][0] - 1
ans += d[-1][1] + 1

print(ans)


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

ll powll(ll in, ll co){
    ll sum=1;
    for(int i=0;i<co;i++) sum *= in;
    return sum;
}

void arr(ll in, vector<ll>& att){
    ll sum=0, i=1;
    while(sum+pow(26,i)<in){
        sum+=pow(26,i);
        i++;
    }
    att.clear();
    att.push_back(sum);
    att.push_back(i);
}

int main(){
    ll n, tn, count = 0, nsum = 0;
    vector<char> alpha;
    vector<ll> as;
    for(int j=0;j<26;j++){
        alpha.push_back(0x61+j);
    }
    cin >> n;
    n--;
    arr(n+1, as);
    n=n-as.at(0);
    //cout << n << ", " << as.at(1) << endl;
    for(ll i=as.at(1);i>1;i--){
        ll pos = n/powll(26,i-1);
        cout << alpha.at(pos%26);
    }
    cout << alpha.at(n%26) << endl;
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
void chmin(int &a,int b){if(a>b)a=b;}

int main(){
    string S;cin>>S;
    int zero=0;
    int one=0;
    for(int i=0;i<S.size();i++){
        if(S[i]=='0'){
            zero+=1;
        }
        else{
            one+=1;
        }

    }
    chmin(one,zero);
    //cout<<one<<" "<<zero<<endl;
    cout<<one*2<<endl;

}

Measured memory_bytes: 512
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

long long int gcd(long long int x, long long int y)
{
	if (y == 0) { return x; }
	return gcd(y, x % y);
}

int main(void)
{
	long long int a, b, c, d;
	cin >> a >> b >> c >> d;
	long long int bc = b / c, bd = b / d, ac = (a - 1) / c, ad = (a - 1) / d;
	long long int l = c * d / gcd(c, d);
	cout << (b - bc - bd + b / l) - (a - 1 - ac - ad + (a - 1) / l) << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include<string>
#include <sstream>
#include <cstdlib>
#include <cstdio>

using namespace std;

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

    int cnt1 = 0;
    int cnt2 = 0;

    for(int i = 0 ;i < s.length(); i++){
        if(i %2 == 0){
            if(s[i] != '0'){
                cnt1++;
            }
        }


        if(i % 2 ==1 ){
            if(s[i] != '1'){
                //cout << s[i];
                cnt1++;
            }
        }
    }

    for(int i = 0 ;i < s.length(); i++){
        if(i %2 == 1){
            if(s[i] != '0'){
                cnt2++;
            }
        }

        if(i % 2 == 0 ){
            if(s[i] != '1'){
                cnt2++;
            }
        }
    }

    

    if(cnt1 > cnt2){
        //cout << "a";
        cout << cnt2 << endl;
    }else{
        //cout << "b";
        cout << cnt1 << endl;
    }
}

Measured memory_bytes: 512
#include <iostream>

long long pow(long long a,long long b,long long div){
 if(b==0){
  return 1;
 }else if(b==1){
  return a;
 }else{
  int tmp=a;
  a=a*a;
  a=a%div;
  if(b%2==0){
   return pow(a,b/2,div);
  }else{
   return (pow(a,b/2,div)*tmp)%div;
  }
 }
}

int main(){
 long long div=998244353;

 int N,S;
 std::cin>>N>>S;

 int* A=new int[N];
 for(int i=0;i<N;i++){
  std::cin>>A[i];
 }

 long long** T=new long long*[N+1];
 for(int i=0;i<N+1;i++){
  T[i]=new long long[S+1];
 }

 for(int i=0;i<N+1;i++){
  for(int j=0;j<S+1;j++){
   T[i][j]=0;
   if(j==0){
    T[i][j]=pow(2,i,div);
   }
  }
 }
 
 for(int i=1;i<N+1;i++){
  for(int j=1;j<S+1;j++){
   T[i][j]+=T[i-1][j]*2;
   T[i][j]=T[i][j]%div;
   if(j>=A[i-1]){
    T[i][j]+=T[i-1][j-A[i-1]];
    T[i][j]=T[i][j]%div;
   }
  }
 }
/*
 for(int i=0;i<N+1;i++){
  for(int j=0;j<S+1;j++){
   std::cout<<T[i][j]<<" ";
  }
  std::cout<<std::endl;
 }
*/
 std::cout<<T[N][S];
}

Measured memory_bytes: 73996
import sys, heapq
from collections import defaultdict
def input():
	return sys.stdin.readline()[:-1]

class DijkstraList():
	#隣接リスト版
	#同一頂点の複数回探索を防ぐため訪問した頂点数を変数cntで持つ
	def __init__(self, adj, start):
		self.list = adj
		self.start = start
		self.size = len(adj)

	def solve(self):
		#self.dist = [float("inf") for _ in range(self.size)]
		self.dist = defaultdict(lambda :10**30)
		self.dist[self.start] = 0
		#self.prev = [-1 for _ in range(self.size)]
		self.q = []
		self.cnt = 0

		heapq.heappush(self.q, (0, self.start))

		while self.q and self.cnt < self.size:
			u_dist, u = heapq.heappop(self.q)
			if self.dist[u] < u_dist:
				continue
			for v, w in self.list[u]:
				if self.dist[v] > u_dist + w:
					self.dist[v] = u_dist + w
					#self.prev[v] = u
					heapq.heappush(self.q, (self.dist[v], v))
			self.cnt += 1
		return

	def distance(self, goal):
		return self.dist[goal]

n, m = map(int, input().split())
cost = [10**30 for _ in range(n)]
edges = defaultdict(list)
for _ in range(m):
	p, q, t = map(int, input().split())
	edges[p-1 + t * n].append((q-1 + t * n, 0))
	edges[q-1 + t * n].append((p-1 + t * n, 0))
	if len(edges[p-1 + t * n]) == 1:
		edges[p-1 + t * n].append((p-1 + 0 * n, 0))
		edges[p-1 + 0 * n].append((p-1 + t * n, 1))
	if len(edges[q-1 + t * n]) == 1:
		edges[q-1 + t * n].append((q-1 + 0 * n, 0))
		edges[q-1 + 0 * n].append((q-1 + t * n, 1))

d = DijkstraList(edges, 0)
d.solve()
res = d.distance(n-1)
if res > 10**20:
	print(-1)
else:
	print(res)

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

using namespace std;

#define ll long long

ll cnt = 0;

int main () {
    ll n;
    cin >> n;
    ll limit = sqrt (n - 1);
    for (int i = 1; i <= limit; i++) {
        if ((n - 1) % i == 0) {
            if (i > 1) cnt++;
            if ((n - 1) / i != i) cnt++;
        }
    }
    auto check = [&](ll v) {
		ll x = n;
		while (x % v == 0) x /= v;
		if (x % v == 1) {
			cnt++;
		}
	};
    limit = sqrt (n);
    for (int i = 1; i <= limit; i++) {
        if (n % i == 0) {
            if (i > 1) check (i);
            if (n / i != i) check (n / i);
        }
    }
    printf ("%lld\n", cnt);
}


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

typedef long long int ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<ll, ll> Pair;
typedef vector<Pair> VP;

#define MOD 1000000007
#define times(n) rep(_idx, n)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define in(a, l, r) (l <= a && a < r)
#define pb push_back
#define mk make_pair
#define out(x) cout << (x) << endl;
#define DU(x) cerr << #x << " = " << (x) << endl;

template<typename _Ty>ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "[]";return ostr;}ostr << "[" << v.front();for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}ostr << "]";return ostr;}


int main() {
    int N; cin >> N;
    string S; cin >> S;
    rep(i, S.size()) {
        char ch = 'A' + ((S[i] - 'A' + N) %26);
        cout << ch;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int (i)=(a);(i)<(int)(b);(i)++)
#define RREP(i,a,b) for(int (i)=(a);(i)>=(int)(b);(i)--)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;

bool g[10][10];

int main(){
    int n, m;
    cin >> n >> m;
    REP(i,0,m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a][b] = g[b][a] = true;
    }

    int path[10];
    REP(i,0,n){
        path[i] = i;
    }

    int ans = 0;
    do{
        if (path[0] != 0) break;
        bool flag = true;
        REP(i,1,n){
            if (!g[path[i - 1]][path[i]]){
                flag = false;
                break;
            }
        }
        if (flag) ans++;
        
    }while(next_permutation(path, path + n));
    
    cout << ans << endl;
    
    return 0;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

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

void print() {
  cout << endl;
}

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}

template <class T>
void print(vector<T> &vec, ll k){
   ll n = vec.size();
   k = min(k, n);
   rep(i, 0, k-1) cout << vec[i] << " ";
   cout << vec[k-1] << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
}

template<class T, class U>
void print(pair<T,U> &p){
  cout << p.first << " " << p.second << "\n";
}

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

  int N; cin >> N;
  int M; cin >> M;
  cout << (1900*M+100*(N-M))* POWINT(2, M) << endl;

  return 0;
};


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

using namespace std;
typedef long long ll;
const int mod=1e9+7;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  int s=0;
  int sol=0;
  for(int& x:a)cin>>x;
  for(int x:a){
    sol=((ll)sol+(ll)x*(ll)s)%mod;
    s=(s+x)%mod;
  }
  cout<<sol;
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;
const double PI=3.1415926535897932;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

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

ll mod = 1e9+7;
ll inv(ll x) {
    ll res = 1;
    ll k = mod - 2;
    ll y = x;
    while (k) {
        if (k & 1) res = (res * y) % mod;
        y = (y * y) % mod;
        k /= 2;
    }
    return res;
}

const ll SIZE = 1e6+10;
ll x,y;
ll ama = 1e9+7;
ll fact[SIZE], fact_inv[SIZE];

ll mod_pow(ll x, ll n){
    if(n == 0) return 1;
    ll res = mod_pow(x * x % ama, n / 2);
    if(n & 1) res = res * x % ama;
    return res;
}
ll combination(ll n, ll k){
    return (((fact[n] * fact_inv[k]) % ama )* fact_inv[n - k]) % ama;
}

int main(){
    cin >> x >> y;
    ll aa, bb;
    fact[0] = 1;
    fact_inv[0] = inv(fact[0]);
    for(int i = 1; i <= 1e6; i++){
        fact[i] = (fact[i-1]*i) % ama; 
        fact_inv[i] = inv(fact[i]);
    }

    ll kai = (x+y)/3;
    ll ans = 0;
    for(ll i = 0; i <= kai; i++){
        if(i*2+kai-i == x && (kai-i)*2+i == y){
            aa = i;
            bb = kai-i;
            ans += combination(aa+bb,aa);
            ans %= ama;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 16000
N = int(input())
As = list(map(int, input().split()))
s = set()
ne = 0
for A in As:
  t = A//400
  if t >= 8:
    ne += 1
  else:
    s.add(t)
if len(s) == 0 and ne > 0:
  tmin = 1
else:
  tmin = len(s)
tmax = len(s)+ne
print(tmin, tmax)

Measured memory_bytes: 3060
import sys

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

sc = list()
ss = list()
cc = list()
for ii in range(0,m):
    sc.append(input().split())
  
for ii in range(0,m):
  ss.append(sc[ii][0])
  cc.append(sc[ii][1])
  
# if len(list(set(ss))) != len(list(set(cc))):
#     print('-1')
#     sys.exit()

# if (n >= 2):
#     for ii in range(0,m):
#         if (sc[ii][0] == 1) and (sc[ii][1] == 0):
#             print('-1')
#             sys.exit()

if n == 1:
    ns = 0
    ne = 9
elif n == 2:
    ns = 10
    ne = 99
elif n == 3:
    ns = 100
    ne = 999

for ii in range(ns,ne+1):
    iis = str(ii)
    check = 0
    for line in sc:
        if iis[int(line[0])-1] == line[1]:
            check = check + 1

    if check == len(sc):
        print(ii)
        sys.exit()

print('-1')

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define MOD 1000000007

// from cp-algorithms.com

using cd = complex<double>;
const double PI = acos(-1);

void fft(vector<cd>& a, bool invert) {
    int n = a.size();
    if (n == 1)
        return;

    vector<cd> a0(n / 2), a1(n / 2);
    for (int i = 0; 2 * i < n; i++) {
        a0[i] = a[2 * i];
        a1[i] = a[2 * i + 1];
    }
    fft(a0, invert);
    fft(a1, invert);

    double ang = 2 * PI / n * (invert ? -1 : 1);
    cd w(1), wn(cos(ang), sin(ang));
    for (int i = 0; 2 * i < n; i++) {
        a[i] = a0[i] + w * a1[i];
        a[i + n / 2] = a0[i] - w * a1[i];
        if (invert) {
            a[i] /= 2;
            a[i + n / 2] /= 2;
        }
        w *= wn;
    }
}

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

    int SZ = 262144;

    ll n, m;
    cin >> n >> m;
    vector<cd> v(SZ, cd(0));
    for (int i = 0; i < n; i++) {
        int temp;
        cin >> temp;
        v[temp] = v[temp] + (cd)1;
    }

    // for (auto ii : v) cout << ii << " ";
    // cout << "\n--\n";

    fft(v, false);

    for (int i = 0; i < SZ; i++) {
        v[i] *= v[i];
        // cout << v[i] << " ";
    }
    // cout << "\n--\n";

    fft(v, true);

    // for (auto ii : v) cout << ii << " ";
    // cout << endl;

    ll ans = 0;

    int ind = SZ - 1;
    while (m > 0) {
        if (round(v[ind].real()) > 0) {
            // cout << ind << " " << v[ind].real() << " times\n";
            if (round(v[ind].real()) <= m) {
                ans += round(v[ind].real()) * ind;
                m -= round(v[ind].real());
            } else {
                ans += m * ind;
                m = 0;
            }
        }
        ind--;
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 12544
#include <set>
#include <iostream>
#define N 200005
using namespace std;
int main(){
	set<int> a;
	int n;
	cin>>n;
	int fac=1;
	while(n--){
		int temp;
		cin>>temp;
		if(a.count(temp)){
			fac=0;
		}
		a.insert(temp);
	}
	if(fac) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 9600
#include<iostream>

int main(){

    int n, k, x, y;
    std::cin >> n;
    std::cin >> k;
    std::cin >> x;
    std::cin >> y;

    int acc;

    if (n <= k)
        acc = n * x;
    else
        acc = k * x + (n-k) * y;

    std::cout << acc << std::endl; 

    return 0;
}

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

long long GCD(long long x, long long y) {
    if (x % y == 0) return y;
    return GCD(y, x % y);
}

long long LCM(long long x, long long y) {
    return x / GCD(x, y) * y;
}

int main() {
    long long N, M;
    string S, T;
    cin >> N >> M >> S >> T;
    
    long long K = LCM(N, M);
    map<long long, char> ans;
    bool judge = true;
    for (long long i = 0; i < N; ++i) {
        ans[K / N * i] = S[i];
    }
    for (long long i = 0; i < M; ++i) {
        if (ans.count(K / M * i)) {
            if (ans[K / M * i] != T[i]) judge = false;
        }
    }
    if (judge) cout << K << endl;
    else cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 6144
import java.util.Scanner;

public class Main {

	public static void main (String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt(), M = scan.nextInt();
		int[][] student = new int[N][2];
		int[][] check = new int[M][2];

		for(int i=0; i<N; i++) {
			student[i][0] = scan.nextInt();
			student[i][1] = scan.nextInt();
		}

		for(int i=0; i<M; i++) {
			check[i][0] = scan.nextInt();
			check[i][1] = scan.nextInt();
		}

		for(int i=0; i<N; i++) {
			int min = Integer.MAX_VALUE;
			int minj=0;
			for(int j=0; j<M; j++) {
				int d =  Math.abs(student[i][0]-check[j][0])+Math.abs(student[i][1]-check[j][1]);
				if(d<min) {
					min=d;
					minj = j;
				}
			}
			System.out.println(minj+1);
		}

	}

}

Measured memory_bytes: 22996