akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int i=(first);i<(last);++i){cout<<#a<<"["<<i<<"] = "<<(a)[i]<<endl;}
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007

using namespace std;

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

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

class union_find_tree
{
    private:
        const int number_of_nodes;
        int number_of_groups;
        int *par;
        int *rank;
    public:
        union_find_tree(int n);
        int get_number_of_nodes();
        int get_number_of_groups();
        int root(int x);
        void unite(int x, int y);
        bool same(int x, int y);
};

union_find_tree::union_find_tree(int n) : number_of_nodes(n)
{
    number_of_groups = n;
    par = new int[n];
    rank = new int[n];
    for (int i = 0; i < n; i++) {
        par[i] = i;
        rank[i] = 0;
    }
}

int union_find_tree::get_number_of_nodes()
{
    return number_of_nodes;
}

int union_find_tree::get_number_of_groups() {
    return number_of_groups;
}

int union_find_tree::root(int x)
{
    if (par[x] == x) {
        return x;
    } else {
        return par[x] = root(par[x]);
    }
}

void union_find_tree::unite(int x, int y)
{
    x = root(x);
    y = root(y);
    if (x == y) {
        return;
    }
    if (rank[x] < rank[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (rank[x] == rank[y]) {
            rank[x]++;
        }
    }
    number_of_groups--;
}

bool union_find_tree::same(int x, int y) {
    return root(x) == root(y);
}

int main(void)
{
    const int N_MAX = 100000;
    int N, M;
    int p[N_MAX + 1];
    int q[N_MAX + 1];
    cin >> N >> M;
    FOR(i, 1, N + 1) {
        cin >> p[i];
        q[p[i]] = i;
    }
    union_find_tree uft(N + 1);
    REP(i, M) {
        int x, y;
        cin >> x >> y;
        uft.unite(x, y);
    }
    int result = 0;
    FOR(i, 1, N + 1) {
        if (uft.same(i, q[i])) {
            ++result;
        }
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using ll = long long;
int main()
{
    int x;
    cin >> x;
    vector<int> dp(100020);
    dp[0] = 1;
    vector<int> p = {100, 101, 102, 103, 104, 105};
    for(int price : p)
    {
        for(int i = 0; i <= x; i++)
        {
            if(dp[i] == 1)
            {
                if(i + price <= 100010) dp[i+price] = 1;
            }
        }
    }
    if(dp[x] == 1) cout << 1 << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
bool f;
ll ans=1;
ll check=1e18;

int main(){
	cin>>n;
	while(n--){
		ll x;cin>>x;
		if(x==0){
			f=true;
			continue;
		}
		ans*=x;
		check/=x;
	}
	

	if(f) cout<<0;
	else{
		if(check<1) cout<<-1;
		else cout<<ans;
	}
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(2)<<(x)
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define inf std::numeric_limits<int>::max();
#define highest_2_pow(n)  __builtin_clzll((long long)0)- __builtin_clzll((long long)n) - 1
//-----------------------------------------------------------------------------------------------------
#define lli long long int 
#define int long long
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define vi vector<int>
#define vlli vector<long long int>
#define si set<int>
#define slli set<long long int>
#define mt make_tuple
#define mp make_pair
#define eb emplace_back
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
//---------------------------------------------------
using namespace std;
// GCD and LCM are available
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}

void faster(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
void solve(){
    string sr;
    cin>>sr;
    int n = sr.size();
    vector< pair<int,int> > RL;
    RL.eb(mp(-1,0));
    map<int,int> s;
    rep(i,0,n-1){
        if(sr[i]=='R' && sr[i+1]=='L'){ 
            RL.eb(mp(i,i+1));
            s.insert({i,0});
            s.insert({i+1,0});
            // cout<<i<<" "<<i+1<<endl;
        }
    }
    // cout<<"------"<<endl;
    // for(auto e:s) cout<<e.first<<" "<<e.sc<<endl;
    // cout<<"------"<<endl;
    int lt,rt,j;
    rep(i,1,RL.size()){
        // cout<<RL[i].fr<<" "<<RL[i].sc<<endl;
        lt = RL[i].fr - RL[i-1].sc;
        s[RL[i].fr] += lt/2 +1;
        s[RL[i].sc] += lt - (lt/2);
        // error(lt); 
        rt=0;
        for(j=RL[i].sc+1;sr[j]=='L' && j<n;j++) rt++;
        s[RL[i].sc] += rt/2 + 1;
        s[RL[i].fr] += rt - (rt/2);
        // error(rt); 
        RL[i].sc = j;
    }
    // cout<<"------"<<endl;
    // for(auto e:s) cout<<e.first<<" "<<e.sc<<endl;
    // cout<<"------"<<endl;

    rep(i,0,n){
        if(s.find(i)==s.end()) cout<<"0 ";
        else cout<<s[i]<<" ";
    }
    cout<<endl;
}
signed main()
{
    faster();
    int t=1;
    //cin>>t;
    while(t--) solve();
}

Measured memory_bytes: 7620
from math import atan, pi

a, b, x = map(int, input().split())

if x/a > a*b/2:
    theta = atan(2 * (a*b - x/a) / (a**2))
else:
    theta = pi/2 - atan((2*x) / (a*b*b))
    
print(180 * theta / pi)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    for (auto i = 0; i < s.size() - 1; ++i) {
        if (s[i] == 'A' && s[i + 1] == 'C') {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <stdlib.h>
#include <stdio.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(10) << ans << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n,m;
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};


signed main(){
    cin >> n;
    int ans = 2;
    REP(i,n){
        ans = ans*2+2;
    }
    print(ans)
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
unsigned long long int mod = 1000000000 + 7;
 
vector<vector<unsigned long long int>>  comb(int N){
  vector<vector<unsigned long long int>> vs(N + 1, vector<unsigned long long int>(N + 1, 0));
 
  for(int i = 0 ; i < vs.size() ;i++){
    vs[i][0] = 1;
    vs[i][i] = 1;
  }
  
  for(int i = 1; i < vs.size(); i++){
      for(int j = 1; j < i ; j++){
        vs[i][j] = (vs[i-1][j-1] +vs[i-1][j]) % mod;
      }
  }
 
  return vs;
}
 
int main(){
  unsigned long long int N, K;
  cin >> N >> K;

  vector<vector<unsigned long long int>>  v = comb(N);
  
  for(int i = 1; i <= K ;i++){   
   unsigned long long int c = v[K-1][i-1] % mod;
   unsigned long long int c1 = v[N-K+1][i] % mod;
   cout <<c * c1 % mod << endl;
  }
  
  return 0;
}


Measured memory_bytes: 31616
r,g,b,n = map(int, input().split())
dp = [[0] * 3001, [0] * 3001, [0] * 3001]
dp[0][0] = 1
dp[1][0] = 1
dp[2][0] = 1
for x in range(1, (n+1)):
    if x - r >= 0:
        dp[0][x] = dp[0][x-r]
for x in range(1, (n+1)):
    dp[1][x] = dp[0][x]
    if x-g >= 0:
        dp[1][x] += dp[1][x-g]
for x in range(1, (n+1)):
    dp[2][x] = dp[1][x]
    if x-b >= 0:
        dp[2][x] += dp[2][x-b]
print(dp[2][n])

Measured memory_bytes: 39408
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := scanInt()
	k := scanInt()
	ans := 0
	for i := k; i <= n+1; i++ {
		// 0~n のなかで i個数を選んだときの和の組み合わせ
		ans += (n*i - i*i + i + 1)
	}
	fmt.Println(ans % 1000000007)
}

func scanInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

Measured memory_bytes: 1756
#include <bits/stdc++.h>
#define MAX_N 10000
#define INF 1e9

using namespace std;

typedef int long long ll;
typedef int long l;
typedef pair<int, int> Pii;
const ll MOD = 1000000007;

ll dp[45];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    dp[0] = 1;
    dp[1] = 1;
    for (int i = 0; i < n - 1; i++) {
        dp[i + 2] = dp[i + 1] + dp[i];
    }
    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 3176
#include <iostream>

int main() {
  int w,h,x,y,r;
  std::cin >> w >> h >> x >> y >> r;
  bool xin{ ((x-r)>=0) && ((x+r)<=w) };
  bool yin{ ((y-r)>=0) && ((y+r)<=h) };
  std::cout << ((xin && yin) ? "Yes" : "No") << std::endl;
}


Measured memory_bytes: 3116
#include <stdio.h>

int main(void) {
	int n,w;
	int list_of_num[11];
	int now;
	int i;
	int highest,right_most;
	double result;
	while(1) {
		scanf("%d%d",&n,&w);
		if(n==0 && w==0)break;
		for(i=0;i<=10;i++)list_of_num[i]=0;
		for(i=0;i<n;i++) {
			scanf("%d",&now);
			list_of_num[now/w]++;
		}
		highest=0;right_most=0;
		for(i=0;i<=10;i++) {
			if(list_of_num[i]>highest)highest=list_of_num[i];
			if(list_of_num[i]>0) {
				right_most=i;
			}
		}
		result=0.01;
		for(i=0;i<right_most;i++) {
			result+=((double)list_of_num[i]/highest)*
				((double)(right_most-i)/right_most);
		}
		printf("%.15f\n",result);
	}
	return 0;
}

Measured memory_bytes: 0
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N,Y = (int(_) for _ in input().split())
    # 10000
    for i in range(N+1):
        # 50000
        for j in range(N+1):
            cnt_of_1000 = N - i -j
            if cnt_of_1000 < 0:
                continue
            sum_of_yen = i* 10000 + j* 5000 + cnt_of_1000*1000
            if sum_of_yen == Y:
                print(i,j,cnt_of_1000)
                return
    print('-1 -1 -1')
if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val x = sc.nextInt()
    val m = (0 until n).map { sc.next().toInt() }
    println(problem090c(n, x, m))
}

fun problem090c(n: Int, x: Int, m: List<Int>): Int {
    val sum = m.sum()
    return n + ((x - sum) / m.min()!!)
}

Measured memory_bytes: 29600
#include <iostream>
#include <string>
using namespace std;
int main(){
	string str;
	while(cin>>str){
		int num[10];
		for(int i=0;i<10;i++){
			num[i]=str[i]-48;
		}
		for(int j=9;j>=0;j--){
			for(int k=0;k<j;k++){
				num[k] += num[k+1];
			}
		}
		cout<<num[0]%10<<endl;	
	}
	return 0;
}

Measured memory_bytes: 1180
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;

bool judge_(int a){
	int b=sqrt(a);
	return b*b==a;
}
int main (){
	int a,b;
	while(cin>>a>>b && a>=1 && a<=100 && b>=1 && b<=100)
	{
		int flag=1;
		if(a<10)
		{   if(b<10)
		    {
			    if(judge_(a*10+b) || judge_(a+b*10))
		            flag=0;
		    }
		    else if(b>=10 && b<100)
		    {
		    	if(judge_(a*100+b) || judge_(a+b*10))
		    	    flag=0;
			}
			else
			{
				if(judge_(a*1000+b) || judge_(a+b*10))
		    	    flag=0;
			}
		}
		
		else if(a>=10 && a<100)
		{
			if(b<10)
		    {
			    if(judge_(a*10+b) || judge_(a+b*100))
		            flag=0;
		    }
		    else if(b>=10 && b<100)
		    {
		    	if(judge_(a*100+b) || judge_(a+b*100))
		    	    flag=0;
			}
			else
			{
				if(judge_(a*1000+b) || judge_(a+b*100))
		    	    flag=0;
			}
		}
		
		else
		{
			if(b<10)
		    {
			    if(judge_(a*10+b) || judge_(a+b*1000))
		            flag=0;
		    }
		    else if(b>=10 && b<100)
		    {
		    	if(judge_(a*100+b) || judge_(a+b*1000))
		    	    flag=0;
			}
			else
			{
				if(judge_(a*1000+b) || judge_(a+b*100))
		    	    flag=0;
			}
		} 
		
		if(!flag)
		    cout<<"Yes"<<endl;
		else
		    cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
A=[]
fp =0
bp =0
n=int(raw_input())
while n: 
    cmd = raw_input()
    if cmd[0] == 'i':
        A.append(int(cmd[7:]))
        fp += 1
    elif cmd[6] == ' ':
        try:
            i = A[::-1].index(int(cmd[7:]))
            if i!=-1:
                del A[-i-1]
                fp -=1
        except:
            pass
    elif cmd[6] == 'F':
        A.pop()
        fp -=1
    elif cmd[6] == 'L':
        bp +=1
    n -=1
 
for e in A[bp:fp+1][::-1]:
    print int(e),

Measured memory_bytes: 42224
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,ra,re) for((i)=ra;(i)<(re);(i)++)
#define rep_(i,ra,re) for((i)=ra;(i)<=(re);(i)++)
#define put(n) cout << n << " "; 
#define puts(n) cout << n << endl;
#define INF 10e9

static const int MAX_N=10e5,MAX_M=10e5;
long long N,M,K,X,Y,Z;
//int maxs=-1,mini=INF,ans,res;
int A[MAX_N],B[MAX_N],C[MAX_N];
long long ans;
//1 1 1->7
void dfs(long long  n,int flag){
	if(n>N)
		return ;
	if(flag==7)
		ans++;
	dfs(n*10+3,flag|1);
	dfs(n*10+5,flag|2);
	dfs(n*10+7,flag|4);
}


int main(void){
	cin >> N;
	dfs(0,0);
	puts(ans);
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>

using namespace std;


int main() {
	
	int x, a, b;
	cin >> x >> a >> b;
	a*=-1;
	a += b;
	if (a <= 0)cout << "delicious" << endl;
	else if (a <= x)cout << "safe" << endl;
	else cout << "dangerous" << endl;


	return 0;
	
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

ll mod(ll a) {
  return (a % MOD + MOD) % MOD;
}

ll dp[int(1e5+5)][5];
	
int main(){
  string s;cin>>s;
  dp[0][3]=1;
  FOR(i,1,s.size()+1){
  	dp[i][0]=dp[i-1][0];	
  	dp[i][1]=dp[i-1][1];
  	dp[i][2]=dp[i-1][2];
  	dp[i][3]=dp[i-1][3];
  	if(s[i-1]=='A'){
  		dp[i][0]=mod(dp[i][0]+dp[i-1][3]);	
  	}else if(s[i-1]=='B'){
  		dp[i][1]=mod(dp[i][1]+dp[i-1][0]);
  	}else if(s[i-1]=='C'){
  		dp[i][2]=mod(dp[i][2]+dp[i-1][1]);
  	}else{
  		dp[i][0]=mod(3*dp[i-1][0]);	
  		dp[i][1]=mod(3*dp[i-1][1]);	
  		dp[i][2]=mod(3*dp[i-1][2]);
  		dp[i][3]=mod(3*dp[i-1][3]);
  		dp[i][0]=mod(dp[i][0]+dp[i-1][3]);	
  		dp[i][1]=mod(dp[i][1]+dp[i-1][0]);
  		dp[i][2]=mod(dp[i][2]+dp[i-1][1]);
  	}
  }
  cout<<dp[s.size()][2]<<endl;
  return 0;
}

Measured memory_bytes: 4352
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
	
	public static class Point implements Comparable<Point>{
		int x, y;

		public Point(int x, int y) {
			super();
			this.x = x;
			this.y = y;
		}

		@Override
		public int compareTo(Point o) {
			if(this.x != o.x){
				return this.x - o.x;
			}else{
				return this.y - o.y;
			}
		}

		@Override
		public String toString() {
			return "Point [x=" + x + ", y=" + y + "]";
		}
	}
	
	public static int check(final int R, Point[] enemys, Point[] bullets){
		final int LIM = 4 * 4 * R * R;
		
		//System.out.println(Arrays.toString(enemys));
		//System.out.println(Arrays.toString(bullets));
		
		int sum = 0;
		Point start = new Point(0, 0);
		for(Point enemy : enemys){
			start.x = enemy.x - 4 * R;
			
			int start_pos = Arrays.binarySearch(bullets, start);
			if(start_pos  < 0){
				start_pos = -(start_pos + 2);
			}
			start_pos = Math.max(0, start_pos);
			
			for(int i = start_pos; i < bullets.length; i++){
				if(bullets[i].x - enemy.x > 4 * R){
					break;
				}
				
				final int dist = (enemy.x - bullets[i].x) * (enemy.x - bullets[i].x) + (enemy.y - bullets[i].y) * (enemy.y - bullets[i].y);
				
				if(dist <= LIM){
					sum++;
				}
			}
		}
		
		return sum;
	}
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
         
        while(sc.hasNext()){
        	final int A = sc.nextInt();
        	final int B = sc.nextInt();
        	final int R = sc.nextInt();
        	
        	if(A == 0 && B == 0 && R == 0){
        		break;
        	}
        	
        	System.gc();
        	
        	Point[] enemys = new Point[A];
        	Point[] bullets = new Point[B];
        	
        	for(int i = 0; i < A; i++){
        		enemys[i] = new Point(sc.nextInt(), sc.nextInt());
        	}
        	
        	for(int i = 0; i < B; i++){
        		bullets[i] = new Point(sc.nextInt(), sc.nextInt());
        	}
        	
        	Arrays.sort(enemys);
        	Arrays.sort(bullets);
        	
        	System.out.println(check(R, enemys, bullets));
        }
    }
}

Measured memory_bytes: 176668
#include<iostream> 
#include<vector> 
#include<algorithm> 
#include<iomanip> 
#include<stack> 
#include<unordered_map>
#include<climits>
#include<set> 
#include<string> 
//#include<bits/stdc++.h> 
using namespace std; 
#define lld long long int 
#define eb emplace_back
//to insert pair use eb
#define mp make_pair
#define fi first
#define se second
#define pb push_back

#define X 1000000007
#define Y 998244353
#define E4 1000
#define E5 10000 
#define E6 1000000
#define inf 1001001001
#define longinf 2001001001001001001
#define pi 3.1415926535

# define rec2(i,a,b) for(lld i=a;i<b;i++) 
#define rec(i,n) for(lld i=0;i<n;i++)
#define rev(i,a,b) for(lld i=b-1;i>=a;i--)
#define all(v) (v).begin(), (v).end()
#define large(v)  *max_element(all(v))
#define small(v)  *min_element(all(v)) 
#define v vector
const double EPS = 1e-6;
/*  //prime sieve if needed 
//prime factors of number
int prime[E6+1]; 
void sieve(lld n) 
{ rec(i,n+1) 
    prime[i]=1; 
   for(lld i=2;i*i<=n;i++) 
     { if(prime[i]!=1) 
          continue; 
         for(lld j=i*i;j<=n;j=j+i) 
          if(prime[i]==1)
           prime[j]=i; 
      }
}
*/
lld gcd(lld a,lld b)
{
    if(a==0)
     return b; 
    return gcd(b%a,a); 
}
//fermat a^(m-2)%mod
lld binarymul(lld a,lld n,lld m)
{  lld res=1; 
 while(n) 
  { if(n%2) 
      { res=(res*a)%m; 
         n--; 
      } 
     a=(a*a)%m; 
     n/=2; 
  }
  return res; 
}
int main()
{
   ios_base::sync_with_stdio(false); 
   cin.tie(0);
     #ifdef PUNEET_GOEL
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif
   //sieve(E6); 
    lld n,k; 
    cin>>n>>k; 
    lld a[n]; 
    rec(i,n) 
    cin>>a[i]; 
     int j=0; 
      
   for(int i=k;i<n;i++) 
   { 
   if(a[i]>a[j])
   cout<<"Yes"<<endl; 
   else 
   cout<<"No"<<endl; 
   j++; 
   }
	return 0;
}

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

vector<set<int> > bomb(300005);

int main() {
    int H, W, M; cin >> H >> W >> M;
    vector<int> bombH(H);
    vector<int> bombW(W);
    rep(i, M){
        int h, w; cin >> h >> w;
        h--; w--;
        bomb[h].insert(w);
        bombH[h]++;
        bombW[w]++;
    }

    int hmax = 0;
    rep(i, H){
        if(bombH[i] > hmax){
            hmax = bombH[i];
        }
    }
    int wmax = 0;
    rep(i, W){
        if(bombW[i] > wmax){
            wmax = bombW[i];
        }
    }

    vector<int> hkouho;
    vector<int> wkouho;
    rep(i, H){
        if(bombH[i] == hmax){
            hkouho.push_back(i);
        }
    }
    rep(i, W){
        if(bombW[i] == wmax){
            wkouho.push_back(i);
        }
    }

    ll hs = hkouho.size();
    ll ws = wkouho.size();
    ll m = M;
    if(hs * ws > m){
        cout << hmax + wmax << endl;
    } else {
        rep(i, hs){
            rep(j, ws){
                if(!bomb[hkouho[i]].count(wkouho[j])){
                    cout << hmax + wmax << endl;
                    return 0;
                }
            }
        }
        cout << hmax + wmax - 1 << endl;
    }

    return 0;
}

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

using namespace std;

int main()
{
    int number;
    cin>>number;
    int numb = number;
    int p;
    while(numb != 0)
    {
    p = numb%10;
    numb = numb/10;
    if(p==7)
    {
        cout<<"Yes";
        return 0;

    }    
    }
    cout<<"No";
}

Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define ll long long
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
#define pi 3.14159265358979323846
const int N = 3100;
int n,L;
double ansx,ansy;
double t[N],pre[2][2][N][N];
int main()
{
	n = read(); L = read();
	for(int i = 1;i <= n;i ++) t[i] = read();
	double ansx = 0,ansy = 0;
	for(int i = 1;i <= n;i ++)
		for(int j = i + 1,cnt;j <= n;j ++)
		{
			cnt = j - i - 1;
			double tmp = pi * (t[i] + t[j]) / L;
			ansx += cos(tmp) * (n - 2 * cnt - 2);
			ansy += sin(tmp) * (n - 2 * cnt - 2);
		}
	ansx = ansx / (1ll * n * (n - 1) * (n - 2) / 6); ansy = ansy / (1ll * n * (n - 1) * (n - 2) / 6);
	printf("%.12f %.12f\n",ansx,ansy);
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000;
const int MOD = (int)1e9 + 7;
template <class T>
inline T in()
{
    T x;
    cin >> x;
    return x;
}

signed main()
{
    int a = in<int>();
    int b = in<int>();
    if (a >= 13)
    {
        cout << b << "\n";
    }
    else if (a >= 6)
    {
        cout << b / 2 << "\n";
    }
    else
    {
        cout << 0 << "\n";
    }
    
}

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a>b) swap(a,b);
    if(b>c) swap(b,c);
    if(a>b) swap(a,b);
    
    cout << a << " " << b << " " << c << endl;
    return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;
using P = pair<char, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

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

    int ok = 0, ng = n;
    cout << 0 << endl;
    string s0, s;
    cin >> s0;
    if(s0[0] == 'V') {
        return 0;
    }

    while(ng-ok > 1) {
        int mid = (ng+ok)/2;
        cout << mid << endl;
        cin >> s;
        if(s[0] == 'V') {
            return 0;
        }
        if(mid % 2) {
            if(s0[0] != s[0]) {
                ok = mid;
            } else {
                ng = mid;
            }
        } else {
            if(s0[0] != s[0]) {
                ng = mid;
            } else {
                ok = mid;
            }
        }
    }

    return 0;

}

Measured memory_bytes: 3792
n=int(input())
a=[list(map(int,input().split())) for i in range(n)]
def l2(a,b,c,d):
    return ((a-c)**2+(b-d)**2)**0.5
c=[]
for i in range(n):
    for j in range(n):
        if i==j: continue
        else:
            c.append(l2(a[i][0],a[i][1],a[j][0],a[j][1]))
#print(c)
print(sum(c)*(n-1)/len(c))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed
#define endl '\n'

const ll MOD = 1e9 + 7;

void solve(istream& cin, ostream& cout) {
  int n;
  cin >> n;
  ll ans = 0;
  char pre = 'A';
  REP(i, n) {
    char input;
    cin >> input;
    if (pre != input) {
      ans++;
      pre = input;
    }
  }
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
}
#endif


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{int a,b,c;
 cin>>a>>b>>c;
 if((a==5 && b==5 && c==7)||(a==5 && b==7 && c==5)||(a==7 && b==5 && c==5))
 cout<<"YES";
 else
 cout<<"NO";
 return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string>
#include<iostream>

using namespace std;

#define MAX 200005
#define INF (1<<26)

int segN=1000000;
struct data{
    int value;
    data* ch[2];
    
    void init(){
        value=INF;
        ch[0]=new data;
        ch[1]=new data;
        ch[0]->ch[0]=NULL;
        ch[1]->ch[0]=NULL;
    }
    
    void set(int i,int x,int l,int r){
        int m=(l+r)/2;
        if(ch[0]==NULL)init();
        if(i<l || r<=i)return;
        if(x<value)value=x;
        if(r-l==1)return;
        ch[0]->set(i,x,l,m);
        ch[1]->set(i,x,m,r);
    }
    
    void set(int i,int x){
        set(i,x,0,segN);
    }
    
    int min(int a,int b,int l,int r){
        int m=(l+r)/2;
        if(ch[0]==NULL)init();
        if(b<=l || r<=a)return INF;
        if(a<=l && r<=b)return value;
        int lc=ch[0]->min(a,b,l,m);
        int rc=ch[1]->min(a,b,m,r);
        return (lc<rc?lc:rc);
    }
    
    int min(int a,int b){
        if(0<=a&&a<b)return min(a,b,0,segN);
        else return INF;
    }
};

int rak[MAX+1];
int tmp[MAX+1];
int n,k;

bool compare_sa(int i,int j){
    if(rak[i]!=rak[j])return (rak[i]<rak[j]);
    else{
        int ri=(i+k<=n?rak[i+k]:-1);
        int rj=(j+k<=n?rak[j+k]:-1);
        return ri < rj;
    }
}

void construct_sa(string s,int *sa){
    n=s.size();
    for(int i=0;i<=n;i++){
        sa[i]=i;
        rak[i]=(i<n?s[i]:-1);
    }
    for(k=1;k<=n;k*=2){
        sort(sa,sa+n+1, compare_sa );
        tmp[sa[0]]=0;
        for(int i=1;i<=n;i++){
            tmp[sa[i]]=tmp[sa[i-1]]+
            (compare_sa(sa[i-1],sa[i])?1:0);
        }
        for(int i=0;i<=n;i++)rak[i]=tmp[i];
    }
}


int search(string &target,int *sa,string &s){
    int l=0,r=n,m;
    int size=target.size(),res;
    while(l<r){
        m=(l+r)/2;
        res=s.compare(sa[m],size,target);
        if(res>=0)r=m;
        else l=m+1;
    }
    if(s.compare(sa[l],size,target)<0)return n+1;
    return l;
}

int search2(string &target,int *sa,string &s){
    int l=0,r=n,m;
    int size=target.size(),res;
    while(l<r){
        m=(l+r)/2;
        res=s.compare(sa[m],size,target);
        if(res>0)r=m;
        else l=m+1;
    }
    if(s.compare(sa[l],size,target)<=0)return n+1;
    return l;
}

data T,T2;
string s,s2;
string x,y;
int m;
int sa[MAX+1];
int sa2[MAX+1];

int main(){
    T.init();
    T2.init();
    
    cin>>s;
    s2=s;
    reverse(s2.begin(),s2.end());
    
    construct_sa(s2,sa2);
    construct_sa(s,sa);
    
    for(int i=0;i<=n;i++){
        T.set(i,sa[i]);
        T2.set(i,sa2[i]);
    }
    
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>x>>y;
        reverse(y.begin(),y.end());
        int xl=search(x,sa,s),xr=search2(x,sa,s);
        int yl=search(y,sa2,s2),yr=search2(y,sa2,s2);
        int xs=x.size();
        int X=T.min(xl,xr);
        int Y=T2.min(yl,yr);
        if(Y!=INF)Y=n-Y;
        
        if(Y<X+xs)cout<<0<<endl;
        else if(X==INF||Y==INF)cout<<0<<endl;
        else cout<<Y-X<<'\n';
        
    }
    
    return 0;
}

Measured memory_bytes: 55004
# Problem: https://atcoder.jp/contests/abc061/tasks/abc061_b
# Python 2nd Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(CITY_NUM, CITY_LIST):
    # result = ""
    resultList = [0] * CITY_NUM
    for j in range(0, len(CITY_LIST), +1):
        now_city = CITY_LIST[j]
        resultList[now_city-1] = resultList[now_city-1]+1
    # for j in range(0, CITY_NUM, +1):
        # print("CITY:{} ROAD:{}".format(j, resultList[j]))
    resultListStr = [str(j) for j in resultList]
    return '\n'.join(resultListStr)
    # print("{}".format(strReturn))
    # return result


if __name__ == "__main__":
    N, M = MI()
    ROAD_ENUMERATION_LIST = []
    for j in range(0, M, +1):
        from_tmp, to_tmp = MI()
        ROAD_ENUMERATION_LIST.append(from_tmp)
        ROAD_ENUMERATION_LIST.append(to_tmp)
    print("{}".format(solver(N, ROAD_ENUMERATION_LIST)))


Measured memory_bytes: 3064
kazu=int(input())
A=[int(i) for i in input().split()]
# kazu=6
# A=[5,2,4,6,1,3]

j=0
for i in range(kazu - 1):
    print(A[i], end=" ")
print(A[kazu-1])

for i in range(1,kazu):
    v=A[i]
    j=i-1

    while j>=0 and A[j] >v:
        A[j+1]=A[j]
        j =j -1
        A[j+1]=v
    for i in range(kazu-1):
        print(A[i],end=" ")
    print(A[kazu-1])

Measured memory_bytes: 8136
#include<iostream>
#include<cstdio>
#include <algorithm>
#include <functional>
#include <vector>

using namespace std;

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

	int stu[31] = {0};
	int i,n;

	for(i=0; i<28; i++){

		cin >> n;
		stu[n] = 1;
	}

	for(i=1; i<=30; i++){

		if(stu[i] == 0) cout << i << "\n";
	}
	
	return 0;
}

Measured memory_bytes: 1196
// AOJ 1585 String in String
// 2018.5.20 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif

int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void out(int n)
{
	int i;
	char ob[20];

	if (!n) pc('0');
	else {
		i = 0; while (n) ob[i++] = n%10 + '0', n/=10;
		while (i--) pc(ob[i]);
	}
	pc('\n');
}

int str(int *f, char *s)
{
	int x;
	char *p = s, c;

	*p++ = x = gc();
	while ((c = gc()) > ' ') {
		*p++ = c;
		if (c != x) x = -1;
	}
	*p = 0;
	*f = x;
	return p-s;
}

#define INF   0x10101010
#define MAX_L 100005

char text[MAX_L]; int len;
char pat[MAX_L]; int wp;
int  sa[MAX_L], rank[MAX_L<<1];

/* 接尾辞配列 */
// rank[i]～[i+k] と rank[j]～[j+k] を比較
int k; // comstruct_sa()内で設定
int compare_sa(int i, int j)
{
	if (rank[i] != rank[j]) return rank[i] < rank[j];
	return rank[i+k] < rank[j+k];
}

// for qsort()
int cmp(const void *a, const void *b)
{
	int i = *(const int *)a, j = *(const int *)b;
	
	if (rank[i] != rank[j]) return rank[i] - rank[j];
	return rank[i+k] - rank[j+k];
}

// 文字列Sの接尾辞配列saを構築。   len:　strlen(s)
int tmp[MAX_L];
void construct_sa(char *s, int *sa)
{
	int i;
	
	memset(rank, -1, sizeof(rank));
	for(i = 0; i <= len; i++) {
		sa[i] = i;
		if (i < len) rank[i] = s[i];
	}
	
	for(k = 1; k <= len; k *= 2) {
		qsort(sa, len+1, sizeof(int), cmp);
		
		tmp[sa[0]] = 0;
		for(i = 1; i <= len; i++) {
			tmp[sa[i]] = tmp[sa[i-1]] + compare_sa(sa[i-1], sa[i]);
		}
		for(i = 0; i <= len; i++) rank[i] = tmp[i];
	}
}

int main()
{
	int Q, l, r, lo, hi, mi, ans;
	int xx, xp;

	len = str(&xx, text);
	if (xx < 0) construct_sa(text, sa);

	Q = in();
	while (Q--) {
		l = in(), r = in()+1, wp = str(&xp, pat);

		if (wp > r-l) {	pc('0'), pc('\n'); continue; }
		if (wp == r-l) {
			pc ('0' + (memcmp(text+l, pat, wp) == 0)), pc('\n');
			continue;
		}
	
		if (xx > 0) {
			if (xp < 0 || xp != xx || wp > len) { pc('0'), pc('\n'); continue; }
			out(r-l+1-wp);
			continue;
		}

		lo = 0, hi = len;
		while (lo < hi) {
			mi = (lo + hi) >> 1;
			if (memcmp(text+sa[mi], pat, wp) < 0) lo = mi+1; else hi = mi;
		}
		
		ans = 0, r -= wp;
		while (lo <= len) {
			if (memcmp(text+sa[lo], pat, wp)) break;
		    if (l <= sa[lo] && sa[lo] <= r) ans++;
			lo++;
		}
		out(ans);
	}
	return 0;
}


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

int main () {
  vector<int> num={1,3,1,2,1,2,1,1,2,1,2,1};

  int x,y;
  cin >> x >> y;

  if (num[x-1]==num[y-1]) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array
-- import Data.Array.Unboxed
import Control.Monad.ST
import Data.Array.ST
import Data.Char


main :: IO ()
main = getLine >>= print . solve . map read . words
solve :: [Int] -> Int
solve (x:y:_) = additional + (prize x) + (prize y)
  where
    additional = if x == 1 && y == 1 then 400000 else 0
    prize 1 = 300000
    prize 2 = 200000
    prize 3 = 100000
    prize _ = 0


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

int main(){
  long long int n,m;
  long long int nsu=1,msu=1;
  cin >> n >>m;
  if(abs(n-m)>1)cout << 0 <<endl;
  else{
    for(int i=1;i<=n;i++)nsu=nsu*i%1000000007;
    for(int i=1;i<=m;i++)msu=msu*i%1000000007;
    if(n==m)cout << nsu*msu*2%1000000007 <<endl;
    else cout << nsu*msu%1000000007 <<endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int i;
	int a, b;
	int tower[999];
	int diff;

	scanf("%d%d", &a, &b);
	
	tower[0] = 1;
	for (i = 1; i < 999; i++) {
		tower[i] = tower[i - 1] + (i + 1);
	}
	diff = b - a;
	printf("%d\n", tower[diff - 2] - a);

	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	int x;
	cin >> x;
	cout << (x ^ 1);
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a<10)
	{
		int ans=(100*(10-a));
		cout<<b+ans<<endl;
	}
	else
	{
		cout<<b<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
def main():
    N, M = map(int, input().split())
    *G, = map(int, input())

    ans = []
    cur = N
    ecur = cur - 1
    while cur > 0:
        ncur = cur
        while (cur - ecur) <= M and ecur >= 0:
            if G[ecur] == 0:
                ncur = ecur
            ecur -= 1

        if ncur == cur:
            print(-1)
            return

        ans.append(cur - ncur)
        cur = ncur

    ans.reverse()

    print(*ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 11388
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define lsc(x)      scanf("%lld",&x)
#define sc(x)       scanf("%d",&x)
#define lpr(x)      printf("%lld ",(long long)x)
#define pr(x)       printf("%d ",x)
#define n_l         printf("\n")
#define VI          vector<int>
#define VII         vector<long long int>
#define m_p         make_pair
#define pb          push_back
#define fi           first
#define se           second
#define mset(x,y)   memset(x,y,sizeof(x))
#define sz(v)       (int)v.size()
#define all(v)      v.begin(), v.end()
#define fr(i, a, n) for(int i=a;i<=n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
const int N=(int)1e6+5;
const int mod = 1000000007;
typedef long long ll;
// order_of_key (val): returns the no. of values strictly less than val
// find_by_order (k): returns the kth largest element iterator.(0-based)
// vector<int>::iterator itr=lower_bound(v.begin(),v.end(),x);
// s.substr(pos[0-indexed], len(default=till end))
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

ll fmod(ll x){if (x<mod) return x;return x%mod;}
ll mul(ll a, ll b, ll c){
	ll ret=0;while(b){if (b%2) ret=(ret+a)%c;a=(a*2)%c;b>>=1;}
    return ret;
}
int modpow(ll a, ll b){
    ll ret=1;while(b){if (b%2) ret=(ret*a)%mod;a=(a*a)%mod;b>>=1;}
    return (int)ret;
}
inline int inv(int x){ return modpow(x, mod-2);}
int isprime[N];
void calc_prime(){
	isprime[1]=1;for(ll i=2;i<N;i++) if (!isprime[i]) for(ll j=i*i;j<N;j+=i) isprime[j]=1;
}
#define ld long double
int main(){
    ld d , t, s;
    cin >>d>>t>>s;
    ld x = s*t;
    if (x>=d) cout<<"Yes\n";
    else cout<<"No\n";

    return 0;
}



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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            if ((b - 1) % (a - 1) == 0)
            {
                Console.WriteLine((b - 1) / (a - 1));
            }
            else
            {
                Console.WriteLine((b - 1) / (a - 1) + 1);
            }
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>
 
int main(){
  int i,j,n,min,a,b,c;
  int G[100][100],k[100],d[100];
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    k[i]=0;
    d[i]=200000;
    for(j=0;j<n;j++){
      G[i][j]=-1;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&a,&b);
    for(j=0;j<b;j++){
      scanf("%d",&c);
      scanf("%d",&G[a][c]);
    }
  }
  d[0]=0;
  while(1){
    min=200000;
    for(i=0;i<n;i++){
      if(k[i]!=1&&d[i]<min){
        min=d[i];
        a=i;
      }
    }
 
    if(min==200000){
      break;
    }
    for(i=0;i<n;i++){
      if(G[a][i]!=-1&&k[i]!=1&&d[a]+G[a][i]<d[i])
        d[i]=d[a]+G[a][i];
    }
    k[a]=1;
  }
  for(i=0;i<n;i++){
    printf("%d %d\n",i,d[i]);
  }
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int gc(int a,int b){
  if(a>b)
    return gc(b,a);
  if(a==0)
    return b;
  return gc(b%a,a);
}
int main(){
  int n,x;
  cin>>n>>x;
  int g=0;
  for(int i=0;i<n;i++){
    int xi;
    cin>>xi;
    int d=abs(xi-x);
    g=gc(g,d);
    x=xi;
  }
  cout<<g<<endl;
}

Measured memory_bytes: 256
import java.io.*;
class Main {
    public static void main( String[] args ) throws IOException {
        BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
        int sec = Integer.parseInt( br.readLine() );
        int hh = sec / 3600;
        int mm = ( sec % 3600 ) / 60;
        int ss = sec % 60;
        System.out.println( hh + ":" + mm + ":" + ss );
    }
}

Measured memory_bytes: 24440
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
	  String s = sc.next(); 
      int[] a = new int[4];
      for(int i=0;i<4;i++){
        a[i] = Character.getNumericValue(s.charAt(i));
      }
      char[] op = new char[3];
      for(int i=0;i<3;i++){
        op[i] = '+';
      }
      for(int i=0;i<(Math.pow(2,3));i++){
        for(int p=0;p<3;p++){
           op[p] = '+';
        }
        String bin = Integer.toBinaryString(i);
        int num = Integer.parseInt(bin);
        //System.out.println(String.format("%04d",num));
        for(int j=0;j<3;j++){
          //int n = 1&(i>>j);
          //System.out.println(j+"桁目を見ると"+n);
          if((1&i>>j)==1){
            //System.out.println(j+"桁目のopを変えるよ");
            op[j]='-';
          }
        }
        for(int l=0;l<4;l++){
          //System.out.print(op[l]);
        }
        //System.out.println();
      int sum=a[0];
      for(int m=0;m<3;m++){
        //System.out.print(op[m]);
        //System.out.print(a[m]);
        if(op[m]=='+'){
          sum+=a[m+1];
        }else{
          sum-=a[m+1];
        }
      }
        if(sum==7){
          for(int n=0;n<3;n++){
            System.out.print(a[n]);
            System.out.print(op[n]);         
          }
          System.out.println(a[3]+"="+sum);
          break;
        }
      }
			
    }
}

Measured memory_bytes: 38648
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
struct point
{
    double x,y;
};
void koch(int n,point p1,point p2)
{
    if(n==0) return;
    point s,t,u;
    double th=M_PI*60/180;
    s.x=(2*p1.x+p2.x)/3;
    s.y=(2*p1.y+p2.y)/3;
    t.x=(p1.x+2*p2.x)/3;
    t.y=(p1.y+2*p2.y)/3;
    u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
    u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;
    koch(n-1,p1,s);
    cout<<fixed<<setprecision(8)<<s.x<<" "<<s.y<<endl;
    koch(n-1,s,u);
    cout<<fixed<<setprecision(8)<<u.x<<" "<<u.y<<endl;
    koch(n-1,u,t);
    cout<<fixed<<setprecision(8)<<t.x<<" "<<t.y<<endl;
    koch(n-1,t,p2);
}
int main()
{
    int n;
    point p1,p2;
    p1.x=0;p1.y=0;
    p2.x=100;p2.y=0;
    cin>>n;
    cout<<fixed<<setprecision(8)<<p1.x<<" "<<p1.y<<endl;
    koch(n,p1,p2);
    cout<<fixed<<setprecision(8)<<p2.x<<" "<<p2.y<<endl;
    return 0;
}


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

using namespace std;


int main()
{
   int k;
   cin>>k;
   string s;
   cin>>s;
   if(s.length()<=k) cout<<s;
   else
   {
       for(int i=0;i<k;++i)
       {
           cout<<s[i];
       }
       cout<<"...";
   }
   
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <string.h>

void branch(int a, char *op, int b) {

    if (strcmp(op, "+") == 0) {
        printf("%d\n", a + b);
    } else if (strcmp(op, "-") == 0) {
        printf("%d\n", a - b);
    } else if (strcmp(op, "*") == 0) {
        printf("%d\n", a * b);
    } else {
        printf("%d\n", a / b);
    }
}

void process() {
    int a, b;
    char op[256];

    do {
        scanf("%d %c %d", &a, op, &b);
	if (strcmp(op, "?") == 0) break;
	branch(a, op, b);
    } while (strcmp(op, "?") != 0);

}

int main(void) {
    process();
    return 0;
}


Measured memory_bytes: 2040