akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>  // ver2.1.7
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define Pii pair<int,int>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int, vector<int>, greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vout(a) rep(Z,0,a.size()-1)cout<<a[Z]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lW,0,a.size()){Vout(a[lW]);}
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;
 
int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
 
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
 
signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int n,m;
  cin >> n >> m;
  map<int,int> kind;
  int qw,er,ty;
  
  rep(i,0,n){
    cin >> qw;
    qw *= -1;
    kind[qw]++;
  }
  
  rep(i,0,m){
    cin >> qw >> er;
    er *= -1;
    kind[er] += qw;
  }
  
  int ans = 0, ct = 0;
  
  for (auto p : kind) {
    auto k = p.first;
    auto v = p.second;
    rep(i,0,v) {
      ans += k*(-1);
      ct++;
      if(ct==n) {cout<<ans<<endl;return 0;}
    }
  }
  return 0;
}

Measured memory_bytes: 12800
#include<iostream>
using namespace std;

int main()
{
	int a, b;
	cin >> a;
	cin >> b;
	if (a < b) {
		cout << "a < b"<<endl;
	}
	if (a > b) {
		cout << "a > b"<<endl;
	}
	if (a == b) {
		cout << "a == b" << endl;
	}
}

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

#define lli long long int
#define REP(i,n) for(int i=0;i<n;i++)
#define DEBUG 0
#define LIM 1000000007

int main(){

	lli n;
	cin>>n;
	vector<lli> a(n);
	REP(i,n)cin>>a[i];

	lli ans=LIM;
	for(lli i=-100;i<=100;i++){
		lli sum=0;
		REP(j,n){
			sum += (i-a[j])*(i-a[j]);
		}
		if(DEBUG)cout<<sum<<endl;
		ans = min(ans,sum);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream> 
using namespace std;
int n, m, tmp, mm;
int main(){
	
	scanf("%d%d", &n, &m);
	mm = (int)sqrt(double(m));
	tmp = 0x7fffffff;
	for (int i=1; i<=mm; i++){
		if (m % i == 0){
			if (i >= n && i < tmp) tmp = i;
			if ((m / i) >= n && (m / i) < tmp) tmp = m / i; 
		}
	}
	printf("%d", m / tmp);
} 

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

int main(){
	string S; cin >> S;
	long long K; cin >> K;

	int par = 0;
	while(S[par] == '1') ++par;

	if(K < par+1) cout << 1 << endl;
	else cout << S[par] << endl;
}


Measured memory_bytes: 256
#line 1 "main.cpp"
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n);
	std::vector<int> a(n), b(n);
	for(int i = 0; i < n; i++) scanf("%d%d", &a[i], &b[i]);

	std::vector<int> c(n);
	for(int i = 0; i < n; i++) c[i] = (a[i] == b[i]);

	for(int i = 1; i < n - 1; i++) {
		if(!(c[i - 1] and c[i] and c[i + 1])) continue;
		printf("Yes\n");
		return 0;
	}
	printf("No\n");
	return 0;
}


Measured memory_bytes: 3688
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    void solve() throws IOException {
        int n = ni();
        int[] a = nia(n);

        Arrays.sort(a);

        if ((a[n - 1] + 1) / 2 != a[0]) {
            out.println("Impossible");
            return;
        }

        if (a[0] * 2 == a[n - 1]) {
            int[] cnt = new int[a[0] + 1];
            for (int i = 0; i < n; i++) {
                cnt[a[i] - a[0]]++;
            }
            if (cnt[0] != 1) {
                out.println("Impossible");
                return;
            }
            for (int i = 1; i <= a[0]; i++) {
                if (cnt[i] < 2) {
                    out.println("Impossible");
                    return;
                }
            }
        } else {
            int[] cnt = new int[a[0]];
            for (int i = 0; i < n; i++) {
                cnt[a[i] - a[0]]++;
            }
            if (cnt[0] != 2) {
                out.println("Impossible");
                return;
            }
            for (int i = 2; i < a[0]; i++) {
                if (cnt[i] < 2) {
                    out.println("Impossible");
                    return;
                }
            }
        }

        out.println("Possible");
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    class INA {
        int[][] a;

        INA(int n, int m) throws IOException {
            this(n, m, -1);
        }

        INA(int n, int m, int t) throws IOException {
            a = new int[m][n];

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    a[j][i] = ni() + t;
                }
            }
        }

        int[] get(int i) {
            return a[i - 1];
        }
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 8272
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string str;
  cin >> str;
  int q,i;
  cin >> q;
  string s1,s2;
  int a,b;
  for(i=0;i<q;i++){
    //cout << str << endl;
    cin >> s1 >> a >> b;
    if(s1=="print"){
      cout << str.substr(a,b-a+1) << endl;
    }else if(s1=="reverse"){
      string s3=str.substr(a,b-a+1);
      reverse(s3.begin(),s3.end());
      str=str.substr(0,a)+s3+str.substr(b+1,str.size()-a-1);
    }else{
      cin >> s2;
      str=str.substr(0,a)+s2+str.substr(b+1,str.size()-a-1);
    }
  }
}


Measured memory_bytes: 3224
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <deque>
#include <string.h>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

const int MAX_N = 300000;

int N, K;

int s[MAX_N];

int crt;

void step () {
  if(s[crt] == 1) {
    s[crt] = 0;
    crt--;
  } else {
    s[crt]--;
    while(crt < N - 1) {
      s[++crt] = K;
    }
  }
}

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

  if(K % 2 == 0) {
    cout << K / 2;
    REP(i, N - 1) cout << " " << K << endl;
    return 0;
  }

  REP(i, N) s[i] = K / 2 + 1;

  crt = N - 1;
  REP(i, N / 2) {
    step();
  }

  REP(i, N) {
    if(s[i] == 0) {
      cout << endl;
      return 0;
    }
    cout << s[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3456
n,m = map(int,input().split())
t = []

for i in range(m):
    t.append(list(map(int,input().split())))
p = list(map(int,input().split()))

x = 0
import copy


for switch_cond in range(2**n):
    s = []

    for i in range(n):
        if switch_cond%2 == 0:
            s.append("off")
            switch_cond = switch_cond//2
        else:
            s.append("on")
            switch_cond = (switch_cond-1)//2
    #print("s",s)
    for j in range(m):
        ss = copy.deepcopy(s)
        for r in range(n):
            if r+1 not in t[j][1:]:
                ss[r]="off"
        #print("t[",j,"]",t[j][1:])
        #print("ss*",ss)
        #print(ss.count("on"),p[j])
              
        if (ss.count("on"))%2 != p[j]:
            #print("break!")
            break
    else:
        #print("all on!")
        x += 1
print(x)



Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

//最大公約数の計算(ユークリッドの互除法)
long long int gcd(long long int a, long long int b) {
    return b == 0 ? abs(a) : gcd(b, a % b);
}

int main() {
    int n, x;
    cin >> n >> x;
    vector<int> coord(n);
    for (int i = 0; i < n; i++) {
        cin >> coord[i];
        coord[i] -= x;
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans = gcd(ans, coord[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 768
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, m, x, y int
	fmt.Scan(&n, &m, &x, &y)

	xs := make([]int, n)
	ys := make([]int, m)
	for i := 0; i < n; i++ {
		fmt.Scan(&xs[i])
	}
	for i := 0; i < m; i++ {
		fmt.Scan(&ys[i])
	}

	sort.Ints(xs)
	sort.Ints(ys)

	xMax := xs[len(xs)-1]
	yMin := ys[0]
	for z := -100; z <= 100; z++ {
		if xMax < yMin && xMax < z && z <= yMin && x < z && z <= y {
			fmt.Println("No War")
			return
		}
	}
	fmt.Println("War")
}


Measured memory_bytes: 512
N,M=map(int,input().split())
s1=set()
sn=set()
for i in range(M):
  a,b=map(int,input().split())
  if a==1:
    s1.add(b)
  if b==N:
    sn.add(a)
print("POSSIBLE" if len(s1&sn)!=0 else "IMPOSSIBLE")

Measured memory_bytes: 18892
#include <stdio.h>
#include <math.h>
#include <string.h>
#define MAX 500005
#define NIL -1

typedef struct{ 
	int pk, lk, rk, key;
}node;

node T[MAX];
int i, h, id, temp;

int parent(int x){
	return floor(x/2);
}
	
int left(int x){
	return 2*x;
}

int right(int x){
	return 2*x + 1;
}

void maxHeapify(int x){
	int l, r, larger;
	l = left(x);
	r = right(x);
	if (l <= h && T[l].key > T[x].key)
		larger = l;
	else larger = x;
	if (r <= h && T[r].key > T[larger].key)
		larger = r; 
	if (larger != x){
		temp = T[x].key;
		T[x].key = T[larger].key;
		T[larger].key = temp;
		maxHeapify(larger);
	}
}

void buildMax(){
	for(i=floor(h/2); i>=1; i--)
		maxHeapify(i);
}


int main(void) {
	scanf("%d", &h);
	
	//initialize
	for (i=1; i<=h; i++){
		T[i].pk = T[i].lk = T[i].rk = T[i].key = NIL;
	}
	
	for(i=1; i<=h; i++){
		scanf("%d", &id);
		T[i].key = id;
	}
	
	buildMax();

	for(i=1; i<=h; i++)
		printf(" %d", T[i].key);
	printf("\n");
	
	return 0;
}






Measured memory_bytes: 9516
#include<iostream>
#include<cstdio>
#include<vector>
#include<utility>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<limits>
#include <bitset>      


#define LL long long
#define f first
#define s second
#define pb push_back
#define mp make_pair


using namespace std;

LL dp[102][100005];



int main(){

    int n, w;
    cin >> n >> w;

    int e[n+1], v[n+1];

    memset(dp, 0, sizeof dp);


    for(int i = 1; i <= n; i++){
        cin >> e[i] >> v[i];
      }
    
    LL ans = 0;

    for(int i = 1; i <= n; i++){
        for(int k = 1; k <= w; k++){
             if(k >= e[i])
                dp[i][k] = max(dp[i][k], dp[i-1][k-e[i]] + v[i]);
             
             dp[i][k] = max(dp[i][k], dp[i-1][k]);
            }
        } 
    


    cout << dp[n][w];



    return 0;
}


Measured memory_bytes: 80000
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <functional>
using namespace std;

typedef long long W;

const W INF = 1LL << 50;

struct edge {
	int to;
	W cost;
};
typedef pair<W, int> P;
typedef vector<vector <edge > > Graph;

void dijkstra(int s, const Graph& G, vector<W>& d) {
	priority_queue< P, vector<P>, greater<P> > que;
	fill(d.begin(), d.end(), INF);
	d[s] = 0;
	que.push(P(0, s));
	while(!que.empty()) {
		P p = que.top();
		que.pop();
		int v = p.second;
		if(d[v] < p.first) continue;
		for(int i = 0; i < G[v].size(); i++) {
			edge e = G[v][i];
			if(d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

int toV(int n, int l) {
	return 101 * n + l;
}

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

	int N, M, L;
	while(cin >> N >> M >> L, N) {
		Graph G(10100);
		while(M--) {
			int a, b, d, e;
			cin >> a >> b >> d >> e;
			a--, b--;
			for(int l = 0; l <= L; l++) {
				if(l - d >= 0) {
					G[toV(a, l)].push_back(edge{ toV(b, l - d), 0 });
					G[toV(b, l)].push_back(edge{ toV(a, l - d), 0 });
				}
				G[toV(a, l)].push_back(edge{ toV(b, l), e });
				G[toV(b, l)].push_back(edge{ toV(a, l), e });
			}
		}
		vector<W> d(10100);
		dijkstra(toV(0, L), G, d);
		W ans = INF;
		for(int l = 0; l <= L; l++) {
			ans = min(ans, d[toV(N - 1, l)]);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 14460
import math

def to_f(e):
  return float(e)

n = int(raw_input().rstrip())

for i in range(n):
  line = raw_input().rstrip()
  l = map(to_f, line.split(" "))
  xa = l[0]
  ya = l[1]
  ra = l[2]
  xb = l[3]
  yb = l[4]
  rb = l[5]
  dist = math.sqrt((xa-xb)**2 + (ya-yb)**2)
  if ra > rb and dist < ra-rb:
    print 2
  elif rb > ra and dist < rb-ra:
    print -2
  elif dist <= ra + rb and dist >= ra-rb:
    print 1
  else:
    print 0

Measured memory_bytes: 6420
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function bsearch(a,x);l,r=0,length(a)+1;while r-l>1;m=(r+l)>>1;if a[m]<x;l=m;else;r=m;end;end;l;end

function main()
	n = readline() |> parseInt
	a = readline() |> split |> parseMap |> sort
	b = readline() |> split |> parseMap |> sort
	c = readline() |> split |> parseMap |> sort
	k = 0
	for i in 1:n
		k += bsearch(a,b[i])*(n-bsearch(c,b[i]+1))
	end
	println(k)
end

main()

Measured memory_bytes: 137868
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010

void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;}
LL dup(LL a,LL d){if(a%d==0)return a/d;else return a/d+1;}
LL rou(LL a,LL d){if((a*10/d)%10<5)return a/d;else return a/d+1;}
LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(&m,&d);x-=k*y;swap(&x,&y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}

int main(){
  LL a,b,i,ans=0;
  scanf("%lld%lld",&a,&b);
  if(b>a)swap(&a,&b);
  FOR(i,0,a)printf("%lld",b);

  //printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  double t=0;
  for(int i=1;i<=n;i++)
  {
    double a;
    string s;
    cin>>a>>s;
    if(s=="JPY")
     t+=a; 
    else
    {
      t+=a*380000;
    }
  }
  cout<<t;
}

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

template<int64_t MOD> struct Mint {
    int64_t v;
    Mint() { v = 0; }
    Mint(int64_t x) { v = x % MOD; if(v < 0)  v += MOD; }

    Mint operator-() { return Mint{-v}; };
    Mint operator+(Mint x) { return Mint(v + x.v); };
    Mint operator-(Mint x) { return Mint(v - x.v); };
    Mint operator*(Mint x) { return Mint(v * x.v); };
    Mint operator/(Mint x) { return Mint(v * pow(x.v, MOD-2).v); };

    Mint& operator+=(Mint x) { return *this = (*this + x); };
    Mint& operator-=(Mint x) { return *this = (*this - x); };
    Mint& operator*=(Mint x) { return *this = (*this * x); };
    Mint& operator/=(Mint x) { return *this = (*this / x); };

    static Mint pow(Mint base, int64_t exp) {
        if(exp == 0)  return Mint(1);
        return pow(base*base, exp/2) * (exp&1 ? base : Mint(1));
    }

    friend ostream& operator<<(ostream& os, Mint x) { return os << x.v; }
};
using mint = Mint<1000000007>;

int main() {
    lint n, k;
    cin >> n >> k;

    mint mn, mx;
    for(lint i=0; i<k-1; i++) {
        mn += mint(i);
        mx += mint(n-i);
    }

    mint ans;
    for(lint i=k-1; i<=n; i++) {
        mn += mint(i);
        mx += mint(n-i);
        ans += mx - mn + mint(1);
    }

    cout << ans << endl;
}

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

#define st first
#define nd second
#define pb push_back

typedef long long   ll;
typedef double      db;
typedef long double ldb;

typedef pair <int, int> pii;
typedef pair <ll,  ll>  pll;
typedef pair <ll,  db>  pdb;
typedef pair <ldb, ldb> pldb;

template <typename T>
void   Debug (T begin, T end);
int    si    ();
ll     sl    ();
string ss    (int); 
db     sf    ();
ldb    slf   ();
void   pi    (int, char = '\n');
void   pl    (ll, char = '\n');
void   pf    (db, char = '\n');
void   plf   (ldb, char = '\n');
void   ps    (string, char = '\n');

ll russian(ll, ll, ll);
ll fast_power(ll, ll, ll);
ll slow_power(ll, ll, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);

const int INF  = 1e9;
const ll  LINF = 1e18;

const int N = 8;
pair<pii, int> P[N];

db dist(pii p1, pii p2)
{
    return sqrt((p1.st - p2.st) * (p1.st - p2.st) + (p1.nd - p2.nd) * (p1.nd - p2.nd));
}

int main()
{
    int n = si();
    for (int i = 0; i < n; ++i) {
        P[i].st.st = si();
        P[i].st.nd = si();
        P[i].nd = i;
    }

    sort(P, P + n);

    db res = 0;
    do {
        for (int i = 0; i < n - 1; ++i)
            res += dist(P[i].st, P[i + 1].st);
    } while (next_permutation(P, P + n));

    for (int i = 1; i <= n; ++i)
        res /= (db)i;
    
    pf(res);

    return 0;
}

template <typename T>
void Debug(T begin, T end)
{
    printf("\nDEBUG:\n");
    while (begin != end)
        printf("%d ", *begin),
        begin++;
    printf("\n\n");
}

template <typename T>
T scanf_t(string s)
{
    T a;
    scanf(s.c_str(), &a);
    return a;
}

template <typename T>
void printf_t(T a, string s, char end_l)
{
    s.push_back(end_l);
    printf(s.c_str(), a);
}

int si() { return scanf_t<int>("%d"); }
ll sl() { return scanf_t<ll>("%lld"); }
db sf() { return scanf_t<db>("%f"); }
ldb slf() { return scanf_t<ldb>("%Lf"); }

void pi(int a, char end_l) { printf_t<int>(a, "%d", end_l); }
void pl(ll a, char end_l) { printf_t<ll>(a, "%lld", end_l); }
void pf(db a, char end_l) { printf_t<db>(a, "%lf", end_l); }
void plf(ldb a, char end_l) { printf_t<ldb>(a, "%Lf", end_l); }

void ps(string a, char end_l)
{
    string s = "%s";
    s.push_back(end_l);
    printf(s.c_str(), a.c_str());
}

string ss(int NN)
{
    char T[NN];
    scanf("%s", T);
    return (string)T;
}

ll fast_power(ll a, ll k, ll m)
{
    ll r = 1LL;
    while (k)
    {
        if (k & 1LL)
            r = (r * a) % m;
        a = (a * a) % m;
        k >>= 1LL;
    }
    return r;
}

ll slow_power(ll a, ll k, ll m)
{
    ll r = 1LL;
    while (k)
    {
        if (k & 1LL)
            r = russian(r, a, m);
        a = russian(a, a, m);
        k >>= 1LL;
    }
    return r;
}

ll russian(ll a, ll k, ll m)
{
    ll r = 0LL;
    while (k)
    {
        if (k & 1LL)
            r = (r + a) % m;
        a = (a + a) % m;
        k >>= 1LL;
    }
    return r;
}

ll gcd(ll a, ll b)
{
    while (b)
        swap(a %= b, b);
    return a;
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstdio>
using namespace std;

#define int long long
#define INF 1e18

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

    if(s[0] != 'A') {
        cout << "WA" << endl;
        return 0;
    }

    int cnt = 0;
    for(int i = 2; i < s.size() - 1; i++) {
        if(s[i] == 'C') {
            cnt++;
        }
    }
    if(cnt != 1) {
        cout << "WA" << endl;
        return 0;
    }

    int cnt2 = 0;
    string str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    for(int i = 0; i < s.size(); i++) {
        if((int)str.find(s[i]) != -1) {
            cnt2++;
        }
    }
    if(cnt2 != 2) {
        cout << "WA" << endl;
        return 0;
    }

    cout << "AC" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	
	int n;
	int d[200];
	int i,j;
	int count[200]={0};
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		
		scanf("%d",&d[i]);
		
		for(j=1;j<=100;j++){
			if(j==d[i])count[j]++;
		}
	}
	
	for(j=1;j<=100;j++){
		if(count[j]>=2){
			n=n-count[j]+1;
		}
	}
	
	
	printf("%d",n);
	
	
	
	return 0;
}

Measured memory_bytes: 128
from collections import deque


h, w = map(int, input().split())
meiro = []
for i in range(h):
    line = input()
    meiro.append(line)


def bfs(y, x):
    dist = [[-1]*w for _ in range(h)]
    if meiro[y][x] == '#':
        return 0
    dist[y][x] = 0

    pattern = [[-1, 0], [1, 0], [0, -1], [0, 1]]
    todo = deque([])
    for dy, dx in pattern:
        ny, nx = y + dy, x + dx
        if 0 <= ny <= h-1 and 0 <= nx <= w-1:
            todo.append([ny, nx, 1])

    while todo:
        y, x, d = todo.popleft()
        if meiro[y][x] == '#':
            continue
        if dist[y][x] != -1:
            continue

        dist[y][x] = d
        for dy, dx in pattern:
            ny, nx = y + dy, x + dx
            if 0 <= ny <= h - 1 and 0 <= nx <= w - 1 and dist[ny][nx] == -1:
                todo.append([ny, nx, d+1])

    res = 0
    for line in dist:
        res = max(max(line), res)

    return res


ans = []
for y in range(h):
    for x in range(w):
        ans.append(bfs(y, x))

print(max(ans))


Measured memory_bytes: 3316
n=int(input())
a=list(str(input()))
b=list(str(input()))
c=list(str(input()))
l=[0 for i in range(n)]
for i in range(n):
    if a[i] == b[i]:
        if b[i] == c[i]:
            l[i] = 0
        else:
            l[i] = 1
    else:
        if b[i] == c[i]:
            l[i] = 1
        else:
            if a[i] == c[i]:
                l[i] = 1
            else:
                l[i] = 2
s = sum(l)
print(s)


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	string s;
	cin>>s;
	int n=s.size();
	cout<<s.substr(0, n-8)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int m,n,a,b;
    cin>>n>>m;
    vector<int> x(n,0);
    for(int i=0;i<m;i++){
        cin>>a>>b;
        x[a-1]++,x[b-1]++;
    }
    for(auto i : x){
        cout<<i<<endl;
    }
}


Measured memory_bytes: 256
import copy

def j(n):
    if n:print("yes")
    else:print("no")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)
ct = 1
n = ip()
a = input()
current = a[0]
for i in range(1,n):
    if current != a[i]:
        current = a[i]
        ct+=1
print(ct)


Measured memory_bytes: 3700
from math import ceil
N, A, B = map(int, input().split())
H = [int(input()) for i in range(N)]
A -= B  # Aを追加ダメージ扱いにする


ok, ng = 10 ** 9, 0
while abs(ok - ng) > 1:
    X = (ok + ng) // 2
    H_damaged = [h - (B * X) for h in H if h - (B * X) > 0]
    Need = sum([ceil(h / A) for h in H_damaged])

    if X >= Need:
        ok = X
    else:
        ng = X

print(ok)


Measured memory_bytes: 15076
#include <stdio.h>

int abs(int b){
	return b>0 ? b : -b;
}

int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if((a-b)%2==0){
		printf("%d\n",abs((a-b)/2)+((a>b) ? b : a));
	}else{
		printf("IMPOSSIBLE\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

void chmin(int &a, int b){a = min(a, b);}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n, m = 100000;
    cin >> n;
    vector<int> dp(n+1, m);
    dp[0] = 0;
    for(int i=0;i<n;i++){
    	chmin(dp[i+1], dp[i] + 1);
    	for(int j=6;j<m;j*=6) if(j + i <= n) chmin(dp[i+j], dp[i] + 1);
    	for(int j=9;j<m;j*=9) if(j + i <= n) chmin(dp[i+j], dp[i] + 1);
    }
    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 3620
#include<iostream>

using namespace std;

void call(int n){
  int i = 1;
  while(i <= n){
    int x = i;
    if(x % 3 == 0){
      cout << " " << i;
    }else{
      while(x != 0){
        if ( x % 10 == 3 ){
          cout << " " << i;
          break;
        }
        x /= 10;
      }
    }

    i++;
  }
}


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


Measured memory_bytes: 3108
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();
        sc.close();
        System.out.println(Math.max(Math.max(a*c,a*d),Math.max(b*c,b*d)));
    }
}


Measured memory_bytes: 35692
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;

bool isPrime(ll n) {
    for (ll i=2; i*i<=n; i++) {
        if (n%i == 0) return false;
    }
    return n != 1;
}

vector<pair<ll, int>> factorize(ll n) {
    vector<pair<ll, int>> res;
    for (ll i=2; i*i<=n; i++) {
        if (n%i) continue;
        res.emplace_back(i, 0);
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1);
    return res;
}

int main() {
    ll n; cin >> n;
    if (isPrime(n)) {
        cout << n-1 << endl;
        return 0;
    }
    ll ans = LINF;
    for (ll i=2; i*i<=n; i++) {
        if (n%i!=0) continue;
        chmin(ans, i+n/i);
    }

    // vector<pair<ll,int>> vec;
    // vec = factorize(n);
    // int s = sz(vec);
    
    // rep(i,s) {
    //     ll tmp = vec[i].first;
    //     chmin(ans, tmp+n/tmp);
    //     cout << tmp << endl;
    // }
    cout << ans-2 << endl;
    

}

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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  int N, M;
  cin >> N >> M;
  vector<map<int, int> > v(N);
  vector<int> H(N);
  rep (i, N) {
    cin >> H[i];
  }
  rep (i, M) {
    int A, B;
    cin >> A >> B;
    A--;
    B--;
    v[A][B]++;
    v[B][A]++;
  }
  int cnt = 0;
  rep(i, N) {
    bool flag = true;
    for (auto j = v[i].begin(); j != v[i].end(); j++) {
      // cout << i << ' ' << j->_1 << ' ' << j ->_2 << endl;
      if (H[i] <= H[j->_1])
        flag = false;
    }
    if (flag)
      cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 17704
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long int  ll;
typedef pair<ll, ll> P;

constexpr int MOD = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template< typename S, typename T >
inline void chmax(S &a, const T &b) { if(a < b) a = b; }
 
template< typename S, typename T >
inline void chmin(S &a, const T &b) { if(a > b) a = b; }
 

//lcm//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
	if(n==0) return (ll)1;
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
ll modinv(ll a, ll m) {
	if(m==0)return (ll)1;
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];
// 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

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

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}

//radP
ll rad(ll u, ll p){
ll cnt=0;
	while(u%p==0){
		u/=p;
		cnt++;
	}
	return cnt;
}


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

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

vector<P> wv{};
rep(i,n){
	ll p,q;
	cin>>p>>q;
	wv.pb(mp(-q,p));
}

sort(ALL(wv));
for(int i=0;i<wv.size();i++){
	swap(wv[i].first, wv[i].second);
wv[i].second=-wv[i].second;
}

ll ans=0;

vector<ll> vec{};
map<ll,ll> MP{};

MP[0]=(ll)0;
vec.push_back((ll)0);
vector<ll> vec2{};

for(ll i=0;i<wv.size();i++){
	ll mx=vec.size();
sort(vec.begin(),vec.end());
for(ll j=mx-1;j>=0;j--){
	ll z=vec[j];
	if(z+wv[i].first>w)continue;
	if(!MP.count(z+wv[i].first)){
		MP[z+wv[i].first]=MP[z]+wv[i].second;
		ans=max(ans,MP[z+wv[i].first]);
		vec2.pb(z+wv[i].first);
	
	}
	else {MP[z+wv[i].first]=max(MP[z+wv[i].first], MP[z]+wv[i].second);
	ans=max(ans,MP[z+wv[i].first]);
}


	}
	for(int p=0;p<vec2.size();p++){
		vec.pb(vec2[p]);
	}
	vec2.clear();
}





cout<<ans<<endl;
}




Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class AMultiplication1 {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            out.println(a * b);
            //out.print("Case #"+ testNumber + ": ");
        }

    }

    static class FastReader {
        public BufferedReader br;
        public StringTokenizer st;
        String context = null;

        public FastReader(InputStream in) {
            this(new InputStreamReader(in));
        }

        public FastReader(InputStreamReader input) {
            br = new BufferedReader(input);
        }

        public String next() {
            if (context != null) {
                System.err.print("[" + context + "] Wait for input ...");
            }
            while (st == null || !st.hasMoreElements()) {
                try {
                    String s = br.readLine();
                    if (s == null)
                        return null;
                    st = new StringTokenizer(s);
                } catch (IOException e) {
                    e.printStackTrace();
                    throw new RuntimeException("Could not read");
                }
            }
            String res = st.nextToken();
            if (context != null) {
                System.err.println("[" + context + "] ... received : " + res);
            }
            return res;
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 32604
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int N,M,Q;
int col[100009],v[100009],d[100009],c[100009];
int vis[100009];
vector<int> G[100009];

void dfs(int cur,int dist,int co){
    if(vis[cur]>=dist) return;
    vis[cur]=dist;
    if(col[cur]==0) col[cur]=co;
    if(dist){
        for(auto &v:G[cur]){
            dfs(v,dist-1,co);
        }
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N>>M;
    rep(i,M){
        int a,b; cin>>a>>b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    
    cin>>Q;
    rep(i,Q) cin>>v[i]>>d[i]>>c[i];
    
    mem(vis,-1);
    rrep(i,Q-1){
        dfs(v[i],d[i],c[i]);
    }
    
    rep1(i,N) cout1(col[i])
}

Measured memory_bytes: 8440
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int num1,num2;
  int amari;
  int goukei = 0;
  cin >> num1;
  num2 = num1;
  
  while (num2) {
    amari = num2 % 10; 
    goukei = goukei + amari;
    num2 = num2 / 10;
  }
   
  if (num1 % goukei == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();

        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a <= 9 && b <= 9) Console.WriteLine(a * b);
        else Console.WriteLine(-1);
    }

    static double Distance(int x1, int y1, int x2, int y2)
    {
        return Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13140
#include <iostream>
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
	
int main(){
      COMinit();
  int N,K;
  cin>>N>>K;
  for(int i = 1;i<=K;i++){
    cout << COM(N-K+1,i)*COM(K-1,i-1)%MOD << endl;
  }
  return 0;
}

Measured memory_bytes: 12160
#include<stdio.h>
#include<cstdio>
#include<algorithm>
#include<iostream>

using namespace std;
const int maxn = 40010;
const int mod = 998244353;
int add(int x,int y) { x+=y; return x>=mod?x-mod:x; }
int sub(int x,int y) { x-=y; return x<0?x+mod:x; }
int mul(int x,int y) { return 1ll*x*y%mod; }
int ksm(int a,int b) {
	int ans=1; for(;b;b>>=1,a=mul(a,a)) if(b&1) ans=mul(ans,a);
	return ans;
}
int n,m;
//int dp[maxn][maxn];
int fac[maxn],finv[maxn];
int getc(int x,int y) {
	if(x<y) return 0;
	return mul(fac[x],mul(finv[y],finv[x-y]));
}
/*
int main() {
	scanf("%d%d",&n,&m);
	fac[0]=1; for(int i=1;i<=n+5;i++) fac[i]=mul(fac[i-1],i);
	finv[n+5]=ksm(fac[n+5],mod-2); for(int i=n+4;i>=0;i--) finv[i]=mul(finv[i+1],i+1);
	for(int i=0;i<=n;i++) dp[i][1] = 1;
	for(int j=2;j<=m;j++) {
		for(int i=0;i<=n;i++) {
			dp[i][j] = mul(add(getc(i+1,2),1),dp[i][j-1]);
			for(int k=0;k<=i-1;k++) {
				dp[i][j] = add(dp[i][j], mul(dp[k][j-1],getc(i+2,i-k+2)) );
			}
		}
	}
	int ans = 0;
	for(int i=0;i<=n;i++) ans = add(ans,mul(getc(n,i),dp[i][m]) );
	printf("%d",ans);
}
*/
const int g = 3;
void ntt(int *a,int s,int dft) {
	for(int i=0,j=0;i<s;i++) {
		if(i<j) swap(a[i],a[j]);
		for(int k=(s>>1);(j^=k)<k;k>>=1);
	}
	for(int st=1;st<s;st<<=1) {
		int dwg = (dft==1) ? ksm(g,(mod-1)/(st<<1) ) : ksm(g,mod-1-(mod-1)/(st<<1) );
		for(int i=0;i<s;i+=(st<<1)) {
			int ng = 1;
			for(int j=i;j<i+st;j++) {
				int x = a[j]; int y = mul(ng,a[j+st]);
				ng = mul(ng,dwg);
				a[j] = add(x,y); a[j+st] = sub(x,y);
			}
		}
	}
	if(dft==1) return;
	int invs = ksm(s,mod-2);
	for(int i=0;i<s;i++) a[i] = mul(a[i],invs);
}
int ta[maxn],tb[maxn];
void MUL(int *a,int *b,int *o,int deg) {
	for(int i=0;i<deg;i++) ta[i]=a[i],tb[i]=b[i];
	ntt(ta,deg,1); ntt(tb,deg,1);
	for(int i=0;i<deg;i++) ta[i]=mul(ta[i],tb[i]);
	ntt(ta,deg,-1);
	for(int i=0;i<deg;i++) o[i]=ta[i];
}
int f[maxn],bc[maxn],z[maxn],tmp[maxn];
int main() {
	scanf("%d%d",&n,&m);
	fac[0]=1; for(int i=1;i<=n+5;i++) fac[i]=mul(fac[i-1],i);
	finv[n+5]=ksm(fac[n+5],mod-2); for(int i=n+4;i>=0;i--) finv[i]=mul(finv[i+1],i+1);
	for(int i=0;i<=n;i++) f[i] = 1;
	int deg = 1; for(;deg<=2*n;deg<<=1);
	for(int i=0;i<=n;i++) z[i]=finv[i+3];
	for(int orz=2;orz<=m;orz++) {
		for(int i=0;i<=n;i++) bc[i]=f[i],f[i]=mul(f[i],finv[i]);
		for(int i=n+1;i<deg;i++) f[i]=0;
		MUL(z,f,tmp,deg);
		for(int i=1;i<=n;i++) f[i]=add(mul(tmp[i-1],fac[i+2]),mul(bc[i],add(getc(i+1,2),1)));
		f[0]=1; for(int i=n+1;i<deg;i++) f[i]=0;
	}
	int ans = 0;
	for(int i=0;i<=n;i++) ans = add(ans,mul(getc(n,i),f[i]) );
	printf("%d",ans);
}

Measured memory_bytes: 640
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    char c[4][4];
    scanf("%s%s",c[1],c[2]);
    if(c[1][0]==c[2][2] && c[1][1]==c[2][1] && c[1][2] == c[2][0]){printf("YES\n");}else{printf("NO\n");}
    return 0;
}

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

int main()
{
    int n, a, b, s1;
    scanf ("%d%d%d", &n, &a, &b);
    s1 = n * a;
    if (s1 <= b)
        printf ("%d", s1);
    else printf ("%d", b);

    return 0;

}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstdio>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <set>
#include <utility>
#include <functional>
using namespace std;
typedef pair<int, int> pii;
typedef pair<string, int> P;
typedef long long ll;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
const int MAXN = 100000;
const int MAXE = 100000;
const int MAXV = 10000;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
struct UnionFind{
    vector<int> par,rank;
    UnionFind(int n):par(n),rank(n){
        for(int i=0;i<n;++i) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    void unite(int x,int y){
        int rx=root(x),ry=root(y);
        if(rx==ry) return ;
        if(rank[ry]>rank[rx]) par[rx]=ry;
        else par[ry]=rx;
        if(rank[rx]==rank[ry]) rank[rx]++;
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
};
vector<ll> fac(1e6),inv(1e6),finv(1e6);
void initcom(){
    fac[0]=fac[1]=1;
    inv[1]=1;
    finv[0]=finv[1]=1;
    for(int i=2;i<1e6;++i){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll com(int n,int k){
    if(n<0||k<0) return 0;
    if(n<k) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
int compress(vector<int> &x,int w){
    vector<int> sx;
    for(int i=0;i<(int)x.size();++i){
        for(int d=-2;d<=2;++d){
            int t=x[i]+d;
            if(t>=0&&t<w) sx.push_back(t);
        }
    }
    sort(sx.begin(),sx.end());
    sx.erase(unique(sx.begin(),sx.end()),sx.end());
    for(int i=0;i<(int)x.size();++i){
        x[i]=lower_bound(x.begin(),x.end(),x[i])-x.begin();
    }
    return (int)sx.size();
}
int main(){
    ll h,w,n;cin>>h>>w>>n;
    vector<int> a(n),b(n);
    for(int i=0;i<n;++i) cin>>a[i]>>b[i];
    map<pii,int> mp;
    for(int i=0;i<n;++i){
        for(int j=0;j>=-2;--j){
            for(int k=0;k>=-2;--k){
                if(a[i]+j>=1&&a[i]+j+2<=h&&b[i]+k>0&&b[i]+k+2<=w){
                    mp[pii(a[i]+j,b[i]+k)]++;
                }
            }
        }
    }
    vector<ll> cnt(10,0);
    for(auto it:mp){
        cnt[it.second]++;
    }
    for(int i=1;i<=9;++i){
        cnt[0]+=cnt[i];
    }
    cnt[0]=(h-2)*(w-2)-cnt[0];
    for(int i=0;i<10;++i) cout<<cnt[i]<<endl;
    return 0;
}

Measured memory_bytes: 83784