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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
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(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<int>A(N), B(N); rep(i, 0, N) { cin >> A[i] >> B[i]; }

	vector<pii>v(N);
	rep(i, 0, N) {
		v[i].first = B[i];
		v[i].second = A[i];
	}
	sort(all(v));

	int t = 0;
	bool f = true;
	rep(i, 0, N) {
		t += v[i].second;
		if (t > v[i].first) {
			f = false;
		}
	}
	Yes(f);

	return 0;
}


Measured memory_bytes: 6528
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <queue>

using namespace std;
const int maxn = 200005;
typedef long long LL;

int n,a[maxn];LL s[maxn],ans;
LL Abs(LL x) {return x>0?x:-x;}
int main()
{
	#ifdef LOCAL_JUDGE
		freopen("pile.in","r",stdin);
		freopen("pile.out","w",stdout);
	#endif
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=1;i<=n;i++) s[i]=s[i-1]+a[i];
	ans=Abs(s[n]-2ll*s[1]);
	for (int i=2;i<n;i++)
		ans=min(ans,Abs(s[n]-2ll*s[i]));
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 2560
use std::io;
//use std::collections::HashMap;
//use std::collections::BinaryHeap;
//use std::collections::HashSet;
//use std::mem; // mem::swap(&mut x,&mut y);
//use std::cmp; // cmp::max,cmp::min

// Rust memo: https://hackmd.io/i0lQY1OKTDW1t66TECOmiw?both

#[allow(dead_code)]
fn read_line() -> String{
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn read_charvec() -> Vec<char>{
    read_line().chars().collect()
}

#[allow(dead_code)]
fn read_ints() -> Vec<i64>{
    let s = read_line();
    let split:Vec<&str> = s.split(" ").collect();
    split.iter().map(|&x| x.to_string().parse().unwrap()).collect()
}

#[allow(dead_code)]
fn read_int() -> i64{
    read_ints()[0]
}

#[allow(dead_code)]
fn reverse(s: &String) -> String{
    s.chars().rev().collect::<String>()
}

#[allow(dead_code)]
fn read_lines(n:i64) -> Vec<String>{
    let mut xs = Vec::new();

    for _i in 0..n{
        xs.push(read_line());
    }

    xs
}

#[allow(dead_code)]
fn read_ints2(n:i64) -> Vec<i64>{
    read_lines(n).iter().map(|x| x.parse().unwrap()).collect()
}

#[allow(dead_code)]
fn arange(start:i64,end:i64,step:i64) -> Vec<i64>{
    let mut ret = Vec::new();
    let mut i = start;

    while i < end{
        ret.push(i);
        i += step;
    }

    ret
}

#[allow(dead_code)]
const DXS : [i64; 4] = [0,0,1,-1];
#[allow(dead_code)]
const DYS : [i64; 4]  = [1,-1,0,0];
#[allow(dead_code)]
const INF : i64 = 999999999;

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

fn rotate(t:&mut Vec<char>){
    let c = t.remove(0);
    t.push(c);
}

fn main(){
    let s : Vec<char> = read_line().chars().collect();
    let mut t : Vec<char> = read_line().chars().collect();
    
    for _ in 0..t.len(){
        rotate(&mut t);
        if s == t{
            println!("Yes");
            return;
        }
    }
    println!("No");    
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N=in();
	auto A=vecin<ll>(N);
	vector<ll> B(N,0);
	REP(i,N){
		B[(i+1)%N] = 2LL*A[i]-B[i];
	}
	ll H = B[0]/2LL;
	B[0]=0;
	REP(i,N){
		if((i%2)) B[i]-=H;
		else B[i]+=H;
	}

	PRINTALL(B);
	return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
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; }
//end



int main(){
   string s; cin>>s;
   if(s.size()!=26){
      rep(i,0,26)if(!count(ALL(s),(char)('a'+i))){
         s+=(char)('a'+i); cout<<s<<endl; return 0;
      }
   }
   else{
      string t=s;
      if(!next_permutation(ALL(s))){puts("-1"); return 0;}
      rep(i,0,s.size()){
         cout<<s[i];
         if(s[i]!=t[i])return 0;
      }
   }
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN
#define INF         100000000000000000
#define PI          3.1415926535897932384626433832795l



#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"


// ll mod = 1000000007;
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)






// struct mycomp {
//     bool operator() (const pair<int,int> &a, const pair<int,int> &b) const{
//         if (a.second-a.first != b.second-b.first)
//         return (a.second-a.first > b.second-b.first);
//         return a.first < b.first;
//     }
// };



/////////////////////GCD//////////////////////
ll gcd(ll a, ll b)
{
	if(b==0) return a;
	return gcd(b, a%b);
}


ll extended_gcd(ll a, ll b, ll& x, ll& y)
{
	if(b==0)
	{
		x=1;
		y=0;
		return a;
	}
	ll x1, y1;
	ll d = extended_gcd(b, a%b, x1, y1);
	x=y1;
	y=x1-y1*(a/b);
	return d;
}

////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}	
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}

////////////////////BINARY EXPONENTIATION///////////////////////
ll bin_exp(ll a, ll b, ll mod)
{
	ll ans = 1;
	while(b)
	{
		if(b%2)
		{
			b--;
			ans = (ans%mod*a%mod)%mod;
		}
		b/=2;
		a = (a%mod*a%mod)%mod;
	}
	return ans;
}


///////////////////////////BFS//////////////////////////////////
void bfs(vector<int>& distance, vector<int> a[], vector<bool>& visited, int u, vector<int>& parent)
{
	visited[u]=true;
	parent[u]=-1;
	distance[u]=0;
	queue<int> q;

	q.push(u); 
    while (!q.empty()) { 
  
        int f = q.front(); 
        q.pop(); 
  		for(int i =0; i < a[f].size(); i++)
  		{
  			if(visited[a[f][i]]==false)
  			{
  				distance[a[f][i]]=distance[f]+1;
  				parent[a[f][i]]=f;
  				visited[a[f][i]]=true;
  				q.push(a[f][i]);
  			}
  		}
    } 

}

void solve()
{

}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	int a, b;
	cin>>a>>b;
	if(b==1)
	{ 
		p(0);
		return 0;
	}
	int sum = 0, i = 0;
	while(true)
	{
		if(sum+a>=b)
		{
			i++;
			break;
		}
		else
			sum+=(a-1);
		i++;
	}
	p(i);
	return 0;
}	

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
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; cin >> n;

    for (int x = 1; x < 50000; x++) {
        if ((int)floor(x * 1.08) == n) {
            cout << x << endl;
            return 0;
        }
    }

    cout << ":(" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for( int i=a; i<b; i++ )
#define REP(i,n) rep(i,0,n)
using lli = long long int;
using ulli = unsigned long long int;
typedef pair<lli,lli> P;

struct edge{ int u, v, cost; };
struct DirectedGraph
{
  int vertex_num;
  int edge_num;
  vector<edge> edge_list;
  vector< vector<int> > adj_list;
};

void displayVector(vector<lli> v)
{
	lli n = v.size();
	REP(i,n){
		cout << v[i] << " " ;
	}
	cout << endl;
}


int main(){
	int n, k; cin >> n >> k;
	vector<int> p(n);
	REP(i, n){ cin >> p[i]; }

	sort(p.begin(), p.end() );
	int res = 0;
	REP(i,k){ res += p[i]; }
	cout << res << endl;

  return 0;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
int n,a[101000],dep[101000];
vector<int> e[101000];
void dfs(int x){
	vector<int> p;
	for(int v:e[x]){
		dfs(v);
		p.push_back(dep[v]);
	}
	int ans=0;
	sort(p.begin(),p.end(),greater<int>());
	for(int i=0;i<p.size();i++)
		ans=max(ans,i+1+p[i]);
	dep[x]=ans;
}
int main(){
	read(n);
	for(int i=2;i<=n;i++)
		read(a[i]),e[a[i]].push_back(i);
	dfs(1);
	cout<<dep[1]<<'\n';
	return 0;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
string str;
int ans,tmp;
int p(int n){
	int p=n-tmp;
	if(p%3==2) tmp=1;
	else tmp=0;
	return (ceil((p)*2.0/3));
}
int main(){
	cin>>str;
	int j=1;
	for(int i=1;i<str.length();i++){
		if(str[i]==str[i-1]){
			j++;continue;
		}
		ans+=p(j);
		j=1;
		
	}
	ans+=p(j);
	cout<<ans-tmp;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int n,k,ans=0;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        int p;
        cin>>p;
        ans+=min(p,k-p);
    }
    cout<<ans*2;
}


Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S=ST()
    print("x"*len(S))
if __name__ == '__main__':
    main()

Measured memory_bytes: 6028
#include <stdio.h>

int main(){
    char str[11];
    int i;

    scanf("%s",str);

    i=0;
    if(str[0]=='Y'&&str[1]=='A'&&str[2]=='K'&&str[3]=='I'){
        i=1;
    }

    puts(i?"Yes":"No");

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void pre(){


}
 
void solve(){
 
 
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	pre();

    int x,y,a,b,c;cin>>x>>y>>a>>b>>c;
    vector<ll > p(a,0), q(b,0), r(c,0), s;
    rep(i,a)cin>>p[i];
    rep(i,b)cin>>q[i];
    rep(i,c)cin>>r[i];
    sort(all(p)), reverse(all(p));
    sort(all(q)), reverse(all(q));
    sort(all(r)), reverse(all(r));
    rep(i,x)s.pb(p[i]);
    rep(i,y)s.pb(q[i]);
    sort(all(s)), reverse(all(s));
    repA(i,1,x+y-1)s[i]+=s[i-1];
    repA(i,1,c-1)r[i]+=r[i-1];
    ll mx=s[x+y-1];
    rep(i,min(c,x+y)){
        if(x+y-1-i-1>=0) mx=max(mx, s[x+y-1-i-1]+r[i]);
        else mx=max(mx, r[i]);
    }
    cout<<mx<<endl;


	return 0;
}
 



Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main() {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);

    int MAX = max({a, b, c});
    int sum = a + b + c;
    int ans = 0;

    // 3 * MAX に全ての数を揃えようとする。どの操作をしても総和は2ずつ増えるので3 * MAX - sumの偶奇によって操作が変わる。
    // 偶数だったら揃う。奇数だったら最大値を1加算して操作する。
    if((3 * MAX - sum) % 2 == 0) {
        ans = (3 * MAX - sum) / 2;
    }
    else ans = (3 * (MAX + 1) - sum) / 2;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 3832
#include<bits/stdc++.h>
using namespace std;
const int N = 1005, P = 1e9 + 7;
int h, w, num, o1, o2, s, s1, s2;
using ll = long long;
ll k;
char m[N][N];

int qp (int a, ll b) {
	int c = 1; for (; b; b >>= 1, a = 1ll * a * a % P) if (b & 1) c = 1ll * c * a % P; return c;
}

struct Matrix {
	int T[2][2];
	Matrix () { T[0][0] = T[0][1] = T[1][0] = T[1][1] = 0; }
}S, T;

void Mul (Matrix &CC, const Matrix &A, const Matrix &B) {
	static Matrix C;
	C.T[0][0] = (1ll * A.T[0][0] * B.T[0][0] + 1ll * A.T[0][1] * B.T[1][0]) % P;
	C.T[0][1] = (1ll * A.T[0][0] * B.T[0][1] + 1ll * A.T[0][1] * B.T[1][1]) % P;
	C.T[1][0] = (1ll * A.T[1][0] * B.T[0][0] + 1ll * A.T[1][1] * B.T[1][0]) % P;
	C.T[1][1] = (1ll * A.T[1][0] * B.T[0][1] + 1ll * A.T[1][1] * B.T[1][1]) % P;
	CC = C;
}

void mqp (const Matrix &AA, Matrix &CC, ll b) {
	static Matrix A, C;
	C = A = AA; --b;
	for (; b; b >>= 1, Mul(A, A, A)) if (b & 1) Mul(C, C, A);
	CC = C;
}

int main () {
	scanf("%d%d%lld", &h, &w, &k);
	if (k <= 1) return puts("1"), 0; --k;
	for (int i = 1; i <= h; ++i) {
		scanf("%s", m[i] + 1);
		for (int j = 1; j <= w; ++j) if (m[i][j] == '#') {
			++num;
			if (j > 1 && m[i][j - 1] == '#') ++s1;
			if (i > 1 && m[i - 1][j] == '#') ++s2;
		}
	}
	for (int i = 1; i <= h; ++i) if (m[i][1] == '#' && m[i][w] == '#') ++o1;
	for (int i = 1; i <= w; ++i) if (m[1][i] == '#' && m[h][i] == '#') ++o2;
	if (o1 > o2) o1 ^= o2 ^= o1 ^= o2, s = s1; else s = s2;
	if (o1) return puts("1"), 0;
	if (!o2) return printf("%d\n", qp(num, k)), 0;
	T.T[0][0] = o2; T.T[1][0] = s; T.T[1][1] = num;
	S.T[0][0] = 0; S.T[0][1] = 1;
	mqp(T, T, k);
//	for (int i = 1; i <= k; ++i) 
//	Mul(S, S, T);
	Mul(S, S, T);
	printf("%d\n", (S.T[0][1] - S.T[0][0] + P) % P);
	return 0;
}
/*
5 5 10000000000000000
#.#.#
#####
.###.
#####
#.#.#
*/

Measured memory_bytes: 1788
import java.util.Scanner;
class Main
    {
        public static void main(String []args)
        {
            Scanner scan = new Scanner(System.in);
            int N = scan.nextInt();
            int arr[] = new int[N];
            for(int i = 0;i<N;i++)
            {
                arr[i] = scan.nextInt();
            }
            int sum = 0;
            for(int i =0;i<N;i++)
            {
                sum  += arr[i];
            }
            int a = sum/N;
            int b = a+1;
            int aa = 0;
            int bb = 0;
            for(int i =0;i<N;i++)
            {
                aa += (a-arr[i])*(a-arr[i]);
                bb += (b-arr[i])*(b-arr[i]);
            }
            int ans;
            if(aa<bb)
            {
                ans =  aa;
            }
            else
            {
                ans = bb;
            }
            System.out.println(ans);
        }
    }


Measured memory_bytes: 24404
#include<stdio.h>

int main(){
  int a,b;
  int res=0;;

  scanf("%d %d", &a, &b);

  for(int c=1;c<4;c++)
    res |= (((a*b*c)%2)!=0);

  if(res){
    printf("Yes\n");
  }else{
    printf("No\n");
  }

  return 0;
}



Measured memory_bytes: 128
#include <iostream>
using namespace std;
#define ll long long

int main () {
  ll N, W;
  cin >> N >> W;
  ll v[N + 1], w[N + 1];
  ll dp[N + 1][W + 1];
  for (ll i = 0; i <= N; i++) {
    if (i != 0) cin >> w[i] >> v[i];
    for (ll j = 0; j <= W; j++) dp[i][j] = 0;
  }
  for (ll i = 1; i <= N; i++) {
    for (ll j = 0; j <= W; j++) {
      if (j - w[i] >= 0) {
        dp[i][j] = max(dp[i - 1][j - w[i]] + v[i], dp[i - 1][j]);
      }
      else {
        dp[i][j] = dp[i - 1][j];
      }
    }
  }
  cout << dp[N][W] << endl;
}


Measured memory_bytes: 79104
n,k,q = map(int, input().split())
a = [0] * q
for i in range(q):
    a[i] = int(input())
p = [k-q] * n
for j in range(q):
    p[a[j]-1] = p[a[j]-1] + 1

for i in range(n):
    if p[i] < 1:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 10456
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

template<typename Abel> struct BIT_max {
    const Abel UNITY_MAX = 0;
    vector<Abel> dat;
    BIT_max(int n) : dat(n, UNITY_MAX) { }  // [0, n)
    inline void update(int i, Abel x) {
        while (i < dat.size()) { chmax(dat[i], x); i |= i + 1; }
    }
    inline Abel get(int i) {            // [0, i]
        Abel res = UNITY_MAX;
        while (i >= 0) { chmax(res, dat[i]); i = (i & (i + 1)) - 1; }
        return res;
    }
    Abel operator[](int i) { return max(i, i + 1); }
    friend ostream& operator<<(ostream& os, BIT_max<Abel> &bit) {
        for (int i = 0; i < bit.dat.size(); i++) os << bit[i] << " ";
        return os;
    }
};

template<typename T>
int compressed(vector<T> &a) {
    vector<T> b = a;
    sort(begin(b), end(b)); b.erase(unique(begin(b), end(b)), end(b));
    for (T &ai: a) ai = lower_bound(begin(b), end(b), ai) - begin(b);
    return b.size();
}

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (int &ai: a) cin >> ai;
    int sz = compressed(a);
    BIT_max<int> bit(sz);
    for (int ai: a) bit.update(ai, bit.get(ai - 1) + 1);
    cout << bit.get(sz - 1) << endl;
    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define VAL 100000
#define ll  long  long
#define INF 10000000000000000LL
#define pll pair<long long , long long>
const int MAX=5e6+9;
const ll MOD=1e9+7;
const int TOT_PRIMES=19;
const int MAX_A=70;
using namespace std;

int main() 
{
    int n;
    cin>>n;
    int l[n+1];
    for(int i=0;i<n;i++)
        cin>>l[i];
    int cnt=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if (l[i]==l[j] or l[i]==l[k] or l[j]==l[k])
                    continue;
                if((l[i]+l[j]>l[k]) and (l[j]+l[k]>l[i]) and (l[i]+l[k]>l[j])){
                    cnt =cnt+1;
                //    cout<<l[i]<<l[j]<<l[k]<<endl;
                }
            }
        }
    }
    cout<<cnt;


}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

#define         pb         push_back
#define         sf(x)      scanf("%d",&x)
#define         sfl(x)     scanf("%lld",&x)
#define         pf(x)      printf("%d\n",x)
#define         pfl(x)     printf("%lld\n",x)
#define         endl       '\n'
#define         pii        pair<int,int>
#define         mapii      map<int,int>
#define         mapll      map<ll,ll>
#define         mapci      map<char,int>
#define         mapcl      map<char,ll>
#define         mapsi      map<string,int>
#define         mapsl      map<string,ll>
#define         pll        pair<ll,ll>
#define         vi         vector<int>
#define         vl         vector<ll>
#define         vd         vector<double,double>
#define         all(c)     c.begin(),c.end()
#define         F          first
#define         S          second
#define         mp         make_pair
#define        ftc(x)      cerr << #x << ": " << x << " " << endl;
#define         PI         acos(-1)
#define         lcm(a,b)   ((a*b)/__gcd(a,b))
#define        optimize    ios_base::sync_with_stdio(false);cin.tie(NULL);
#define        sqr(a)       ((a)*(a))
#define         MOD    1000000007


inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

int main()
{
    ll ans = 0,u,v,n,i;
    cin >> n;

    for(i=1;i<=n;i++)
    {
        ans += (n-i+1)*i;
    }

    for(i=0;i<n-1;i++)
    {
        cin >> u >> v;

        if(u > v)swap(u,v);

        ans -= (u*(n-v+1));
    }

    cout << ans << endl;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;

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; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()


int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep (i, n) {
        cin >> a[i];
    }
    ll z = 0;
    rep (i, n) {
        z ^= a[i];
    }
    rep (i, n) {
        ll ans = z ^ a[i];
        if (i) cout << " ";
        cout << ans;
    }
    cout << endl;
}




Measured memory_bytes: 4684
from time import time
key = 1
rnd_mod = 12345678901234567891
rnd_x = 9876543210987654321 + 1234567890123456789 * key % rnd_mod
def rnd():
    global rnd_x
    rnd_x = rnd_x**2 % rnd_mod
    return (rnd_x>>10) % (1<<40)
def randrange(a, b=-1):
    if b > 0: return randrange(b-a) + a
    return rnd() % a

def calc():
    s = 0
    last = [-1] * 26
    for i, t in enumerate(A):
        s += S[i][t]
        last[t] = i
        for j, c in enumerate(C):
            s -= c * (i - last[j])
    return s

sTime = time()
D = int(input())
C = [int(a) for a in input().split()]
S = [[int(a) for a in input().split()] for _ in range(D)]
A = [randrange(26) for _ in range(D)]
# A = [0] * D
# A = [0, 16, 12, 13, 12]
# A = [0, 16, 12, 13, 19]
ans = calc()
# print("ans =", ans)
while time() - sTime < 1.8:
    d = randrange(D)
    i = A[d]
    for k in range(d)[::-1]:
        if A[k] == i:
            prev = k
            break
    else:
        prev = -1
    for k in range(d + 1, D):
        if A[k] == i:
            prev_ne = k
            break
    else:
        prev_ne = D
    for j in range(26):
        t = S[d][j] - S[d][i]
        for k in range(d)[::-1]:
            if A[k] == j:
                new = k
                break
        else:
            new = -1
        for k in range(d + 1, D):
            if A[k] == j:
                new_ne = k
                break
        else:
            new_ne = D
        t += C[j] * (d - new) * (new_ne - d) - C[i] * (d - prev) * (prev_ne - d)
        if t > 0:
            A[d] = j
            ans += t
            prev, prev_ne = new, new_ne
            i = j
            if 0:
                print("A =", A)
                print("ans =", ans)
                print("calc =", calc())
            
            

print(*[a + 1 for a in A], sep = "\n")
if 0:
    print(ans)
    print("A =", A)

Measured memory_bytes: 74664
n,l = map(int,input().split())
x = [ int(i) for i in input().split() ]
a = [ 0 for i in range(10) ]
for i in x:
    a[i] = 1

def check(n):
    s = str(n)
    for i in s:
        if a[int(i)] == 1:
            return False
    return True

while check(n) == False:
    n += 1

print(n)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define PI 2 * acos(0)
#define FAST ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define MAX 200000
#define MOD 1e7
#define print(a, b) printf("Case %d: %.0f\n", a, b)
#define all(x) (x).begin(), (x).end()
using namespace std;
/*................OMI.................*/

bool isPrime(ll n)
{
   if (n <= 1)
      return false;
   if (n <= 3)
      return true;

   if (n % 2 == 0 || n % 3 == 0)
      return false;

   for (ll i = 5; i * i <= n; i = i + 2)
      if (n % i == 0)
         return false;

   return true;
}
ll gcd(ll a, ll b)
{
   if (a == 0)
      return b;
   return gcd(b % a, a);
}

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

///palindrome check!
bool palindrome(string s)
{
   for (ll i = 0; i < s.length() / 2; i++)
   {
      if (s[i] != s[s.length() - i - 1])
         return 0;
   }
   return 1;
}
/// divisors->>
void printDivisors(int n)
{
   for (int i = 1; i <= sqrt(n); i++)
   {
      if (n % i == 0)
      {
         if (n / i == i)
            printf("%d ", i);

         else
            printf("%d %d ", i, n / i);
      }
   }
}

///prime storage>>>

vector<ll> prime;

void primes(ll m)
{

   bool isprime[m];
   for (int i = 0; i <= m; i++)
      isprime[i] = true;

   for (int i = 3; i * i <= m; i++)
   {
      if (isprime[i])
      {

         for (int j = i * i; j <= m; j += i)
            isprime[j] = false;
      }
   }
   prime.push_back(2);
   for (int i = 3; i <= m; i += 2)
      if (isprime[i])
         prime.push_back(i);
}

/************MAIN_FUNCTION***********/

int main(int argc, char *argv[])
{
   FAST;

   int n, a, b;

   cin >> n >> a >> b;

   for (int i = a; i <= b; i++)
   {
      if (i % n == 0)
      {
         cout << "OK" << endl;
         return 0;
      }
   }

   cout << "NG" << endl;

   return 0;
}

Measured memory_bytes: 3668
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    ans = 0
    for i in range(1, N+1):
        if 1 <= i < 10 or 100 <= i < 1000 or 10000 <= i < 100000:
            ans += 1

    return ans


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 2940
h, w = map(int, raw_input().split())
table = list()
table.append([0]*(w+2))
for _ in xrange(h):
    table.append([0]+list(map(lambda c:0 if c == "." else c, list(raw_input())))+[0])
table.append([0]*(w+2))

xy = [0, 1, 0, -1, 1, 1, -1, -1, 0]
for i in xrange(1, h+1):
    for j in xrange(1, w+1):
        if table[i][j] == "#":
            for k in xrange(8):
                if type(table[i+xy[k]][j+xy[k+1]]) == type(int()):
                    table[i+xy[k]][j+xy[k+1]] += 1


for i in xrange(1, h+1):
    print "".join(map(str, table[i][1:-1]))


Measured memory_bytes: 2820
#include <bits/stdc++.h>
#include <unordered_map>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007;

string s;
int main() {
	cin >> s;
	if (s[0] != 'A') {
		cout << "WA" << endl;
		return 0;
	}
	int c = 0;
	for (int i = 0; i != s.size(); ++i) {
		if (s[i] == 'C')++c;
	}
	if (c != 1) {
		cout << "WA" << endl;
		return 0;
	}
	if (s[1] == 'C') {
		cout << "WA" << endl;
		return 0;
	}
	for (int i = 1; i != s.size(); ++i) {
		if (s[i] == 'C')continue;
		if ('A' <= s[i] && s[i] <= 'Z') {
			cout << "WA" << endl;
			return 0;
		}
	}
	if (s.back() == 'C') {
		cout<<"WA"<<endl;
		return 0;
	}
	cout << "AC" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
  string w;
  cin>>w;
  map<char,int>mp;
  for(const auto c : w){
    ++mp[c];
  }
  for(const auto e : mp){
    if(e.second%2==1){
      puts("No");
      return 0;
    }
  }
  puts("Yes");
}
    


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
bool flg;
 
void init(char field[8][8],bool can[8][8]){
  flg = false;
  for(int i = 0 ; i < 8 ; i++){
    for(int j = 0 ; j < 8 ; j++){
      field[i][j] = '.';
      can[i][j] = true;
    }
  }
}
 
bool inField(int y,int x){
  return 0 <= y && y < 8 && 0 <= x && x < 8;
}
 
void putQ(int r,int c,bool can[8][8]){
  const int dx[4] = {-1,1,1,-1};
  const int dy[4] = {-1,-1,1,1};
  for(int i = 0 ; i < 8 ; i++){
    can[r][i] = can[i][c] = false;
  }
  for(int i = 0 ; i < 4 ; i++){
    int x = c,y = r;
    while(inField(y,x)){
      can[y][x] = false;
      x += dx[i]; y += dy[i];
    }
  }
}
 
void print(char field[8][8]){
  for(int i = 0 ; i < 8 ; i++){
    for(int j = 0 ; j < 8 ; j++){
      cout << field[i][j];
    }
    cout << endl;
  }
}
 
void copy(bool a[8][8],bool b[8][8]){
  for(int i = 0 ; i < 8 ; i++){
    for(int j = 0 ; j < 8 ; j++){
      a[i][j] = b[i][j];
    }
  }
}
 
void solve(int now,int S,bool can[8][8],char field[8][8]){
  if(now == 8){
    print(field);
    flg = true;
    return;
  }
  if((S >> now) & 1){
    solve(now+1,S,can,field);
  }else{
    bool t[8][8];
    for(int i = 0 ; i < 8 ; i++){
      if(can[now][i]){
        copy(t,can);
        field[now][i] = 'Q';
        putQ(now,i,can);
        solve(now+1,S,can,field);
        if(flg) return;
        copy(can,t);
        field[now][i] = '.';
      }
    }
  }
}
 
int main(){
  int N,r,c,S = 0;
  bool can[8][8];
  char field[8][8];
 
  init(field,can);
 
  cin >> N;
  for(int i = 0 ; i < N ; i++){
    cin >> r >> c;
    S |= 1<<r;
    field[r][c] = 'Q';
    putQ(r,c,can);
  }
  solve(0,S,can,field);
  return 0;
}

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

#define MAX 100000010
int t[100000010];

int main(void){
	int n;

	while(cin>>n, n){
		int sum = 0;

		for(int i=1;i<n && i*i<=n;i++){
			if(n % i == 0){
				sum += i;
				if(i != n / i && n / i != n) sum += n / i;
			}
		}
		//		cout<<sum<<endl;

		cout<<(sum==n ? "perfect" : sum>n ? "abundant" : "deficient")<<" number\n";
	}

	return 0;
}

Measured memory_bytes: 0
A, B, C = map(int, input().split())

tmp = [A, B, C]
tmp.sort()

ans = 0
while 1:
    if tmp[0] == tmp[1] and tmp[1] == tmp[2]:
        break
    else:
        if tmp[1] != tmp[2]:
            tmp[0] += 1
            tmp[1] += 1
            ans += 1
        elif tmp[2] - tmp[0] > 1:
            tmp[0] += 2
            ans += 1
        else:
            tmp[1] += 1
            tmp[0] += 1
            ans += 1
        tmp.sort()
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n;
ll a[300005], sum1[100005], sum2[100005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n;
	priority_queue<ll, vector<ll>, greater<ll> > q1;
	priority_queue<ll> q2;
	FOR(i, 3*n) {
		cin >> a[i];
		if (i < n) {
			sum1[0] += a[i];
			q1.push(a[i]);
		}
		else if (i >= 2*n) {
			sum2[0] += a[i];
			q2.push(a[i]);
		}
	}
	for (int i = 1; i <= n; i++) {
		q1.push(a[i+n-1]);
		sum1[i] = sum1[i-1] + a[i+n-1] - q1.top();
		q1.pop();
		q2.push(a[2*n-i]);
		sum2[i] = sum2[i-1] + a[2*n-i] - q2.top();
		q2.pop();
	}
	ll ma = -1000000000000000;
	FOR(i, n+1) ma = max(ma, sum1[i]-sum2[n-i]);
	cout << ma << endl;
	return 0;
}

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

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

    string ans = "";

    for (int i = 0; i < s.length(); i++) {
        if (s[i] == '0') {
            ans += "0";
        } else if (s[i] == '1') {
            ans += "1";
        } else {
            int len = ans.length();
            if (len > 0) {
                ans = ans.substr(0, len - 1);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}


//for(int i = ; i < ; i++){}

int main(){
  int n,a;
  cin>>n>>a;
  cout<<n*n-a<<endl;
  return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+5;
long long f[maxn],s[maxn];
long long ans;
int main()
{
    int n,x;
    cin>>n;
    f[0]=0,s[0]=0;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        f[i]=f[i-1]+x;
        s[i]=s[i-1]^x;
    }
    int L=1;
    ans=0;
    for(int R=1;R<=n;R++)
    {
        while((f[R]-f[L-1])!=(s[R]^s[L-1])) L++;
        ans+=R-L+1;
    }
    cout<<ans<<"\n";
}
 

Measured memory_bytes: 6752
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P; typedef unsigned long long int ull;
const ll mod = 1e9 + 7;
const int inf = 1e9 + 7;
const ll linf = 1LL << 60;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,m,n) for(int i=(m);i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define vec vector<int>
#define vecd vector<double>
using str = string;
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
std::string sreverse(string str, int firstItr, int secondItr) {
	if (firstItr < 0 || secondItr>int(str.size() - 1))return str;
	while (firstItr < secondItr) {
		swap(str[firstItr], str[secondItr]);
		firstItr++; secondItr--;
	}
	return str;
}
std::string RunLengthEncoding(std::string str) {
	int itr = 0; std::string res;
	while (itr < int(str.size())) {
		char tmp = str[itr++];
		int length = 1;
		while (itr <int(str.size()) && str[itr] == tmp) { ++itr; ++length; }
		res.push_back(tmp);
		res += to_string(length);
	}
	return res;
}
std::string split(std::string str, size_t first_itr, bool isFront) {
	if (first_itr < 0 || first_itr > str.size()) {
		return str;
	}
	else {
		if (isFront) {
			std::string tmp;
			for (size_t i = 0; i < first_itr; i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
		else {
			std::string tmp;
			for (size_t i = first_itr; i < str.size(); i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
	}
}


bool dfs(int depth, str s) {
	/*if (depth == n) {
		ans.push_back(s);
		return false;
	}
	for (int i = 0; i < n; i++) {
		if (dfs(depth + 1, s + dic.at(i))) {
			return true;
		}
	}*/
	return false;
}


int main() {
	str a; cin >> a;
	rep(i, a.size())cout << "x";
	cout << endl;

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define all(a) (a).begin(), (a).end()

int N, D, X;

int main () {
  cin >> N >> D >> X;

  int ans = X;
  rep(i,N) {
    int A;
    cin >> A;
    for(int j = 1; j <= D; j += A) ans++;
  }

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


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

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli t,n,m,x,k,d,number,ans;string s;
// cin>>t;
// while(t--){
cin>>x>>k>>d;
x=abs(x);
if(k>x/d){
  number=x/d;
  if(number%2==k%2){
    ans=abs(x-number*d);
}
else ans=min(abs(x-number*d-d),abs(x-number*d+d));
}
else ans=abs(x-k*d);
cout<<ans;
}


Measured memory_bytes: 3604
function main(lines) {
  const [N, M] = na();
  
  // 頂点情報構築
  const nodes = Array(N+1).fill(0).map(() => new Set());
  for (let i = 1; i <= M; i++) {
    const [a, b] = na();
    nodes[a].add(b);
    nodes[b].add(a);
  }

  // ルート探索
  const ans = countRoute(nodes[1], [1]);

  // 探索再帰関数
  function countRoute(node, passed) {
    return passed.length == N ? 1
      : Array.from(node).reduce((cnt, n) => {
        return passed.includes(n) ? cnt
          : cnt + countRoute(nodes[n], passed.concat(n));
      }, 0);
  }
  
  return ans;
}


const lines = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");

let lineCount = 0;
const s = () => lines[lineCount++];
const n = () => Number(s());
const b = () => BigInt(s());
const sa = () => s().split(' ');
const na = () => sa().map(Number);
const ba = () => sa().map(BigInt);

const ans = main(lines);
console.log( ans );

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

#define ll long long int
#define ull unsigned long long int
#define db double
#define ld long double
#define MOD 1000000007
#define inf (1LL << 62)
#define pi acos(-1.0)
#define si(a) scanf("%lld",&a)
#define sd(n) scanf("%lf", &n)
#define for1(i, stop) for(ll i = 1; i <= stop; i++)
#define for0(i, stop) for(ll i = 0; i < stop; i++)
#define rep1(i, start) for(ll i = start; i >= 1; i--)
#define rep0(i, start) for(ll i = (start-1); i >= 0; i--)
#define loop(i, start, stop, inc) for(ll i = start; i <= stop; i += inc)
#define pb(v,a) v.push_back(a)
#define pll pair <ll, ll>
#define mp make_pair
#define pbp(v,a,i) v.push_back(make_pair(a,i))
#define srt(v) sort(v.begin(),v.end())
#define rv(v) reverse(v.begin(),v.end())
#define ms(n, i) memset(n, i, sizeof(n))
#define debug printf("Debug\n");
#define en '\n'



#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
/*typedef tuple<ll,ll,ll>tpl;

ll bigmod(ll n,ll pow)
{
    if(pow==0)
        return 1;
    if(pow==1)
        return n%MOD;

    ll ans=bigmod(n,pow/2);
    ans=(ans*ans)%MOD;

    if(pow%2==1)
    {
        ans=(ans*n)%MOD;
    }
    return ans%MOD;
}

ll fact[1000005];

ll nCr(ll n,ll r)
{

    ll ans=fact[n];
    ans=(ans*bigmod(fact[r],MOD-2))%MOD;
    ans=(ans*bigmod(fact[n-r],MOD-2))%MOD;
    return ans;
} */

ll ar[1000005];
int main()
{
    _fastio
    ll n,a,gc;
    cin>>n;
    ll fl=1;
    for1(i,n)
    {
        cin>>a;
        ar[a]+=1;
        if(i==1) gc=a;
        else gc=__gcd(gc,a);
    }
    for(ll i=2;i<=1000000;i++)
    {
        ll cn=0;
        for(ll j=i;j<=1000000;j=j+i)
        {
            cn+=ar[j];
        }
        if(cn>=2)
        {
            fl=-1;
            break;
        }
    }
    if(fl==1)
        cout<<"pairwise coprime"<<en;
    else if(gc==1)
        cout<<"setwise coprime"<<en;
    else
        cout<<"not coprime"<<en;
}


Measured memory_bytes: 11468
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    String a = sc.next();
    String b = sc.next();

    sc.close();

    int ab = Integer.valueOf(a + b);
    
    String result = "No";

    int c = 1;
    int d = 1;

    while (d <= ab) {
      if (d == ab){
        result = "Yes";
        break;
      }
      c++;
      d = c * c;
    }

    System.out.println(result);

  }

}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dbg(x) cerr << #x << " : " << x << endl;
int main(){
    int n,d;
    cin >> n >> d;
    vector<int> p[n];
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            int x;
            cin >> x;
            p[i].push_back(x);
        }
    }
    int ans=0;
    for(int i=0;i<n;i++) for(int j=i+1;j<n;j++){
        int dis=0;
        for(int k=0;k<d;k++){
            dis+=pow(p[i][k]-p[j][k],2);
        }
        int sq=sqrt(dis);
        if(sq*sq==dis) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n uint64
	fmt.Scan(&n)

	var a, m uint64
	for i := 0; i < 5; i++ {
		fmt.Scan(&a)
		if m == 0 {
			m = a
		}
		if a < m {
			m = a
		}
	}
	var l uint64
	l = n / m
	if n%m > 0 {
		l++
	}
	fmt.Println(l + 4)
}


Measured memory_bytes: 512
while True:
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    elif m==-1 or f==-1:
        print('F')
    elif m+f>=80:
        print('A')
    elif m+f>=65 and m+f<80:
        print('B')
    elif m+f>=50 and m+f<65:
        print('C')
    elif m+f>=30 and m+f<50 and r>=50:
        print('C')
    elif m+f>=30 and m+f<50 and r<50:
        print('D')
    else:
        print('F')


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define scanVec(vec) for(int never = 0; never < vec.size(); never++){ cin>>vec[never];}
#define printVec(vec) for(int never = 0; never < vec.size(); never++){ cout<<vec[never]<<" ";} cout<<endl;
#define S second
#define F first
typedef long long ll;
typedef long double ld;
const int  MOD = 1e9 + 7;
const int  N = 1e6 + 7;



void solve() {
    // cout << "test" << endl;
    int a,b,c,d;
    cin >> a >> b >> c >> d;

    int m = (a-1)/d;
    int n = (c-1)/b;
    if (n > m) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    
}

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

    int t;
    t = 1;
    // cin >> t;
    while(t--) {
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;


int main () {
  int H, W;
  int i, j;
  while (1) {
    cin >> H >> W;
    if (H == 0 && W == 0) break;
    rep(i,H) {
      rep(j,W) {
	if (i == 0 || i == H-1 || j == 0 || j == W-1) {
	  cout << '#';
	} else {
	  cout << '.';
	}
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,flag=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        long long x;
        scanf("%lld",&x);
        if(x%2)
            flag=1;
    }
    if(flag)
        cout<<"first"<<endl;
    else cout<<"second"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define rad(A) (A/180.0*M_PI)

int main(void){
	double x=0, y=0; int r, angle=90, t;
	
	while(scanf("%d,%d",&r,&t), r!=0){
		x-=r*cos(rad(angle)), y+=r*sin(rad(angle));
		angle+=t;
	}
	
	printf("%d\n%d\n",(int)x,(int)y);
	
	return 0;
}

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

using namespace std;

int v[100002], n, p[100002], m, x, y, sol, a[100002];

int find(int x) {
  if (v[x] != x)
    find(v[x]);
  else
    return x;
}

void Union(int x, int y) {
  int nr1 = find(x);
  int nr2 = find(y);
  if (nr1 != nr2) {
    if (a[nr1] > a[nr2])
      v[nr2] = nr1;
    if (a[nr1] < a[nr2])
      v[nr1] = nr2;
    if (a[nr1] == a[nr2]) {
      v[nr1] = nr2;
      a[nr2]++;
    }
  }
}

int main()
{
  cin >> n >> m;
  for (int i = 1; i <= n; i++)  {
    v[i] = i;
    a[i] = 1;
  }
  for (int i = 1; i <= n; i++)
    cin >> p[i];
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    Union(x, y);
  }
  for (int i = 1; i <= n; i++)
    if (find(i) == find(p[i]))
      sol++;
  cout << sol;
  return 0;
}


Measured memory_bytes: 1408