akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll dp[505050];
int N,M;
const ll mo=1000000007;
const int NUM_=600001;
static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];

ll comb(ll N_, ll C_) {
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	inv[1]=fact[0]=factr[0]=1;
	for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
	for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	
	cin>>N>>M;
	ll ret=0;
	FOR(i,N+1) {
		dp[i]=comb(M,i)*comb(N,i)%mo*fact[i]%mo*fact[M-i]%mo*fact[M-i]%mo*factr[M-N]%mo*factr[M-N]%mo;
		if(i%2) {
			ret-=dp[i];
		}
		else {
			ret+=dp[i];
		}
	}
	
	cout<<(ret%mo+mo)%mo<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

int main() {
    string s;
    cin >> s;
    vector<int> t(26);
    rep(i,s.size()) t[s[i]-'a']++;
    if(s.size()<26){
        cout << s;
        rep(i,26){
            if(t[i]==0) {
                char ans = 'a'+ i;
                cout << ans << endl;
                return 0;
            }
        }
    }
    else if(s=="zyxwvutsrqponmlkjihgfedcba"){
        cout << -1 << endl;
        return 0;
    }
    else{
        string u = s;
        next_permutation(all(u));
        rep(i,s.size()){
            cout << u[i];
            if(s[i]!=u[i]) break;
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Diagnostics;
using static System.Console;
using static System.Math;


namespace FunProCon
{
    class FunProConSummer
    {
        static void Main(string[] args)
        {
            long s = long.Parse(ReadLine());
            //65656565...という操作を行う
            long hoge = s % 11;
            WriteLine(hoge==0 ?
                ((s / 11) * 2) + (hoge / 7):
                ((s / 11) * 2) + (hoge / 7) + 1
                );
        }
        
    }
}


Measured memory_bytes: 13140
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//↑templete
signed main(){
	int N;
	cin>>N;
	for(int i=0;i<=N;i++){
		if(i*108/100==N){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<":("<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string.h>
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%I64d",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)
#define INF                         (int)1e9
#define EPS                         1e-9
#define bitcount                    __builtin_popcount
#define gcd                         __gcd
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define MOD                         1000000007
typedef long long ll;
/*For you see , each day i love you
 more.Today more than yesterday
  less than tomorrow.*/
using namespace std;

int main()
{
	int n;s(n);
	cout<<(int)ceil(1.0*n/1000)*1000 - n<<endl;
	return 0;
}

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

int main() {
    int h, a;
    cin >> h >> a;

    int ans = 0;
    rep(i, 0, 1000000) {
        h -= a;
        ans++;
        if (h <= 0) break;
    }

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

Measured memory_bytes: 256
N = int(input())
h = [int(i) for i in input().split()]
DP = [0]
DP.append(abs(h[0] - h[1]))

for i in range(2,len(h)):
    if DP[i-1] + abs(h[i-1] - h[i]) > DP[i-2] + abs(h[i-2] - h[i]):
        DP.append(DP[i-2] + abs(h[i-2] - h[i]))
    else:
        DP.append(DP[i-1] + abs(h[i-1] - h[i]))

print(DP[N-1])


Measured memory_bytes: 13928
#include <iostream>
#include <vector>

int main(){
  int n,b,max,max2,d;
  std::cin >> n;
  std::vector<int> v(n);
  for (int i = 0; i < n; i++) std::cin >> v[i];
  max = *std::max_element(v.begin(), v.end());
  for (int i = 0; i < n-1; i++)  {
    if (v[i]==max){
      max2=*std::max_element(v.begin()+i+1, v.end());
      std::cout << max2 << '\n';
      for (int j = i+1; j < n; j++) {std::cout << max << '\n';}
      return 0;
    }else{
      std::cout << max << '\n';
    }
  }
  if (v[n-1]==max){
    max2=*std::max_element(v.begin(), v.end()-1);
    std::cout << max2 << '\n';
    return 0;
  }else{
    std::cout << max << '\n';
  }
}


Measured memory_bytes: 2432
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

h,w,a,b = MAP()
if a > w // 2 or b > h // 2:
    print('No')
    exit()
ans = [['0' for _ in range(w)] for _ in range(h)]
for i in range(h):
    for j in range(w):
        if (i < b and j < a) or (i >= b and j >= a):
            ans[i][j] = '1'
for i in range(h):
    print(''.join(ans[i]))

Measured memory_bytes: 72536
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;
typedef long long ll;


struct Point {
    double x;
    double y;
};

void koch(int n, Point a, Point b) {
    if (n == 0) return;
    Point s, t, u;
    double th = M_PI * 60.0 / 180.0;

    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    koch(n-1, a, s);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n-1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(n-1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n-1, t, b);
}


int main() {
    Point a, b;
    int n;

    cin >> n;

    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;

    printf("%.8f %.8f\n", a.x, a.y);
    koch(n, a, b);
    printf("%.8f %.8f\n", b.x, b.y);

    return 0;
}



Measured memory_bytes: 3152
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<numeric>
#include<vector>
#include<tuple>
using namespace std;
#define FOR(i,aaaaaaaaa,bbbbb) for(ll i=aaaaaaaaa;i<bbbbb;i++)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
typedef long long ll;
const int MOD = 1e9 + 7;
ll a, b;
int k;
int main(void)
{
	cin >> a >> b >> k;
	FOR(i, 0, k) {
		if ((i % 2) == 0) {
		if (a % 2 == 0) {
			a /= 2;
			b += a;
		}
		else {
			a--;
			b += (a / 2);
			a /= 2;
		}
		}
		else {
			if ((b % 2) == 0) {
				a += b / 2;
				b /= 2;
			}
			else{
				b--;
				a += b / 2;
				b /= 2;
		}
		}

	}
	cout << a << " " << b << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
#define mod 1000000007

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    string s;
    cin >> s;
    if(s[2]==s[3]){
        if(s[4]==s[5]){
            puts("Yes");
            return 0;
        }
    }
    puts("No");

    return 0;
}











Measured memory_bytes: 256
#coding: UTF-8
import math

def SC(F):
    for i in range(len(F)):
        ele = F[i].split(" ")
        if ele[1] == "+":
            print(int(ele[0]) + int(ele[2]))
        elif ele[1] == "-":
            print(int(ele[0]) - int(ele[2]))
        elif ele[1] == "*":
            print(int(ele[0]) * int(ele[2]))
        elif ele[1] == "/":
            print(int(int(ele[0]) / int(ele[2])))
        else:
            break
if __name__=="__main__":
    F = []
    for i in range(100000000):
        F.append(input())
        if F[i].split(" ")[1] == "?":
            break
    SC(F)

Measured memory_bytes: 7792
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
typedef long long LL;
using namespace std;

int main()
{
	//freopen("data_in.txt", "r", stdin);
	string s;
	cin >> s;
	int res = 0;
	for (auto c : s) {
		if (c == '+') res++;
		else if (c == '-') res--;
	}
	cout << res;
	return 0;
}

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


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();
		int m = sc.nextInt();

		int[] a = new int[n];
		int[] b = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
		}

		int[] c = new int[m];
		int[] d = new int[m];
		for (int i = 0; i < m; i++) {
			c[i] = sc.nextInt();
			d[i] = sc.nextInt();
		}

		for (int i = 0; i < n; i++) {
			int min = Integer.MAX_VALUE;
			int t = 0;
			for (int j = 0; j < m; j++) {
				int dd = Math.abs(c[j] - a[i]) + Math.abs(d[j] - b[i]);

				if (dd < min) {
					min = dd;
					t = j;
				}
			}

			pr.println(t + 1);
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>

class UnionFind {
    public:
        std::vector<int> par, rank;

        UnionFind(int N) {
            par.resize(N);
            rank.resize(N);
            for (int i = 0; i < N; i++) {
                par[i]  = i;
                rank[i] = 0;
            }
        }

        int find(int x) {
            if (par[x] == x) {
                return x;
            }
            return par[x] = find(par[x]);
        }

        void unite(int x, int y) {
            x = find(x);
            y = find(y);

            if (x == y) {
                return;
            }

            if (rank[x] < rank[y]) {
                par[x] = y;
            } else {
                par[y] = x;

                if (rank[x] == rank[y]) {
                    rank[x]++;
                }
            }
        }

        bool same(int x, int y) {
            return find(x) == find(y);
        }
};

int main()
{
    int N, M;
    std::cin >> N >> M;
    std::vector<int> p(N);
    for (int i = 0; i < N; i++) {
        std::cin >> p[i];
        p[i]--;
    }

    UnionFind uf(N);
    for (int i = 0; i < M; i++) {
        int x, y;
        std::cin >> x >> y;
        x--; y--;
        uf.unite(x, y);
    }

    int match_count = 0;
    for (int i = 0; i < N; i++) {
        if (uf.same(i, p[i])) {
            match_count++;
        }
    }
    std::cout << match_count << std::endl;
    return 0;
}

Measured memory_bytes: 1408
#include<iostream>

int makePalind(int n, int a){
  if(n/10==0) {
    a += n;
    return a;
    }
  else {
    a += (n%10);
    return makePalind(n/10, a*10);
  }
}

int main(void){
  int n; std::cin>>n;
  if(makePalind(n, 0) == n){
    std::cout<<"Yes"<<std::endl;
  }else{
    std::cout<<"No"<<std::endl;
  }
  return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int N, S; cin >> N >> S;
  int min = inf;
  int a[N], sum = 0;
  int l = 0, r = 0;
  while(r < N) {
    cin >> a[r];
    sum += a[r++];
    while(sum >= S) {
      minimize(min, r - l);
      sum -= a[l++];
    }
  }

  cout << (min == inf ? 0 : min) << endl;
  
  return 0;
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end

vector<int> g[100010];
ll dfs(int v){
    vector<ll> a;
    for(int nxt:g[v])a.push_back(dfs(nxt));
    sort(ALL(a)); reverse(ALL(a)); ll res=0;
    rep(i,0,a.size())chmax(res,a[i]+i+1);
    return res;
}

int main(){
    int n; scanf("%d",&n);
    rep(i,1,n){
        int p; scanf("%d",&p);
        g[p-1].push_back(i);
    }
    printf("%lld\n",dfs(0));
    return 0;
}

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


#define MAX 2000001
#define VMAX 10000

int main(){
    unsigned short *A, *B;
    int C[VMAX+1]={};
    int n, i, j,l=0;
    int count=0;

    scanf("%d", &n);

    A = malloc(sizeof(short)*n+1);
    B = malloc(sizeof(short)*n+1);

    for(i=1;i<=n;i++){
        scanf("%d",&A[i]);
        C[A[i]]++;
    }

    for(i=1;i<=VMAX;i++){
        C[i]=C[i]+C[i-1];
    }

    for(i=n;i>0;i--){
        if(C[A[i]]!=0){
            B[C[A[i]]]=A[i];
            C[A[i]]--;
        }
    }

    for(i=1;i<n;i++){
        printf("%d ",B[i]);
    }

    printf("%d\n",B[i]);




    return 0;
}




Measured memory_bytes: 9612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

struct Edge { int to, id;};
vector<vector<Edge>> graph;
vector<int> ans;
vector<bool> used;

void dfs(int cur, int pre) {
	used[cur] = true;
	int color = 1;
	for(int i = 0; i < graph[cur].size(); ++i) {
		if(color == pre) ++color;
		Edge e = graph[cur][i];
		if(used[e.to]) continue;
		ans[e.id] = color;
		dfs(e.to, color);
		color++;
	}
	return;
}

int main(){
	int n;
	cin >> n;
	graph.resize(n);
	used.resize(n);
	ans.resize(n - 1);
	rep(i, n - 1){
		int a, b;
		cin >> a >> b;
		--a; --b;
		graph[a].push_back((Edge){b, i});
		graph[b].push_back((Edge){a, i});
	}

	dfs(0, -1);
	int maxVal = -1;
	rep(i, n - 1) maxVal = max(maxVal, ans[i]);
	cout << maxVal << endl;
	rep(i, n - 1) {
		cout << ans[i] << endl;
	}

}

Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
#define D(x)    cout << #x " = " << (x) << endl
#define cost    first
#define xx      second.first
#define yy      second.second
#define MAX     100000
typedef pair<int,int> pii;
typedef pair<int, pii> piii;
typedef long long int LL;

vector< piii > edge;
vector<piii> on_x, on_y;

namespace std{
    bool cmp (const piii &u, const piii & v){ return u.xx < v.xx;}
}

int par[MAX+5];

int find_par(int idx)
{
    if(par[idx] == idx) return idx;
    return par[idx] = find_par(par[idx]);
}

bool join(int u, int v)
{
    int pu = find_par(u);
    int pv = find_par(v);
    if(pu == pv) return false;
    par[pu] = pv;
    return true;
}

int main()
{
    int i, j, k, n, x, y;
    LL res = 0;

    scanf("%d", &n);
    for(i = 1; i <= n; i++) par[i] = i;

    for(i = 1; i <= n; i++)
    {
        scanf("%d %d", &x, &y);
        on_x.push_back(piii(i, pii(x,y)));
        on_y.push_back(piii(i, pii(y,x)));
    }

    sort(on_x.begin(), on_x.end(), cmp);
    sort(on_y.begin(), on_y.end(), cmp);

    for(i = 1; i < (int) on_x.size(); i++) edge.push_back(piii(on_x[i].xx - on_x[i-1].xx, pii(on_x[i].first, on_x[i-1].first)));
    for(i = 1; i < (int) on_y.size(); i++) edge.push_back(piii(on_y[i].xx - on_y[i-1].xx, pii(on_y[i].first, on_y[i-1].first)));

    sort(edge.begin(), edge.end());
    for(auto e : edge)
        if(join(e.xx, e.yy))
            res += e.cost;

    cout << res << endl;
    return 0;
}


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

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

    int n,x;
    cin>>n;

    x = n/2;

    if(n&1){
        x++;
    }
    cout<<x*(n/2)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define all(c) c.begin(),c.end()
#define str string
#define edl "\n"
#define add insert
#define cot continue
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;




int main() 
{

 fast();
  
  // #ifndef ONLINE_JUDGE
  //   freopen("input.txt", "r", stdin);
  //   freopen("output.txt","w",stdout);
  // #endif
  ll a;
  cin>>a;
  ll x,y;
  vector<pa>q;
  // if(a==1)
  // {
  //   cout<<1;
  //   return 0;
  // }
  f(i,0,a)
  {
    cin>>x>>y;
    q.pb({x,y});
  }
  if(a==1)
  {
    cout<<1;
    return 0;
  } 
  ll ma=-1;
  ll q1[a];
   map<pa,ll>maps;
  f(i,0,a)
  {
  
   
    f(j,0,a)
    {
      if(i!=j)
      {
        if((q[i].F-q[j].F)==0&&(q[i].S-q[j].S)==0)
        {
            continue;
         }
         else
         {   
          // cout<<q[i].F-q[j].F<<" "<<q[i].S-q[j].S<<edl;
          maps[{q[i].F-q[j].F,q[i].S-q[j].S}]++;
        }

      }
    }
  }
  for(auto s:maps)
  {
    ma=max(ma,s.S);
  }
  cout<<a-ma;

  


  


    




    // cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
    return 0;
}
 

Measured memory_bytes: 384
#include <iostream>
#include <cmath>

using namespace std;

typedef long long ll;

int main() {
    ll N, A, B; cin >> N >> A >> B;

    if ((B-A) % 2 == 0) {
        ll x = (B-A) / 2;
        ll d_A = N-A;
        ll d_B = B-1;
        ll ans = min(x, min(d_A, d_B));
        cout << ans << endl;
        return 0;
    }

    else {
        ll x = 0, y = 0;

        ll d_A = N-A;
        ll d_B = B-1;

        ll A_ = A, B_ = B;
        x += A_;
        A_ = 1, B_ -= A;
        x += (B_-1) / 2;
        A_ = A, B_ = B;
        y += N-B_+1;
        A_ += (N-B+1), B_ = N;
        y += (B_ - A_) / 2;

        cout << min(x, y) << endl;
        return 0;
    }
}

Measured memory_bytes: 888
#include <iostream>
#include <string>
using namespace std;
int main()
{
  string S;
  cin >> S;
  int alpha[26] = {0};
  for (int i = 0; i < S.length(); i++) {
    alpha[(int)(S[i]-'a')]++;
  }
  bool ans = true;
  for (int i = 0; i < 26; i++) {
    if (alpha[i]>1) ans = false;
  }
  if (ans) {
    cout << "yes" << endl;
  } else {
    cout << "no" << endl;
  }
  return 0;
}


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

int main() {
  int H, W;
  cin >> H >> W;

  vector<vector<char>> table(H, vector<char>(W));
  vector<bool> row(H);
  vector<bool> col(W);

  for (size_t i = 0; i < H; i++) {
    string tmp;
    cin >> tmp;

    for (size_t j = 0; j < W; j++) {
      table.at(i).at(j) = tmp.at(j);
    }
  }

  for (size_t i_h = 0; i_h < H; i_h++) {
    for (size_t i_w = 0; i_w < W; i_w++) {
      if (table.at(i_h).at(i_w) == '#') {
        row.at(i_h) = true;
        col.at(i_w) = true;
      }
    }
  }

  
  for (size_t i_h = 0; i_h < H; i_h++) {
    int count = 0;
    for (size_t i_w = 0; i_w < W; i_w++) {
      if (row.at(i_h) && col.at(i_w)) {
        cout << table.at(i_h).at(i_w);
        count++;
      }
    }
    if (count > 0) cout << endl;
    count = 0;
  }
}


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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  for (int i = 0; i < n; i++)
    cin >> s[i];

  int preB = 0, sufA = 0, bothAB = 0, other = 0;

  int cnt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < s[i].size(); j++) {
      if (j != 0 && s[i][j] == 'B') {
        if (s[i][j - 1] == 'A') cnt++;
      }
    }
    if (s[i][0] == 'B' && s[i][s[i].size() - 1] == 'A') {
      bothAB++;
    } else if (s[i][0] == 'B') {
      preB++;
    } else if (s[i][s[i].size() - 1] == 'A') {
      sufA++;
    }
  }
  bool ab = false;
  if (bothAB > 0) ab = true;

  bool minus = false;
  if (bothAB > 0 && sufA > 0) {
    sufA--;
    bothAB--;
    cnt++;
    minus = true;
  }

  while (bothAB > 0) {
    if (!minus) {
      bothAB--;
      minus = true;
      continue;
    }
    cnt++;
    bothAB--;
  }

  if (ab && preB > 0) {
    preB--;
    cnt++;
  }
  while (preB > 0 && sufA > 0) {
    cnt++;
    preB--;
    sufA--;
  }

  cout << cnt << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define INF 100000000
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)


int calc(int x){
    int a=0;
    while(x>0){
        a=a+x%10;
        x=x/10;
    }
    return a;
}


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, a, b, ans=0;
    cin >> n >> a >> b;
    rep(i, n+1){
        int ret = calc(i);
        if ((a <= ret) && (ret <= b)) ans += i;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS                      \
    ios_base::sync_with_stdio(0);\
    cin.tie(0);                  \
    cout.tie(0);
#define eps 1e-6
#define ll long long
//#define int long long
#define INF 0x3f3f3f3f
#define MEM(x,y) memset(x,y,sizeof(x))
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
const int mod=1000000007;
using namespace std;
int cmp(int a,int b)
{
    return a>b;
}
//typedef pair<int ,int> P;
int main()
{
    int n,m;
    cin>>n>>m;
    int a[n],sum=0;
    rep(i,0,n)
    {
        cin>>a[i];
        sum+=a[i];
    }
    sort(a,a+n,cmp);
    if(a[m-1]*1.0>=sum*1.0/(4*m))
    cout<<"Yes";
    else
    cout<<"No";
}


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

int main() {
  string a, b,c;
  cin >> a >> b >> c;
 
  if ((a[a.size() - 1] == b[0]) && (b[b.size() - 1] == c[0])) {
  	cout << "YES" << endl;
  }
      else{
      	cout << "NO" << endl;
      }
}



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

const double PI = 3.14159265358979323846;
//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 1e15;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;

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

    ll ma = 1;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) ma = i;
    }
    ll l = log10(max(ma, n / ma)) + 1;
    cout << l << endl;

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
/******************************************
* AUTHOR : PANDRAVISAM SHIVA SANTHOSH *
* Handle : santhosh_80 *
* INSTITUTION : IIT Palakkad *
******************************************/
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
#define ll long long int 
#define mod 1000000007
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define S(x) scanf("%d",&(x))
#define P(x) printf("%d\n",(x))
#define Sl(x) scanf("%lld",&(x))
#define Pl(x) printf("%lld\n",(x))
#define pb push_back
#define f first
#define s second


int main() {
	ll n, k ;cin >> k >> n ;
	vector<ll> vi ;
	for(int i = 0 ; i < n ; i++){
		ll x ; cin >> x ;
		vi.pb(x) ;
	}
	ll min_dist = INT_MAX ;
	for(int i = 0; i < n ; i++){

		if( i == 0) {

			min_dist = min (min_dist , vi[n-1] - vi[0]) ;
			continue ;

		}

		min_dist = min (min_dist , k - vi[i] + vi[(n+i-1)%n]) ;

	}

	cout << min_dist ;

	return 0 ;
}

Measured memory_bytes: 2420
using System;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = int.Parse(Console.ReadLine());
            var b = int.Parse(Console.ReadLine());
            var c = int.Parse(Console.ReadLine());
            var d = int.Parse(Console.ReadLine());

            Console.WriteLine(Math.Min(a,b) + Math.Min(c,d));
        }
    }
}


Measured memory_bytes: 13140
from collections import deque

def solve():
    N = int(input())
    A = map(int, input().split())
    b = deque()
    for i,a in enumerate(A):
        if i%2 == 0:
            b.append(a)
        else:
            b.appendleft(a)
    
    if N % 2 == 1:
        b = list(reversed(b))

    print(' '.join(map(str, b)))
    
solve()

Measured memory_bytes: 28996
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include<cstdint>
#include<unordered_map>
//#include<boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < ( int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second


//namespace mp = boost::multiprecision;

//using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;


int main() {
	ll n; cin >> n;
	vector<ll>people(5);
	rep(i, 5) {
		cin >> people[i];
	}
	vector<ll>city(6);
	city[0] = n;
	ll count = 0;
	ll Min = *min_element(all(people));
	count += 5;
	n -= Min;
	if (n < 0) {

	}else if (n%Min == 0) {
		count += n / Min;
	}
	else {
		count += n / Min + 1;
	}
	cout << count << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

#include <vector>
#include <queue>

using namespace std;

int N, K;
vector<tuple<int, int, int>> info;

double nth_distance(double x, double y)
{
	vector<double> dist(N);
	for (int i = 0; i < N; i++)
	{
		dist[i] = get<2>(info[i]) * hypot(x - get<0>(info[i]), y - get<1>(info[i]));
	}

	nth_element(dist.begin(), dist.begin() + K - 1, dist.end());
	return dist[K - 1];
}

double nth_distance_lb(double x, double y, double r)
{
	vector<double> dist(N);
	for (int i = 0; i < N; i++)
	{
		dist[i] = get<2>(info[i]) * hypot(max(abs(x - get<0>(info[i])) - r, 0.0), max(abs(y - get<1>(info[i])) - r, 0.0));
	}

	nth_element(dist.begin(), dist.begin() + K - 1, dist.end());
	return dist[K - 1];
}

const double eps = 1e-6;

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

	cin >> N >> K;

	for (int i = 0; i < N; i++)
	{
		int x, y, c;
		cin >> x >> y >> c;

		info.emplace_back(x, y, c);
	}

	double result = 1e9;

	queue<tuple<double, double, double>> q;
	q.emplace(0, 0, 1000);
	while (!q.empty())
	{
		double x, y, r;
		tie(x, y, r) = q.front();
		q.pop();

		double lb = nth_distance_lb(x, y, r);
		if (result - lb > eps * max(1.0, lb))
		{
			result = min(result, nth_distance(x, y));

			for (double dx : {-0.5, 0.5})
			{
				for (double dy : {-0.5, 0.5})
				{
					q.emplace(x + dx * r, y + dy * r, r / 2.0);
				}
			}
		}
	}

	cout.setf(ios::fixed);
	cout.precision(15);
	cout << result;

	return 0;
}


Measured memory_bytes: 384
use std::io;
use std::str::FromStr;

fn input_tuple() -> (i64, i64, i64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<i64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1], vec[2])
}

fn input_vec() -> Vec<i64> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn main() {
    let (n, m, c) = input_tuple();
    let b_vec = input_vec();
    let mut count = 0;
    for _ in 0..n {
        let a_vec = input_vec();
        let mut sum = c;
        for i in 0..m as usize {
            sum += a_vec[i] * b_vec[i];
        }
        if sum > 0 {
            count += 1;
        }
    }
    println!("{}", count);
}


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

namespace ConsoleApp15
{
    class Class390
    {
        static void Main()
        {
            var XA = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (XA[0] < XA[1]) Console.WriteLine(0);
            else Console.WriteLine(10);
        }
    }
}


Measured memory_bytes: 13268
S = input()

dp = [(-1,-1,-1,-1)] * (len(S) + 1)
dp[0] = (1,0,0,0)
for i in range(len(S)):
    w, x, y, z = dp[i]
    if S[i] == "A":
        x += w
    elif S[i] == "B":
        y += x
    elif S[i] == "C":
        z += y
    else:
        z = 3 * z + y
        y = 3 * y + x
        x = 3 * x + w
        w = 3 * w
    w = w % 1000000007
    x = x % 1000000007
    y = y % 1000000007
    z = z % 1000000007
    dp[i + 1] = (w, x, y, z)

res = dp[len(S)][3]
print(res)


Measured memory_bytes: 54876
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
//long long num[100000];
long long kai(long long n){
	if(n==0) return 1;
	long long ans;
	ans=n*kai(n-1)%1000000007;
	return ans;
}
int main(){
	int n,m;
	cin>>n>>m;
	if(abs(n-m)>1) {
		cout<<0<<endl;
		return 0;
	}
	long long ans;
	if(n==m)cout<<kai(n)*kai(m)*2%1000000007<<endl;
  else cout<<kai(n)*kai(m)%1000000007<<endl;
	return 0;
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, K;
  cin >> N >> K;
  map<ll, ll> Kd;
  map<ll, ll> A;
  rep(i, N){
    ll a;
    cin >> a;
    rep(j, 61){
      A[j]+=(a>>j&1?1LL:0LL);
    }
  }
  
  rep(j, 61){
    Kd[j]=(K>>j&1LL? 1LL : 0LL);
  }
  
  ll ans = -1;
  for(ll i=-1;i<=60;i++){
    if(i>=0LL and Kd[i]==0LL)continue;
    ll cand=0;
    for(ll j=60;j>=0;j--){
      ll mask = 1LL<<j;
      if(j>i){
        ll tmp = (Kd[j]==1LL? N-A[j] : A[j]);
        cand += mask * tmp;
      }else if(j==i){
        cand += mask * A[j];
      }else{
        cand += mask * max(N-A[j], A[j]);          
      }
    }
    ans=max(ans, cand);
  }
  
  
  cout << ans;
  return 0;
}


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

int main() {
  int N,D,X; 
  cin>>N>>D>>X;
  vector<int> A(N);
  rep(i,N) cin>>A[i];
  
  int ans=X;
  
  if(D==1){
    cout<<N+X<<endl;
    return 0;
  }
  else {
  rep(i,N){
    ans += (D-1)/A[i]+1;
    
  }
  cout<<ans<<endl;
  return 0;
  }
}

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

using ll = long long;
using p = pair<ll, ll>;
constexpr ll INF = 1LL << 62;

ll S(ll n) {
  if (n == 0) {
    return 0;
  }
  return n % 10 + S(n / 10);
}

int main(void) {
  ll K;
  cin >> K;
  ll a = 1;
  ll b = 1;
  for (ll k = 0; k < K; k++) {
    ll n = a * b + (a - 1);
    ll m = a * (b + 1) + (a - 1);
    if (float(n) / S(n) > float(m) / S(m)) {
      a *= 10;
      b /= 10;
    }

    cout << a * b + (a - 1) << endl;
    b++;
  }

  return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;

namespace Contest
{
    class Program
    {
        public void Solve()
        {
            var sc = new Scanner();
            int A = sc.NextInt();
            int P = sc.NextInt();

            P += A * 3;
            Console.WriteLine(P / 2);
        }
        static void Main() => new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _stream = new StreamReader(Console.OpenStandardInput());
        _pos = 0;
        _line = new string[0];
        _separator = ' ';
    }
    private char _separator;
    private StreamReader _stream;
    private int _pos;
    private string[] _line;
    #region get a element
    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = _stream.ReadLine().Split(_separator);
            _pos = 0;
        }
        return _line[_pos++];
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    #endregion
    #region convert array
    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }
    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }
    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }
    #endregion
    #region get array
    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = _stream.ReadLine().Split(_separator);
        _pos = _line.Length;
        return _line;
    }
    public int[] IntArray()
    {
        return ToIntArray(Array());
    }
    public long[] LongArray()
    {
        return ToLongArray(Array());
    }
    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }
    #endregion
}

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

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

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

fn main() {
    let n: usize = read();
    let mut s: Vec<char> = read::<String>().chars().collect();

    let mut last_w: i64 = -1;
    let mut last_r: i64 = -1;

    for i in 0..n {
        if s[i] == 'R' {
            last_r = i as i64;
        }
    }

    for i in (0..n).rev() {
        if s[i] == 'W' {
            last_w = i as i64
        }
    }

    if last_w == -1 || last_r == -1 {
        println!("0");
        return;
    }

    let mut head_w = s.len();
    let mut ans = 0;
    for i in 0..last_r as usize {
        if s[i] == 'W' {
            let mut found = false;
            for j in (i..head_w).rev() {
                if s[j] == 'R' {
                    s[j] = 'W';
                    s[i] = 'R';
                    ans += 1;
                    found = true;
                    head_w = j;
                    break;
                }
            }
            // println!("{:?}", s);
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
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; }

vector<ll> divisor(ll n){
	vector<ll> res;
	for(int i = 1; i * i <= n; i++) {
		if (n % i == 0){
			res.pb(i);
			if(i != n / i){
				res.pb(n / i);
			}
		}
	}
	return res;
}

int main(){
	ll A;cin>>A;
	vector<ll> p = divisor(A);
	// for(int i = 0; i < p.size(); i++) {
	// 	cout << p[i] << endl;
	// }
	for(int i = 0; i < p.size(); i++) {
		// cout << p[i] << endl;
		ll q = p[i];
		ll t = A / q;
		for(ll y = -10000; y < 10000; y++) {
			ll x = q + y;
			if (pow(x,4) + pow(x,3) * y + x * x * y * y + x * pow(y ,3) + pow(y,4) == t){
				cout << x<< " " << y << endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 4176
#include <iostream>
#include <cstring>
using namespace std;
int main(){
  int N;
  cin>>N;
  for(int i=1;i<=9;i++){
    if(N%i==0&&N/i<=9){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}

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

int main(){
	int n,a,b,base,top[101],cal[101];
	std::cin>>n>>a>>b>>base;
	for(int i=0;i<n;i++)std::cin>>top[i];
	std::sort(top+0,top+n);std::reverse(top+0,top+n);
	for(int i=0;i<=n;i++){
		int all_cal=base;
		for(int j=0;j<i;j++)all_cal+=top[j];
		cal[i]=all_cal/(a+i*b);
	}
	std::sort(cal+0,cal+n+1);std::reverse(cal+0,cal+n+1);
	std::cout<<cal[0]<<std::endl;
	return 0;
}

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

using namespace std;

#define int long long

signed main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  for(int i=0;i<n;i++){
    if(i == 0) ans++;
    else{
      if(s[i] != s[i-1]) ans ++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
///
// File:  a.go
// Author: ymiyamoto
//
// Created on Sat Feb 24 21:00:50 2018
//
package main

import (
	"fmt"
)

func max(N string) bool {
	for i := 1; i < len(N); i++ {
		if N[i] != '9' {
			return false
		}
	}
	return true
}

func main() {
	var N string
	fmt.Scan(&N)

	count := 0
	if max(N) {
		for i := range N {
			count += int(N[i] - '0')
		}
		fmt.Println(count)
		return
	}

	if N[0] != '9' {
		count += int(N[0]-'1') + (len(N)-1)*9
		fmt.Println(count)
		return
	}

	prefix := true
	for i := range N {
		if N[i] == '9' {
			count += 9
		} else if prefix {
			count += 8
			prefix = false
		} else {
			count += 9
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
import java.io.*;

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        String s[]=bu.readLine().split(" ");
        int a=Integer.parseInt(s[0]),b=Integer.parseInt(s[1]),c=Integer.parseInt(s[2]),d=Integer.parseInt(s[3]);
        int t=0;
        while(a>0 && c>0)
        {
            if(t==1) {a-=d; t=0;}
            else {t=1; c-=b;}
        }
        if(a>0) System.out.print("Yes");
        else System.out.print("No");
    }
}


Measured memory_bytes: 32512
N = int(input())
A = list(map(int, input().split()))
A.sort()
# print(A)
i = 0
while i < len(A) - 1:
    a, b = A[i], A[i + 1]
    A[i] = b % a
    A[i + 1] = a
    if A[i] == 0:
        i += 1
print(A[i])

Measured memory_bytes: 15020
import scala.io.StdIn.readInt

object Main {
  def fib(a:Int, b: => Int, c:Int, n:Int):Int = {
    if (n ==  0)
      a
    else
      fib(a+b, a, b, n-1)
  }

  def main(args: Array[String]) = {
    val n = readInt()
    println(fib(1, 0, 0, n))
  }
}

Measured memory_bytes: 43684
x,y = map(int,input().split())
m = 10**9+7
if not((x+y)%3== 0 and abs(x-y)<=(x+y)//3):
    print(0);exit()

def comb(n,k):
    #if 2 * k > n:
        #k = n - k
    a = 1
    for i in range(1,k+1):
        a *= (n - ( i - 1)) * pow(i,m-2,m)
        a = a%m
    return a

n = (x+y)//3
k = x-n
print(comb(n,k))


Measured memory_bytes: 3188
#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>
#include<time.h>
#include<stdlib.h>
#define pb push_back
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ull unsigned long long
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define clr(x) x.clear()
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vi>
#define mp make_pair
#define hell 1000000007
//#include<conio.h>

using namespace std;

multiset<long long> lower,upper;
multiset<long long>::iterator itr;

long long suml=0,sumu=0;

void adjust()
{
    long long ls=lower.size(),us=upper.size();
    if(ls-us==2)
    {
        itr=lower.end();
        itr--;
        sumu=sumu+*itr;
        suml=suml-*itr;
        upper.insert(*itr);
        lower.erase(itr);
    }
    else if(us>ls)
    {
        itr=upper.begin();
        sumu=sumu-*itr;
        suml=suml+*itr;
        lower.insert(*itr);
        upper.erase(itr);
    }
}

int main()
{
    IOS
   	int q;
   	cin>>q;
   	long long sum=0;
   	while(q--)
    {
        int t,a,b;
        cin>>t;
        if(t==1){
            cin>>a>>b;
            if((int)lower.size()==0){
                lower.insert(a);
                suml=suml+a;}
            else{
            itr=lower.end();
            itr--;
            if(a<*itr){
                lower.insert(a);
                suml=suml+a;}
            else{
                upper.insert(a);
                sumu=sumu+a;}
            }
            adjust();
            sum=sum+b;
        }
        if(t==2)
        {
            long long print=0,res;
            itr=lower.end();
            itr--;
            if((int)lower.size()-(int)upper.size())
                print=sumu-suml+*itr;
            else
                print=sumu-suml;
            res=print + sum;
            cout<<*itr<<" "<<res<<"\n";
        }
    }
	return 0;
}


Measured memory_bytes: 9600
n = int(input())
answers = []
for i in range(0, n):
    tmp = int(input())
    answers.append([])
    for j in range(0, tmp):
        line = input().split(" ")
        answers[i].append([int(line[0])-1, int(line[1])])

result = 0
for p in range(0, 2**n):
    flag = False
    for i in range(0, len(answers)):
        for a in answers[i]:
            if (p >> a[0]) & 1 != a[1] and (p >> i) & 1 == 1:
                flag = True
                break
        if flag:
            break
    if not flag:
        tmp_result = bin(p).count('1')
        if result < tmp_result:
            result = tmp_result
print(result)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define fastio 	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long int
using namespace std;
int mod = 1e9 + 7;

int mat[3001][3001];
// int track[3001];
int dp[3001][3001][5];
int n, m, k;

int find(int i, int j, int track) {
	if (i >= n || j >= m)
		return INT_MIN;
	if (i == n - 1 && j == m - 1)
		return (track < 3 ? mat[i][j] : 0);
	if (dp[i][j][track] != -1)
		return dp[i][j][track];
	int res = INT_MIN;
	if (mat[i][j] && track < 3) {
		res = max(res, mat[i][j] + max(find(i + 1, j, (int)0), find(i, j + 1, track + 1)));
	}
	res = max(res, max(find(i + 1, j, (int)0), find(i, j + 1, track)));
	return dp[i][j][track] = res;
}

int32_t main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio;

	cin >> n >> m >> k;
	int r, c, val;
	for (int i = 0; i < k; i++) {
		cin >> r >> c >> val;
		mat[r - 1][c - 1] = val;
	}
	memset(dp, -1, sizeof dp);
	cout << find((int)0, (int)0, (int)0);
	return 0;
}

Measured memory_bytes: 426000