akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
#define mp make_pair
#define f(i,x,n) for(ll i=x;i<n;i++)
#define fl(i,x,n) for(ll i=n;i>=x;i--)
#define mod (ll)1e9+7
#define print(x) cout<<x<<endl
#define vec vector<ll>
#define pai pair<ll, ll>
#define itr(it) :: iterator it
#define MAX (ll)1e16
#define MIN (ll)-1e16
#define X first
#define Y second
#define up upper_bound
#define lo lower_bound
using namespace std;
       ///////////   ///     ///   ///      ///   ////////////  ///      ///
       ///           ///     ///   ///      ///   ///      ///  ///      ///
       ///           ///     ///   ///      ///   ///      ///  ///      ///
       ///////////   ///////////   ///      ///   ////////////  ////////////
               ///   ///     ///   ///      ///   ///      ///  ///      ///
               ///   ///     ///   ///      ///   ///      ///  ///      ///
       ///////////   ///     ///   ////////////   ////////////  ///      ///
ll minn( ll a , ll b) 
{
    if(a>b)
        return b;
    return a;
}
ll maxx2( ll a , ll b)
{
    if(a>b)
        return a;
    return b;
}
ll maxx(ll a,ll b,ll c)
{
  return maxx2(a,maxx2(b,c));
}
ll gcdd(ll a, ll b)
{
    if(b==0)
        return a;
    else
        return gcdd(b,a%b);
}
ll dsum(ll n)
{
    ll sum=0;
    while(n>0)
    {
        sum+=n%10;
        n/=10;
    }
    return sum;
}
ll poww(ll a,ll b)
{
    if(b<=0)
        return 1;
    if(b==1)
        return a;
    if(b==2)
        return (a*a);
    else
        return poww(poww(a,b/2),2)*(poww(a,b%2));
}
ll sumsq(ll x,ll y,ll z)
{
    return (x-y)*(x-y)+(y-z)*(y-z)+(z-x)*(z-x);
} 
signed main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    IOS;
    ll x,y;
    cin>>x>>y;
    f(i,0,x+1)
    {
        if((i*2+(x-i)*4)==y)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3644
h, w, a, b = map(int, input().split())
d = [[0]*w for _ in range(h)]
for i in range(b):
    for j in range(a, w):
        d[i][j] = 1
for i in range(a):
    for j in range(b, h):
        d[j][i] = 1
for i in d: print(*i, sep="")

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

namespace TorT
{
    class Program
    {
        static void Main(string[] args)
        {
            var list = (from m in (Console.ReadLine()).Split(' ')
                       select int.Parse(m)).ToList();

            int N = list[0];
            int A = list[1];
            int B = list[2];

            Console.WriteLine((N * A) > B ? B : N * A);
        }
    }
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using graph=vector<vector<int>>;

class mint{
	static const int MOD=1e9+7;
	int x;
public:
	mint():x(0){}
	mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }

	mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
	mint& operator-=(const mint& m){ x-=m.x; if(x<   0) x+=MOD; return *this; }
	mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; }
	mint& operator/=(const mint& m){ return *this*=inverse(m); }
	mint operator+(const mint& m)const{ return mint(*this)+=m; }
	mint operator-(const mint& m)const{ return mint(*this)-=m; }
	mint operator*(const mint& m)const{ return mint(*this)*=m; }
	mint operator/(const mint& m)const{ return mint(*this)/=m; }

	friend mint inverse(const mint& m){
		int a=m.x,b=MOD,u=1,v=0;
		while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); }
		return u;
	}

	friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=mint(t); return is; }
	friend ostream& operator<<(ostream& os,const mint& m){ return os<<m.x; }
	int to_int()const{ return x; }
};

graph T;
bool vis[100000][2];
mint memo[100000][2];

mint dfs(int u,int p,bool black){
	if(vis[u][black]) return memo[u][black];
	vis[u][black]=true;

	if(black){
		mint res=1;
		for(int v:T[u]) if(v!=p) res*=dfs(v,u,false);
		return memo[u][black]=res;
	}
	else{
		mint res1=1,res2=1;
		for(int v:T[u]) if(v!=p) {
			res1*=dfs(v,u,true);
			res2*=dfs(v,u,false);
		}
		return memo[u][black]=res1+res2;
	}
}

int main(){
	int n; scanf("%d",&n);
	T.resize(n);
	rep(i,n-1){
		int u,v; scanf("%d%d",&u,&v); u--; v--;
		T[u].emplace_back(v);
		T[v].emplace_back(u);
	}

	cout<<dfs(0,-1,false)<<'\n';

	return 0;
}


Measured memory_bytes: 14976
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

const int mod = 1000000007;
int add(int a, int b) { return (a += b) < mod? a : a - mod; }
int sub(int a, int b) { return (a -= b) >=  0? a : a + mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
void adds(int& a, int b) { a = add(a, b); }
void subs(int& a, int b) { a = sub(a, b); }
void muls(int& a, int b) { a = mul(a, b); }
void maxs(int& a, int b) { a = max(a, b); }
void mins(int& a, int b) { a = min(a, b); }
int pwr(int a, ll p) {
    if (p == 0) return 1;
    if (p & 1) return mul(a, pwr(a, p - 1));
    return pwr(mul(a, a), p / 2);
}
int inv(int a) { return pwr(a, mod - 2); }
const int maxn = 4000005;
int f[maxn + 1], fi[maxn + 1];
int ncr(int n, int r) { return mul(f[n], mul(fi[r], fi[n - r])); }

void precompute()
{
    f[0] = 1;
    for (int i = 1; i <= maxn; ++i)
        f[i] = mul(f[i - 1], i);

    fi[maxn] = inv(f[maxn]);
    for (int i = maxn - 1; i >= 0; --i)
        fi[i] = mul(fi[i + 1], i + 1);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    precompute();
    int x, y;
    cin >> x >> y;
    if ((2*y-x)%3)
        return cout << 0, 0;
    int b = (2*y-x) / 3;
    int a = y-2*b;
    if (b < 0 || a < 0)
        return cout << 0, 0;
    cout << ncr(a+b,a);
}


Measured memory_bytes: 31488
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

def calc(y,x):
    return y*W+x


def dijkstra(lines,N,s):
    weight = [INF]*N
    weight[s] = 0

    def search(s,w_0,q,weight):
        for t,w in lines[s]:
            w += w_0
            if weight[t] > w:
                heapq.heappush(q,[w,t])
                weight[t] = w

    q = [[0,s]]
    heapq.heapify(q)
    while q:
        w,n = heapq.heappop(q)
        search(n,w,q,weight)

    return weight



while True:
    W,H = inpl()
    if W==0 and H == 0:
        break
    else:
        lines = defaultdict(set)
        for i in range(2*H-1):
            if i%2 == 0:
                h = i//2
                ww = inpl()
                for i,w in enumerate(ww):
                    if w == 0:
                        lines[calc(h,i)].add((calc(h,i+1),1))
                        lines[calc(h,i+1)].add((calc(h,i),1))
            else:
                h = i//2
                ww = inpl()
                for i,w in enumerate(ww):
                    if w == 0:
                        lines[calc(h,i)].add((calc(h+1,i),1))
                        lines[calc(h+1,i)].add((calc(h,i),1))

        weight = dijkstra(lines,H*W,0)
        if weight[-1] == INF:
            print(0)
        else:
            print(weight[-1]+1)



Measured memory_bytes: 7696
void main() {
  problem();
}

void problem() {
  auto N = scan!ulong;

  ulong solve() {
    // Sum_{k=1..n} k/2 * floor(n/k) * floor(1 + n/k)
    ulong ans;
    foreach(k; 1..N+1) {
      ulong x = k * cast(ulong)floor(cast(real)N/k) * cast(ulong)floor(1 + cast(real)N/k);
      ans += x / 2;
    }
    return ans;
  }

  solve().writeln;
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Queue = Tuple!(long, "from", long, "to");

// -----------------------------------------------


Measured memory_bytes: 2740
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
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; }

int n;

int main() {
    cin >> n;
    vector<int> avec(n, 0);
    vector<int> bvec(n, 0);
    for(int i = 0; i < n; ++i) cin >> avec[i];
    for(int i = 0; i < n; ++i) cin >> bvec[i];

    map<int, int> acnt;
    map<int, int> bcnt;
    for(int i = 0; i < n; ++i) {
        acnt[avec[i]]++;
        bcnt[bvec[i]]++;
    }

    for(int i = 0; i < n; ++i) {
        if(n-acnt[avec[i]] < bcnt[avec[i]]) {
            cout << "No" << endl;
            return 0;
        }
    }

    sort(bvec.begin(), bvec.end(), greater<int>());
    for(int i = 0; i < n; ++i) {
        if(avec[i] == bvec[i]) {
            for(int j = 0; j < i; ++j) {
                if(avec[i] != bvec[j] && avec[j] != bvec[i]) {
                    swap(bvec[i], bvec[j]);
                    break;
                }
            }
        }
    }

    bool flg = true;
    for(int i = 0; i < n; ++i) {
        if(avec[i] == bvec[i]) {
            for(int j = 0; j < n; ++j) {
                if(i == j) continue;
                if(avec[i] != bvec[j] && avec[j] != bvec[i]) {
                    swap(bvec[i], bvec[j]);
                    break;
                }
            }
        }
    }

    for(int i = 0; i < n; ++i) {
        if(avec[i] == bvec[i]) flg = false;
    }

    if(flg) {
        cout << "Yes" << endl;
        for(int i = 0; i < n; ++i) {
            if(i == n-1) cout << bvec[i] << endl;
            else cout << bvec[i] << " ";
        }
    }else cout << "No" << endl;
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

struct Segtree{
	typedef int sgT;
	vector<sgT> seg;
	int nbn; sgT INF;
	void init(int n){
		for(nbn=1; nbn<n+2; nbn<<=1); INF=0; // min:+inf,max:-inf,0 
		seg.assign(nbn*2, INF);
	}
	sgT comp(sgT l, sgT r){return (l | r);}  //or
	void update(int k,sgT x){
		k+=nbn-1; seg[k]=x;
		while(k>0){ k=(k-1)/2; seg[k]=comp(seg[k*2+1],seg[k*2+2]); }
	}
	sgT query2(int a,int b,int l,int r,int k){
		if(b<=l||r<=a) return INF;
		if(a<=l&&r<=b) return seg[k];
		return comp(query2(a,b,l,(l+r)/2,k*2+1), query2(a,b,(l+r)/2,r,k*2+2));
	}
	sgT query(int a,int b){ return query2(a,b,0,nbn,0); }

};
int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, q; string s;
	cin >>n >>s >>q;
	
	Segtree sg; sg.init(n);
	rep(i, n) sg.update(i, 1<<(s[i]-'a'));
	
	rep(g, q){
		int ck, ps, l, r; char z;
		cin >>ck;
		if(ck==1){
			cin >>ps >>z;
			if(s[ps-1]==z) continue;
			sg.update(ps-1, 1<<(z-'a'));
			s[ps-1] =z;
		}else{
			cin >>l >>r;
			int ans = __builtin_popcount(sg.query(l-1, r));
			cout <<ans <<"\n";
		}
	}
	
	return 0;
}


Measured memory_bytes: 5020
n=int(input())
import math
import itertools
#total=0
x=[]
y=[]
total=0
num=math.factorial(n)
for i in range(n):
    X,Y=map(int,input().split())
    x.append(X)
    y.append(Y)
num_lis=[]
for i in range(n):
    num_lis.append(i)
P=itertools.permutations(num_lis,n)
for p in P:
    for i in range(n-1):
        tmp=math.sqrt((x[p[i+1]]-x[p[i]])**2+(y[p[i+1]]-y[p[i]])**2)
        total+=tmp
print(total/num)



Measured memory_bytes: 3064
using System;

class Program {
    public static void Main() {
        int[] s = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        Array.Sort(s);
        if (s[0] == 1 && s[1] == 4 && s[2] == 7 && s[3] == 9) {
            Console.WriteLine("YES");
        } else {
            Console.WriteLine("NO");
        }
    }
}

Measured memory_bytes: 11220
#include <iostream>
#include <utility>
#include <vector>
#include <climits>
#include <algorithm>
using namespace std;

struct iostream_init_struct
{ 
	iostream_init_struct()
	{
		std::cin.tie(0);
		std::cin.sync_with_stdio(false);
	}
} iostream_init;

int main(void)
{
	int N;
	vector<pair<int, int>> list;

	cin >> N;
	list.reserve(N);
	for (int i = 0; i < N; ++i)
	{
		int x, y;
		cin >> x >> y;
		if (x < y)
		{
			list.emplace_back(x, y);
		}
		else
		{
			list.emplace_back(y, x);
		}
	}

	// case R_max = max, B_min = min:
	//      R <- bigger, B <- smaller
	int R_max = INT_MIN;
	int R_min = INT_MAX;
	int B_max = INT_MIN;
	int B_min = INT_MAX;
	for (int i = 0; i < N; ++i)
	{
		int bigger = list[i].second;
		int smaller = list[i].first;
		R_max = max(R_max, bigger);
		R_min = min(R_min, bigger);
		B_max = max(B_max, smaller);
		B_min = min(B_min, smaller);
	}

	long long result = (long long)(R_max - R_min) * (long long)(B_max - B_min);

	int max_of_all = R_max;
	int min_of_all = B_min;

	// case B_max = max, B_min = min:
	//      minimize R_max - R_min
	sort(begin(list), end(list));
	R_max = list[list.size() - 1].first;
	R_min = INT_MAX;
	int R_range = R_max - list[0].first;
	for (int i = 0; i < N - 1; ++i)
	{
		R_max = max(R_max, list[i].second);
		R_min = min(R_min, list[i].second);
		if (R_min <= list[i + 1].first)
		{
			R_range = min(R_range, R_max - R_min);
			break;
		}
		else
		{
			R_range = min(R_range, R_max - list[i + 1].first);
		}
		
	}

	result = min(result, (long long)(R_range) * (long long)(max_of_all - min_of_all));

	cout << result << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  double ans = 0.0;
  for (int i = 0; i < N; i++) {
    double a;
    cin >> a;
    ans += 1 / a;
  }
  cout << setprecision(17) << 1 / ans << endl;
}

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

using namespace std;

#define int long long
#define reg register
#define debug(x) cerr<<#x<<" = "<<x<<endl;
#define rep(a,b,c) for(reg int a=(b),a##_end_=(c); a<=a##_end_; ++a)
#define ret(a,b,c) for(reg int a=(b),a##_end_=(c); a<a##_end_; ++a)
#define drep(a,b,c) for(reg int a=(b),a##_end_=(c); a>=a##_end_; --a)

inline int Read() {
	int res=0,f=1;
	char c;
	while(c=getchar(),c<48||c>57)if(c=='-')f=0;
	do res=(res<<3)+(res<<1)+(c^48);
	while(c=getchar(),c>=48&&c<=57);
	return f?res:-res;
}

template<class T>inline bool Min(T &a,T const&b) {
	return a>b?a=b,1:0;
}
template<class T>inline bool Max(T &a,T const&b) {
	return a<b?a=b,1:0;
}

const int N=1e5+5,mod=1e9+7;

int n,k,w;

vector<int>edge[N];

void dfs(int x,int pre,int tot){
	int cnt=0;
	ret(i,0,edge[x].size()){
		int y=edge[x][i];
		if(y==pre)continue;
		w=(w*(k-tot-cnt))%mod;
		cnt++;
		dfs(y,x,tot==2?2:tot+1);
	}
}

signed main() {
	n=Read(),k=Read();
	ret(i,1,n){
		int u=Read(),v=Read();
		edge[u].push_back(v);
		edge[v].push_back(u);
	}
	w=k;
	dfs(1,0,1);
	printf("%lld",w);
	return 0;
}

Measured memory_bytes: 11520
import sys
input = sys.stdin.readline
mod = 10**9 + 7
n,k = map(int,input().split())
x = [list(map(int,input().split())) for i in range(n)]
ans = [[0]*i +[1]+[0]*(n-i-1) for i in range(n)]

def dot(A,B):
    res = [[0]*n for _ in range(n)]
    for i in range(n):
        for j in range(n):
            for k in range(n):
                res[i][j] += A[i][k]*B[k][j]
                res[i][j] %= mod
    return res

while k > 0:
    if k&1:
        ans = dot(ans, x)
    k = k >> 1
    x = dot(x,x)
res = 0
for i in range(n):
    for j in range(n):
        res += ans[i][j]
        res %= mod
print(res)


Measured memory_bytes: 42860
export default solve;

// =================================================
// ABC110A
// =================================================

// main
function main(lines) {
  console.log(solve(lines));
}

// solver
function solve(lines: string[]): string {
  const { nums } = parseLines(lines);

  return nums.map(n => (n === 1 ? 9 : 1)).join('');
}

// helpers
function parseLines(lines: string[]) {
  const nums = lines[0].split('').map(s => +s);
  const obj = { nums };
  debug(obj);
  return obj;
}

// general helpers
function debug(message?: any, ...optionalParams: any[]) {
  if (!!process.env.LOCAL_DEBUG) console.log(message, ...optionalParams);
}

// reader
if (!process.env.LOCAL_DEBUG) {
  const { stdin: input, stdout: output } = process;
  input.resume().setEncoding('utf8');
  const lines = [];
  require('readline')
    .createInterface({ input, output })
    .on('line', line => lines.push(line))
    .on('close', () => main(lines));
}


Measured memory_bytes: 11596
#include <stdio.h>
#define N 10000
#define Q 500
#define notFound 0

int linearSearch(int[], int, int);

int main()
{
  int i,n,q,key,cnt=0;
  int S[N];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);

    if(linearSearch(S,key,n)){
      cnt++;
    }
  }
  printf("%d\n",cnt);


  return 0;
}


int linearSearch(int A[],int key,int n)
{
  int i=0;
  for(i=0;i<n;i++){
    if(A[i]==key){
      return 1;
    }
  }
    return notFound;
}

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

int main() {
    string s;
    cin >> s;
    rep(i, s.size()) { cout << 'x'; }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;

const int N=2e6+1;
const long long M = 1000000007;

// a>=0, b>=0, x*a+y*b=gcd>=0, a>0,b>0=>abs(y)<=a,abs(x)<=b
LL gcdex(LL a,LL b,LL& x, LL& y){
	LL ax=1,ay=0;
	LL bx=0,by=1;
	while(b){
		LL r=a/b;
		LL t=a-r*b; a=b; b=t;
		LL tx=ax-r*bx; ax=bx; bx=tx;
		LL ty=ay-r*by; ay=by; by=ty;
	}
	x=ax;
	y=ay;
	return a;
}
LL modinv(LL a, LL mod){
	LL x,y;
	gcdex(a,mod,x,y);
	if(x<0){
		x+=mod;
	}
	return x;
}

template<int S>
struct Comb
{
	LL f[S+1];
	LL r[S+1];
	LL mod;
	Comb(int m)
	{
		mod=m;
		f[0]=1;
		r[0]=1;
		for(LL i=1;i<=S;i++){
			f[i]=i*f[i-1]%m;
			r[i]=modinv(i,m)*r[i-1]%m;
		}
	}
	LL c(int n,int i){
		if(i<0&&n<i)
		{
			assert(0);
			return 0;
		}
		return f[n]*r[i]%mod*r[n-i]%mod;
	}
};
Comb<N> comb(M);
LL C(int n,int i){
	return comb.c(n,i);
}

LL f(LL a, LL b)
{
	LL ret=0;
	for(int i=b+1;i<=a+b+1;i++){
		ret+=C(i,b);
		ret%=M;
		//cerr << i << ", " << b << ", " << C(i,b) << endl;
	}
	//cerr << a << ", " << b << ": " << ret << endl;
	return ret%M;
}
void solve(std::vector<long long> r, std::vector<long long> c){
	cout << (f(r[1],c[1])+M-f(r[0]-1,c[1])+M-f(r[1],c[0]-1)+f(r[0]-1,c[0]-1))%M << endl;

}

int main(){
	//cerr << f(2,2) << endl;
    std::vector<long long> r(2);
    std::vector<long long> c(2);
    for(int i = 0 ; i < 2 ; i++){
        scanf("%lld",&r[i]);
        scanf("%lld",&c[i]);
    }
    solve(std::move(r), std::move(c));
    return 0;
}


Measured memory_bytes: 31488
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <cmath>
using namespace std;
int n;

list<int> ans;

bool is_prime(int n)
{
    int m=sqrt(n);
    for(int i=2;i<=m;i++)
    {
        if(n%i==0) return false;
    }
    return true;
}
void prime_factorize(int n)
{
    int tmp=n;
    if(is_prime(n))
    {
        printf("%d: %d\n",tmp,n);
        return;
    }
    while(n%2==0)
    {
        ans.push_back(2);
        n/=2;
        if(n&1) break;
    }
    for(int i=3;i<=n;i+=2)
    {
        while(n%i==0)
        {
            ans.push_back(i);
            n/=i;
        }
        if(n==1) break;
    }
    printf("%d:",tmp);
    for(list<int>::iterator iter=ans.begin();iter!=ans.end();iter++)
    {
        printf(" %d",*iter);
    }
    printf("\n");
}

int main()
{
//    freopen("in.txt","r",stdin);
    scanf("%d",&n);
    prime_factorize(n);
    return 0;

}

Measured memory_bytes: 3220
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, K = map(int, input().split())

    num = [0 for _ in range(K)]
    for i in range(1, N + 1):
        num[i % K] += 1

    res = 0
    for a in range(0, K):
        b = (K - a) % K
        c = (K - a) % K
        if (b + c) % K != 0:
            continue
        res += num[a] * num[b] * num[c]

    print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 52460
<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
//list($N,$M,$X) = explode(" ",trim(fgets(STDIN)));
$X  = explode(" ",trim(fgets(STDIN)));
$x = $X;
sort($x);
for($i=0;$i<$N;$i++) {
  if ($X[$i]<=$x[($N/2)-1]) {
   printf("%d\n",$x[($N/2)]);
  }
  else {
   printf("%d\n",$x[($N/2)-1]);
  }
}


Measured memory_bytes: 61140
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int w = sc.nextInt(), h = sc.nextInt(), n = sc.nextInt();
		
		int lx = 0, rx = w;
		int ly = 0, ry = h;
		
		for(int i=0;i<n;i++){
			int x = sc.nextInt(), y = sc.nextInt(), a = sc.nextInt();
			if(a==1)
				lx = Math.max(x, lx);
			else if(a==2)
				rx = Math.min(rx, x);
			else if(a==3)
				ly = Math.max(ly, y);
			else
				ry = Math.min(ry, y);
		}
		
		if(ry<=ly || rx<=lx)
			System.out.println(0);
		else
			System.out.println((rx-lx) * (ry-ly));
	}

}


Measured memory_bytes: 21968
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
//vector<vector<ll>> piyo(tate,vector<ll> (yoko));

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1000000019
#define ll long long
#define ln cout<<endl;
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
int dp[120][20000];
vector<int> w(2000);
vector<int> v(2000);

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    //double mini=INF;
    int maxi=0,f=0,sum=0;
    string str,str1,str2;
    int i;
    double h;
    int n,x,m;
    int a,b,d,c;
    int e,weight;
    cin>>n>>weight;
    w.resize(n+1);
    v.resize(n+1);


    rep(i,n){
        cin>>v[i]>>w[i];
    }
    
    for(ll i=0;i<n;i++){
        for(ll j=0;j<weight+1;j++){
            dp[i][j]=0;
        }
    }
    rep(i,weight+1) {
        if(i>=w[0]) dp[0][i]=v[0];
        else dp[0][i]=0;
            //cout<<dp[0][i]<<" ";
    }
    //cout<<endl;
    REP(i,1,n){
        rep(j,weight+1){
            if(j>=w[i]) dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
            else dp[i][j]=dp[i-1][j];
           // cout<<dp[i][j]<<" ";
        }
      //  cout<<endl;
    }

    cout<<dp[n-1][weight]<<endl;


    return 0;
}



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

int main(void){
	int N;
	cin >> N;
	int d[N];
	rep(i,N) cin >> d[i];
	sort(d,d+N);
	cout << d[N/2] - d[N/2-1] << endl;

	return 0;
}


Measured memory_bytes: 3988
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) return a.second > b.second;
	else return a.first > b.first;
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<long long> a(n);
	for (int i = 0;i < n;i++) {
		cin >> a[i];
	}
	vector<pair<long long, long long>> bc(m);
	for (int i = 0;i < m;i++) {
		cin >> bc[i].first >> bc[i].second;
	}
	sort(bc.begin(), bc.end(), compare_by_second);
	int sum = 0;
	//vector<int> array(1);
	for (int i = 0;i < m;i++) {
		sum += bc[i].first;
		for (int j = 0;j < bc[i].first;j++) {
			a.push_back(bc[i].second);
		}
		if (sum > n) break;
	}
	sort(a.begin(), a.end());
	long long ans = 0;
	for (int i = 0;i < n;i++) {
		ans += a[n + sum - 1-i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6384
using System;

namespace AtC157
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] NM = Console.ReadLine().Split(' ');
            int N = int.Parse(NM[0]);
            int M = int.Parse(NM[1]);
            int[] s = new int[M];
            int[] c = new int[M];

            bool[] a = new bool[N+1];
            int[] b = new int[N+1];
            bool error = false;
            for (int i = 0; i < M; i++)
            {
                string[] sc = Console.ReadLine().Split(' ');
                s[i] = int.Parse(sc[0]);
                c[i] = int.Parse(sc[1]);

                if (a[s[i]])
                {
                    if (b[s[i]] != c[i]) error = true;
                    
                }
                else
                {
                    a[s[i]] = true;
                    b[s[i]] = c[i];
                }
                if (N > 1 && s[i] == 1 && c[i] == 0) error = true;
            }
            if (error)
            {
                Console.WriteLine(-1);
                return;
            }
            int ans = 0;
            if (b[1] == 0 && N > 1) b[1] = 1; 
            for(int i = 1; i <= N; i++)
            {
                ans = ans * 10 + b[i];
            }
            Console.WriteLine(ans);
        }
    }
}


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

int main() {
     int A,B;
     cin >> A >> B;
     cout << A * B << endl;
     return 0;
    
}

Measured memory_bytes: 3596
c=[500,100,50,10,5,1]

def solve(n):
    t=1000-n
    cnt=0
    for i in range(len(c)):
        while t//c[i]>0:
            t-=c[i]
            cnt+=1
    return cnt


for i in range(5):
    n=int(input())
    if n==0:exit()
    print(solve(n))


Measured memory_bytes: 5600
from collections import Counter

class union:
    def __init__(self,x):
        self.par = list(range(x))

    def root(self,x):
        S = set()
        S.add(x)
        y = x
        while True:
            if self.par[y] == y:
                for s in S:
                    self.par[s] = y
                return y
            S.add(y)
            y = self.par[y]

    def unite(self,x,y):
        rx = self.root(x)
        ry = self.root(y)
        self.par[rx] = ry

    def same(self,x,y):
        return self.root(x) == self.root(y)

N,M = map(int,input().split())
a,b = 0,0
U = union(N)
for i in range(M):
    a,b = map(int,input().split())
    a-=1
    b-=1
    U.unite(a,b)

C = Counter([U.root(x) for x in range(N)])
print(max(C.values()))

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

public class Main
{
    public static void main(String[] args) throws IOException
    {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        
        int[] arr = new int[n];
        for (int i = 0; i < n; i++)
            arr[i] = scan.nextInt();
        
        long[][] dp = new long[n + 1][n + 1];
        for (int i = n - 1; i >= 0; i--)
        {
            for (int j = i; j < n; j++)
            {
                if (j == i)
                    dp[i][j] = arr[i];
                else
                    dp[i][j] = Math.max(arr[j] - dp[i][j - 1], arr[i] - dp[i + 1][j]);
            }
        }
        System.out.println(dp[0][n - 1]);
    }
}

Measured memory_bytes: 131556
#include <stdio.h>

int main(){
  int n,m,l;
  scanf("%d",&n);
  scanf("%d",&m);
  scanf("%d",&l);

  int A[n][m],B[m][l];
  long C[n][l];
  for(int i=0;i<n;i++) for(int j=0;j<m;j++) scanf("%d",&A[i][j]);
  for(int i=0;i<m;i++) for(int j=0;j<l;j++) scanf("%d",&B[i][j]);
  for(int i=0;i<n;i++) for(int j=0;j<l;j++) C[i][j] = 0;

  int sum=0;
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      for(int k=0;k<l;k++){
        C[i][k] += A[i][j] * B[j][k];
      }
    }
  }

  for(int i=0;i<n;i++){ for(int k=0;k<l;k++){ if(k){printf(" ");} printf("%ld", C[i][k]); }printf("\n");}

  return 0;
}


Measured memory_bytes: 2916
#coding: utf-8
# n,k = int(input())
# list = list(map(int,input().split()))
# strings = list(map(str, [input() for i in range(amount)]))

n = int(input())
ans = 'No'

for i in range(1,10):
    # print(i)
    if n % i == 0 and n // i < 10:
        ans = 'Yes'
        break

print(ans)


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using namespace std;
using ll=long long;

const int limit=100010;
ll bit[limit];

void add(ll i,ll x,ll n,ll p){
	for(i++;i<=n;i+=i&-i)
		bit[i]+=x,bit[i]%=p;
}

ll sum(ll i,ll n,ll p){
	ll ret=0LL;
	for(i++;i>0;i-=i&-i)
		ret+=bit[i],ret%=p;
	return ret;
}


int main(void){
	ll a,b,p;
	while(cin >> a >> b >> p,p){
		const ll n=b-a+1;
		clr(bit,0);

		using state=tuple<string,int>;
		vector<state> ary;
		rep(i,n) ary.push_back(state(to_string(a+i),i));
		sort(_all(ary));
		ll ans=0LL;

		for(auto &event:ary){
			int idx;
			tie(ignore,idx)=event;
			ll cur=(sum(idx,n,p)+1)%p;
			ans=(ans+cur)%p;
			add(idx,cur,n,p);
		}

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

Measured memory_bytes: 10008
from collections import deque
n = int(input())
graph = [deque([]) for _ in range(n+1)]
ans = [[i, ] for i in range(n+1)]
for i in range(n):
  u, k, *v = list(map(int, input().split()))
  for j in v:
    graph[u].append(j)
stack = deque()
stack.append(1)
marked = []
t = 0
def dfs(v):
  global t
  marked.append(v)
  t += 1
  ans[v].append(t)
  for i in graph[v]:
    if i in marked:
      continue
    else:
      marked.append(i)
      dfs(i)
  t += 1
  ans[v].append(t)
for i in range(1, n+1):
  if len(ans[i])==1:
    dfs(i)
for i, x in enumerate(ans):
  if i==0:
    continue
  print(*x)


Measured memory_bytes: 6108
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8');
const args: string[][] = input.split('\n').map(l => l.split(' '));

const [s, w] = args[0].map(x => parseInt(x));

const msg = w >= s ? 'unsafe' : 'safe';

console.log(msg);

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

#define         ll          long long int

ll ara[100005];
ll seg[400005];

void build(int l, int r, int node)
{
    if (l == r)
    {
        seg[node] = ara[l];
        return ;
    }

    int mid, left, right;
    mid = l + r >> 1;
    left = node << 1;
    right = left | 1;

    build(l, mid, left);
    build(mid + 1, r, right);

    seg[node] = __gcd(seg[left], seg[right]);

    return ;
}

void update(int l, int r, int node, int i, ll val)
{
    if (l == r)
    {
        seg[node] = val;
        return ;
    }

    int mid, left, right;
    mid = l + r >> 1;
    left = node << 1;
    right = left | 1;

    if (i <= mid) update(l, mid, left, i, val);
    else          update(mid + 1, r, right, i, val);

    seg[node] = __gcd(seg[left], seg[right]);
    return ;
}

int main( )
{
    ll n, i;

    cin >> n;

    for (i = 1; i <= n; i++)
    {
        cin >> ara[i];
    }

    build(1, n, 1);

    ll mx = 0, x;

    for (i = 1; i <= n; i++)
    {
        x = ara[i];
        update(1, n, 1, i, 0);
        mx = max(mx, seg[1]);
        update(1, n, 1, i, x);
    }

    cout << mx << "\n";

    return 0;
}


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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int x = sc.NextInt();
        int n = sc.NextInt();

        if(n == 0)
        {
            Console.WriteLine(x);
            return;
        }

        int[] p = sc.IntArray();

        p = p.OrderBy(num => num).ToArray();

        int answer = int.MaxValue;
        int min = int.MaxValue;

        for(int i = 0; i <= 101; i++)
        {
            if (p.Contains(i))
            {
                continue;
            }
            int d = Math.Abs(i - x);
            if(d < min)
            {
                answer = i;
                min = d;
            }
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 28520
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#define int long long
#define uint unsigned long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
using namespace std;

struct St
{
	int i;
	int a;
	int l;

	St(int i, int a)
	{
		this->i = i;
		this->a = a;
	}
	
	bool operator < (const St &st) const
	{
		if (a == st.a)
		{
			return i < st.i;
		}
		return a > st.a;
	}
};

vector<St> st;
int ans[100000] = { 0 };

signed main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		if (a > 0)
		{
			st.push_back(St(i, a));
		}
	}
	st.push_back(St(0, 0));
	sort(st.begin(), st.end());

	int cnt = 0;
	int prev_s = 0;
	int l = 1;
	int min_i = INT_MAX;
	for (int s = 0; s < st.size() - 1; s++)
	{
		if (st[s].a > st[s + 1].a)
		{
			min_i = MIN(min_i, st[prev_s].i);
			ans[min_i] += (st[s].a - st[s + 1].a) * l;
			prev_s = s + 1;
		}
		l++;
	}

	for (int i = 0; i < n; i++)
	{
		cout << ans[i] << endl;
	}
}


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

using namespace std;

typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	ll H;
	cin >> H;
	ll ans = 0;
	ll val = 1;
	while (H) {
		ans += val;
		val *= 2;
		H /= 2;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int w,h;
int mp[20][20];
int memo[20][20];
int dx[] = {-1,0,1},dy[] = {1,1,1};
void saiki(int x,int y) {
  if(y >= h-1) memo[y][x]++;
  else if(mp[y][x] != 1) {
    for(int i=0;i<3;i++) {
      int nx = dx[i]+x, ny = dy[i]+y;
      if(nx <0|| nx >= w || memo[ny][nx] == -1||mp[ny][nx] == 1) continue;
      
      if(memo[ny][nx] > 0 && mp[ny][nx] == 0) memo[y][x] += memo[ny][nx];
      else if(mp[ny][nx] == 0){
	saiki(nx,ny);
	if(memo[ny][nx] > 0) memo[y][x] += memo[ny][nx];
      }
      else if(nx==x && mp[ny][nx] == 2){
	int ty = ny;
	while(mp[ty][nx] == 2) ty+=2;
	if(mp[ty][nx] == 0 && memo[ty][nx] == 0){
	  saiki(nx,ty);
	  if(memo[ty][nx] > 0) memo[y][x] += memo[ty][nx];
	}
	else if(mp[ty][nx] == 0 && memo[ty][nx] > 0) memo[y][x] += memo[ty][nx];
      }
    }
    if(memo[y][x] == 0) mp[y][x] = -1;
  }
}
 
 
int main() {
   while(1) {
    cin >> w >> h;
    if(w == 0 && h == 0) break;
    for(int i=0;i<=19;i++)
      for(int j=0;j<=19;j++)memo[i][j] = mp[i][j] = 0;
    
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)cin >> mp[i][j];
 
    for(int i=0;i<w;i++) 
      if(mp[0][i] !=1) saiki(i,0);
    
    int cnt = 0;
    for(int i=0;i<w;i++)
      if(memo[0][i] > 0) cnt+=memo[0][i];
    cout <<cnt<<endl;
   }
   return 0;
}

Measured memory_bytes: 1164
import sys
input=sys.stdin.readline

n,m=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(m)]
ab.sort()
ans=0
memo=-1

for i in range(m):
   if memo<ab[i][0]:
      ans+=1
      memo=ab[i][1]-1
   elif memo>ab[i][1]:
      memo=ab[i][1]-1
   else:
      pass

print(ans)

Measured memory_bytes: 27880
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	if(s.size()%2){
		cout<<"No"<<endl;
		return 0;
	}
	for(int i=0;i<s.size();i+=2){
		if(s[i]!='h'||s[i+1]!='i'){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){

  string s;
  ll k;
  cin >> s >> k;
  ll cnt = 0;
  ll res = 0;
  rep(i,s.size()-1){
    if(s[i] != s[i+1]){
      res += (cnt+1)/2;
      cnt = 0;
    }else{
      cnt++;
    }
  }
  res += (cnt+1)/2;
  res *= k;
  if(s == string(s.size(),s[0])){
    res = s.size()*k/2;
  }else{
    if(s[0] == s.back()){
      ll a = 1,b = 1;
      rep(i,s.size()-1){
        if(s[i+1] == s[i])a++;
        else break;
      }
      for(int i = s.size()-1;i > 0;i--){
        if(s[i-1] == s[i])b++;
        else break;
      }
      res -= (a/2+b/2-(a+b)/2)*(k-1);
    }
  }
  cout << res << endl;





  return 0;
}

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

int main(){
    long long int h;
    cin>>h;
    long long int x=0,s=0;
    for(long long int i=h;i>0;i/=2){
    	x++;
    	if(i/2==0&&i<=1)break;
	}
    for(long long int i=0;i<x;i++)s+=pow(2,i);
    cout<<s;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    char a[101];
    bool flag[2]={0};
    cin>>a; 
    for(int i=0;i<strlen(a);i++){
        if(a[i]=='C') flag[0]=1;
        if(a[i]=='F'&&flag[0])  flag[1]=1;
    }
    if(flag[1]) return !printf("Yes");
    else return !printf("No");
}

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

#define MAX(a, b) (a>b?a:b)
#define MIN(a, b) (a<b?a:b)
#define MOD 1000000007

int compare(const void* a, const void* b) {
    return *(int*)a-*(int*)b;
}

void testCase() {
    int i, n;
    if(scanf("%d%d", &n, &i)) {
    if(n>i)
        printf("safe");
    else
    {
        printf("unsafe");
    }
    }
}

int main() {
    int t;
    // scanf("%d", &t);
    // while(t--) {
    //     testCase();
    // }
    testCase();
    return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
int main() {
    
    
    int a,b;
    cin>>a>>b;
    
    string s;
    cin>>s;
    if(s[a]=='-')
    {
        bool ok = 1;
       // s.erase(a);
        
        for(int i=0;i<s.size();i++)
        {
            if(i==a) continue;
            if(!isdigit(s[i]))  ok=0;
           // cout<<s[i]<<" ";
        }
        
        if(ok) cout<<"Yes";
        else cout<<"No";
        
    }
    
   else cout<<"No";
    
}

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

int compare0(int **a, int **b) {
    return *(*a) - *(*b);
}

int compare1(int **a, int **b) {
    return *(*a+1) - *(*b+1);
}

typedef struct node {
    bool checked;
    int num;
    struct node **next;
    int num_next;
} Node;

Node *init_node(int n, int i) {
    Node *a = (Node *)malloc(sizeof(Node));
    a->checked = false;
    a->num = i;
    a->num_next = 0;
    a->next = (Node **)malloc(sizeof(Node *)*n);
    return a;
}

void run_tree(Node *start, int **c, int *count) {
    if (start->checked) return;
    start->checked = true;
    c[*count][1] = start->num;
    *count -= 1;
    for (int i=0; i<start->num_next; i++) {
        run_tree(start->next[i], c, count);
    }
}

int main() {
    int n = 0;
    scanf("%d\n", &n);
    Node *tree[n];
    for (int i=0; i<n; i++) {
        tree[i] = init_node(n, i);
    }
    int a = 0, b = 0;
    for (int i=0; i<n-1; i++) {
        scanf("%d %d", &a, &b);
        a--;
        b--;
        tree[a]->next[tree[a]->num_next] = tree[b];
        tree[b]->next[tree[b]->num_next] = tree[a];
        tree[a]->num_next++;
        tree[b]->num_next++;
    }
    int *c_giving = (int *)malloc(sizeof(int)*n*2);
    int **c = (int **)malloc(sizeof(int *)*n);
    for (int i=0; i<n; i++) {
        c[i] = c_giving+2*i;
        scanf("%d", c[i]);
    }
    int start = 0;
    int mem_max = 0;
    for (int i=0; i<n; i++) {
        if (tree[start]->num_next > mem_max) {
            start = i;
            mem_max = tree[i]->num_next;
        }
    }
    qsort(c, n, sizeof(int *), compare0);
    long int max = 0;
    for (int i=0; i<n-1; i++) {
        max += *(c[i]);
    }
    printf("%ld\n", max);
    int count = n-1;
    run_tree(tree[start], c, &count);
    qsort(c, n, sizeof(int *), compare1);
    for (int i=0; i<n; i++) {
        printf("%d ", *(c[i]));
    }
    putchar('\n');
    return 0;
}


Measured memory_bytes: 54812
import sys
s = list(input())
t = list(input())
n = len(s)
r = ['']*n

for i in range(n):
    r[0] = s[n - 1]
    for j in range(1, n):
        r[j] = s[j - 1]
    s = r
    r = ['']*n
    if s == t:
        print('Yes')
        sys.exit()

print('No')

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

string query(vector<ll> v){
  sort(all(v));
  cout<<"? "<<v[0]+1;
  repl(i,1,v.size())cout<<" "<<v[i]+1;
  cout<<endl;
  fflush(stdout);
  string res;
  cin>>res;
  return res;
}

void answer(string ans){
  cout<<"! "<<ans<<endl;
  fflush(stdout);
}

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

  ll N;
  cin>>N;
  mt19937 mt;

  if(N==1){
    string res(2*N,'-');
    rep(i,2*N){
      vector<ll> v(1,i);
      string crt=query(v);
      if(crt=="Red"){
        res[i]='R';
      }else{
        res[i]='B';
      }
    }
    answer(res);
    return 0;
  }

  uniform_int_distribution<> rands(0,N-1);
  
  ll ri,bi;
  {
    vector<ll> qs;
    rep(j,N)qs.push_back(j);
    string crt=query(qs);
    if(crt=="Red"){
      ri=0; bi=N;
    }else{
      ri=N; bi=0;
    }
  }

  ll lb=min(ri,bi),ub=max(ri,bi);
  while(ub-lb>1){
    ll mid=(ub+lb)/2;
    vector<ll> qs;
    repl(j,mid,mid+N)qs.push_back(j);
    string crt=query(qs);
    if(crt=="Red"){
      ri=mid;
    }else{
      bi=mid;
    }
    lb=min(ri,bi); ub=max(ri,bi);
  }
  P r=P(lb+1,lb+N);

  string res(2*N,'-');
  vector<ll> oth;
  ll rcnt=0,bcnt=0;
  rep(i,2*N){
    if(r.fi<=i&&i<r.se)continue;
    vector<ll> v;
    repl(j,r.fi,r.se)v.push_back(j);
    v.push_back(i);
    string crt=query(v);
    if(crt=="Red"){
      res[i]='R';
      if(rcnt<(N-1)/2){
        oth.push_back(i);
        rcnt++;
      }
    }else{
      res[i]='B';
      if(bcnt<(N-1)/2){
        oth.push_back(i);
        bcnt++;
      }
    }
  }

  repl(i,r.fi,r.se){
    vector<ll> v=oth;
    v.push_back(i);
    string crt=query(v);
    if(crt=="Red"){
      res[i]='R';
    }else{
      res[i]='B';
    }
  }

  answer(res);

  return 0;
}


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

namespace AtCoder.BeginnersSelections
{
    class Test
    {
        static void Main(string[] args)
        {
            int[] a = new int[3];
            int[] b = new int[3];
            var c = new int[3, 3];
            for (int i = 0; i < 3; i++) 
            {
                int[] str = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for (int j = 0; j < 3; j++)
                    c[i, j] = str[j];
            }
            bool hantei = true;

            for (int i = 0; i <= 100; 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];
                if (c[1, 1] != a[1] + b[1] ||
                    c[1, 2] != a[1] + b[2] ||
                    c[2, 1] != a[2] + b[1] ||
                    c[2, 2] != a[2] + b[2])
                    hantei = false;
            }

            if (hantei)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}

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

int main(){
	int n;
	map<int,int>mp;
	cin>>n;
	vector<int>a(n);
	rep(i,n-1){
		cin>>a[i];
		mp[a[i]]++;
	}
	// for(auto p:mp){
	// 	cout<<p.second<<endl;
	// }
	for(int i=1;i<=n;++i){
		cout<<mp[i]<<endl;
	}
}

Measured memory_bytes: 13572
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <numeric>
#include <algorithm>
//#include <iomanip> : 表示桁数, ex) cout << fixed << setprecision(15) << ...

#define pi 3.14159265358979323846
#define rep(i, n) for (int i = 0; i < n; i++)
typedef unsigned long long ll;
typedef unsigned char Byte;
using namespace std;

//string ans = "Yes";
long double ans = 0;
long double A;
long double B;
int main() {
	cin >> A >> B;
	cout << ll(A * B);
}


Measured memory_bytes: 3168
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <tuple>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long
#define pb push_back

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  int cnt = 0;
  if (a == b) cnt++;
  if (a == c) cnt++;
  if (b == c) cnt++;

  // cout << cnt << endl;

  if (cnt == 1) cout << "Yes" << endl;
  else cout << "No" << endl;

}


Measured memory_bytes: 256
var
	N,K,i,a:Longint;
	D:Array[0..9]of Boolean;
function f(n:Longint):Boolean;
begin
	while n>0 do begin
		if D[n mod 10]then begin
			f:=True;
			exit;
		end;
		n:=n div 10;
	end;
	f:=False;
end;
begin
	read(N,K);
	for i:=1 to K do begin
		read(a);
		D[a]:=True;
	end;
	while f(N)do inc(N);
	writeln(N);
end.


Measured memory_bytes: 128