akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

void solve() {
    int x, k, d;
    cin>>x>>k>>d;
    x = abs(x);
    int mn = x / d;
    if(k < mn) {
        cout<<x - k * d;
        return;
    }
    int ans = LLONG_MAX;
    for(int i = max(0ll, mn - 2); i <= min(k, mn + 2); i++) {
        int rem = (k - i) % 2;
        int cPos = x - i * d;
        cPos = abs(cPos);
        if(rem) { 
            ans = min(ans, min(abs(cPos - d), abs(cPos + d)));
        }
        else ans = min(ans, cPos);
    }
    cout<<ans;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int t = 1;
    //cin>>t;
    for(int test = 1; test <= t; test++) {
        //cout<<"Case #"<<test<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3684
#include<stdio.h>
#define MAX 100000

int A[MAX], n;

int parti(int p, int r){
	int x,i,j,t;
	x = A[r];
	i = p-1;
	for ( j = p; j < r; j++ ){
		if(A[j] <= x ){
			i++;
			t = A[i]; A[i] = A[j]; A[j] = t; 
		}
	}
	t = A[i+1]; A[i+1] = A[r]; A[r] = t;
	return i + 1;
}

int main(void){
	int i, q;
	
	scanf("%d",&n);
	for ( i = 0; i < n; i++ ) scanf("%d",&A[i]);
	
	q = parti(0, n - 1);
	
	for ( i = 0; i < n; i++ ){
		if (i) printf(" ");
		if (i == q) printf("[");
		printf("%d",A[i]);
		if (i == q) printf("]");
	}
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 2076
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}
vector<pll> tejun;
void addtejun(ll a,ll b){
  tejun.push_back({a,b});
}
void printtejun(){
  for (auto &&i : tejun)
  {
    cout<<i.first<<" "<<i.second<<endl;
  }
}

void solve(long long N, std::deque<long long> A){
  sort(A.begin(),A.end());
  if(A[0]<0){
    if(A[N-2]<0){
      cout<<A.back()-accumulate(A.begin(),A.end()-1,0LL)<<endl;
      REP(N-1){
        addtejun(A[N-1],A[i]);
        A[N-1]-=A[i];
      }
      printtejun();
      return;
    }
    for(; A[A.size()-2]>0;){
      addtejun(A[0],A.back());
      A[0]-=A.back();
      A.pop_back();
    }
    REP(A.size()-1){
      addtejun(A.back(),A[i]);
      A[A.size()-1]-=A[i];
    }
    cout<<A[A.size()-1]<<endl;
    printtejun();
    return;
  }else{
    REP(N-2){
      addtejun(A[0],A[i+1]);
      A[0]-=A[i+1];
    }
    addtejun(A[N-1],A[0]);
    cout<<A[N-1]-A[0]<<endl;
    printtejun();
    return;
  }
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::deque<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 4468
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<int,int>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

////////// 二項係数(N<=10^7) //////////

ll fac[MAX],finv[MAX],inv[MAX];
// fac[i] i!
// finv[i] i!の逆元
// inv[i] iの逆元

// テーブルを作る前処理
void COMinit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(ll i=2; i<MAX; ++i){
    fac[i]=fac[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}

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

//////////////////////////////////////////////////

int main(){
  COMinit();
  ll X,Y;
  cin>>X>>Y;
  
  if((X+Y)%3!=0) co(0);
  else co(COM((X+Y)/3,X-(X+Y)/3));
  return 0;
}

Measured memory_bytes: 123132
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DStringEquivalence solver = new DStringEquivalence();
        solver.solve(1, in, out);
        out.close();
    }

    static class DStringEquivalence {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            // 初めて出てくる順番が必ずa,b,c,d,e,f,g,h,i,jの順であればよいことがわかる
            int n = in.nextInt();
            bfs("", n, 'a');
        }

        void bfs(String str, int n, char ch) {
            // ch は新しく作る場合どこまで使ってよいかを示すもの
            if (n == 0) {
                System.out.println(str);
                return;
            }
            for (char c = 'a'; c <= ch; c++) {
                StringBuilder sb = new StringBuilder(str);
                sb.append(c);
                if (c == ch) {
                    bfs(new String(sb), n - 1, (char) (ch + 1));
                } else {
                    bfs(sb.toString(), n - 1, ch);
                }
            }
        }

    }
}



Measured memory_bytes: 58624
from itertools import combinations
N, K = map(int, input().split())
dots = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])

ans = 10 ** 37
for i in range(N):
    for j in range(i+K-1, N):
        width = dots[j][0] - dots[i][0]
        y = sorted([l for _, l in dots[i:j+1]])
        for a, b in zip(y, y[K-1:]):
            height = b - a
            ans = min(ans, width*height)

print(ans)


Measured memory_bytes: 41196
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
 
namespace IO{
    const int insiz = 1 << 12, outsiz = 1 << 18;
    char in[insiz], *A(in), *B(in); char out[outsiz], *ptr(out);
    inline char getc(){
    	#ifndef LOCAL
        return (A == B) && (B = (A = in) + fread(in, 1, insiz, stdin), A == B) ? EOF : *A++;
        #endif
        return getchar();
    }
    template <typename T> inline T read(){
        T ret(0), p(1); char ch(getc());
        while(ch < '0' || ch > '9'){
            if(ch == '-') p = -1; ch = getc();
        }
        while(ch >= '0' && ch <= '9') ret = ret * 10 + ch - '0', ch = getc();
        return ret*p;
    }
    inline void flush(){ fwrite(out, 1, ptr - out, stdout); ptr = out; }
    template <typename T> inline void write(T x, char cmd = '\n'){
        if(x < 0) *ptr++ = '-', x = -x;
        if(x == 0) *ptr++ = '0';
        static char s[123]; int cnt = 0;
        for(; x; x /= 10) s[++cnt] = x % 10 + '0';
        for(; cnt; --cnt) *ptr++ = s[cnt];
        *ptr++ = cmd;
        if((outsiz >> 1) > ptr - out) flush();
    }
} using IO::getc; using IO::read; using IO::write; using IO::flush;
 
int main(){
	int a[3]; a[0] = read<int>(); a[1] = read<int>();
	std::sort(a, a + 2);
	if(a[0] == a[1]){
		write(a[0] << 1);
	}
	else{
		write((a[1] << 1) - 1);
	}
	flush(); return 0;
}
 
 

Measured memory_bytes: 128
#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <numeric>

typedef unsigned long long ULONG;
typedef long long LONG;
using namespace std;

#define PI 3.1415926535897932384626433
#define _DBG_

#define BIG 10000000000 //10

#define LAST 10000000 //10^7

#define MOD (LONG)(10e8 + 7)

LONG popcount(string X) {
	LONG count = 0;
	for (int i = 0; i < X.length(); i++) {
		if (X[i] == '1') {
			count++;
		}
	}
	return count;
}

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


	for (int n = 1; n <= N; n++) {
		ULONG max = (ULONG)sqrt(n);
		ULONG count = 0;
		bool flgA = false;
		for (int x = 1; x <= max; x++) {
			for (int y = 1; y <= x; y++) {
//				if (x*x + y* y + x*y + x + y>= n) {
//					break;
//				}
				for (int z = 1; z <= y; z++) {
					ULONG val = x*x + y*y + z*z + x*y + y*z + z*x;
					if (val == n) {
						if (x == y && y == z) {
							count++;
						}
						else if (x == y || y == z) {
							count += 3;
						}
						else {
							count += 6;
						}
					}
				}
			}
		}
		cout << count << endl;

	}



	return 0;
}


Measured memory_bytes: 3440
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {/*
        var nm = Add.ar;
        var ads = new List<int>[nm[0]];
        for (var i = 0; i < nm[0]; i++)
            ads[i] = new List<int>();
        var ct = 0L;
        for(var i = 0; i < nm[1]; i++)
        {
            var inp = Add.ar;
            ads[inp[0] - 1].Add(inp[1] - 1);
        }
        for(var i = 0; i < nm[0]; i++)
        {

        }*/
        var ar = Add.ar;
        WriteLine(Min(ar[2], ar[1] / ar[0]));
    }
}

public class Add
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public  static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li d;
li c[111];
li s[444][33];

int main() {
    cin >> d;
    rep(i, 26) {
        cin >> c[i];
    }
    rep(i, d) {
        rep(j, 26) {
            cin >> s[i][j];
        }
    }

    rep(i, d) {
        li ma = -1;
        li mai = -1;
        rep(j, 26) {
            if (ma < s[i][j]) {
                ma = s[i][j];
                mai = j;
            }
        }
        cout << mai + 1 << endl;
    }


    return 0;
}

Measured memory_bytes: 3728
#include<iostream>
using namespace std;
int main(){
    int c[3][3];
    for(int i = 0;i<3;i++){
            cin>>c[i][0]>>c[i][1]>>c[i][2];
    }
    int a_sum[3],b_sum[3];
    for(int i=0;i<3;i++){
        a_sum[i]=(c[i][0]+c[i][1]+c[i][2]);
        b_sum[i]=(c[0][i]+c[1][i]+c[2][i]);
    }
    int a[3],b[3];
    for(int i=0;i<=a_sum[0]/3;i++){
        a[0]=i;
        b[0]=c[0][0]-a[0];
        b[1]=c[0][1]-a[0];
        b[2]=c[0][2]-a[0];
        a[1]=c[1][0]-b[0];
        a[2]=c[2][0]-b[0];
        bool flag=true;
        for(int j=0;j<3;j++){
            if(a[j]>a_sum[j]/3||b[j]>b_sum[j]/3)flag=false;
        }
        if(flag){
            bool flag_2=true;
            for(int s=1;s<3;s++){
                for(int t=1;t<3;t++){
                    if(c[s][t]!=a[s]+b[t])flag_2=false;
                }
            }
            if(flag_2){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<algorithm>
#include<functional>

typedef unsigned long long LL;

using namespace std;

int main() {
	string S;
	cin >> S;
	bool flag = false;
	for (int i = 0; i < S.length() - 1; i++) {
		if (S[i] == 'A'&&S[i + 1] == 'C') {
			flag = true;
		}
	}
	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
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; }

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    string s;
    cin >> s;
    int cnt = 0;
    for(int i=0;i<s.size();i++){
        int len = 0;
        if(s[i] == 'R')len = 1;
        while(s[i] == 'R' && s[i+1] == 'R' && i+1 < s.size())len++,i++;
        chmax(cnt,len);
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3616
class Chess_board:
    def __init__(self):
        self.board=[[0]*8 for i in range(8)]
        self.queen_array=[]
        self.queen_row=[]


def copy_board(chess_board):
    new_board=Chess_board()
    new_board.board=[chess_board.board[i][:] for i in range(8)]
    new_board.queen_array=chess_board.queen_array[:]
    new_board.queen_row=chess_board.queen_row[:]
    return new_board


def mk_board(chess_board,queen_array):
    for queen in queen_array:
        row=queen[0]
        col=queen[1]
        if(chess_board.board[row][col]==0):
            chess_board.queen_array.append(queen)
            chess_board.queen_row.append(row)
            for i in range(8):
                chess_board.board[row][i]=1
            for i in range(8):
                chess_board.board[i][col]=1
            for i in range(1,8):
                if(row - i >=0 and col - i >=0):
                    chess_board.board[row-i][col-i]=1
                else:
                    break
            for i in range(1,8):
                if(8 > row + i >=0 and col - i >=0):
                    chess_board.board[row+i][col-i]=1
                else:
                    break
            for i in range(1,8):
                if(row - i >=0 and 8 > col + i >=0):
                    chess_board.board[row-i][col+i]=1
                else:
                    break
            for i in range(1,8):
                if(8 > row + i >=0 and 8 > col + i >=0):
                    chess_board.board[row+i][col+i]=1
                else:
                    break

        else:
            return 0
    
    return 1



def find_queen(chess_board):
    
    for tmp_row in range(8):
        if(tmp_row in chess_board.queen_row):
            pass
        else:
            break
    
    for col in range(8):
        new_board=copy_board(chess_board)
        if(mk_board(new_board,[[tmp_row,col]])==1):
            if(len(new_board.queen_row)==8):
                return new_board
            else:
                result=find_queen(new_board)
                if(result is not None):
                    return result
    
    return None



n=int(input())

queen_array=[]
for i in range(n):
    queen_array.append(list(map(int,input().split())))

board=Chess_board()
mk_board(board,queen_array)
if(n!=8):
    result_board=find_queen(board)
else:
    result_board=board

for i in range(8):
    for queen in result_board.queen_array:
        if(queen[0]==i):
            str1="."*queen[1]
            str2="."*(7-queen[1])
            print(f"{str1}Q{str2}")


Measured memory_bytes: 5640
#include <iostream>

using namespace std;

int main()
{
  int n, x, acc;

  cin >> n;

  x = 1;
  acc = 0;
  do {
    if (n < x*10) {
      acc += n - x + 1;
    } else {
      acc += x*9;
    }
    x *= 100;
  } while (x <= n);

  cout << acc << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
int main()
{
	ll n,m;
	while(~scanf("%lld%lld",&n,&m))
	{
		ll ans=0;
		if(2*n<=m)
		{
			ans=n;
			m-=2*n;
			ans+=m/4;
		}
		else 
		{
			ans=m/2;
		}
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;
const int INF = 1e9;



signed main()
{
    int A, B;
    cin >> A >> B;
    
    if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
}


Measured memory_bytes: 256
#C - Energy Drink Collector
N,M = map(int,input().split())
A_B = [tuple(map(int,input().split())) for _ in range(N)]

A_B = sorted(A_B, key = lambda x:x[1],reverse = True)
A_B = sorted(A_B, key = lambda x:x[0], reverse = False)

pay = 0
drink = M
for A, B in A_B:
    if drink <= B:
        pay += A*drink
        break
    else:
        pay += A*B
        drink -= B
print(pay)

Measured memory_bytes: 24672
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n; readV(n);
  writeln(n%2 == 0 ? n : n*2);
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,k,i,j,l,g,c=0;
  int a[5001],dp1[5001][5001],dp2[5001][5001];
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++)scanf("%d",&a[i]);
  for(i=0;i<=n;i++)for(j=0;j<=k;j++)dp1[i][j]=dp2[i][j]=0;
  dp1[0][0]=dp2[n][0]=1;
  for(i=0;i<n;i++)for(j=0;j<=k;j++)dp1[i+1][j]=dp1[i][j]|(j<a[i]?0:dp1[i][j-a[i]]);
  for(i=n;i>0;i--)for(j=0;j<=k;j++)dp2[i-1][j]=dp2[i][j]|(j<a[i-1]?0:dp2[i][j-a[i-1]]);
  for(i=0;i<n;i++){
    g=l=0;
    for(j=k-1;j>=0;j--){l+=dp2[i+1][k-j-1];if(k-j>a[i])l-=dp2[i+1][k-a[i]-j-1];g|=dp1[i][j]*l;}
    if(a[i]<k&&!g)c++;
  }
  printf("%d",c);
}


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

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")

#define DEBUG(x) cout << ">> " << #x << ": " << x << endl;
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int MOD = 1000000007;
typedef long long ll;
typedef long double ld;

void setIO(string s) {
  ios_base::sync_with_stdio(0); cin.tie(0);
  freopen((s+".in").c_str(),"r",stdin);
  freopen((s+".out").c_str(),"w",stdout);
}

int main() { _
  int n, k; cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  vector<bool> g(k+1, false);
  for (int i = v[0]; i < k+1; i++) {
    bool w = true;
    for (int j : v) {
      if (j > i) break;
      w &= g[i-j];
    }
    if (!w) g[i] = true;
  }
  cout << (g[k] ? "First" : "Second") << endl;
  return 0;
}

Measured memory_bytes: 384
N = int(input())
A = list()
B = list()
C = list()

for i in range(N) :
    a, b, c = map(int, input().split())
    A.append(a)
    B.append(b)
    C.append(c)

maxA = [0 for i in range(N)]
maxB = [0 for i in range(N)]
maxC = [0 for i in range(N)]

maxA[0] = A[0]
maxB[0] = B[0]
maxC[0] = C[0]

for i in range(1, N) :
    maxA[i] = max(maxB[i - 1], maxC[i - 1]) + A[i]
    maxB[i] = max(maxA[i - 1], maxC[i - 1]) + B[i]
    maxC[i] = max(maxA[i - 1], maxB[i - 1]) + C[i]

print(max(maxA[N - 1], maxB[N - 1], maxC[N - 1]))


Measured memory_bytes: 72536
nq = gets.chomp.split
n = nq[0].to_i
q = nq[1].to_i

s = gets.chomp

ac_from_1_to_i = [0]
ac_count = 0
n.times do |i|
  if s[i] == "A" && s[i+1] == "C"
    ac_count += 1
  end
  ac_from_1_to_i << ac_count
end

q.times do
  lr = gets.chomp.split
  ac_count = ac_from_1_to_i[lr[1].to_i - 1] - ac_from_1_to_i[lr[0].to_i - 1]
  puts ac_count
end

Measured memory_bytes: 3452
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 1000000000000000000;//10^18
const ll mod = 1000000007;
//printf("%.10f\n", n);
ll ok[123456];
signed main() {
	ll n = 0, k, b = 0, cnt = 0, ans = 0; cin >> n >> k;
	vector<ll> a(n), v(n);
	for (int h = 0; h < n; h++) { cin >> a[h]; cnt += a[h]; }
	sort(a.begin(), a.end());
	for (int h = 0; h < n; h++) { cin >> v[h]; }
	cnt -= k; ll ng = -1, ok = INF + 1, mid = (ok + ng) / 2;
	while (ok - ng > 1) {
		ll sum = 0, bo = k; vector<ll> ve;
		for (int h = 0; h < n; h++) {
			sum += mid / v[h]; ve.push_back(mid / v[h]);
		}
		sort(ve.begin(), ve.end());
		for (int h = 0; h < n; h++) {
			if (ve[h] < a[h]) { bo -= a[h] - ve[h]; }
		}
		if (bo >= 0 && sum >= cnt) { ok = mid; }
		else { ng = mid; }
		mid = (ok + ng) / 2;
	}
	cout << ok << endl;
	return 0;
}

Measured memory_bytes: 7604
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const ll INF = std::numeric_limits<long long>::max();
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define fi first
#define se second
#define sz size
string YN(bool b) { return(b ? "YES" : "NO"); }
string yn(bool b) { return(b ? "Yes" : "No"); }
int main() {
	ll n, l,v[100000],p=-10;
	cin >> n >> l;
	rep(i, n) { cin >> v[i]; if (i > 0&&p==-10) { if (v[i - 1] + v[i] >= l)p = i; } }
	if (p == -10)cout << "Impossible" << endl;
	else {
		cout << "Possible" << endl;
		for (ll i = 1; i < p;++i)cout << i << endl;
		for (ll i = n - 1; i > p;--i)cout << i << endl;
		cout << p << endl;
	}
	return 0;
}


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

using namespace std;

long long pw(long long a) {
    return a*a*a*a*a;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    long long x;
    cin >> x;
    bool ok = false;
    for (long long a = 0; a < 1000; a++) {
        for (long long b = -1000; b < 1000; b++) {
            if (!ok && pw(a) - pw(b) == x) {
                ok = true;
                cout << a << " " << b << endl;
            }
        }
    }
}



Measured memory_bytes: 3644
import java.math.BigInteger;
import java.util.*;
public class Main {
	static long mod = 1000000007;
	public static BigInteger c(int n , int r)
	{
		if(r>n/2) r = n-r;
		BigInteger x = BigInteger.ONE;
		for(int i = 1 ;i<=r;i++)
			x = x.multiply(BigInteger.valueOf(n-r+i)).divide(BigInteger.valueOf(i));
		return x;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner (System.in);
		int n = sc.nextInt();
		int k =sc.nextInt();
		
		for(int i=1;i<=k;i++)
		{		
			
			BigInteger pll = c(n-k+1,i);	
			BigInteger prt = c(k-1,i-1);
			
			//System.out.println(pll);
			//System.out.println(prt);
			System.out.println(n-k-i+1 < 0 ? 0:(pll.mod(BigInteger.valueOf(mod)).multiply(prt.mod(BigInteger.valueOf(mod)))).mod(BigInteger.valueOf(mod)));			
			
		}

	}

}


Measured memory_bytes: 220868
#include <bits/stdc++.h>
using namespace std;
int main(void){
	char S[100001];
	int cnt=0;
	int red,blue=0;
	scanf("%s",S);
	while(S[cnt] != 0 && S[cnt] != 1){
		if(S[cnt] == 48){
			red++;
			//printf("a",S[cnt]);
		}else{
			blue++;
			//printf("b",S[cnt]);
		}
		cnt++;
	}
	if(red > blue){
		printf("%d",blue*2);
	}else{
		printf("%d",red*2);
	}
	return 0;
}

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

int main() {
    double n, k;
    cin >> n >> k;
    long double ans = 0.0;
    for(double i = 1.0; i <= n; i++) i < k ? ans += (1 / n) * pow(0.5, ceil(log2(k / i))) : ans += 1 / n;
    cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 4072
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define STRINGIFY(n) #n
#define TOSTRING(n) STRINGIFY(n)
#define PREFIX "#" TOSTRING(__LINE__) "| "
#define debug(x) \
{ \
  std::cout << PREFIX << #x << " = " << x << std::endl; \
}

std::ostream& output_indent(std::ostream& os, int ind) {
  for(int i = 0; i < ind; i++) os << " ";
  return os;
}

template<class S, class T> std::ostream& operator<<(std::ostream& os, const std::pair<S, T>& p);
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& v);

template<class S, class T> std::ostream& operator<<(std::ostream& os, const std::pair<S, T>& p) {
  return (os << "(" << p.first << ", " << p.second << ")");
}
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
  os << "[";
  for(int i = 0;i < v.size();i++) os << v[i] << ", ";
  return (os << "]");
}

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) { return std::vector<T>(n, std::forward<T>(val)); }
template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}
template<class Cond> struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  template<class T> bool operator()(T& a, const T& b) const { if(cond(a, b)) { a = b; return true; } return false; }
};
template<class Cond> chain<Cond> make_chain(Cond cond) { return chain<Cond>(cond); }

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

vector<i64> strongly_connected_components(const vector<vector<i64>>& g) {
  i64 n = g.size();
  vector<vector<i64>> rg(n);
  for(int i = 0;i < n;i++) {
    for(auto j: g[i]) {
      rg[j].push_back(i);
    }
  }

  vector<bool> vis(n,false);
  vector<i64> vs;
  vector<i64> res(n,-1);
  function<void(int)> dfs = [&](int v) {
    vis[v] = true;
    for(auto& t : g[v]) {
      if(!vis[t]) dfs(t);
    }
    vs.push_back(v);
  };

  function<void(int,int)> rdfs = [&](int v,int k) {
    vis[v] = true;
    res[v] = k;
    for(auto to : rg[v]) {
      if(!vis[to]) rdfs(to,k);
    }
  };

  for(int i = 0;i < n;i++) {
    if(!vis[i]) dfs(i);
  }

  vis.assign(n,false);
  int k = 0;
  for(int i = n - 1;i >= 0;i--) {
    if(!vis[vs[i]]) rdfs(vs[i] , k++);
  }
  return res;
}

int main() {
  i64 N, M;
  cin >> N >> M;
  string S;
  cin >> S;
  vector<vector<i64>> g(N * 2);
  rep(e,0,M) {
    i64 a, b;
    cin >> a >> b;
    a--;
    b--;
    if(a == b) {
      g[a * 2].push_back(a * 2 + 1);
    }
    else if(S[a] == S[b]) {
      g[a * 2].push_back(b * 2 + 1);
      g[b * 2].push_back(a * 2 + 1);
    }
    else {
      g[a * 2 + 1].push_back(b * 2);
      g[b * 2 + 1].push_back(a * 2);
    }
  }
  auto res = strongly_connected_components(g);
  if(2 * N - 1 == *std::max_element(all(res))) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<pair<int,int>, null_type,less<pair<int, int> >, rb_tree_tag,tree_order_statistics_node_update>

#define NEWLINE         cerr << "\n";
#define HOISE           cerr << "hoise " << __LINE__ << "\n"
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << "\n"
#define READ            freopen("D:\\moidda CPP\\alu.txt", "r", stdin)
#define WRITE           freopen("D:\\moidda CPP\\vorta.txt", "w", stdout)
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MASK(x)         for(int i = 0; i < 8; i++){ if(x&(1<<i)){ cout << i << " "; } } cout << endl;

#define INF             1e9
#define INFL            8e18
#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair

typedef long long ll;
typedef pair<int, int > pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pff;

const int MAX = 1e5 + 5;
const int MAXLOG = log2(MAX) + 2;
const int MAXN = 1e6 + 2;
const int MOD = 998244353 ;
const double PY = acos(-1.0);
const double EPS = 1E-9;

int32_t main()
{
#ifndef ONLINE_JUDGE
//    READ;
//    WRITE;
#endif // ONLINE_JUDGE

    FASTIO;

    ll r, c;
    cin >> r >> c;
    if(r>c) swap(r, c);

    if(r == 1){
        cout << 1;
        return 0;
    }

    ll ans = r*(c/2);
    if(c%2 == 1) ans += r/2;
    if(r%2 == 1 and c%2 == 1) ans++;
    cout << ans;

    return 0;
}



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

int main(){
  int N,M,sum;
  sum=0;
  cin >> N;
  vector<int> p(N);
  for(int i=0;i<N;i++){cin >> p[i];}
  M=p[0];
  for(int i=0;i<N;i++){sum+=p[i];}
  for(int i=0;i<N;i++){M=max(M,p[i]);}
  cout << sum-M/2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

double dot(P a,P b){return real(conj(a)*b);}
double cross(P a,P b){return imag(conj(a)*b);}

int main(){
  double a,b,c,d,e,f,g,h;
  while(~scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&a,&b,&c,&d,&e,&f,&g,&h)){
    P x[6];
    x[0] = P(a,b);
    x[1] = P(c,d);
    x[2] = P(e,f);
    x[3] = P(g,h);
    x[4] = x[0];
    x[5] = x[1];
    double ccw = cross(x[2]-x[0],x[1]-x[0]);
    bool flag = true;
    REPR(i,4){
      double ccc = cross(x[2+i]-x[i],x[1+i]-x[i]);
      if(ccw*ccc <= 0){
        flag = false;
        break;
      }
    }
    if(flag){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1228
#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 li          long
#define ll          long long
#define ull         unsigned long long
#define ff          first
#define ss          second
#define pii         pair<int,int>
#define pli         pair<li,li>
#define pll         pair<ll,ll>
#define pb          push_back
#define fo(i,k,n)   for(int i = k;i<n; i++)
#define ro(i,k,n)   for(int i = k; i>=n; i--)
#define fd(i,k,n,d) for(int i = k; i<n; i+=d)
#define tc          int t;cin>>t;while(t--)
#define all(v)      v.begin(),v.end()
#define inf         INT_MAX
#define ninf        INT_MIN
#define W(x)        cout<<x<<endl
#define WW(x,y)     cout<<x<<' '<<y<<endl;
#define in(x)       cin>>x
#define v(x)        vector<x>
#define int         long long
#define ar(x,y)       array<x,y>
const ll mod1 = 99844353;
const ll mod2 = 1e9+7;
template <class T>
using oset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

//****************************************************************************************************************************************//

void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

//*****************************************************************************************************************************************//

template<class T>
T power(T a,T b){
    T res = (T)1;
    while(b>0){
        if(b&1)res = res*a;
        b>>=1;
        a*=a;
    }
    return res;
}

template<class T>
T power(T a,T b,T m){
    T res = (T)1;
    a%=m;
    while(b>0){
        if(b&1)res = (res*a)%m;
        b>>=1;
        a = (a*a)%m;
    }
    return res;
}

//*****************************************************************************************************************************************//

struct dsu{
  map<int,int> pr,sz;
  dsu(){
    (this->pr).clear();
    (this->sz).clear();
  }
  void make(int x){
    pr[x] = x;
    sz[x] = 1;
  }
  int getpar(int x){
    if(pr[x] == x)return x;
    return pr[x] = getpar(pr[x]);
  }
  void merge(int x,int y){
    x = getpar(x);
    y = getpar(y);
    if(sz[x]<sz[y])swap(x,y);
    pr[y] = x;
    sz[x]+=sz[y];
    sz[y] = 0;
  }
};

//******************************************************************************************************************************************//


void solve(){
    int a,b;
    cin>>a>>b;
    set<int> st1,st2;
    for(int i = 2; i<=sqrt(a)+1; i++){
        if(a%i == 0){
            st1.insert(i);
            while(a%i == 0){
                a/=i;
            }
        }
    }
    if(a>1)st1.insert(a);
    for(int i = 2; i<=sqrt(b)+1; i++){
        if(b%i == 0){
            st2.insert(i);
            while(b%i == 0)b/=i;
        }
    }
    if(b>1)st2.insert(b);
    int ans = 0;
    for(auto x:st1){
        if(st2.count(x))ans++;
    }
    cout<<ans+1<<"\n";
}

signed main(){
    fastio();
    int cs = 1;
    //cin>>cs;
    while(cs--){
        solve();
    }
}


Measured memory_bytes: 3644
/***
**   AUTHOR::ASHUTOSH MOUDGIL
***/


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

#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F first
#define S second
#define int long long
//#define ll long long
#define all(x) x.begin(),x.end()
#define rsort(x) sort(all(x)); reverse(all(x));
#define endl '\n'
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define vi vector<int>
#define vlli vector<long long>
#define pii pair<int,int>
#define mod 1000000007
#define LMAX 1e18
#define deb(x) cout<<#x<<" : "<<x<<endl;

void mymain(){
    string s;
    cin >> s;
    bool ok = true;
    for(int i=0;i<s.size();i++){
        //deb(i);deb(ok);
        if(i&1){
            if(s[i]=='R')
                ok=false;
        }else{
            if(s[i]=='L')
                    ok=false;
        }
    }
    if(ok)
        cout << "Yes" <<endl;
    else
        cout << "No" <<endl;
}

signed main(){
IOS;
///freopen("input.txt", "r", stdin);
///freopen("output.txt", "w", stdout);
int t=1;
///cin>>t;
for(int tt=0;tt<t;tt++){
   ///cout << "Case #" << tt+1 <<": ";
   mymain();
   }
return 0;
}


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

int main(){
    int n;  cin >> n;
    vector<int>d(n);
    rep(i, n)   cin >> d[i];
    //solve
    int ans = 0;
    rep(i, n-1){
        for(int j = i+1; j < n; j++){
            ans += d[i]*d[j];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
S = input()

le = len(S)
w_pattern = '10'
b_pattern = '01'

A = (w_pattern * int(le/2 + 1))[0:le]
B = (b_pattern * int(le/2 + 1))[0:le]

w_ans = sum([s != a for s,a in zip(S,A)])
b_ans = sum([s != b for s,b in zip(S,B)])
ans = w_ans if w_ans < b_ans else b_ans

print(ans)

Measured memory_bytes: 4248
import java.util.Scanner;

public class Main {
	public static void main(String[]args){
		//????????£????????????
		Scanner sc = new Scanner(System.in);
		//??°?????????
		while(true){
			//x??????
			int x = sc.nextInt();
			//y??????
			int y = sc.nextInt();
			//x??¨y???????????¨???0????????°??????
			if(x == 0 && y == 0){
				break;
			}
			//?°??????????????????????
			if(x < y){
				//????????¨???
				System.out.println(x + " " + y);
			}else{
				//????????¨???
				System.out.println(y + " " + x);
			}
		}
	}
}

Measured memory_bytes: 35880
#include <stdio.h>
int main(void){
    int n1,n2,n3,min;
    scanf("%d %d %d",&n1,&n2,&n3);
    if(n1>n2){
        min=n1;
        n1=n2;
        n2=min;
    }
    if(n1>n3){
        min=n1;
        n1=n3;
        n3=n2;
        n2=min;
    }
    if(n2>n3){
        min=n2;
        n2=n3;
        n3=min;
    }
    printf("%d %d %d\n",n1,n2,n3);
    return 0;
}



Measured memory_bytes: 2104
s = input()
t = input()
s_list = [-1 for i in range(26)]
t_list = [-1 for i in range(26)]
for i in range(len(s)):
    if s_list[ord(s[i]) - ord("a")] == -1:
        s_list[ord(s[i]) - ord("a")] = ord(t[i])
    else:
        if s_list[ord(s[i]) - ord("a")] != ord(t[i]):
            print("No")
            exit()
    if t_list[ord(t[i]) - ord("a")] == -1:
        t_list[ord(t[i]) - ord("a")] = ord(s[i])
    else:
        if t_list[ord(t[i]) - ord("a")] != ord(s[i]):
            print("No")
            exit()
print("Yes")

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

using namespace std;

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

    vector<long long> A(N), B(N), C(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    for (int i = 0; i < N; ++i) cin >> B[i];
    for (int i = 0; i < N; ++i) cin >> C[i];
    
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    long long result = 0;
    for (int i = 0; i < N; i++) {
        long long a = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
        long long c = C.end() - upper_bound(C.begin(), C.end(), B[i]);

        result += a * c;
    }

    cout << result << endl;
    return 0;
}

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

int main(){
    string S;
    cin >> S;
    bool ans = true;
    for(int i = 0; i < S.length(); i++){
        if(i % 2 == 0){
            if(S[i] == 'L'){
                ans = false;
                break;
            }
        }else{
            if(S[i] == 'R'){
                ans = false;
                break;
            }
        }
    }
    
    cout << ((ans) ? "Yes" : "No") << endl;
}

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

int main(){
 int A,B,bisc;
 int T;
 int bisc1,bisc2,bisc3;
    cin >> A >> B >> T;
  bisc1 = T+0.5;
  bisc2 = bisc1/A*B;
//  bisc = ((T+0.5)/A)*B;
  
  cout << bisc2 << endl;

}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws Exception {
    try (final var stdin = new InputStreamReader(System.in);
         final var br = new BufferedReader(stdin)) {
      br.readLine();
      final var s = br.readLine();
      final char[] c = new char[3];

      int count = 0;
      for (int i = 0; i < 10; i++) {
        c[0] = (char)('0' + i);
        for (int j = 0; j < 10; j++) {
          c[1] = (char)('0' + j);
          for (int k = 0; k < 10; k++) {
            c[2] = (char)('0' + k);

            int idx = 0;
            for (int l = 0; l < s.length(); l++) {
              if (c[idx] == s.charAt(l)) {
                idx++;
              }

              if (idx == 3) break;
            }

            if (idx == 3) {
              count++;
            }
          }
        }
      }

      System.out.println(count);
    }
  }
}


Measured memory_bytes: 33948
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
  long long X;
  cin >> X;
  long int year = 0;
  long long money = 100;

  while (money < X)
  {
    year++;
    money += (long long int)(money * 0.01);
  }
  cout << year;
  return 0;
}

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

using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238463;
const int MAXN = 2e5 + 5;

void debug_out() {
    cerr << endl;
}

template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int main() {
    FAST
int n,m;
    cin>>n>>m;
    int arr[m];
    ll sum=0;
    for(int i=0;i<m;i++)
    {
        cin>>arr[i];
        sum+=arr[i];
    }
    if(sum>n)
        cout<<-1<<endl;
    else
        cout<<n-sum<<endl;

    return 0;
}


Measured memory_bytes: 3672
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse4")

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

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) begin(x),end(x)

#define forn(i, n) for (int i = 0; i < n; ++i)
#define rforn(i, n) for (int i = n - 1; i >= 0; --i)

const int N = 2e5 + 5, M = 1e9 + 7; // 998244353
const int dx[]{0, 1, 0, -1}, dy[]{1, 0, -1, 0};
const ll INF = 1e18 + 10LL;
const ld PI = 4.0 * atan((ld) 1.0), EPS = 1e-6;
const char nl = '\n';

template <typename T> inline T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T> inline T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> void ckmin(T& a, T b) { a = min(a, b); }
template <class T> void ckmax(T& a, T b) { a = max(a, b); }
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

string YN(bool x) { return x ? "YES" : "NO"; }

void solve(int tcn) {
	int n, q;
	cin >> n;
	map<int, int> m;
	ll sum = 0LL;
	forn(i, n) {
		int cur;
		cin >> cur;
		++m[cur];
		sum += cur;
	}
	cin >> q;
	while (q--) {
		int b, c;
		cin >> b >> c;
		ll x = m[b];
		sum -= x * b;
		sum += x * c;
		m[b] = 0;
		m[c] += x;
		cout << sum << nl;
	}
}

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

	int t = 1; //cin >> t;
	for (int i = 1; i <= t; ++i) {
		solve(i);
	}
	return 0;
}


Measured memory_bytes: 8108
# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

A=int(input())
B=int(input())
C=int(input())
X=int(input())


total = 0
for i in range(0, A + 1):
    for j in range(0, B + 1):
        for k in range(0, C + 1):
            if (i * 500 + j * 100 + k * 50) == X:
                total += 1

print(total)

Measured memory_bytes: 21760
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    double a,b;
    cin >> a >> b;
    if(a>b) cout << "GREATER" << endl;
    else if(a<b) cout << "LESS" << endl;
    else cout << "EQUAL" << endl;
    
}


Measured memory_bytes: 256