akhauriyash/Code-Regression huggingface dataset:
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	x := uint32(getNextInt64(scanner))
	y := uint32(getNextInt64(scanner))
	fmt.Fprintln(writer, fmt.Sprintf("%032b", x&y))
	fmt.Fprintln(writer, fmt.Sprintf("%032b", x|y))
	fmt.Fprintln(writer, fmt.Sprintf("%032b", x^y))
}



Measured memory_bytes: 1236
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
using namespace std;
int main() {
  long n;
  stringstream ss;
  cin >> n;
  if(n==0){
    cout << "0" << endl;
    return 0;
  }
  long b=2;
  long bm = n/abs(n);
  for(int i=0;n!=0;i++){
    if(n%(b)!=0){
      n -= (i%2==0?1:-1) * (b/2);
      ss << 1;
    } else {
      ss << 0;
    }
    b *= 2;
  }
  string ans = ss.str();
  for(int i=ans.length()-1;i>=0;i--){
    cout << ans[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def lcm(x, y) : return (x * y) // math.gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

def check(j):
    global cur

    for i in range(g):
        cur[i] += c[i][j]

    flag = True
    for curr in cur:
        if curr > K:
            flag = False

    return flag

H, W, K = LI()
S = RS(H)

ans = INF
N = H-1
for bit in range(1 << N):
    g = 0
    id = [0] * H

    for i in range(H):
        id[i] = g
        if (bit >> i) & 1:
            g += 1

    g += 1    
            
    c = [[0] * W for _ in range(g)]
    for i in range(H):
        for j in range(W):
            c[id[i]][j] += int(S[i][j])

    num = g-1
    cur = [0] * g
    for i in range(W):
        if not check(i):
            num += 1
            cur = [0] * g

            if not check(i):
                num = INF
                break
    
    ans = min(ans, num)

print(ans)


Measured memory_bytes: 52060
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define fir first
#define sec second
#define mod 998244353
#define ll long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
#define N 1000005
int p[N],vis[N],pr[N],cnt;
void init()
{
	for(int i=2;i<N;i++)
	{
		if(!vis[i])
		{
			pr[i]=i; p[++cnt]=i;
		}
		for(int j=1;j<=cnt;j++)
		{
			if(i*p[j]>=N) break;
			vis[i*p[j]]=1;
			pr[i*p[j]]=p[j];
			if(i%p[j]==0) break;
		}
	}
}
int Cnt[N],a[N];
signed main()
{
	int n=read(); init(); int g=0;
	for(int i=1;i<=n;i++)
	{
		a[i]=read(); g=__gcd(g,a[i]);
		int x=a[i];
		while(x!=1)
		{
			Cnt[pr[x]]++;
			int c=pr[x];
			while(x%c==0) x/=c;
		}
	}
	for(int i=1;i<N;i++)
	{
		if(Cnt[i]>1)
		{
			if(g==1)
			{
				printf("setwise coprime\n");
			}
			else
			{
				printf("not coprime\n");
			}
			return 0;
		}
	}
	printf("pairwise coprime\n");
	return 0;
}




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


int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	long long sum = 0;
	for(int i=1; i<=n; ++i){
		if(i%3 && i%5)
			sum += i;
	}
	
	cout << sum << "\n";
}

Measured memory_bytes: 3624
#include <stdio.h>          // printf(), scanf()
#include <math.h>           // sqrt()
#include <stdbool.h>

#define MAX_N 10000

int
main(int argc, char **argv)
{
	bool f[MAX_N + 1];

	for (int i = 0; i <= MAX_N; ++i)
		f[i] = true;

	f[0] = f[1] = false;
	for (int i = 2; i <= sqrt(MAX_N); ++i)
	{
		if (f[i])
		{
			for (int j = i * i; j <= MAX_N; j += i)
				f[j] = false;
		}
	}

	int n;
	while (true)
	{
		scanf("%d", &n);
		if (n == 0)
			break;

		for (int i = n; i >= 5; --i)
		{
			if (f[i - 2] && f[i])
			{
				printf("%d %d\n", i - 2, i);
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1816
import sys

while True:
	h, w = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
	if 0 ==h and 0 == w:
		break
	pa = [ "#", "." ]
	d = 0
	ouput = []
	for i in range( h ):
		d = i%2
		for j in range( w ):
			ouput.append( pa[d] )
			d = not d	
		ouput.append( "\n" )	
	print( "".join( ouput ) )

Measured memory_bytes: 7012
from sys import stdin

def execute(a, b, c):
    return b+c, a+c, a+b


a, b, c, k = [int(x) for x in stdin.readline().rstrip().split()]

"""
for i in range(k):
    a, b, c = execute(a, b, c)

if a - b > 10e18:
    print('Unfair')
else:
    print(a-b)
"""

if k % 2 == 0:
    print(a-b)
else:
    print(b-a)

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

int main()
{
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int d = (h2 - h1) * 60 + m2 - m1;
    d -= k;
    if (d < 0) d = 0;
    cout << d << endl; 
    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

int main()
{
    int n;
    cin >> n;
    const int lim = 55555;
    vector<int> prime[lim];
    vector<int> ans;
    for(int i = 2; i < lim; i++)
{
    bool k = true;
    for(int j = 2; j <= sqrt(i); j++)
    {
        if(i % j == 0) k = false;
    }
    if(k && i%10 == 1) ans.push_back(i);
}
for(int i = 0; i < n; i++)
{
    cout << ans[i] << " ";
}
} 


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

int main(void){
  string s;
  cin >> s;
  
  int n = s.size();
  vector<int> check(n);
  
  for (int i = 0; i < n; i++) {
    if (s.at(i) == 'A' || s.at(i) == 'T' || s.at(i) == 'G' ||s.at(i) == 'C' ) {
      check.at(i) = 1;
    }
    else {
      check.at(i) = 0;
    }
  }
  
  int ans = 0;
  int count = 0;
  
  for (int i = 0; i < n; i++) {
    if (check.at(i) == 1) {
      count++;
      if (count > ans) {
        ans = count;
      }
    }
    else {
      count = 0;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
ll ans = 0;

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

    int n;
    cin >> n;
    ll ans = 0;
    vi arr((ll)2e5 + 10), mp(2e5 + 10, 0);
    for (int i = 0; i < n; i++)
        cin >> arr[i], ans += mp[arr[i]], mp[arr[i]]++;
    for (int i = 0; i < n; i++)
        cout << ans - mp[arr[i]] + 1 << endl;
    return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
using ll=unsigned long long int;
int const m=1000000007;
int main(){

string s;
cin>>s;

ll n=0;
for(int i=0;i<s.size();i++){
	n+=(s[i]-'0');
}
if(n%9 == 0 ){
	cout<<"Yes";
}
else{
	cout<<"No";
}

return 0;
}


Measured memory_bytes: 3756
s = input()

def is_odd_string(s):
    if len(s)%2 ==0:
        i = len(s)//2
        if s[:i] == s[i:]:
            return True
    return False

for i in range(1, len(s)):
    if is_odd_string(s[:-i]):
        print(len(s[:-i]))
        exit()

Measured memory_bytes: 3060
#include <cmath>
#include <cstdio>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

#ifndef ASSERT
#	define ASSERT(...)
#endif
#define MOD 1000000007

struct Graph
{
	struct Edge
	{
		Edge()
		{}

		Edge(int from, int to, int weight)
			: u(from)
			, v(to)
			, w(weight)
		{}

		int u, v;
		int w;
	};

	int nvert, nedge;
	vector< vector<Edge> > ve;
	vector<Edge> edges;

	vector<ll> d;
	vector<int> a;

	Graph(int n)
		: nvert(n)
		, nedge(0)
		, ve(n)
		, d(n, 1LL<<60)
		, a(n, 0)
	{}

	void add_edge(int u, int v, int w)
	{
		ASSERT(0 <= u && u < nvert);
		ASSERT(0 <= v && v < nvert);
		ASSERT(0 <= w);
		ASSERT(u != v);
		ve[u].push_back(Edge(u, v, w));
		ve[v].push_back(Edge(v, u, w));
		edges.push_back(Edge(u, v, w));
		edges.push_back(Edge(v, u, w));
		++nedge;
	}

	ll dijkstra(int io, int i1)
	{
		d[io] = 0;
		a[io] = 1;

		priority_queue< pair<ll,int> > q;
		q.push( make_pair(0,io) );

		vector<bool> processed(nvert, false);
		int step = 0;
		while(!q.empty())
		{
			int u = q.top().second;
			if(u == i1)
				break;
			ll du = q.top().first;
			q.pop();
			if(d[u] < du)
				continue;
			
			if(processed[u])
				continue;
			processed[u] = true;
			
			++step;

			for(int i=0; i<ve[u].size(); ++i)
			{
				Edge &e = ve[u][i];
				int v = (u == e.v ? e.u : e.v);
				ASSERT(v != u);

				if(d[u] + e.w  <= d[v])
				{
					if(d[u] + e.w  < d[v])
					{
						a[v] = 0;
					}
					
					a[v] = (a[v] + a[u]) % MOD;
					d[v] = d[u] + e.w;
					q.push( make_pair(-d[v], v) );
				}
			}
		}

		return d[i1];
	}
};


int main()
{
	ios::sync_with_stdio(false);

	int n, m, s, t;
	//cin >> n >> m >> s >> t;
	scanf("%d %d %d %d", &n, &m, &s, &t);
	Graph graph(n+1);
	for(int i=0; i<m; ++i)
	{
		int u, v, w;
		//cin >> u >> v >> w;
		scanf("%d %d %d", &u, &v, &w);
		graph.add_edge(u, v, w);
	}
	Graph graph2(graph);

	ll len = graph.dijkstra(s, t);
	graph2.dijkstra(t, s);

	vector<ll> q1(n+1, 0);
	vector<ll> q2(n+1, 0);
	
	ll ans = graph.a[t]*1LL*graph.a[t] % MOD;
	for(int i=0; i<graph.edges.size(); i+=1)
	{
		int u = graph.edges[i].u;
		int v = graph.edges[i].v;
		if(graph.d[u] + graph.edges[i].w + graph2.d[v] == len)
		{
			ll t1 = graph.d[u], t2 = graph.d[v];
			if(t1*2 < len && len < t2*2)
			{
				ans = (ans + MOD - graph.a[u]*1LL*graph.a[u]%MOD * graph2.a[v]%MOD *graph2.a[v]%MOD) % MOD;
			}
			else if(t1*2 == len)
			{
				q1[u] = graph.a[u];
			}
			else if(t2*2 == len)
			{
				q2[v] = graph2.a[v];
			}
		}
	}
	
	for(int i=1; i<=n; ++i)
		ans = (ans + MOD - q1[i]*q1[i]%MOD*q2[i]%MOD*q2[i]%MOD) % MOD;

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 33324
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int main(){
	int N,a[110];
	cin >> N;
	for(int i=0;i<N;i++) cin >> a[i];
	
	sort(a,a+N,greater<int>());
	
	int Alice = 0;
	int Bob = 0;
	
	for(int i=0;i<N;i++){
		if(i%2 == 0){
			Alice += a[i];
		}
		else{
			Bob += a[i];
		}
	}
	cout << Alice - Bob << endl;
	return 0;
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
 //Compiler version g++ 6.3.0

 int main()
 {
 	int N,a;
 	cin >> N>>a;
 	int x[N];
 	for (int i = 0; i < N; i++){
 		cin >> x[i];
 	}
 	sort(x,x+N);
 	int ans=1145141919;
 	for (int i = 0; i < N-a+1; i++){
 		int p=x[i+a-1]-x[i];
 		if(p<ans){
 			ans=p;
 		}
 	}
 	cout << ans << endl;
 }

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  ll ret = 2LL*(x/11);
  if(x%11 > 0){
    ret += (x%11<=6?1:2);
  }
  
  cout << ret << endl;
  
  return 0;
}



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

namespace ConsoleApp15
{
    class Class307
    {
        static void Main()
        {
            long x = long.Parse(Console.ReadLine());
            long n = 100;

            int count = 0;
            while (n < x)
            {
                count++;
                n = (long)Math.Floor(n * 1.01);
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 27400
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█
 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int lo;
typedef pair< int,int > PII;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(lo i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
 
const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;
 
lo n,m,b[li],a[li],k,flag,t;
lo cev;
string s;
vector<int> v;

int main(void){
	scanf("%lld",&n);
	FOR{
		scanf("%lld",&a[i]);
		b[i]=a[i];
	}
	sort(b+1,b+n+1);
	reverse(b+1,b+n+1);
	cev=b[1];
	lo cev1=b[2];
	FOR{
		if(cev==a[i])printf("%lld\n",cev1);
		else printf("%lld\n",cev);
	}
	return 0;
}


Measured memory_bytes: 7296
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <cstring>
#include <cmath>
using namespace std;
#define MAXH 1000000001
#define MAXW 101
#define INF 1000
#define MAXN 101
#define MOD 1000000007
typedef long long ll;
typedef pair<ll, ll> P;


template<typename T>
T pow(T i, T n){
    T re;
    if(n == 0) return 1;
    re = pow(i, n / 2);
    if(n % 2 == 0){
        return re * re;
    }else{
        return i * re * re;
    }
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

int W, H, N;
int x[MAXN], y[MAXN], a[MAXN] ;

int main(){
    string S;
    cin >> S;
    bool flag;
    int ans = 0;
    if(S[0] == 'B')flag = false;
    else flag = true;

    for(int i = 0;i < S.length();i++){
        if(flag && S[i] == 'B'){
            flag = false;
            ans++;
        }else if(!flag && S[i] == 'W'){
            flag = true;
            ans++;
        }
    }

    printf("%d\n", ans);


    return 0;
}


        

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

long long fif(long long t){
  return t*t*t*t*t;
}

int main(){
long long X;
cin >> X;

long long A,B;

for(long long j = -119; j < 120; j++){
  for(long long i = -119; i < 120; i++){
    if(fif(j) - fif(i) == X){
      A = j;
      B = i;
      break;
    }
    }
  }

cout << A << " " << B << endl;



}

Measured memory_bytes: 3632
N, K = map(int, input().split())
p = list(map(int, input().split()))
P = [(x+1)/2 for x in p]
tmp = sum(P[:K])
ans = tmp
for i in range(K, N):
    tmp += P[i] - P[i-K]
    ans = max(tmp, ans)
print(ans)

Measured memory_bytes: 77448
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define all(v) (v).begin(),(v).end() 
#define endl "\n"
#define int long long int
#define ll long long
#define ld long double
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
const int mod = 1000000007;
const int N=200005;
const int inf=1e18;
vector<vector<int>>adj(N);


bool isPrime(ll n){if(n<2)return false;for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res%mod;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}

void fun(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}


signed main(){
    flash;
    fun();
    int t=1;
    //cin>>t;
    while(t--){
        string s;
        cin>>s;
        int n=s.size();
        if(s[n-1]=='s'){
            cout<<s<<"es";
        }
        else{
            cout<<s<<'s';
        }

    }
    return 0;
}

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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);

int n, m;

vector <vector <int>> adj;
vector <bool> used;

int cnt = 0;

void dfs (int v) {
	used[v] = true;
	cnt ++;
	for (int to : adj[v]) {
		if (!used[to]) {
			dfs(to);
		}
	}
}

int main() {

	FAST;

	cin >> n >> m;
	adj.resize(n + 1);
	used.assign(n + 1, false);
	while (m -- ) {
		int x, y;
		cin >> x >> y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	int ans = 0;
	for (int i = 1; i <= n; i ++) {
		if (!used[i]) {
			cnt = 0;
			dfs(i);
			ans = max(ans, cnt);
		}
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 20208
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
struct edge { ll s, t, x; };
typedef pair<ll, ll> P;
typedef pair<ll,P> event;
const ll MAX = 510000;
const ll MOD = 1000000007;
#define INF (ll)10000000000000000


int main() {
  ll N;
  cin>>N;
  vector<ll>A(N);
  rep(i,N){cin>>A[i];}
  ll sum=0ll;
  rep(i,N){sum=sum^A[i];}
  rep(i,N){
    ll g=sum^A[i];
    cout<<g<<' ';
  }
  
  
}




Measured memory_bytes: 4796
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <numeric>
#include <utility>
#include <iomanip>

using namespace std;
using int64 = long long;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

int main() {
    int x;
    cin >> x;
    cout << (x?0:1) << endl;
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
using ll = long long;
const ll INF = (ll)1e18L;
template<class X, class Y> X& remin(X& x, Y y) { return x = (y < x ? y : x); }
int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);
    for (int n, k; std::cin >> n >> k; ) {
        std::vector<ll> dp(n, INF), h(n);
        for (auto &it : h) std::cin >> it;
        dp[0] = 0;
        for (int i = 1; i < n; i++) {
            for (int j = std::max(i - k, 0); j < i; j++) {
                remin(dp[i], dp[j] + std::abs(h[i] - h[j]));
            }
        }
        std::cout << dp.back() << std::endl;
    }
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
using namespace std;
typedef vector <int> ivector;

int selectionsort(ivector &A){
	int n = A.size(), mini, count=0;
	for (int i=0; i<n; i++){
		mini = i;
		for (int j=i; j<n; j++)
			if (A[j] < A[mini])
				mini = j;
		if (i!=mini){
			swap(A[i], A[mini]);
			count++;
		}
	}
	return count;
}

int nums_out(ivector &A){
    int n=A.size();
    for (int i=0; i<n; i++){
        cout << A[i];
        if (i!= n-1) cout<<" ";
        else cout<<endl;
    }
    return 0;
}

int main(void){
	int n, count;
	cin>>n;
	ivector A(n);
	
	for (int i=0; i<n; i++)
		cin>>A[i];

	count = selectionsort(A);

	nums_out(A);
	cout << count << endl;
	return 0;
}

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

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

  for(int i = s.size()-2; i > 0; i--){
    if(i % 2 == 0) continue;

    bool flag = true;

    for(int j = 0; j < i/2; j++){
      if(s[j] != s[j + i/2 + 1]){
        flag = false;
        break;
      }
    }

    if(flag){
      cout << i+1 << endl;
      break;
    }
  }

  return 0;

}


Measured memory_bytes: 256
points = [ [None for j in range(3)] for i in range(3) ]
from itertools import product

for i in range(3):
  c1, c2, c3 = map(int, input().split())
  points[i][0] = c1
  points[i][1] = c2
  points[i][2] = c3

valid = False

for a1 in range(101):
  maxA1 = min(points[0])

  if a1 > maxA1:
    continue

  b1 = points[0][0] - a1
  b2 = points[0][1] - a1
  b3 = points[0][2] - a1
  a2 = points[1][0] - b1
  a3 = points[2][0] - b1

  A = {0: a1, 1: a2, 2: a3}
  B = {0: b1, 1: b2, 2: b3}

  for i in range(3):
    for j in range(3):
      if points[i][j] != A[i] + B[j]:
        print("No")
        exit()


print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll ans[1000010][13];
int main() {
	string s;
	cin>>s;
	if(s[0]=='?'){
		for(ll i=0;i<10;i++){
			ans[0][i]=1;
		}
	}
	else{
		ll now=s[0]-'0';
		ans[0][now]=1;
	}
	for(ll i=1;i<s.size();i++){
		if(s[i]=='?'){
			for(ll j=0;j<10;j++){
				for(ll k=0;k<13;k++){
					ll next=(k*10+j)%13;
					ans[i][next]+=ans[i-1][k];
					ans[i][next]%=inf;
				}
			}
		}
		else{
			ll now=s[i]-'0';
			for(ll k=0;k<13;k++){
				ll next=(k*10+now)%13;
				ans[i][next]+=ans[i-1][k];
				ans[i][next]%=inf;
			}
		}
	}
	cout << ans[s.size()-1][5];
	return 0;
}

Measured memory_bytes: 13884
from collections import deque
h,w=map(int, input().split())
sy,sx=1,1
gy,gx=h,w
cnt=0
delta=[[1,0],[0,1],[-1,0],[0,-1]]
m=[]
d=[[float('inf')]*(w+2) for _ in range(h+2)]
d[sy][sx]=1
a=['#']*(w+2)
m.append(a)
for i in range(h):
    a='#'
    a+=input()
    a+='#'
    cnt+=a.count('.')
    m.append(a)
a=['#']*(w+2)
m.append(a)
q=deque()
q.append((sy,sx))
while len(q)>0:
    y,x=q.popleft()
    if y==gy and x==gx:
        break
    for dx,dy in delta:
        if d[y+dy][x+dx]==float('inf') and m[y+dy][x+dx]=='.':
            q.append((y+dy,x+dx))
            d[y+dy][x+dx]=d[y][x]+1
if d[gy][gx]==float('inf'):
    print(-1)
else:
    print(cnt-d[gy][gx])

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

int main() {
    int n;
    cin >> n;
    vector<int> r(n+1);
    rep(i, n){
        int p;
        cin >> p;
        r[p] = i+1;
    }

    const ll p = 3e4;
    rep(i, n) cout << p * (i + 1) << " ";
    cout << endl;
    rep(i, n) cout << p * (n-i-1) + r[i+1] << " ";
    cout << endl;
}

Measured memory_bytes: 768
// by syu
package main

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

var in = NewScanner(os.Stdin, 0)

func main() {
	n := in.Int()
	for i := 0; i < 25; i++ {
		for j := 0; j < 15; j++ {
			if i*4+j*7 == n {
				Rln("Yes")
			}
		}
	}
	Pln("No")
}

type Scanner struct {
	*bufio.Scanner
}

func NewScanner(r io.Reader, max int) *Scanner {
	s := bufio.NewScanner(r)
	s.Split(scanWords)
	if max <= 0 {
		max = 1048576
	}
	s.Buffer([]byte{}, max)
	return &Scanner{s}
}
func (s *Scanner) Int() int {
	s.Scan()
	i, e := strconv.ParseInt(s.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return int(i)
}
func isSpace(b byte) bool {
	return b == ' ' || b == '\n' || b == '\r' || b == '\t'
}
func scanWords(data []byte, atEOF bool) (advance int, token []byte, err error) {
	start := 0
	for start < len(data) && isSpace(data[start]) {
		start++
	}
	for i := start; i < len(data); i++ {
		if isSpace(data[i]) {
			return i + 1, data[start:i], nil
		}
	}
	if atEOF && len(data) > start {
		return len(data), data[start:], nil
	}
	return start, nil, nil
}
func Pln(s ...interface{}) {
	fmt.Println(s...)
}
func Rln(s ...interface{}) {
	fmt.Println(s...)
	os.Exit(0)
}


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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;


int main(){
  int A,B,C;
  cin>>A>>B>>C;
  if(C>=A && C<=B){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, -1, 0, 1 };

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

string pos = "POSSIBLE";
string imp = "IMPOSSIBLE";

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

	vector<int> A;
	inputVector(A, N);

	sort(all(A));

	if (N == 1) {
		cout << (A[0] == K ? pos : imp) << endl;
		return 0;
	}

	set<int> st = set<int>(all(A));
	if (st.find(K) != st.end()) {
		cout << pos << endl;
		return 0;
	}

	if (A[N - 1] < K) {
		cout << imp << endl;
		return 0;
	}

	vector<int> dif;
	rep(i, N - 1) {
		dif.push_back(A[i + 1] - A[i]);
	}
	sort(all(dif));

	set<int> st2 = set<int>(all(dif));
	st2.erase(0);

	bool sp = st2.size() > 0;
	int key = st2.size() > 0 ? *st2.begin() : 1;
	rep(i, N) {
		if (A[i] % key) {
			sp = false;
			break;
		}
	}

	if (sp) {
		cout << (K % key == 0 ? pos : imp) << endl;
	} else {
		cout << pos << endl;
	}

    return 0;
}


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

using namespace std;

typedef long long ll;
const ll mod = 1000000007;

int main() {
  int n,k;
  cin>>n>>k;
  int cnt = 2;
  int tmp = 3;
  int maxv = (n - 1) * (n - 2) / 2;
  if (k > maxv) cout<<-1<<endl;
  else {
    cout<<(n - 1 + maxv - k)<<endl;
    for (int i = 2; i <= n + (maxv - k); i++) {
      if (i <= n) cout<<1<<" "<<i<<endl;
      else {
        if (tmp > n) {
          cnt++;
          tmp = cnt + 1;
        }
        cout<<cnt<<" "<<tmp<<endl;
        tmp++;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define fi first
#define se second
using namespace std;
typedef pair<int,int> P;
const int M=5000+10,inf=0x3f3f3f3f;
int dp[M];
P a[M];
int n,m;
int main()
{
    memset(dp,inf,sizeof(dp));
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++)
    {
        int tmp=0,cost,b;
        scanf("%d%d",&cost,&b);
        while(b--)
        {
            int x;
            scanf("%d",&x);
            tmp|=(1<<(x-1));
        }
        a[i]=P(tmp,cost);
        //dp[tmp]=min(dp[tmp],cost);
    }
    dp[0]=0;
    for(int i=0;i<m;i++)
    {
        for(int j=((1<<n)-1);j>=0;j--)
            //printf("%d %d %d\n",i,j,a[i].fi|j),
            dp[a[i].fi|j]=min(dp[a[i].fi|j],dp[j]+a[i].se);
        //for(int j=0;j<(1<<n);j++) printf("%d %d\n",j,dp[j]);
    }
    if(dp[((1<<n)-1)]!=inf) printf("%d\n",dp[((1<<n)-1)]);
    else printf("-1\n");
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	long long n, k, a, b, sum = 0; cin >> n >> k;
	vector<vector<int>>aa(n, vector<int>(2));
	for (int h = 0; h < n; h++) {
		cin >> aa[h][0] >> aa[h][1];
	}
	sort(aa.begin(), aa.end());
	for (int h = 0; h < n; h++) {
		sum += aa[h][1];
		if (k <= sum) {
			cout << aa[h][0] << endl;
			return 0;
		}
	}
	cin >> n;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
//#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define MOD 1000000009
#define SIZE 100005

struct Edge{
	void set(int arg_from,int arg_to){
		from = arg_from;
		to = arg_to;
	}
	int from,to;
};

int N,M;
ll degree[SIZE],size[SIZE];
bool DELETE[SIZE];
Edge edge[200005];

int main(){

	scanf("%d %d",&N,&M);

	for(int i = 0; i < N; i++){

		degree[i] = 0;
		size[i] = 1;
		DELETE[i] = false;
	}

	int from,to;

	for(int loop = 0; loop < M; loop++){

		scanf("%d %d",&from,&to);
		from--;
		to--;

		edge[loop].set(from,to);

		degree[from]++;
		degree[to]++;
	}

	for(int i = 0; i < M; i++){

		from = edge[i].from;
		to = edge[i].to;

		if((degree[from] < degree[to]) || (degree[from] == degree[to] && from < to)){

			DELETE[to] = true;
		}else{

			DELETE[from] = true;
		}

		if(degree[from] == degree[to]){

			size[from]++;
			size[to]++;
		}
	}

	ll ans_sum = 0,ans_num = 1;

	for(int i = 0; i < N; i++){
		if(DELETE[i])continue;

		ans_sum++;
		ans_num *= size[i];
		ans_num %= MOD;
	}

	printf("%lld\n",ans_sum);
	printf("%lld\n",ans_num);

	return 0;
}



Measured memory_bytes: 6440
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    long long int k=0;
    for (int i = 0; i < s.length(); i++)
    {
        k+=(s[i]-'0');
    }
    
    if(k%9==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

int main(){

    long long int H,W,a,b,c,ans;
    cin>>H>>W;
    if(H%3==0||W%3==0) cout<<0<<endl;
    else{
        a=(H/3)*W;
        b=(H-H/3)*(W/2);
        c=(H-H/3)*(W-W/2);
        ans=max(max(abs(a-b),abs(a-c)),abs(b-c));
        a=(H/3)*W;
        b=((H-H/3)/2)*W;
        c=(H-H/3-(H-H/3)/2)*W;
        ans=min(ans,max(max(abs(a-b),abs(a-c)),abs(b-c)));
        a=(H/3+1)*W;
        b=(H-H/3-1)*(W/2);
        c=(H-H/3-1)*(W-W/2);
        ans=min(ans,max(max(abs(a-b),abs(a-c)),abs(b-c)));
        a=(H/3+1)*W;
        b=((H-H/3-1)/2)*W;
        c=(H-H/3-1-(H-H/3-1)/2)*W;
        ans=min(ans,max(max(abs(a-b),abs(a-c)),abs(b-c)));
        a=(W/3+1)*H;
        b=(W-W/3-1)*(H/2);
        c=(W-W/3-1)*(H-H/2);
        ans=min(ans,max(max(abs(a-b),abs(a-c)),abs(b-c)));
        a=(W/3+1)*H;
        b=((W-W/3-1)/2)*H;
        c=(W-W/3-1-(W-W/3-1)/2)*H;
        ans=min(ans,max(max(abs(a-b),abs(a-c)),abs(b-c)));
        a=(W/3)*H;
        b=(W-W/3)*(H/2);
        c=(W-W/3)*(H-H/2);
        ans=min(ans,max(max(abs(a-b),abs(a-c)),abs(b-c)));
        a=(W/3)*H;
        b=((W-W/3)/2)*H;
        c=(W-W/3-(W-W/3)/2)*H;
        ans=min(ans,max(max(abs(a-b),abs(a-c)),abs(b-c)));
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	//static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		//int a[]=new int[N];
		int H=sc.nextInt();
		int W=sc.nextInt();
		//# 35 
		char v[][]=new char[H][W];
		
		for(int a=0;a<H;a++) {
			String t=sc.next();
			v[a]=t.toCharArray();
		}
		int t=0;
		for(int a=0;a<H;a++) {
			for(int b=0;b<W;b++) {
				if(v[a][b]==35)t++;
			}
		}
		Queue<Integer> qq=new ArrayDeque<>(); //add,poll,peek
		Queue<Integer> qq2=new ArrayDeque<>(); 
		Queue<Integer> qq3=new ArrayDeque<>();
		qq.add(0);
		qq2.add(0);
		qq3.add(1);
		boolean x=false;
		while(qq.peek() != null) {
			int a=qq.poll();
			int b=qq2.poll();
			int c=qq3.poll();
			if(a==H-1&&b==W-1) {
				if(c==t) {
					x=true;
					
					break;
				}
				
				
			}
			if(a+1<H&&v[a+1][b]==35) {
				qq.add(a+1);
				qq2.add(b);
				qq3.add(c+1);
			}
			if(b+1<W&&v[a][b+1]==35) {
				qq.add(a);
				qq2.add(b+1);
				qq3.add(c+1);
			}
			
			
		}
		if(x)p("Possible");
		else p("Impossible");
		}
		
		
	

	

	public static long gcd(long a, long b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	public static long lcm(long n, long m) {
        return n / gcd(n, m) * m;
}
	
	

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


Measured memory_bytes: 21972
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <queue>
# include <stack>
# define MOD 1000000000+7
# define INF 1000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
ll counter;

int main() {
	ll a = 0, b = 0, n = 0,m=0, counter = 0, maxi = 0;
	ll ar[100001];
	priority_queue<ll> pque;
	std::string str, str2;
	cin >> n>>m;
	rep(i, n) {
		cin >> a;
		pque.push(a);
	}
	rep(i, m) {
		b=pque.top();
		pque.pop();
		pque.push(b/2);
	}
	rep(i, n) {
		counter += pque.top();
		pque.pop();
}
	cout << counter << endl;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+20;
ll n,a[N],p[N],q[N];
int main()
{
	while(cin>>n)
	{
		p[0]=0;
		bool sign=true;
		int pos;
		for(int i=1;i<=n;i++)
			scanf("%lld",&a[i]),p[i]=p[i-1]+a[i],q[i]=p[i];
		
		ll ans=0;
		ll x=0;//acc
		//p[1]要么为正或者负
		//p[1]固定后后面答案就固定了 
		if(a[1]<=0)//p[1]为正 
		{
			ans=abs(a[1])+1;
			x=abs(a[1])+1;
		}
		sign=true;
		for(int i=2;i<=n;i++)
		{
			sign=sign==true?false:true;
			p[i]+=x;
			//	cout<<sign<<' '<<p[i]<<' '<<x<<endl;
			if(sign==false&&p[i]>=0)
			{
				ans=ans+p[i]+1;
				x=x-p[i]-1;
			}
			if(sign==true&&p[i]<=0)
			{
				ans=ans+abs(p[i])+1;
				x=x+abs(p[i])+1;			
			}
		}
		ll res=ans;
		x=0;
		ans=0;
		if(a[1]>=0)//p[1]为负 
		{
			ans=a[1]+1;
			x=x-a[1]-1;
		}
		sign=false;//
		for(int i=2;i<=n;i++)
		{
			sign=sign==true?false:true;
			q[i]+=x;
			if(sign==false&&q[i]>=0)
			{
				ans=ans+q[i]+1;
				x=x-q[i]-1;
			}
			if(sign==true&&q[i]<=0)
			{
				ans=ans+abs(q[i])+1;
				x=x+abs(q[i])+1;			
			}
		}
		cout<<min(res,ans)<<endl;
	}
	return 0;
}

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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

class UnionFind {
public:
	vector<int> tree;

	UnionFind(int n) : tree(n) {
		rep (i, 0, n)
			tree[i] = i;
	}

	int root(int x) { // データxの根を取得
		if (tree[x] == x)
			return x;
		else
			return tree[x] = root(tree[x]); // 根に直接つなぎ直す
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x);
		int ry = root(y);

		if (rx == ry)
			return ;
		else
			tree[rx] = ry;
	}

	bool same(int x, int y) { // データxとデータyの根が同じか判定
		return (root(x) == root(y));
	}
};


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

	int n, m;
	cin >> n >> m;

	vector<int> p(n);
	rep (i, 0, n)
		cin >> p[i];

	UnionFind uni(n);

	rep (i, 0, m) {
		int x, y;
		cin >> x >> y;

		uni.unite(x - 1, y - 1);
	}

	int res = 0;
	rep (i, 0, n) {
		if (uni.same(p[i] - 1, i))
			res++;
	}

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    string S;
    cin >> S;
    map<ll, ll> mp;  // Xi,0 mod2019 を入れておく
    mp[0] = 1;       // X0,0 mod2019 (=0) はfor文に出てこないので先に入れておく
    reverse(all(S)); // 後ろから数字を見るのであらかじめreverseしておくと良い
    ll now = 0, ten = 1;
    for (auto s : S) // Xi,0 mod2019を計算するループ
    {
        now = (now + (s - '0') * ten) % 2019; // Xi,0 mod2019の計算
        ten *= 10;
        ten %= 2019;
        mp[now]++;
    }

    ll ans = 0;
    for (auto p : mp)
    {
        ans += p.second * (p.second - 1) / 2;
    }

    cout << ans << endl;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N, A;
	cin >> N >> A;
	cout << N * N - A << endl;

	return 0;
}

Measured memory_bytes: 256
tbl = Array.new(51){0}
10.times{|i|
  10.times{|j|
    10.times{|k|
      10.times{|l|
        tbl[i+j+k+l] += 1
      }
    }
  }
}

while n = gets
  puts tbl[n.to_i]
end

Measured memory_bytes: 8616
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;

    repr(i, n+1){
        if((i * 108) / 100 == n){
            cout << i << endl;
            return 0;
        }
    }

    cout << ":(" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

    int N, K;
    cin >> N >> K;
    
    int ans;
    if (N == K){
        ans = 1;
    }else{
        if (K == 2){
            ans = N - 1;
        }else{
            if ((N - 1) % (K - 1) == 0){
                ans = (N - 1) / (K - 1);
            }else{
                ans = (N - 1) / (K - 1) + 1;
            }
        }
    }

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

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,c,d;
	
	scanf("%d %d %d",&a,&b,&c);
	
	if(a>b){
		d=a;
		a=b;
		b=d;
		
	}
	
	if(a>c){
		d=a;
		a=c;
		c=d;
		
	}
	
	if(b>c){
		d=b;
		b=c;
		c=d;
		
	}
	
	printf("%d %d %d\n",a,b,c);
	
	
	
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);
unordered_map<ll, int> get_primes(ll n) {
    unordered_map<ll, int> facs;
    ll n2 = n;
    for(ll i = 2; i*i <= n; i++) {
        while (n2 % i == 0) {
            facs[i] += 1;
            n2 /= i;
        }
    }
    if (n2 > 1)
        facs[n2] += 1;
    return facs;
}

vector<ll> get_facs(unordered_map<ll, int>& primes) {
    vector<ll> nums, cnt;
    for(auto p: primes) {
        nums.push_back(p.first);
        cnt.push_back(p.second);
    }
    vector<ll> ans;
    auto dfs = [&] (auto self, int d, ll cur) -> void {
        if (d == nums.size()) {
            ans.push_back(cur);
            return;
        }
        ll pre_mul = 1;
        for(int i = 0; i <= cnt[d]; i++) {
            self(self, d+1, cur*pre_mul);
            pre_mul *= nums[d];
        }
    };
    dfs(dfs, 0, 1);
    return ans;
}
int main() {
    //3140 = 2 * 2 * 5 * 157 => 3x2x2 = 11
    // 3141 = 3*3*349, backtracing: 3, 3141
    ll n; cin >> n;
    unordered_set<ll> ans;
    auto tmp = get_primes(n-1);
    for(ll num: get_facs(tmp)) {
        ans.insert(num);
        // cout << num << endl;
    }
    auto tmp2 = get_primes(n);
    auto facs = get_facs(tmp2);
    for(ll cand: facs) {
        if(cand == 1) continue;
        ll n2 = n;
        while(n2 % cand == 0) {
            n2 /= cand;
        }
        if (n2 % cand == 1) {
            ans.insert(cand);
        }
    }
    ans.erase(1);
    cout << ans.size() << endl;
    return 0;
}




Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const ll INFLL = 1001001001001001001;  // > 10^18
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

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

    int n = s.length();
    for (int i = 0; i < n-1; i++) {
        if (s[i] == s[i+1]) {
            cout << i+1 << " " << i+2 << endl;
            return 0;
        } 
    }

    for (int i = 0; i < n-2; i++) {
        if (s[i] == s[i+2]) {
            cout << i+1 << " " << i+3 << endl;
            return 0;
        } 
    }
    
    cout << -1 << " " << -1 << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <cmath>
#include <utility>
#include <string>

using namespace std;

int main(){

    int N = 0;
    cin >> N;

    int total = 0;
    int t_total = -1;
    int j = 0;

    vector<vector<int> > A;
    A.assign(2, vector<int>(N, 0));

    if(N == 1){
        for(int i = 0; i < 2; i++){
            cin >> N;
            total += N;
        }
        std::cout << total << std::endl;
        return 0;
    }

    for(int i = 0; i < 2; i++){
        for(int j = 0; j < N; j++){
            cin >> A[i][j];
        }
    }

    for(int i = 0; i < N; i++){
        j = 0;
        total = 0;
        for(j = 0; j < i; j++){
            total += A[0][j];
        }
        for(j = j - 1; j < N; j++){
            total += A[1][j];
        }   
        if(t_total < total){
            t_total = total;
        }
        
           
    }

    std::cout << t_total << std::endl;  




}

Measured memory_bytes: 256
// abc of ABC
#include <stdio.h>

int main(void){
    char s[3+1];
    scanf("%s", s);

    int abcnum[3] = {};
    int able = 1;
    for(int i = 0; s[i] != '\0'; i++){
        if(s[i] == 'a') abcnum[0]++;
        else if(s[i] == 'b') abcnum[1]++;
        else abcnum[2]++;

        if(abcnum[0] > 1 || abcnum[1] > 1 || abcnum[2] > 1){
            able = 0;
            break;
        }
    }

    printf("%s\n", (able)? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <string>
#include <string.h>
#include <iostream>
#include <stdlib.h>
using namespace std;
int T[3]={0};


int check(){
	for(int i = 0; i < 3; i++){
		if(T[i] % 2 == 0) continue;
		else return 0;
	}
	return 1;
}

void share(){
	int a = 0, b = 0, c = 0;
	a = T[0] / 2;
	b = T[1] / 2;
	c = T[2] / 2;
	T[0] = b + c;
	T[1] = a + c;
	T[2] = b + a;
}

int main(){
	for(int i = 0; i < 3; i++){
		cin >> T[i];
	}

	int ans = 0;
	while(check()){
		share();
		ans++;
		if(ans > 1000000) break;
	}
	if(ans > 1000000) cout << -1 << endl;
	else cout << ans << endl;

}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a,b,c,n=0,i;
    
    scanf("%d%d%d",&a,&b,&c);
    
    i=c;
    do{
        i=i+b+c;
        n++;
    }while(i<a);
    
    if(i==a) printf("%d\n",n);
    else printf("%d\n",n-1);
    
    return 0;
}


Measured memory_bytes: 1728
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    string s;
    cin >> s;
    int dp[13] = {};
    dp[0] = 1;
    rep(i, s.size())
    {
        int nxt[13] = {};
        if (s[i] != '?')
        {
            int n = s[i] - '0';
            rep(j, 13)
            {
                int m = (10 * j + n) % 13;
                nxt[m] += dp[j];
            }
            rep(j, 13) dp[j] = nxt[j];
            continue;
        }
        rep(j, 10)
            rep(k, 13)
        {
            int n = (10 * k + j) % 13;
            (nxt[n] += dp[k]) %= mod;
        }
        rep(j, 13) dp[j] = nxt[j];
    }
    cout << dp[5] << endl;
}

Measured memory_bytes: 512
import numpy as np


n = int(input())
table = [[0 for i in range(n+10)] for j in range(n+10)]

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y)

ab_gcd = [0 for i in range(n+10)]
for i in range(1, n+1):
    for j in range(1, n+1):
        ret = gcd(i, j)
        table[i][j] = ret
        ab_gcd[ret] += 1

table = np.array(table)
ans = 0
for i in range(n+10):
    if ab_gcd[i] != 0:
        ans += int(np.sum(table[i, :]))*ab_gcd[i]
print(ans)



Measured memory_bytes: 27620