akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(void){
  long long X, Y;
  cin >> X >> Y;

  if(llabs(X-Y) <= 1){
    cout << "Brown" << endl;
  }
  else{
    cout << "Alice" << endl;
  }
  return 0;
}


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

using namespace std;

pair<int, int> euc_gcd(int a, int b){

    int c, step = 0;

    if(a < b){
        swap(a, b);
    }

    while(b > 0){
		step++;
        c = a % b;
        a = b;
        b = c;
    }

    return make_pair(a, step);
}

int main(){

	int a, b;

	while(cin>>a>>b, (a||b)){
		
		pair<int, int> t = euc_gcd(a, b);
		cout << t.first << " " << t.second << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <string>
#include <sstream>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<ll> VL;

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

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

  string s;
  int K, N;

  cin >> N >> s >> K;
  char target = s[K-1];
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] != target) s[i] = '*';
  }
  cout << s << endl;
}


Measured memory_bytes: 256
/*
  Motto - try hard to become an expert
*/
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define INF (int)INT_MAX
#define all(v)  v.begin(), v.end()
#define endl "\n"
 
//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const int N = 3*1e5 +5 ;
const long long MOD = 998244353;
const long long inf = 1e18;
 
using namespace std;
 
ll MAXN=100001;
ll spf[100001]; 
 
ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll modFact(ll n, ll p) 
{ 
    if (n >= p) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result;  
} 
 
bool isPrime(int x)
{
    if(x%2==0)
        return 0;
    for(int i=3;i<=sqrt(x);i+=2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
 

 
void solve()
{
	int n ; 
	cin>>n ; 
	int mat[n][n-1] ;
	rep( i ,n ){
		rep(j , n-1){
			cin>>mat[i][j]  ;
			mat[i][j]--;
		}
	}
	// cout<<n<<endl;
	// rep(i  ,n){
	// 	rep(j , n-1){
	// 		cout<<mat[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }
	int index[n] = {0} ;
	bool ok = true  ;
	int day = 0  ;
	bool vis[n] ;
	int k = 0 ;
	while(ok){
		int cnt = 0 ;
		k++;
		memset(vis , false , sizeof(vis)) ;
		for(int i = 0 ; i<n ;i++){
			if(!vis[i]){
				if(index[i]!=n-1){
					if(!vis[mat[i][index[i]]]){
						if(index[mat[i][index[i]]]!=n-1){
							int adj = mat[i][index[i]] ;
							if(i==mat[adj][index[adj]]){
								vis[i] = true ;
								vis[adj] = true ;
								cnt++;
								index[i]++;
								index[adj]++;							}
						}
					}
				}
			}
		}
		// cout<<cnt<<endl;
		if(cnt==0){
			rep(i , n){
				if(index[i]!=n-1){
					cout<<-1<<endl;
					return ;
				}
			}
			break;
		}

		day++;
	}
	cout<<day<<endl;

}
 
int main() {
    // #ifndef ONLINE_JUDGE
    //     // for getting input from input.txt
    //     freopen("input.txt", "r", stdin);
    //     // for writing output to output.txt
    //     freopen("output.txt", "w", stdout);
    // #endif
    
    // ios_base::sync_with_stdio(0);
    // cin.tie(NULL);
    int t = 1;
    // cin>>t;
    while(t--)
    {
        solve();
    } 
    // cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

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

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

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

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

// 二項係数計算
int64_t COM(int64_t n, int64_t k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();
    
    int64_t N,K;
    cin >> N >> K;
    vector<int64_t> A(N);
    for ( int64_t i = 0; i < N; ++i){
        cin >> A[i];
    }
    
    sort(A.begin(),A.end());
    
    int64_t sum = 0;
    for ( int64_t i = 0; i <= N-K; ++i){
        // A[N-1-i] が最大値になる場合の数を求める
        int64_t cases = COM(N-i-1,K-1);
        //cout << A[N-1-i] << " " << cases << endl;
        sum = ( sum + cases * A[N-1-i] ) % MOD;
    }
    
    int64_t sum_min = 0;
    for ( int64_t i = 0; i <= N-K; ++i){
        // A[i] が最小値になる場合の数を求める
        int64_t cases = COM(N-i-1,K-1);
        sum_min = ( sum_min + cases * A[i] ) % MOD;
    }
    
    int64_t res = ( sum - sum_min ) % MOD;
    res = ( res + MOD ) % MOD;
    
    cout << res << endl;
    
    
    return 0;
}


Measured memory_bytes: 15908
import math
a,b = map(int, input().split())
ans = 0
for zeinuki in range(1,1001):
    if math.floor(zeinuki*0.08) == a and\
       math.floor(zeinuki*0.1)  == b:
        ans = zeinuki
        break
if ans == 0:
    print("-1")
else:
    print(ans)

Measured memory_bytes: 3060
main(){
	int W,Q,a[100],id,w,i,l,c;
	char e[2];
	for(;scanf("%d%d",&W,&Q),W;){
		memset(a,-1,sizeof(a));
		for(;Q--;){
			scanf("%s%d",e,&id);
			if(*e=='s'){
				scanf("%d",&w);
				l=0;
				c=W;
				for(i=W;i--;){
					if(a[i]==-1)
						l++;
					else
						l=0;
					if(l>=w)
						c=i;
				}
				if(c!=W){
					printf("%d\n",c);
					for(i=0;i<w;i++)
						a[c+i]=id;
				}else
					puts("impossible");
			}else{
				for(i=0;i<W;i++)
					if(a[i]==id)
						a[i]=-1;
			}
		}
		puts("END");
	}
	exit(0);
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
using namespace std;
vector<int> G[100005];
bool vis[100005];
const long long mod = 1e9 + 7;
long long dp[2][100005];
void dfs(int u) {
	dp[0][u] = dp[1][u] = 1;
	for (auto v : G[u]) {
		if (not vis[v]) {
			vis[v] = true; 
			dfs(v);
			dp[0][u] = dp[0][u] * (dp[0][v] + dp[1][v]) % mod;
			dp[1][u] = dp[1][u] * dp[0][v] % mod;
		}
	}
}
int main() {
	int N; cin >> N;
	for (int i = 0; i < N - 1; i++) {
		int x, y; cin >> x >> y;
		G[x].push_back(y);
		G[y].push_back(x);
	}
	vis[1] = true;
	dfs(1);
	cout << (dp[0][1] + dp[1][1]) % mod << endl;
}


Measured memory_bytes: 11520
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

S = input()
C = collections.Counter(S)
if (C["N"] and not C["S"]) or ((not C["N"]) and C["S"]) or  (C["W"] and not C["E"]) or ((not C["W"]) and C["E"]):
  print("No")
else:
  print("Yes")

# print(bool(((C["W"] and not C["E"]))))

Measured memory_bytes: 3444
#include <fstream>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <cassert>
#include <deque>
#include <set>
#include <map>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

const int MAX_N = 1000;

//#define LOCAL_DEBUG
int main() {
#ifdef LOCAL_DEBUG
	freopen("input.txt","r", stdin);
#endif
	int N; cin >> N;
	int a[(int)1e5];
	int cntOdd = 0;
	int cntEven = 0;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		if (a[i] % 2 == 0)
			cntEven++;
		else
			cntOdd++;
	}

	if (cntOdd % 2 == 1) {
		cout << "NO" << endl;
	}
	else {
		cout << "YES" << endl;
	}

	return 0;
}


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


int main() {
	int n;
	cin >> n;
	vector<int> h(100000);
	for(int i=0; i<n; i++){
		cin >> h.at(i);
	}
	vector<long long> cost(100000);
	for(int i=0; i<n; i++){
		cost.at(i) = 1000000000;
	}
	cost.at(0) = 0; 
	for(int i=0; i<n-1; i++){
		if(n == n-2){
			int tmp = abs(h.at(i)-h.at(i+1));
			cost.at(i+1) = min(cost.at(i+1), cost.at(i)+tmp);
			break;
		}
		int tmp1 = abs(h.at(i)-h.at(i+1));
		cost.at(i+1) = min(cost.at(i+1), cost.at(i)+tmp1);
		if(i+2 > n-1) continue;
		int tmp2 = abs(h.at(i)-h.at(i+2));
		cost.at(i+2) = min(cost.at(i+2), cost.at(i)+tmp2);
	}
	cout << cost.at(n-1) << endl;
}


Measured memory_bytes: 1408
import java.io.PrintWriter

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}


fun solve(out: PrintWriter) {
    val n = readInteger()
    val aList = readIntegerList()
    val ansList = IntArray(n)
    for (i in (n - 1) downTo 0) {
        var tmp = 0
        for (j in i until n step (i + 1)) {
            tmp += ansList[j]
        }
        tmp %= 2

        ansList[i] = if (tmp == aList[i]) 0 else 1
    }
    val ans = mutableSetOf<Int>()
    for (i in 0 until n) {
        if (ansList[i] == 1) {
            ans += (i + 1)
        }
    }
    println(ans.size)
    println(ans.joinToString(" "))
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 83396
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-04-26 20:29:51
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rev(x) greater<x>()
#define MOD 1000000007
#define INF 1000000000

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

LL modpower(LL n, LL m, LL mod)
{
    if (m == 0) {
        return 1;
    } else if (m % 2 == 0) {
        LL p = modpower(n, m/2, mod);
        return p*p % mod;
    } else {
        return n*modpower(n, m-1, mod) % mod;
    }
}

LL modinv(LL n, LL mod)
{
    return modpower(n, mod-2, mod);
}

LL modcombination(LL n, LL r, LL mod)
{
    LL ret = 1;

    for (int i = 0; i < r; i++) {
        ret *= (n-i);
        ret %= mod;
        ret *= modinv(i+1, mod);
        ret % mod;
    }

    return ret % mod;
}

int gcd(int k, int l)
{
    if (l > 0) return gcd(l, k%l);
    else return k;
}

struct UnionFind
{
    vector<int> par;

    UnionFind(int n) : par(n) {
        for (int i = 0; i < n; i++) par[i] = i;
    }

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

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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

    int sum = 0;
    vector<int> und;
    for (int i = 0; i < n; i++) {
        sum += s[i];
        if (s[i] % 10 != 0) {
            und.push_back(s[i]);
        }
    }

    if (und.size() > 0) {
        if (sum % 10 == 0) {
            sort(all(und));
            sum -= und[0];
        }
    } else {
        sum = 0;
    }

    cout << sum << endl;

    return 0;
}


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

using namespace std;

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

    int n, k;
    string s;
    cin >> n >> k >> s;
    s[k - 1] = s[k - 1] - 'A' + 'a';
    cout << s << '\n';

    return 0;
}


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

// #define set unordered_set
#define map unordered_map

using namespace std;

class UnionFind {
private:
	int size;
	int parent[40000];
	int rank[40000];

public:
	UnionFind() {}
	UnionFind(int sz) {
		init(sz);
	}
	void init(int sz) {
		size = sz;
		fill(rank, rank+sz, 0);
		for (int i = 0; i < sz; ++i) {
			parent[i] = i;
		}
	}
	int root(int n) {
		if (parent[n] == n) return n;
		return parent[n] = root(parent[n]);
	}
	void unite(int n, int m) {
		int x = root(n);
		int y = root(m);
		if (x == y) return;

		if (rank[x] < rank[y]) {
			parent[x] = y;
		}
		else if (rank[x] > rank[y]) {
			parent[y] = x;
		}
		else {
			parent[x] = y;
			++rank[y];
		}
	}
	bool isUnited(int n, int m) {
		return root(n) == root(m);
	}
};


typedef pair<int, int> P;

struct Query {
	int type, u, v;
};

typedef vector< set<int> > Graph;

const int bucket = 100;

map<int, int> make_table(set<P>& use) {
	map<int, int> res;
	set<int> s;
	for (P p : use) {
		s.insert(p.first);
		s.insert(p.second);
	}
	int n = 0;
	for (int v : s) {
		res[v] = n++;
	}
	return res;
}
Graph trim(Graph& G, set<P>& use, map<int, int>& tbl) {
	tbl = make_table(use);

	int i = 0;
	Graph res(tbl.size());
	UnionFind uf(G.size());
	for (int i = 0; i < G.size(); ++i) {
		for (int v : G[i]) {
			if ( !use.count( P(i, v) ) ) {
				uf.unite(i, v);
			}
		}
	}
	for (P p1 : tbl) {
		for (P p2 : tbl) {
			int a = p1.first, b = p2.first;
			if ( uf.isUnited(a, b) ) {
				tbl[a] = tbl[b];
			}
		}
	}
	for (P p1 : tbl) {
		for (P p2 : tbl) {
			int a = p1.first, b = p2.first;
			if ( G[b].count(a) ) {
				res[tbl[b]].insert(tbl[a]);
			}
		}
	}
	return res;
}
void unite(Graph& G, int u, int v) {
	G[u].insert(v);
	G[v].insert(u);
}
void remove(Graph& G, int u, int v) {
	G[u].erase(v);
	G[v].erase(u);
}
bool judge(Graph& G, int v, int t, vector<bool>& reached) {
	if (v == t) return true;
	reached[v] = true;
	for (int to : G[v]) {
		if ( !reached[to] ) {
			if ( judge(G, to, t, reached) ) return true;
		}
	}
	return false;
}
bool judge(Graph& G, int s, int t) {
	vector<bool> reached(G.size(), false);
	return judge(G, s, t, reached);
}

int main() {
	int N, M; cin >> N >> M;
	Query Q[40000];
	set<P> Use[40000/bucket+1];
	for (int i = 0; i < M; ++i) {
		int t, u, v; scanf("%d%d%d", &t, &u, &v);
		Q[i] = (Query){t, u, v};
	}
	for (int i = 0; i < M; ++i) {
		int type = Q[i].type, u = Q[i].u, v = Q[i].v;
		Use[i/bucket].insert( P(u, v) );
		Use[i/bucket].insert( P(v, u) );
	}
	Graph G(N);
	Graph g;
	map<int, int> tbl;
	for (int i = 0; i < M; ++i) {
		int type = Q[i].type, u = Q[i].u, v = Q[i].v;
		if (i % bucket == 0) {
			g = trim(G, Use[i/bucket], tbl);
		}
		switch (type) {
		case 1: // unite
			unite(G, u, v);
			unite(g, tbl[u], tbl[v]);
			break;
		case 2: // remove
			remove(G, u, v);
			remove(g, tbl[u], tbl[v]);
			break;
		case 3: // judge
			if ( judge(g, tbl[u], tbl[v]) ) {
				cout << "YES" << endl;
			}
			else {
				cout << "NO" << endl;
			}
			break;
		}
	}
}

Measured memory_bytes: 11776
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

int W,a,b;
cin >> W >> a >> b;
if(a > b) swap(a, b);
int l = b;
int r = a+W;
cout << max(0,l-r) << endl;

return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

int n, y;

int main(){
	scanf("%d %d", &n, &y);
	if(1000 * n > y || 10000 * n < y){
		printf("-1 -1 -1\n");
		return 0;
	}
	for(int i = y / 10000; i >= 0; i--){
		for(int j = (y - i * 10000) / 5000; j >= 0; j--){
			int k = (y - i * 10000 - j * 5000) / 1000;
			if(i + j + k == n && i * 10000 + j * 5000 + k * 1000 == y){
				printf("%d %d %d\n", i, j, k);
				return 0;
			}
		}
	}
	printf("-1 -1 -1\n");
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void){
	int m,div,i,j,k,l,x,cnt[1000],sw,ans;
	char tr[100],rec[80][1000];
	scanf("%d",&m);
	while(m!=0){
		scanf("%s",&tr);
		div=strlen(tr)-1;//div??????????????¨????????¨??????div???????????§??¨?????????????????§????????????
		if(div==0){//???????????????1?????¨??????????¨?????????????
			printf("1\n");
		}
		else{//??\?????§rec[][]?????????????????¨????????????????¨???????????????????
			i=j=0;
			while(div!=0){//?????¢??????????????????????????¢2?¨????????????????????????¢???
				for(i=0;i<strlen(tr);i++){
					rec[i][j]=tr[i];
				}
				j++;
				l=strlen(tr);
				for(i=0;i<div;i++){
					rec[i][j]=tr[i];
				}
				for(i=0;div+i!=strlen(tr);i++){
					rec[div+i][j]=tr[l-1-i];
				}
				j++;
				for(i=0;i<div;i++){
					rec[i][j]=tr[div-1-i];
				}
				for(i=0;div+i!=strlen(tr);i++){
					rec[div+i][j]=tr[div+i];
				}
				j++;
				for(i=0;i<div;i++){
					rec[i][j]=tr[div-1-i];
				}
				for(i=0;div+i!=strlen(tr);i++){
					rec[div+i][j]=tr[l-1-i];
				}
				j++;
				i=0;
				while(1){//???????????????????????????????????¢????????´??????????????\???????????¨?????????
					rec[i][j]=tr[div+i];
					i++;
					if(div+i==strlen(tr)){
						break;
					}
				}
				k=0;
				while(1){
					rec[i][j]=tr[k];
					i++;
					k++;
					if(k==div){
						break;
					}
				}
				j++;
				i=0;
				while(1){
					rec[i][j]=tr[div+i];
					i++;
					if(div+i==strlen(tr)){
						break;
					}
				}
				k=0;
				while(1){
					rec[i][j]=tr[div-1-k];
					k++;
					i++;
					if(k==div){
						break;
					}
				}
				j++;
				i=0;
				while(1){
					rec[i][j]=tr[l-1-i];
					i++;
					if(i==l-div){
						break;
					}
				}
				k=0;
				while(1){
					rec[i][j]=tr[k];
					i++;
					k++;
					if(k==div){
						break;
					}
				}
				j++;
				i=0;
				while(1){
					rec[i][j]=tr[l-1-i];
					i++;
					if(i==l-div){
						break;
					}
				}
				k=0;
				while(1){
					rec[i][j]=tr[div-1-k];
					i++;
					k++;
					if(k==div){
						break;
					}
				}
				j++;
				div--;
			}
			for(i=0;i<j;i++){//???????????????
				cnt[i]=1;
			}
			ans=0;
			for(i=0;i<j;i++){
				if(cnt[i]!=1){//?????????????????´???????£???°??????
					continue;
				}
				for(x=i+1;x<j;x++){
					sw=0;
					for(k=0;k<l;k++){
						if(rec[k][i]==rec[k][x]){
							sw++;
						}
					}
					if(sw==l){//rec[][i]??¨rec[][x]????????´????????°???strlen(tr)??????cnt[x]???0????????????
						cnt[x]=0;
					}
				}
			}
			for(i=0;i<j;i++){
				ans+=cnt[i];//cnt[]??????????????¨???????¨?????????°???
			}
			printf("%d\n",ans);
		}
		m--;
	}
	return 0;
}

Measured memory_bytes: 676
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin>>N;
  vector<int> party(N);
  for(int i=0; i<N; i++){
    int x;
    cin>>x;
    party.at(i)=x;
  }
  sort(party.begin(), party.end());
  priority_queue<int, vector<int>, greater<int>> answer;
  int sum=0;
  for(int i=party.at(0); i<=party.at(N-1); i++){
    for(int j=0; j<N; j++){
      sum+=(party.at(j)-i)*(party.at(j)-i);
    }
    answer.push(sum);
    sum=0;
  }
  cout<<answer.top()<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int lld;
lld ar[100005];
lld n;
lld dp[100005];
lld change(lld a)
{
    if(a>=n)
        return 0;
    if(a==n-1)
        return 0;
    if(dp[a]!=-1)
        return dp[a];
    else
    {
        lld c=INT_MAX,B=INT_MAX;
        if(a<n-2)
            c=change(a+2)+abs(ar[a]-ar[a+2]);
        lld b=change(a+1)+abs(ar[a]-ar[a+1]);

        lld ans=min(c,b);
        dp[a]=ans;
        return ans;
    }
}
int main()
{

    cin>>n;
    lld i,j;
    for(i=0;i<=n;i++)
        dp[i]=-1;
    for(i=0;i<n;i++)
    cin>>ar[i];
    cout<<change(0);
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n;cin>>n;
  vector<int>a(n),b(n);
  for(int i =0;i<n;i++)cin>>a[i];
   for(int i =0;i<n;i++)cin>>b[i];
  int ans=0;
  for(int i=0;i<n;i++){
  if(a[i]>b[i])ans+=a[i]-b[i];
  }
  cout<<ans;

}


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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define for_each(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
const int INF = __INT_MAX__;               // 2^31 - 1
const long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

int MOD;
long long modpow(long long m, long long p) {
    if (p == 0) return 1;
    if (p % 2)
        return m * modpow(m, p - 1) % MOD;
    else {
        long res = modpow(m, p / 2);
        return res * res % MOD;
    }
}

int main() {
    int n, p;
    cin >> n >> p;
    string s;
    MOD = p;
    cin >> s;
    reverse(all(s));
    ll ans = 0;
    if (p == 2 || p == 5) {
        rep(i, n) {
            if ((s[i] - '0') % p == 0)
                ans += n - i;
        }
    } else {
        map<int, ll> cnt;
        cnt[0]++;
        ll sum = 0;
        rep(i, n) {
            int d = (s[i] - '0') * modpow(10, i);
            sum = (sum + d) % p;
            cnt[sum]++;
        }

        rep(i, p) {
            ans += cnt[i] * (cnt[i] - 1) / 2;
        }
    }
    out(ans);
}


Measured memory_bytes: 1028
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#define ll long long
#define MOD_P 1000000007
using namespace std;

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

	for (int i = 0; i < 2; i++) {
		if (str[i] != str[i + 1]) {
			printf("Yes");
			return 0;
		}
	}

	printf("No");

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
using namespace std;

int main(){
        int a[9];
        int n;
        for(int i=0;i<9;i++){
                cin >> n;
                a[i]=n;
        }
        int N;
        cin >> N;
        for(int i=0;i<N;i++){
                cin >> n;
                for(int j=0;j<9;j++){
                        if(a[j]==n){
                                a[j]=0;
                                break;
                        }
                }

        }
        int cnt=0;
        for(int i=0;i<3;i++){
                if(a[3*i]+a[3*i+1]+a[3*i+2]==0){
                        cnt++;
                }
        }
        for(int i=0;i<3;i++){
                if(a[i]+a[i+3]+a[i+6]==0){
                        cnt++;
                }
        }
        if(a[0]+a[4]+a[8]==0||a[2]+a[4]+a[6]==0){
                cnt++;
        }
        if(cnt>=1)cout << "Yes";
        else cout << "No";

        return 0;

}


Measured memory_bytes: 256
// package app;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;
import java.util.StringJoiner;
import java.util.stream.Stream;

public class Main {

    public static void main(final String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        // long u = sc.nextLong();
        // long D = sc.nextLong();
        // long K = sc.nextLong();

        int N = sc.nextInt();
        int L = sc.nextInt();

        int excludeApple = 0;
        if (0 < L)
            excludeApple = 1;
        else
            excludeApple = Math.min(N, Math.abs(-1 + L));

        int sum = 0;
        for (int i = 1; i <= N; i++) {
            if (excludeApple == i)
                continue;

            sum += i - 1 + L;
        }

        System.out.println(sum);
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    long long x=1000;
    for(int i=0;i<n-1;i++)if(a[i]<a[i+1])x=x%a[i]+(x/a[i])*a[i+1];
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>
int main(int argc, const char * argv[]) {
    char s[100],p[100],c[201];
    scanf("%s",s);
    scanf("%s",p);
    strcat(c,s);
    strcat(c,s);//?????¢???????????????????????¨????????¨???
    if(strstr(c,p)!='\0'){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 532
#include<bits/stdc++.h>
using namespace std;
#define vite ios_base::sync_with_stdio(false); cin.tie(NULL);
int main()
{
    vite;
    long long int t;
    cin >> t;
    t = t % 10;
    if(t==2||t==4||t==7||t==9||t==5)
        cout << "hon";
    else if(t==0||t==1||t==6||t==8)
        cout << "pon";
    else
        cout << "bon";
    return 0;
}

Measured memory_bytes: 3652
package main
import "fmt"
func main() {
  var h,w int
  fmt.Scan(&h,&w)
  var c [][]int = make([][]int,10)
  for i:=0;i<10;i++ {
    c[i] = make([]int,10)
    for j:=0;j<10;j++ {
      fmt.Scan(&c[i][j])
    }
  }
  var m int
  a := map[int]int{}
  for i:=0;i<h*w;i++ {
    fmt.Scan(&m)
    a[m]++
  }
  x := map[int]int{1:0}
  m = c[0][1]
  for i:=2;i<10;i++ {
    if m > c[i][1] {
      m = c[i][1]
    }
  }
  for i:=0;i<10;i++ {
    if c[i][1] == m {
      x[i] = m
    }
  }
  for len(x) != 10 {
    y := map[int]int{}
    for i:=0;i<10;i++ {
      if _,ok := x[i];ok { continue }
      m = 1001
      for k,v := range x {
        if m > c[i][k] + v { m = c[i][k] + v }
      }
      y[i] = m
    }
    m = 1001
    for _,v := range y {
      if m > v { m = v }
    }
    for k,v := range y {
      if m == v { x[k] = m }
    }
  }
  m = 0
  for i:=0;i<10;i++ {
    m += a[i]*x[i]
  }
  fmt.Println(m)
}

Measured memory_bytes: 2560
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N = int(sys.stdin.buffer.readline())
W = [sys.stdin.buffer.readline().decode().rstrip() for _ in range(N)]

ok = len(set(W)) == len(W)
for s, t in zip(W, W[1:]):
    ok &= s[-1] == t[0]
if ok:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 13544
import sys
readline=sys.stdin.readline

N=int(readline())
A=list(map(int,readline().split()))

from collections import defaultdict
dic=defaultdict(int)

for i in range(len(A)):
  dic[A[i]]+=1
  
all=0
for v in dic.values():
  all+=v*(v-1)//2
  
for i in range(len(A)):
  print(all-(dic[A[i]]-1))

Measured memory_bytes: 24988
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < (n);i++)
#define lint long long
const lint mod=1e9+7;
const lint inf=2.19e15+1;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}

signed main(){
    int x;
    cin >> x;
    if (x >= 30){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3620
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))

    visited = [0] * (N+1)
    seq = []

    step = 0
    current = 1

    n1 = n2 = 0
    while(step<len(A)):
        #print(visited)
        seq.append(current)
        step += 1
        visited[current] = step
        next_pos = A[current-1]
        if visited[next_pos]>0:
            n1 = visited[next_pos]
            n2 = step - n1 + 1
            seq.append(next_pos)
            break
        current = next_pos

    #print(n1, n2)
    #print(n1-1, ((K-(n1-1))%n2))
    #print(seq)
    if n1+n2<=K:
        print(seq[n1-1+((K-(n1-1))%n2)])
    else:
        print(seq[K])

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 32388
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <set>
#include <cmath>
#include <vector>
#include <ctime>
#include <queue>
#include <sstream>
#include <utility>
#include <bitset>
#include <stack>

using namespace std;

#define MP make_pair 
#define PB push_back 
#define INF (1000000007) 
#define eps 1e-8
#define MOD (1000003)
#define IOS ios::sync_with_stdio(false)

typedef pair<int,int> pii ;
typedef pair<double,double> pdd ;
typedef long long ll ;

ll n,e,t;
ll dp[100005],p[100005];
ll mx=1e18;
multiset<ll>s;

int main()
{
	IOS;
	cin>>n>>e>>t;
	for(int i=1;i<=n;i++) cin>>p[i];
	dp[0]=0;
	ll pos=1;
	for(ll i=1;i<=n;i++)
	{
		s.insert(dp[i-1]);
		while(pos<=i)
		{
			if((p[i]-p[pos])*2>t) 
			{
				mx=min(dp[pos-1]-p[pos]*2,mx);
				s.erase(s.find(dp[pos-1]));
				pos++;
			}
			else break;
		}
		dp[i]=min(*s.begin()+t,mx+2*p[i]);
	}
	cout<<dp[n]+e;
	return 0;
}

Measured memory_bytes: 3840
#include <algorithm>
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
#define lambda(RES_TYPE, ...) (function<RES_TYPE(__VA_ARGS__)>)[&](__VA_ARGS__) -> RES_TYPE
#define method(FUNC_NAME, RES_TYPE, ...) function<RES_TYPE(__VA_ARGS__)> FUNC_NAME = lambda(RES_TYPE, __VA_ARGS__)
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
  method(input,set<int>){
    int n = in();
    set<int> s;
    rep(_,n)s.emplace(in());
    return s;
  };
  set<int> x = input();
  set<int> y = input();
  set<int> ans;
  set_difference(all(x),
                 all(y),
                 inserter(ans,ans.end()));
  foreach(i,ans){
    cout << i << endl;
  }
}



Measured memory_bytes: 31296
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n,tot;
int a[105];
int main(){
    scanf("%d%d",&n,&tot);
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    int ans=0;
    for(int i=0;i<n;i++)
        if(a[i]<=tot){
            ans++;
            tot-=a[i];
        }
        else{
            tot=0;
            break;
        }
    if(tot) ans--;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
//Moh_K_Imar .......
//28/08/2020  ... 11,25.
//Ya Rab....
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
int main(){
    ll x,a;
    cin>>x>>a;
    if(x<a)cout<<0<<endl;
    else cout<<10<<endl;

    return 0;
}



Measured memory_bytes: 3632
#include <cassert>
#include <iostream>

__attribute__ ((constructor))
void faster_io() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
}

int main() {
  int n, x, t;
  std::cin >> n >> x >> t;
  t *= (n+x-1) / x;
  std::cout << t << '\n';
}

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

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static long LINF = 1L << 55;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long n = in.nextLong();
			out.println(keta(n, -2));

		}

		String keta(long num, long mod) {

			if (num == 0) {
				return "0";
			}

			StringBuilder sb = new StringBuilder();
			while (num != 0) {
				if (num % mod == 0) {
					sb.append('0');
				} else {
					sb.append('1');
					num -= 1;
				}
				num /= mod;
			}

			return sb.reverse().toString();
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public int[] nextIntArrayDec(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt() - 1;
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public long[] nextLongArrayDec(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong() - 1;
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 22996
def solve n, r
  cards = (1..n).to_a
  r.times do
    p, c = gets.chomp.split
    p, c = p.to_i, c.to_i
    pl = n-c-p+1
    c.times do
      cards.push(cards.delete_at(pl))
   end
  end
  puts cards.last
end

loop do
  n, r = gets.chomp.split
  if n=='0' && r=='0'
    break
  end
  solve(n.to_i, r.to_i)
end

Measured memory_bytes: 8668
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//ここまでテンプレ
int main(){
	int H,W;
	cin>>H>>W;
	int ans=0;
	for(int i=0;i<H;i++){
		string S;
		cin>>S;
		for(int j=0;j<S.size();j++){
			if(S[j]=='#')
				ans++;
		}
	}
	if(ans==H+W-1)
		cout<<"Possible"<<endl;
	else
		cout<<"Impossible"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;
const int k = 50;

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

  char g[k * 2][k * 2];
  rep(i, k) {
    rep(j, k * 2) {
      g[i][j] = '#';
    }
  }
  FOR(i, k, k * 2) {
    rep(j, k * 2) {
      g[i][j] = '.';
    }
  }

  int y = 0, x = 0;
  rep(i, a - 1) {
    g[y][x] = '.';
    x += 4;
    if (x >= 100) {
      y++;
      x -= 98;
    }
  }

  y = 51, x = 0;
  rep(i, b - 1) {
    g[y][x] = '#';
    x += 4;
    if (x >= 100) {
      y++;
      x -= 98;
    }
  }

  cout << 100 << " " << 100 << endl;
  rep(i, k * 2) {
    rep(j, k * 2) {
      cout << g[i][j];
    }
    cout << endl;
  }


  
  return 0;
}

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

int main() {
    int n, k;
    cin >> n >> k; k--;
    int h[n];
    rep(i, n) cin >> h[i];
    sort(h, h+n);

    int ans = 1e9;
    rep(i, n-k) {
        ans = min(ans, h[i+k] - h[i]);
    }

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


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

int main()
{
    long double l; cin >> l;
    long double ans = (l/3)*(l/3)*(l/3);
    cout << fixed << setprecision(10) << ans << endl;
}

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

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

int main(){
	
	int n , x , y ;
	char d ;
	int m , k , dir;
	int nx , ny , count ;
	
	while(1){
		cin >> n ;
		if( n==0 ) break;
		
		for( int i=0 ; i<n ; i++ ){
			cin >> x >> y ;
			map[x][y] = 1 ;
		}
		
		cin >> m ;
		nx = 10 ;
		ny = 10 ;
		count = 0 ;
		
		for( int i=0 ; i<m ; i++ ){
			cin >> d >> k ;
			if( d == 'N' ) dir = 0 ;
			else if( d == 'E' ) dir = 1 ;
			else if( d == 'S' ) dir = 2 ;
			else if( d == 'W' ) dir = 3 ;
			
			for( int j=0 ; j<k ; j++ ){
				nx += dx[dir] ;
				ny += dy[dir] ;
				if( map[nx][ny] == 1 ){
					count++;
					map[nx][ny] = 0 ;
				}
			}
		}
		
		if( count == n ) cout << "Yes" << endl ;
		else {
			cout << "No" << endl ;
			
			for( int i=0 ; i<21 ; i++ )
				for( int j=0 ; j<21 ; j++ )
					map[i][j] = 0;
		}
	}
	
return 0;
}

Measured memory_bytes: 1152
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
  ll n;
  cin>>n;
  for(ll i=1;i<=3500;i++){
      for(ll j=1;j<=3500;j++){
        if((4*i*j-n*i-n*j)<=0)continue;
           if((n*i*j)%(4*i*j-(n*i+n*j))==0){
                  cout<<i<<" "<<j<<" "<<(n*i*j)/(4*i*j-n*i-n*j)<<endl;
                  return 0;
           }
      }
    }
}

Measured memory_bytes: 256
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
import random
J=int(1e9)+7

###############################################################################\n=17
x=int(input())
if x==0:
    print(1)
else:
    print(0)

Measured memory_bytes: 76708
from itertools import permutations


def main():
    n, m = map(int, input().split())
    graph = [[] for _ in range(n)]
    for _ in range(m):
        a, b = map(lambda x: int(x) - 1, input().split())
        graph[a].append(b)
        graph[b].append(a)
    answer = 0
    for p in permutations([i for i in range(n)]):
        if p[0] != 0:
            continue
        if all(p[i] in graph[p[i - 1]] for i in range(1, n)):
            answer += 1
    print(answer)


if __name__ == '__main__':
    main()



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

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

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{
    int n, k, cnt = 0;
    cin >> n >> k;

    while (n) {
        cnt += 1;
        n /= k;
    }
    cout << cnt << endl;
    return 0;
}



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

int main(void){
  double S = 0.0, fx, fy, n1x, n1y, n2x, n2y;
  scanf("%lf,%lf", &fx, &fy);
  scanf("%lf,%lf", &n1x, &n1y);
  while(scanf("%lf,%lf", &n2x, &n2y) != EOF){
    double a, b, c, z;
    a = sqrt((n1x - fx) * (n1x - fx) + (n1y - fy) * (n1y - fy));
    b = sqrt((n2x - n1x) * (n2x - n1x) + (n2y - n1y) * (n2y - n1y));
    c = sqrt((fx - n2x) * (fx - n2x) + (fy - n2y) * (fy - n2y));
    z = (a + b + c) / 2;
    S += sqrt(z * (z - a) * (z - b) * (z - c));
    n1x = n2x; n1y = n2y;
  }
  printf("%.6lf\n", S);
  return 0;
}

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

int main()
{
  int X;
  cin >> X;
  
  for (int A = -1000; A < 1000; A++)
  {
    ll A5 = 1;
    rep(i, 5)
    {
      A5 *= A;
    }
    
    for (int B = -1000; B < 1000; B++)
    {
      ll B5 = 1;
      rep(i, 5)
      {
        B5 *= B;
      }
      
      if (X == (A5 - B5))
      {
        printf("%d %d\n", A, B);
        
        return 0;
      }
      
    }
  }

  return 0;
}

Measured memory_bytes: 3760
X,K,D = list(map(int,input().split()))
x = abs(X)
a = abs(X)//D
b = x - D*a
# print(a,b)
if a  > K:
    print(abs(x-D*K))
else:
    if (K-a) %2 ==0:
        print(abs(b))
    else:
        print(abs(abs(b)-D))

Measured memory_bytes: 9184
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iomanip>
#include <vector>
#include <stack>
#include <string>
#include <bitset>
#include <queue>
#include <iostream>
#include <cmath>
#define cz size_t
#define fx(x) << fixed;cout << setprecision(x)
#define u unsigned
#define ll long long
using namespace std;
int a, n, in, r, t, c = 0, k, mx, b, j = 1, m, l, y, rd;
double pi = 3.1415926535;
vector<int > f;
vector<vector<int>> g;
bitset<13> bt(0x0);
string s;
bool ch = true;
stack<cz> q, ans;
vector<bool> used;

int main()
{
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(false);
	//freopen("aquarium.out", "w", stdout); freopen("aquarium.in", "r", stdin);
	cin >> n;
	cout fx(3) << n * pi * 2;
	return 0;
}





Measured memory_bytes: 3852
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0

for i in range(N):
    ans += min(A[i], B[i])
    B[i] -= min(A[i], B[i])
    ans += min(A[i+1], B[i])
    A[i+1] -= min(A[i+1], B[i])
print(ans)

Measured memory_bytes: 18624