akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
ll n,A,B,C;
vector<string> s(1e+5),x;
bool jud=false;
bool dfs(int i,int a,int b,int c){
    if(a<0||b<0||c<0)return false;
    if(i==n){
        jud=true;
        return true;
    }
    if(s[i]=="AB"){
        if(dfs(i+1,a+1,b-1,c)){
            x.push_back("A");
            return true;
        }else if(dfs(i+1,a-1,b+1,c)){
            x.push_back("B");
            return true;
        }
        return false;
    }else if(s[i]=="BC"){
        if(dfs(i+1,a,b+1,c-1)){
            x.push_back("B");
            return true;
        }else if(dfs(i+1,a,b-1,c+1)){
            x.push_back("C");
            return true;
        }
        return false;
    }else if(s[i]=="AC"){
        if(dfs(i+1,a+1,b,c-1)){
            x.push_back("A");
            return true;
        }else if(dfs(i+1,a-1,b,c+1)){
            x.push_back("C");
            return true;
        }
        return false;
    }
    return false;
}
int main(void){
    cin>>n>>A>>B>>C;
    rep(i,n) cin>>s[i];
    dfs(0,A,B,C);
    reverse(x.begin(),x.end());
    if(jud){
        cout<<"Yes"<<endl;
        rep(i,n)cout<<x[i]<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 19948
#include<bits/stdc++.h>
using namespace std;
long read(){
    long num=0,flag=1;
    char c=getchar();
    while(!isdigit(c)){
        if(c=='-') flag=-1;
        c=getchar();
    }
    while(isdigit(c)){
        num=(num<<1)+(num<<3)+(c^48);
        c=getchar();
    }
    return num*flag;
}
int main(){
	puts(abs(read()-read())<=1?"Brown":"Alice");
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

   if(W>=S){
     System.out.println("unsafe");
   }else{
     System.out.println("safe");
   }
 
 }
}

Measured memory_bytes: 35696
using System;
using System.Linq;

public class AtCoder_158_B
{
    public static void Main()
    {
        long[] line1 = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        long count = line1[0];
        long b = line1[1];
        long r = line1[2];

        if (b == 0 && r == 0)
        {
            Console.WriteLine(0);
            return;
        }

        long bCount = count / (b + r) * b;
        long amari = count % (b + r);
        bCount += (amari > b ? b : amari);

        Console.WriteLine(bCount);
    }
}


Measured memory_bytes: 13396
def cad(s, k):
    if len(s) == 1:
        return k // 2
    if len(set(s)) == 1:
        return len(s) * k // 2

    l = list(s)

    count = 0
    new_l = l.copy()

    first_len = 1
    first_block = True
    for i, c in enumerate(s[1:]):
        if c == new_l[i]:
            new_l[i + 1] = 0
            count += 1

        if first_block:
            if c == s[0]:
                first_len += 1
            else:
                first_block = False

    result = count * k

    if new_l[0] == new_l[-1] and first_len % 2 == 1:
        result += k - 1

    return result


s = input()
k = int(input())
print(cad(s, k))


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

typedef long long int in; 

in dp[105][100005],cp[105][100005];

int main() 
{
    in n,k,s=0,l=1000000007;
    cin>>n>>k;
    
    in a[n],i,j;
    
    for(i=0;i<n;++i)
    cin>>a[i];
    
    for(j=0;j<=a[0];++j)
    {
        dp[0][j]=1;
        cp[0][j]=1;
    }
    
    for(j=1;j<100005;++j)
    {
        cp[0][j]=(cp[0][j]+cp[0][j-1])%l;
    }
    
    for(i=1;i<n;++i)
    {
        for(j=0;j<=a[i];++j)
        {
            dp[i][j]=(dp[i-1][j])%l;
            cp[i][j]=(dp[i-1][j])%l;
        }
        
        for(j=1;j<=a[i];++j)
        {
            dp[i][j]=(dp[i][j]+dp[i][j-1])%l;
            cp[i][j]=(cp[i][j]+cp[i][j-1])%l;
        }
        
        for(j=a[i]+1;j<100005;++j)
        {
            dp[i][j]=((cp[i-1][j]%l-cp[i-1][j-a[i]-1]%l)+l)%l;
            cp[i][j]=(dp[i][j])%l;
        }
        
        for(j=1;j<100005;++j)
        cp[i][j]=(cp[i][j]+cp[i][j-1])%l;
    }
    
    // for(i=0;i<n;++i)
    // {
    //     for(j=0;j<=10;++j)
    //     cout<<dp[i][j]<<" ";
    //     cout<<"\n";
    // }
    
    // for(i=0;i<n;++i)
    // {
    //     for(j=0;j<=10;++j)
    //     cout<<cp[i][j]<<" ";
    //     cout<<"\n";
    // }
    
    cout<<dp[n-1][k];
    
	return 0;
}


Measured memory_bytes: 160000
#include <iostream>
#include <string>
#include <set>
using namespace std;

void solve()
{
    int a, b, c;
    set<int> d;
    cin >> a >> b >> c;
    d.insert(a);
    d.insert(b);
    d.insert(c);
    cout  << d.size() << endl;
}

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

Measured memory_bytes: 3636
A,B,M=map(int,input().split())
alist=list(map(int,input().split()))
blist=list(map(int,input().split()))

answer=min(alist)+min(blist)
for _ in range(M):
  x,y,c=map(int,input().split())
  disc=alist[x-1]+blist[y-1]-c
  answer=min(answer,disc)
  
print(answer)

Measured memory_bytes: 24764
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
typedef pair<pill,int> PA;
//ll MOD;
ll MOD = 1000000007;
// ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	ll weight;
};
int N;
int nums[114514][65]={0};
int hoge[65]={0};
int main(){
	cin>>N;
	vector<ll> A(N);
	ll sum=0;
	rep(i,N){
		cin>>A[i];
		sum^=A[i];
		ll temp=A[i];
		rep(j,65){
			nums[i][j]=temp%2;
			temp/=2;
		}
	}
	rep(i,N)A[i] &= ~sum;
	ll ans=0;
	ll now=1;
	rep(i,61){
		if(sum%2==0)hoge[i]=11;
		else ans+=now;
		now*=2;
		sum/=2;
	}
	ll X=0;
	int i,j;
	int rank=0;
	for (i = 59; i >= 0; i--) {
		for (j = rank; j < N; j++) {
			if (A[j] & (1LL << i)) break;
		}
		if (j == N) {
			continue;
		}
 
		if (j > rank) A[rank] ^= A[j];
		for (j = rank + 1; j < N; j++) {
			A[j] = min(A[j], A[j] ^ A[rank]);
		}
 
		rank++;
	}
	rep(i,N)X=max(X,X^A[i]);
	cout<<2*X+ans<<endl;
}


Measured memory_bytes: 27648
#include <bits/stdc++.h>    //C++の標準ライブラリのヘッダを全て読み込む
 
int main() {
    using std::cout;
    using std::endl;
    using std::cin;
    using std::string;

    int N, p_num = 0;
    string s[100];
    int l[1000] = {0}, r[1000] = {0};

    cin >> N;
 
    for(int i = 0; i < N; i++)
    {
        cin >> l[i] >> r[i];
    }

    for(int i = 0; i < N; i++)
    {
        p_num += (r[i]-l[i])+1;
    }

    cout << p_num << endl;


}

Measured memory_bytes: 256
// Undone
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
signed main() {
  int N = 10;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin>>A[i];
  }
  sort(A.begin(), A.end(), greater<int>());
  for (int i = 0; i < 3; i++) {
    cout<<A[i]<<endl;
  }
}




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

#define st first
#define nd second
typedef long long LL;
typedef pair <int, int> PII;
typedef pair <LL, LL> PLL;

const int N = 3e5;
char Tab[N + 1];

int main()
{
    int n;
    scanf("%d %s", &n, Tab);
    string t = Tab;

    int e = 0, w = 0;
    for (int i = 0; i < n; ++i)
        if (t[i] == 'E')
            ++e;
    
    int result = n;
    for (int i = 0; i < n; ++i)
    {
        if (t[i] == 'E')
            --e;
        result = min(result, w + e);
        if (t[i] == 'W')
            ++w;
    }
    
    printf("%d", result);

    return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(VECTOR) (VECTOR).begin(),(VECTOR).end()

int main(){

	int a, b, c;
	cin >> a >> b >> c;
	cout << min(c, b / a) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>

using namespace std;

int main()
{
    // 整数の入力
    long long A,B,C,D;
    cin >> A;
    cin >> B;
    cin >> C;
    cin >> D;

    if (B<=C || D<= A){
        cout << 0 << endl;
    }else if(A<=C){
        if (B<=D){
            cout << B - C << endl;
        }else{
            cout << D - C << endl;
        }
    }else{
        if (B<=D){
            cout << B - A << endl;
        }else{
            cout <<  D - A << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
input1 = list(map(int,input().split()))
A = input1[0]
B = input1[1]
C = input1[2]
if A == 5:
  if B == 5 and C == 7:
    print("YES")
  elif B == 7 and C == 5:
    print("YES")
  else:
    print("NO")
elif A == 7:
  if B == 5 and C == 5:
    print("YES")
  else:
    print("NO")
else:
  print("NO")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

string arr[1024];

void dobin(void){
    for(int i=0;i<1024;i++){
        int j=i;
        string s="";
        while(j>0){
            s+='0'+(j&1);
            j>>=1;
        }
        while(s.length()<10)
            s+="0";
        arr[i]=s;
    }
}

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

    int f[n+1][11];
    for(int i=1;i<=n;i++){
        for(int k=1;k<=10;k++){
            cin>>f[i][k];
        }
    }

    int p[n+1][11];
    for(int i=1;i<=n;i++){
        for(int j=0;j<=10;j++){
            cin>>p[i][j];
        }
    }

    ll ans=-1000000000000000;
    for(int t=1;t<1024;t++){
        string s=arr[t];
        ll profit=0;
        for(int i=1;i<=n;i++){
            int count=0;
            for(int j=1;j<=10;j++){
                if(s[j-1]=='1' && f[i][j]==1){
                    count+=1;
                }
            }
            profit+=p[i][count];
        }
        if(profit>ans)
            ans=profit;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<deque>
#include<algorithm>
using namespace std;

int main(){
  
  int q, command, d, x, p;
  deque<int> A;
  
  cin >> q;
  for(int i = 0;i < q;i++){
    cin >> command;
    
    if(command == 0){
      cin >> d >> x;
      if(d == 0) A.push_front(x);
      if(d == 1) A.push_back(x);
    }else if(command == 1){
      cin >> p;
      cout << A[p] << endl;
    }else if(command == 2){
      cin >> d;
      if(d == 0) A.pop_front();
      if(d == 1) A.pop_back();
    }
  }
  
  return 0;
}


Measured memory_bytes: 4652
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			long[] a = new long[n];
			IntStream.range(0, n).forEach(i -> a[i] = scanner.nextLong());
			// sum1=[1,-1,...], sum2=[-1,1,...]
			int[] sum1 = new int[n], sum2 = new int[n];
			Arrays.fill(sum1, 1);
			Arrays.fill(sum2, -1);
			IntStream.range(0, n / 2).forEach(i -> {
				sum1[2 * i + 1] = -1;
				sum2[2 * i + 1] = 1;
			});
			System.out.println(Math.min(getResult(a, sum1), getResult(a, sum2)));
		}
	}

	/**
	 * @param a   数値配列
	 * @param sum 変更したい合計値の配列
	 * @return 変更すべきステップ数
	 */
	private static long getResult(final long[] a, final int[] sum) {
		int n = a.length;
		long now = 0, result = 0;
		for (int i = 0; i < n; i++) {
			now += a[i];
			if (sum[i] * now <= 0) {
				result += Math.abs(sum[i] - now);
				now = sum[i];
			}
		}
		return result;
	}
}


Measured memory_bytes: 58456
#include <bits/stdc++.h>
#include<iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 	
    ll n,i;
    cin >> n;
    ll a[n];
    ll h[n+1]={0};
    for(i=0;i<n;i++) {
    	cin >> a[i];
    	h[a[i]]++;
    }
    ll sum=0;
    for(i=1;i<=n;i++) {
    	sum+=(h[i]*(h[i]-1))/2;
    }
    for(i=0;i<n;i++) {
    	ll cnt=h[a[i]];
    	ll ans=sum;
    	ans-=(cnt*(cnt-1))/2;
    	cnt--;
    	ans+=(cnt*(cnt-1))/2;
    	cout << ans << "\n";
    }
    return 0;
}



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

int main(){
	int n;
	cin >> n;
	int l=0, r=111;
	while(r<1000){
		if(l<n && n<=r){
			cout << r << endl; 
			return 0;
		}
		l +=111;
		r +=111;
	}
	return 0;
}




Measured memory_bytes: 256
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int  i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;

long long max(long long a,long long b){
	return (a>b)? a:b;
}

int main (){
	long long NNN,MMM;
	cin >> NNN >> MMM;
	long long x[NNN],y[NNN],z[NNN];
	rep(i,NNN){
		cin >> x[i] >> y[i] >>z[i];
	}
	//+++
	long long maxx=0;

	vector <long long> tempppp,tempppm,temppmp,temppmm,tempmpp,tempmpm,tempmmp,tempmmm;
	long long ppp=0,ppm=0,pmp=0,pmm=0,mpp=0,mpm=0,mmp=0,mmm=0;
	long long sumppm=0,sumpmp=0,sumpmm=0,summpp=0,summpm=0,summmp=0,summmm=0,sumppp=0;
	rep(i,NNN){
		ppp = x[i] + y[i] + z[i];
		ppm = x[i] + y[i] - z[i];
		pmp = x[i] - y[i] + z[i];
		pmm = x[i] - y[i] - z[i];
		mpp =-x[i] + y[i] + z[i];
		mpm =-x[i] + y[i] - z[i];
		mmp =-x[i] - y[i] + z[i];
		mmm =-x[i] - y[i] - z[i];
		tempppp.push_back(ppp);
		tempppm.push_back(ppm);
		temppmp.push_back(pmp);
		temppmm.push_back(pmm);
		tempmpp.push_back(mpp);
		tempmpm.push_back(mpm);
		tempmmp.push_back(mmp);
		tempmmm.push_back(mmm);
		ppp = 0;ppm = 0;pmp = 0;pmm = 0;mpp = 0;mpm = 0;mmp = 0;mmm = 0;
	}

	sort(tempppp.rbegin(),tempppp.rend());
	sort(tempppm.rbegin(),tempppm.rend());
	sort(temppmp.rbegin(),temppmp.rend());
	sort(temppmm.rbegin(),temppmm.rend());
	sort(tempmpp.rbegin(),tempmpp.rend());
	sort(tempmpm.rbegin(),tempmpm.rend());
	sort(tempmmp.rbegin(),tempmmp.rend());
	sort(tempmmm.rbegin(),tempmmm.rend());
	rep(i,MMM){
		sumppp += tempppp[i];
		sumppm += tempppm[i];
		sumpmp += temppmp[i];
		sumpmm += temppmm[i];
		summpp += tempmpp[i];
		summpm += tempmpm[i];
		summmp += tempmmp[i];
		summmm += tempmmm[i];
	}
	maxx= max(maxx,sumppp);
	maxx= max(maxx,sumppm);
	maxx= max(maxx,sumpmp);
	maxx= max(maxx,sumpmm);
	maxx= max(maxx,summpp);
	maxx= max(maxx,summpm);
	maxx= max(maxx,summmp);
	maxx= max(maxx,summmm);

	cout << maxx << endl;

	return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
vector<ll> primes;
ll factor[1005];
ll field[505][505];
set<ll> used;

int main() {
    //cout.precision(10);
    int N;
    cin >> N;
    for(ll i = 2; i <= 20000; i++) {
        bool ok = true;
        for(ll j = 2; j * j <= i; j++) {
            if(i % j == 0) {
                ok = false;
                break;
            }
        }
        if(ok) primes.push_back(i);
    }
    int index = 1;
    for(int i = 2; i <= 2 * N; i += 2) {
        factor[i] = primes[index];
        index++;
    }
    for(int i = 1; i <= N + 1; i += 2) {
        field[i][1] = primes[index];
        index++;
        ll now1 = field[i][1];
        field[1][i] = primes[index];
        index++;
        ll now2 = field[1][i];
        //cerr << i << " " << index << endl;
        for(int j = 1; j + i - 1 <= N + 1; j++) {
            field[j][i+j-1] = now1 * factor[i + 2 * j - 1];
            field[i+j-1][j] = now2 * factor[i + 2 * j - 1];
            //cerr << i << " " << j << endl;
        }
    }
    vector<ll> val;
    for(int i = 1; i <= N; i++) {
        for(int j = 1; j <= N; j++) {
            if(field[i][j] == 0) {
                if(i > 1) field[i][j] = field[i+1][j] * field[i-1][j] + 1;
                else field[i][j] = field[i][j+1] * field[i][j-1] + 1;
            }
            cout << field[i][j] << " ";
            //if(field[i][j] > 1e15) val.push_back(field[i][j]);
            //if(used.find(field[i][j]) != used.end()) val.push_back(field[i][j]);
            used.insert(field[i][j]);
            if(i > 1) {
                if(max(field[i-1][j], field[i][j]) % min(field[i][j], field[i-1][j]) != 1) val.push_back(field[i][j]);
                //cerr << i << " " << j << " " << field[i][j] << " "<< field[i-1][j] << endl;
            }
        }
        cout << endl;
    }
    //cout << "out" << endl;
    //for(int i = 0; i < val.size(); i++) cout << val[i] << endl;
    //cout << primes.size() << " " << primes[2] << endl;
    return 0;
}


Measured memory_bytes: 16896
#include <iostream> 
using namespace std; 
  
int main() 
{ 
  	int n, r, k;
  	cin>>n>>r;
  	if(n>10)
      	cout<<r;
  	else
    {
      	k=r+(100*(10-n));
      	cout<<k;
    }
    return 0; 
}

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

bool isPalindromicNumber(int num);
int getOneOfPlaces(int num);
int getTenOfPlaces(int num);
int getThousandsOfPlaces(int num);
int getTenThousandsOfPlaces(int num);

int main(void){
    int A, B, counter;
    cin >> A >> B;

    counter = 0;
    for(int i=A; i<=B; i++){
        if(isPalindromicNumber(i)) counter++;
    }
    cout << counter << endl;
}

bool isPalindromicNumber(int num){
    if((getOneOfPlaces(num)==getTenThousandsOfPlaces(num)) && getTenOfPlaces(num)==getThousandsOfPlaces(num)){
            return true;
    }
    else{
        return false;
    }
}

int getOneOfPlaces(int num){
    return num%10;
}

int getTenOfPlaces(int num){
    return (num%100 - num%10) / 10;
}

int getThousandsOfPlaces(int num){
    return (num%10000 - num%1000) / 1000;
}

int getTenThousandsOfPlaces(int num){
    return (num - num%10000) / 10000;
}

Measured memory_bytes: 256
def g;gets.split.map &:to_i;end
def f m,l
(n,v=l[0];v)?(1..v).flat_map{|i|v%i==0&&(j=v/i
y,x=$o[n]
(y-i+1..y).flat_map{|t|t>=0&&m[t+i-1]&&(x-j+1..x).flat_map{|u|u>=0&&m[t][u+j-1]&&m[t,i].all?{|k|k[u,j].all?{|z|z==0||z==n}}&&(d=m.map{|k|k.dup}
d[t,i]=d[t,i].map{|k|k[u,j]=[n]*j;k}
f d,l[1..-1])}})}.select{|i|i}:!m.flatten.index(0)&&[m]
end
while(x,y,n=g;x>0)
l=(1..n).map{g}
$o=[]
m=(1..y).map{|i|j=0;g.each{|c|c>0&&$o[c]=[i-1,j];j+=1}}
a=f m,l
puts a.size==1?a[0].map{|i|i*" "}:"NA"
end

Measured memory_bytes: 6232
// #include <atcoder/all>
// using namespace atcoder;
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
using namespace std;
using ll = long long;
template<typename T>
inline bool chmax(T& a, const T& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
/**
 * @brief 多次元 vector の作成
 * @author えびちゃん
 */
namespace detail {
    template<typename T, int N>
    auto make_vec(vector<int>& sizes, T const& x) {
        if constexpr (N == 1) {
            return vector(sizes[0], x);
        } else {
            int size = sizes[N-1];
            sizes.pop_back();
            return vector(size, make_vec<T, N-1>(sizes, x));
        }
    }
}
template<typename T, int N>
auto make_vec(int const(&sizes)[N], T const& x = T()) {
    vector<int> s(N);
    for (int i = 0; i < N; ++i) s[i] = sizes[N-i-1];
    return detail::make_vec<T, N>(s, x);
}
__attribute__((constructor))
void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max({a * c, a * d, b * c, b * d}) << '\n';
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int mod = 1e5+5;

main(){ 
    int n;
    cin>>n;
    int a[n],there[mod] = {0};
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+= a[i];
        there[a[i]]++;
    }
    int q;cin>>q;
    int b,c;
    while(q--){
        cin>>b>>c;
        if(there[b]>0){
            sum+= (there[b]*c - (there[b]*b));
            there[c]+= there[b];
            there[b]=0;
        }
        cout<<sum<<"\n";
    }
}

Measured memory_bytes: 4348
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int sx, sy, tx, ty;
  scanf("%d %d %d %d", &sx, &sy, &tx, &ty);

  for(int i = 0; i < ty - sy; i++) printf("U");
  for(int i = 0; i < tx - sx; i++) printf("R");
  for(int i = 0; i < ty - sy; i++) printf("D");
  for(int i = 0; i < tx - sx; i++) printf("L");
  printf("L");
  for(int i = 0; i < ty - sy + 1; i++) printf("U");
  for(int i = 0; i < tx - sx + 1; i++) printf("R");
  printf("DR");
  for(int i = 0; i < ty - sy + 1; i++) printf("D");
  for(int i = 0; i < tx - sx + 1; i++) printf("L");
  printf("U\n");

  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<string>
#include<iomanip>
#include<cmath>
#include<numeric>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<map>
#include<vector>
#include<set>
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef std::pair<int, int> P;
typedef std::vector<int> vec;
typedef std::vector<vec> mat;

int main() {
	ll X, Y;
	std::cin >> X >> Y;
	ll d = abs(X - Y);
	if (d <= 1)
		std::cout << "Brown\n";
	else
		std::cout << "Alice\n";
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int a, b; cin >> a >> b;
	cout << a*b;

	return 0;
}

Measured memory_bytes: 3644
w, h, n = map(int, input().split())
xya = [list(map(int, input().split())) for _ in range(n)]

w0 = 0
h0 = 0
for i in range(n):
    if xya[i][2] == 1:
        w0 = max(w0,xya[i][0])
    elif xya[i][2] == 2:
        w = min(w,xya[i][0])
    elif xya[i][2] == 3:
        h0 = max(h0,xya[i][1])
    else:
        h = min(h,xya[i][1])
        
print(max(0, (w-w0)) * max(0, (h-h0)))

Measured memory_bytes: 38384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999;
	
	public static void Main(string[] args)
	{
		var q = Console.ReadLine().ToInt();
		
		int k = 100010;
		var primes = new bool[k];
		primes[1] = true;
		for(int i = 2; i < k; i++)
		{
			if(primes[i])
				continue;
			for(int j = i * 2; j < k; j += i)
			{
				primes[j] = true;
			}
		}
		var a = new int[k];
		
		for(int i = 0; i < k; i++)
		{
			if (i % 2 == 0) continue;
			if(!primes[i] && !primes[(i+1)/2])
				a[i] = 1;
		}
		var s = new int[k+1];
		
		for(int i = 0; i < k; i++)
		{
			s[i+1] = s[i] + a[i];
		}
		
		for(int i = 0; i < q; i++)
		{
			var p = Input().ToInt();
			Console.WriteLine(s[(p[1]+1)] - s[p[0]]);
		}
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}


Measured memory_bytes: 17596
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<bits/stdc++.h>
using namespace std;

#define int long long
#define endl '\n'

const int N = 100005;

signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	cout << n*n*n;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  int a = n % 10;
  string res;
  if(a == 3) res = "bon";
  else if(a == 0 || a == 1 || a == 6 || a == 8) res = "pon";
  else res = "hon";
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pi;
const int MAXN=200005;
const int MOD=1000000007;
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define fst first
#define snd second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())

int N;
int A[MAXN];
map<int,int>cnt;
void imp(){cout<<"No\n";exit(0);}

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N;
	FOR(i,0,N-1)cin>>A[i];
	FOR(i,0,N-1)cnt[A[i]]++;
	if(sz(cnt)>3)imp();
	if(N%3==0){
		if(sz(cnt)==1){
			if(cnt.begin()->fst!=0)imp();
		}
		else if(sz(cnt)==2){
			if(cnt.begin()->fst!=0)imp();
			if(cnt.begin()->snd!=N/3)imp();
		}
		else if(sz(cnt)==3){
			int x=0;
			for(auto i:cnt)x^=i.fst;
			if(x!=0)imp();
			for(auto i:cnt)if(i.snd!=N/3)imp();
		}
	}
	else{
		if(sz(cnt)>1)imp();
		if(cnt.begin()->fst!=0)imp();
	}
	cout<<"Yes\n";
}
/*
5
0 011001010110110110100111110011010111111111111000101011100101001
7 011001010110110110100111110011010111111111111000101011100101001
62 011001010110110110100111110011010111111111111000101011100101001
63 011001010110110110100111110011010111111111111000101011100101001
-1 011001010110110110100111110011010111111111111000101011100101001
*/


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

using namespace std;

int main()
{
  int n;
  cin>>n;
  
  vector<int> vec;
  for(int i=1;i<n+1;i++)
    vec.push_back(i);
  
  vector<vector<int>> x;
  
  do
  {
    x.push_back(vec);
  }while(next_permutation(vec.begin(),vec.end()));
  
  vector<int> p(n);
  vector<int> q(n);
  
  for(int i=0;i<n;i++)
    cin>>p.at(i);
  for(int i=0;i<n;i++)
    cin>>q.at(i);
  
  int a=1,b=1;
  
  while(1)
  {
    if(p==x.at(a-1))
      break;
    a++;
  }
  while(1)
  {
    if(q==x.at(b-1))
      break;
    b++;
  }
  
  int result=a-b;
  if(result<0)
    result=result*(-1);
  
  cout<<result<<endl;
}

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

using std::pair;
using std::vector;
using std::string;

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

#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) std::make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)

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

const int oo = 0x3f3f3f3f;

string procStatus() {
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}

template <typename T> T read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
    return x *= f;
}

int l;
int n = 20, m;

struct edge {
    int u, v, w;
};

edge e[1000];

int main() {
#ifdef Wearry
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    for(int i = 19, j = 1; i > 1; --i) {
        e[++ m] = (edge) { i, i + 1, 0 };
        e[++ m] = (edge) { i, i + 1, j };
        j <<= 1;
    }

    read(l);
    int cur = 0;
    if(l >> 19 & 1) {
        cur |= (1 << 19);
        e[++ m] = (edge) { 1, 2, 1 << 18 };
        e[++ m] = (edge) { 1, 2, 0 };
    }

    for(int i = 18; i >= 0; --i) if(l >> i & 1) {
        e[++ m] = (edge) { 1, 19-i+1, cur };
        cur |= (1 << i);
    }

    printf("%d %d\n", n, m);
    for(int i = 1; i <= m; ++i) printf("%d %d %d\n", e[i].u, e[i].v, e[i].w);

    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
ab = []
for i in range(n):
    ai, bi = map(int, input().split())
    ab.append([ai, bi])

ab = sorted(ab)
count = 0
total = 0
idx = 0
while True:
    if count >= m:
        total -= (count-m) * ab[idx-1][0]
        break
    total += ab[idx][0] * ab[idx][1]
    count += ab[idx][1]
    idx += 1

print(total)

Measured memory_bytes: 20832
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)

int main() {
    int sx,sy,tx,ty;
    scanf("%d %d %d %d\n",&sx,&sy,&tx,&ty);
    string ans;
    REP(i,ty-sy) ans+="U";
    REP(i,tx-sx) ans+="R";
    REP(i,ty-sy) ans+="D";
    REP(i,tx-sx) ans+="L";
    ans+="L";
    REP(i,ty-sy+1) ans+="U";
    REP(i,tx-sx+1) ans+="R";
    ans+="DR";
    REP(i,ty-sy+1) ans+="D";
    REP(i,tx-sx+1) ans+="L";
    ans+="U";
    cout << ans << "\n";
}

Measured memory_bytes: 256
from collections import Counter

def bb091():
    n = int(input())
    sn = Counter()
    sn['0'] = 0
    for i in range(0,n):
        sn[input()] += 1

    m = int(input())
    tm = Counter()
    for i in range(0,m):
        tm[input()] += 1

    for k,v in tm.items():
        sn[k] -= v

    ma = 0
    for k,v in sn.items():
        if v > ma:
            ma = v

    print(ma)

bb091()

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int flag[1001];
map<int,int>mp;
map<int,int>mp1;
int ara[5];
int main()
{
    string s,s1;
    int c=0,f=0,i,a,b;

    cin>>a>>b;
    ara[a]++;
    ara[b]++;
    for(i=1;i<=3;i++)
    {
        if(ara[i]==0)
            cout<<i<<"\n";
    }
}


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

int main(void){
    char a[4];
    int po=0;
    scanf("%c%c%c%c", a, a+1, a+2, a+3);
    for(int i=0; i<4; i++){
        if(a[i] == '+') ++po;
        if(a[i] == '-') --po;
    }
    printf("%d", po);
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

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

/*==================================================*/
/*variable*/
int A, B;
/*==================================================*/
/*function*/

/*==================================================*/

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

    ll ans;

    if(abs(A) < abs(B)){
        if(0 <= A && 0 <= B){  //正負が反転
            ans = B - A;
        }else if(0 > A && 0 > B){
            ans = abs(B) - abs(A) + 2;
        }else{
            ans = abs(B) - abs(A) + 1;
        }
    }else if(abs(A) > abs(B)){
        if(0 <= A && 0 < B){  //正負が反転
            ans = abs(A) - abs(B) + 2;
        }else if(0 > A && 0 > B){
            ans = abs(A) - abs(B);
        }else if(A < 0 && B == 0){
            ans = abs(A);
        }else{
            ans = abs(A) - abs(B) + 1;
        }
    }else{
        ans = 1;    //A,Bは相異なるため、必ず正負が逆
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<utility>
using namespace std;
int main()
{
	int n,k,x;
	cin>>n>>k;k--;
	for(int i=1;i<=n;i++)
	{
		int y;scanf("%d",&y);
		if(y==1)x=i;
	}
	int l = x-1,r = n-x;
	int ans = 1<<30;
	for(int i=0;i<=k;i++)
	{
//		cout<<(l-i+k-1)/k<<" "<<(r+i-1)/k<<endl;
		int buf = (l-i+k-1)/k + (r+i-1)/k + 1;
		ans = min(ans,buf);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
//#pragma GCC optimize(2)
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#include<bitset>
#include<stack>
#include<time.h>



#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define ALL(x) x.begin(),x.end()
#define sz(a) ((int)a.size())
#define getmid ((l+r)>>1)
#define mst(var,val) memset(var,val,sizeof(var))
#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define lowbit(x) x&(-x)
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ls rt<<1
#define rs rt<<1|1
using namespace std;
#ifdef local
#define dbg(args...) cout << #args << " -> ", err(args);
void err(){ cout << endl; }
template<typename T, typename... Args>
void err(T a, Args... args){ cout << a << ' '; err(args...); }
#else
#define dbg(args...)
#endif // local

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <double, double> pdd;
const int inf=0x3f3f3f3f;
const long long INF=0x3f3f3f3f3f3f3f3fLL;
const double PI=acos(-1.0);
const long double eps=1e-8;
const int mod=1e9+7;
const int maxn=3e5+100;
const int N=2e5+1000;
const int M=500+10;
const ll mm=(1LL<<32);

template <class T>
inline void read(T &x)
{
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar())
        f ^= c == '-';
    for (; isdigit(c); c = getchar())
        x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    T y = 1;
    int len = 1;
    for (; y <= x / 10; y *= 10)
        ++len;
    for (; len; --len, x %= y, y /= 10)
        putchar(x / y + 48);
}
ll qpow(ll a,ll b,ll mod)
{
    ll ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%mod;
        b>>=1;
        a=(a*a)%mod;
    }
    return ans;
}

int main()
{
#ifdef local
    freopen("in.txt","r",stdin);
#endif // local
    IOS;cout.tie(0);
    string s;cin>>s;
    ll x=0;
    for(int i=0;i<sz(s);++i)
    {
        x=(x+s[i]-'0')%9;
    }
    if(x==0) cout<<"Yes";
    else cout<<"No";
    return 0;
}



Measured memory_bytes: 3784
#include <iostream>
#include <vector>
#include <map>
#include <math.h>
#include <algorithm>

using namespace std;
using ll = long long;

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

	map<ll,int> numbers;

	for (int i = 0; i < N; i++) {
		ll A;
		cin >> A;
		numbers[A]++;
	}

	int ans = 0;
	for (auto&& var : numbers) {
		if (var.second % 2 == 1) {
			ans++;
		}
	}
	cout << ans;
	return 0;
}



Measured memory_bytes: 6528
#include <stdio.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

typedef long long ll;
typedef long double ld;

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

  int a, b;
  cin >> a >> b;
  if (a < b) {
    while (b--) {
      cout << a;
    }
  } else {
    while (a--) {
      cout << b;
    }
  }
}


Measured memory_bytes: 256
fun main() {
    println(if (nextInt() >= 30) "Yes" else "No")
}
// # Utils
// ## Input
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map(String::toInt)
fun nextLongList() = next().split(" ").map(String::toLong)
fun nextDoubleList() = next().split(" ").map(String::toDouble)
// ## Array
inline fun <reified T> sizedArray(size: Int, default: T) = Array(size) { default }
inline fun <reified T> sized2DArray(row: Int, column: Int, default: T) = Array(row) { Array(column) { default } }
// ## mod^-1
//    [NOTE] CANNOT use this for 0, mod, 2mod, 3mod ...(return wrong value)
fun modinv(num: Long, mod: Long): Long {
    var a = num
    var b = mod
    var u = 1L
    var v = 0L
    while (b > 0) {
        val t = a.div(b)
        a -= t * b
        a = b.also { b = a } // swap a and b
        u -= t * v
        u = v.also { v = u } // swap u and v
    }
    u %= mod
    if (u < 0) u += mod
    return u
}

Measured memory_bytes: 34536
[x,n]=list(map(int,input().split()))
plist=list(map(int,input().split()))
nums=[]
for i in range(102):
    if i not in plist:
        nums.append(i)

for i in range(1000):
    if x-i in nums:
        ans=x-i
        break
    if x+i in nums:
        ans=x+i
        break

print(ans)

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define vint vector<int>
#define pri_que priority_queue
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    string s; cin >> s;
    int n=s.size();
    rep(i,n){
        if(i%2==1){
            if(s[i]!='L' && s[i]!='U' && s[i]!='D'){
                coutn; return 0;
            }
        }else{
            if(s[i]!='R' && s[i]!='U' && s[i]!='D'){
                coutn; return 0;
            }
        }
    }
    couty;
}

Measured memory_bytes: 3536
#include <iostream>
#include <unordered_map>

using namespace std;

int main() {
	int N;
	cin >> N;
	unordered_map<string, int> point_map;
	for (int i = 0; i < N; ++i) {
		string word;
		cin >> word;
		if (point_map.find(word) != point_map.end()) {
			++point_map[word];
		}
		else {
			point_map.emplace(word, 1);
		}
	}
	int M;
	cin >> M;
	for (int i = 0; i < M; ++i) {
		string word;
		cin >> word;
		if (point_map.find(word) != point_map.end()) {
			--point_map[word];
		}
		else {
			point_map.emplace(word, -1);
		}
	}
	int max_point = 0;
	for (const auto& pair : point_map) {
		max_point = max(max_point, pair.second);
	}
	cout << max_point;
}


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

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long

int main(int argc, char const *argv[])
{
	int w,h,n;
	int x[107],y[107],a[107],xmax,xmin,ymax,ymin;
	scanf("%d%d%d",&w,&h,&n);
	xmax = 0;	xmin = w;
	ymax = 0;	ymin = h;
	for (int i = 0; i < n; ++i)
	{
		scanf(" %d%d%d",&x[i],&y[i],&a[i]);
		if(x[i] > xmax && a[i] == 1) xmax = x[i];
		else if(x[i] < xmin && a[i] == 2) xmin = x[i];
		else if(y[i] > ymax && a[i] == 3) ymax = y[i];
		else if(y[i] < ymin && a[i] == 4) ymin = y[i];
	}
	if(xmax < xmin && ymax < ymin) printf("%d\n",(xmin - xmax) * (ymin - ymax));
	else printf("0\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(void) {
	string str;
	cin >> str;
	int fob,fow;
	fob = fow = 0;
	for (int i = 0; i < str.length(); ++i) {
		if (i%2 == 0) {
			if (str[i] == '1') {
				++fob;
			}
			else {
				++fow;
			}
		}
		else {
			if (str[i] == '0') {
				++fob;
			}
			else {
				++fow;
			}
		}
	}
	cout << min(fob,fow) << endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007

using namespace std;

int n;

int main() {
	cin >> n;
	cout << "ABC" << n << endl;
	
	return 0;
}


Measured memory_bytes: 256
//https://exawizards2019.contest.atcoder.jp/tasks/exawizards2019_a
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
    int A, B, C;

    cin >> A >> B >> C;

    string ans;
    // 3 4 5
    if (A == B && A == C ){
        ans = "Yes";
    } else
    {
        ans = "No";
    }
    cout << ans << endl;
        
}

Measured memory_bytes: 256
/*2つの整数 a と b を読み込んで、以下の値を計算するプログラムを作成して下さい：
a ÷ b ： d(整数)
a ÷ b の余り ： r(整数)
a ÷ b ： f(浮動小数点数)*/
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int intput(int *a, int *b);
int Seisu(int a, int b, int *seisu);
int Amari(int a, int b, int *amari);
double Syo(int a, int b, double *syo);
int output(int seisu, int amari, double syo);
int main(void)
{
	int a,b,seisu,amari = 0;
	double syo = 0;

	intput(&a, &b);
	Seisu(a, b, &seisu);
	Amari(a, b, &amari);
	Syo(a, b, &syo);
	output(seisu, amari, syo);
	return 0;
}
int intput(int *a, int *b)
{
	scanf("%d%d",a,b);
	return 0;
}
int Seisu(int a, int b, int *seisu)
{
	*seisu = a / b;
	return 0;
}
int Amari(int a, int b, int *amari)
{
	*amari = a % b;
	return 0;
}
double Syo(int a, int b, double *syo)
{
	*syo = (double)a / b;
	return 0;
}
int output(int seisu, int amari, double syo)
{
	printf("%d %d %f\n", seisu, amari, syo);
	return 0;
}


Measured memory_bytes: 2128
// Problem : A - Not
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long 	
int mod=1e9+7;
int po(int x,int y,int m)  { if (y==0) return 1; int t=po(x,y/2,m)%m; t=(t*t)%m; if (y&1) return (t*x)%m;	return t%m; }



signed main() {

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0); 

   int n;
   cin>>n;
   cout<<!n<<endl;
   	
   
   	return 0;
}

Measured memory_bytes: 3632
# C - Vacation
# https://atcoder.jp/contests/dp/tasks/dp_c
#
N = gets.chomp.to_i
a, b, c = [], [], []
readlines.each{|l| 
  abc = l.split.map(&:to_i)
  a << abc[0]
  b << abc[1]
  c << abc[2]
}

#pp a, b, c

dp = Array.new(N) { Array.new(3) { 0 } }

(0...N).each do |i|

  if i == 0
    dp[i][0] = a[i]
    dp[i][1] = b[i]
    dp[i][2] = c[i]
    next
  end

  dp[i][0] = a[i] + [dp[i-1][1], dp[i-1][2]].max
  dp[i][1] = b[i] + [dp[i-1][0], dp[i-1][2]].max
  dp[i][2] = c[i] + [dp[i-1][0], dp[i-1][1]].max

end


#pp dp
puts dp[N-1].max


Measured memory_bytes: 27616