akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    string s;
    cin >> s;
    vl ret(s.size(), 0);
    ll rightodd = 0;
    ll righteven = 0;
    ll leftodd = 0;
    ll lefteven = 0;
    int n = s.size();
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'R') {
            if (i % 2 == 0)
                righteven++;
            else
                rightodd++;
        } else if (i != 0) {
            if (i % 2 == 0) {
                ret[i] += righteven;
                ret[i - 1] += rightodd;
            } else {
                ret[i] += rightodd;
                ret[i - 1] += righteven;
            }
            righteven = 0;
            rightodd = 0;
        }
    }
    for (int i = n - 1; i >= 0; --i) {
        if (s[i] == 'L') {
            if (i % 2 == 0)
                lefteven++;
            else
                leftodd++;
        } else if (i != n - 1) {
            if (i % 2 == 0) {
                ret[i] += lefteven;
                ret[i + 1] += leftodd;
            } else {
                ret[i] += leftodd;
                ret[i + 1] += lefteven;
            }
            lefteven = 0;
            leftodd = 0;
        }
    }
    print(ret);
    return 0;
}

Measured memory_bytes: 1408
#include <algorithm>
#include <iostream>
#include <vector>

int main() {
    std::vector<int> v(3);
    for (size_t i = 0; i != 3; ++i) {
        std::cin >> v[i];
    }
    std::sort(v.begin(), v.end());
    int t = std::stoi(std::to_string(v[2]) + std::to_string(v[1]));
    std::cout << t + v[0];
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			char[] a = in.toCharArray();
			 System.out.println(a[2]==a[3] && a[4]==a[5] ? "Yes" : "No");
		}
	}
}

Measured memory_bytes: 25372
#include<stdio.h>

int main(void)
{

  int a,b,c,d;
  int i,s=0;

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

  for(i=1;i<100;i++){
    d=a*i%b;
    if(d==c){
      s=1; break;
    }
    else if(d==0)
      break;
  }

  if(s==0)
    printf("NO\n");
  else
    printf("YES\n");

  return 0;
}



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



Measured memory_bytes: 2512
/*
* Welcome to my code!
*---------------------------------------------*
* author : lynmisakura(twitter : @andoreiji11)
*/

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

#define rep(i,n) for(int i = 0;i < n;i++)
using ll = int64_t;

template<class T> void print(vector<T>& a){
    int sz = a.size();
    for(int i=0;i<sz;i++)cout<<a[i] << (i<sz-1?' ':'\n');
}

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


template<class T> struct BellmanFord{

    struct Edge{
        int from,to;
        T cost;
        Edge(int from,int to,T cost):from(from),to(to),cost(cost){}
    };

    const T INF = 1LL << 55;

    int V,E;
    vector<Edge> es;
    vector<T> dist;

    BellmanFord(int V):V(V),dist(V,INF){}
    void add_edge(int from,int to,T cost){
       es.emplace_back(from,to,cost);
    }
    bool solve(int s){ // exist roop ?
        E = es.size();
        dist.assign(V,INF);
        dist[s] = 0;
        for(int roop = 0;roop <= V;roop++){
            if(roop == V) return true;
            bool update = false;
            for(int i = 0;i < E;i++){
                Edge e = es[i];
                if(dist[e.from] != INF && dist[e.to] > dist[e.from] + e.cost){
                    dist[e.to] = dist[e.from] + e.cost;
                    update = true;
                }
            }
            if(!update) break;
        }
        return false;
    }
};

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

    int64_t n,m,r;cin >> n >> m >> r;
    BellmanFord<ll> BF(n);

    rep(i,m){
        int64_t s,t,d;cin >> s >> t >>d;
        BF.add_edge(s,t,d);
    }

    if(BF.solve(r)){
        cout << "NEGATIVE CYCLE" << '\n';
    }else{
        rep(i,n)cout << (BF.dist[i] == BF.INF ? "INF" : to_string(BF.dist[i])) << '\n';
    }
}


Measured memory_bytes: 3280
#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
 
    int n , k , R , P , S;
	cin >> n >> k >> R >> S >> P;
	string mach , player = "";
	cin >> mach;
	int ans = 0;
	for(int i = 0; i < k; i++) {
		if(mach[i] == 'r') player += "p";
		else if(mach[i] == 's') player += "r";
		else player += "s";
	}
	for(int i = k; i < n; i++) {
		if(mach[i] == 'r') {
			if(player[i-k] != 'p') player += "p";
			else player += "?";
		}
		if(mach[i] == 'p') {
			if(player[i-k] != 's') player += "s";
			else player += "?";
		}
		if(mach[i] == 's') {
			if(player[i-k] != 'r') player += "r";
			else player += "?";
		}
	}
	for(int i = 0; i < n; i++) {
		if(mach[i] == 'r' && player[i] == 'p') ans += P;
		else if(mach[i] == 'p' && player[i] == 's') ans += S;
		else if(mach[i] == 's' && player[i] == 'r') ans += R;
	}
	cout << ans << "\n";
 
    return 0;
}


Measured memory_bytes: 640
N = int(input())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))

a_b = 0
b_c = 0
count = 0
for b_item in b:
    while a_b < N and a[a_b] < b_item:
        a_b += 1
    while b_c < N and c[b_c] <= b_item:
        b_c += 1
    count += (a_b * (N - b_c))

print(count)


Measured memory_bytes: 24096
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.math;

void main()
{
  for (;;) {
    auto rd = readln.split, a = rd[0].to!int, op = rd[1], b = rd[2].to!int;
    if (op == "?") break;
    writeln(op.predSwitch("+", a + b, "-", a - b, "*", a * b, "/", a / b));
  }
}

Measured memory_bytes: 2484
S=input()

if S=='SAT':
    print('1')
elif S=='FRI':
    print('2')
elif S=='THU':
    print('3')
elif S=='WED':
    print('4')
elif S=='TUE':
    print('5')
elif S=='MON':
    print('6')
else:
    print('7')


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    int A, B;
    string s;
    cin >> A >> B;
    cin >> s;
    
        for (int i=0; i<A+B+1; i++){
            if (i==A){
                if(s[i] == '-')continue;
                else {
                    cout << "No" << endl;
                return 0;
                }
            }
            if (s[i] == '0' or s[i] == '1' or s[i] == '2' or s[i] == '3' or s[i] == '4' or s[i] == '5' or s[i] == '6' or s[i] == '7' or s[i] == '8' or s[i] == '9'){
                //hoge
            }
            else {
                cout << "No" << endl;
                return 0;
            }
        }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

char grid[100][100];
int H, W;

int memo[100][100];

int solve(int r, int c) {
	if (memo[r][c] != -1) return memo[r][c];

	int down = INF;
	int right = INF;

	// to downward
	if (r+1 < H) {
		if (grid[r][c] == '.' && grid[r+1][c] == '#') {
			down = solve(r+1, c) + 1;
		} else {
			down = solve(r+1, c);
		}
	}

	// to right
	if (c+1 < W) {
		right = solve(r, c+1);
		if (grid[r][c] == '.' && grid[r][c+1] == '#') {
			right = solve(r, c+1) + 1;
		} else {
			right = solve(r, c+1);
		}
	}

	int rev = min(down, right);
	memo[r][c] = rev;

	return rev;
}


int main(){
	cin >> H >> W;
	for (int i=0; i<H; i++) {
		for (int j=0; j<W; j++) {
			cin >> grid[i][j];
		}
	}

	for (int i=0; i<H; i++) {
		for (int j=0; j<W; j++) {
			memo[i][j] = -1;
		}
	}

	memo[H-1][W-1] = 0;

	int ans;
	if (grid[0][0] == '#') {
		ans = solve(0, 0) + 1;
	} else {
		ans = solve(0, 0);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
K=gets.to_i
tmp_ans=0
a=[*1..K].repeated_permutation(2).to_a
res=a.map { |e| e.inject{|x,y| x.gcd(y)} }
K.times do |i|
  res.each do |j|
    tmp_ans+=(i+1).gcd(j)
  end
end
puts tmp_ans

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

using ll = long long;

int main() {
    string S;
    cin >> S;
    int n = S.size();
    for (int i = n - 2; i > 0; i -= 2) {
        int m = i / 2;
        bool f = true;
        rep(j, m) {
            if (S[j] != S[m + j]) f = false;
        }
        if (f) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
# coding: utf-8
def main():
    n = int(input())
    S = input()
    T = input()
    overlap_num = 0
    for i in range(n):
        if S[i:] in T:
            overlap_num = n-i
            break
    print(n*2 - overlap_num)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

int main() {
	ll n,d;
	cin>>n>>d;
	vector<vector<ll> > vv(10,vector<ll>());
	rep(i,0,n){
		rep(j,0,d){
			ll a;
			cin>>a;
			vv[i].pb(a);
		}
	}
	ll ans = 0;
	rep(i,0,n){
		rep(j,i+1,n){
			ll a = 0;
			rep(k,0,d){
				a += (vv[i][k]-vv[j][k])*(vv[i][k]-vv[j][k]);
			}
			ll b = (ll)pow(a,0.5);
			if(b*b==a){
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
main(){int b[20],s,t,x,y,i;char l[8],a;for(;;){for(i=0;i<20;i++)b[i]=0;s=t=9;for(y=0;y<8;y++){if(!(std::cin>>l))break;for(x=0;x<8;x++){if(l[x]==49){if(t==9){s=x-1;t=y;}b[x-s+(y-t)*5]=1;}}}if(y<8)break;a=65;if(b[16])a=66;if(b[4])a=67;if(b[10])a=68;if(b[8])a=69;if(b[12])a=70;if(b[5]&&b[2])a=71;std::cout<<a<<"\n";}}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<int>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  ll n,k;
  cin >> n >> k;
  ll p=1000000007;
  vector<ll> b;
  vector<ll> a;
  rep(i,n){
    ll d;
    cin >> d;
    if(d>=0)a.push_back(d);
    if(d<0)b.push_back(d);
  }
  int x=a.size();
  int y=b.size();
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  ll mi=1;
  int aa=0;
  int bb=y-1;
  rep(i,k){
    if(aa==x){
      mi=(p*p+mi*b[bb])%p;
      bb--;
    }
    else if(bb==min(0,y-1)){
      mi=(p*p+mi*a[aa])%p;
      aa++;
    }
    else{
      if(a[aa]<=-1*b[bb]){
        mi=(p*p+mi*a[aa])%p;
        aa++;
      }
      else{
        mi=(p*p+mi*b[bb])%p;
        bb--;
      }
    }
  }
  if((k==n&&y%2==1)||(x==0&&k%2==1)){
    cout << mi << endl;
    return 0;
  }
  //cout << 1 << endl;
  ll ma=1;
  if(k%2==1){
    ma=a[x-1];
    x--;
    a.pop_back();
  }
  ll h[y/2];
  ll w[x/2];
  rep(i,x/2){
    w[i]=a[x-1-2*i]*a[x-2-2*i];
  }
  rep(i,y/2){
    h[i]=b[2*i]*b[2*i+1];
  }
  aa=0,bb=0;
  rep(i,k/2){
    //cout << ma << endl;
    if(aa==x/2){
      ma=(ma*(h[bb]%p))%p;
        bb++;
    }
    else if(bb==y/2){
      ma=(ma*(w[aa]%p))%p;
      //cout << ma << " " << w[aa] << endl;
      aa++;
    }
    else{
      if(w[aa]>=h[bb]){
        ma=(ma*(w[aa]%p))%p;
        aa++;
      }
      else{
        ma=(ma*(h[bb]%p))%p;
        bb++;
      }
    }
  }
  cout << ma << endl;
}


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

int main(){
    string S,year,month,day;cin>>S;
    month[0]=S[5];month[1]=S[6];
    int m=stoi(month);
   
    if(m<=4)cout<<"Heisei"<<endl;
    else cout<<"TBD"<<endl;

    return 0;

}

Measured memory_bytes: 256
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

void Init() {
	std::cin.tie(0); std::ios::sync_with_stdio(false);
	struct Init_caller { Init_caller() { Init(); } }caller;
}

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using ppi = pair<pi, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;
using vppi = vector<ppi>;

#pragma endregion

struct edge {
	int from, to, cost;
};

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}


#pragma endregion 


/*****************************************************************************/
signed main(void) {
	int n;
	cin >> n;
	vi h(n);
	f_vI(h, n);
	int sum = 0;
	f(i, 0, n) {
		sum += h[i];
	}
	f(i, 0, n - 1) {
		sum -= min(h[i], h[i + 1]);
	}
	cout << sum;
	return 0;
}

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

using namespace std;

const int maxn = 1e5 + 7;

int Read(char c = 0,int re = 0){
	while(!isdigit(c = getchar()));
	re = c - '0';
	while(isdigit(c = getchar()))
		re = ((re << 2) + re << 1) + c - '0';
	return re;
}
struct Edge{
	int to,last;
}E[maxn << 1];
int n;
int cnt;
int head[maxn];
int step[2][maxn];
void Adde(int x,int y){
	E[++cnt] = (Edge){y,head[x]};
	head[x] = cnt;
}
void Dfs(int x,int p,int tp){
	for(int i = head[x],y; y = E[i].to,i; i = E[i].last)if(y ^ p){
		step[tp][y] = step[tp][x] + 1;
		Dfs(y,x,tp);
	}
}
int main(){
	n = Read();
	for(int i = 1; i < n; ++i){
		int x = Read(),y = Read();
		Adde(x,y);Adde(y,x);
	}
	Dfs(1,0,0);
	Dfs(n,0,1);
	int ans = 0;
	for(int i = 1; i <= n; ++i)
		if(step[0][i] <= step[1][i])ans++;
		else ans--;
	if(ans <= 0)puts("Snuke");
	else puts("Fennec");
	return 0;
}


Measured memory_bytes: 9216
#include<iostream>

using namespace std;
int main()
{
    int h,w;
  cin >> h >> w;
  while(h!=0){
    int i,j;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
            if(i==0||i==h-1||j==0||j==w-1)
	cout << "#";
	else cout<<".";
      }
      cout << endl;
    }
    cout << endl;
    cin >> h >> w;
  }
    return 0;
}



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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,0,n) cin >> a[i];
  var c = a.size();
  set<int> s(a.begin(), a.end());
  if (a.size() == s.size()) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 10496
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    Int N, A, B; cin >> N >> A >> B;
    N %= 12;
    for (int i = 1; i <= N; i++) {
        if (i % 2 == 1) A = A - B;
        if (i % 2 == 0) B = A + B;
    }
    cout << A << ' ' << B << endl;
    return 0;
}



Measured memory_bytes: 3100
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <deque>
#include <map>
#include <set>

#define ll long long
#define inf 0x3f3f3f3f
#define il inline

namespace io {

#define in(a) a = read()
#define out(a) write(a)
#define outn(a) out(a), putchar('\n')

#define I_int ll
inline I_int read() {
    I_int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}
char F[200];
inline void write(I_int x) {
    if (x == 0) return (void) (putchar('0'));
    I_int tmp = x > 0 ? x : -x;
    if (x < 0) putchar('-');
    int cnt = 0;
    while (tmp > 0) {
        F[cnt++] = tmp % 10 + '0';
        tmp /= 10;
    }
    while (cnt > 0) putchar(F[--cnt]);
}
#undef I_int

}
using namespace io;

using namespace std;

#define N 100010

int a, b, c;

int main() {
	in(a), in(b), in(c);
	printf("%d\n", min(b / a, c));
}

Measured memory_bytes: 256
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*
    I LOVE CLARICE STARLING

     ♥LOVE♥        ♥LOVE♥
  ♥LOVE♥♥LOVE♥  ♥LOVE♥♥LOVE♥
♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥
   ♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥
      ♥LOVE♥♥LOVE♥♥LOVE♥
         ♥LOVE♥♥LOVE♥
            ♥LOVE♥
               ♥


    EXPLAINATION BELOW->
    
*/
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
void solve()
{
    string s;cin>>s;
    int i;
    fo(i,0,sz(s))cout<<"x";
    cout<<"\n";
}
int main()
{
   fastio
   solve();
  return 0;
}
//map<ll,ll,greater<int>> to sort in descending order ,in iterator declaration no greater<int>
//if you want to apply lowerbound on set use s.lower_bound(key),not the one used for vector
/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/


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

int main() {
  string S;
  int a,b,c;
   cin >> S;

  int dif,ans =754;;
  int N =S.size();
  for(int i=0;i<N-2;i++){
    a = S[i] - '0';
    b = S[i+1] - '0';
    c = S[i+2] -'0';
    dif = abs(a*100 + b*10 + c -753);

    ans = min(dif,ans);

  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a,b;
  scanf("%d %d", &a, &b);

  int c,d,e;
  c = a+b;
  d = a-b;
  e = a*b;;
    
  if(d > c)c=d;
  if(e > c)c=e;

  printf("%d\n", c);
  
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ford(i,a,b) for(int i=(a);i>=b;i--)
#define rep1(i,a,b) for(int i=(a);(i)<=(b);(i)++)
#define rep(i,a,b) for(int i=(a);(i)<(b);(i)++)
#define ll long long
#define N 300005
#define pql priority_queue<ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define rev(a,n) reverse(a,a+n)
using namespace std;
int n,ans=300005,l[N],r[N];
char s[N];
int main() {
	cin>>n;
	rep1(i,1,n)cin>>s[i];
	rep1(i,2,n){
		l[i]=l[i-1]+(s[i-1]=='W');
	}
	ford(i,n-1,1){
		r[i]=r[i+1]+(s[i+1]=='E');
	}
	rep1(i,1,n){
		if(ans>l[i]+r[i]){
			ans=l[i]+r[i];
		} 
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 6264
#16D8103010K Ko Okasaki
#ALDS_5_D

global cnt
cnt=0

def merge(A,left,mid,right):
    L=A[left:mid]
    R=A[mid:right]
    L.append(float("inf"))
    R.append(float("inf"))
    
    i=0
    j=0
    for k in range(left,right):
        global cnt
        if L[i]<=R[j]:
            A[k]=L[i]
            i=i+1
        else:
            A[k]=R[j]
            j=j+1
            cnt+=mid-left-i

def mergeSort(A,left,right):
    if left+1<right:
        mid=(int)((left+right)/2)
        mergeSort(A,left,mid)
        mergeSort(A,mid,right)
        merge(A,left,mid,right)

n=int(input())
S=list(map(int,input().split()))

mergeSort(S,0,n)
print(cnt)


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

int main(){
    // 制約見て！！！デカかったらlong longにすること！
    int M,D;
    cin>>M>>D;
    int ans=0;
    for(int d = 1;d<=D;d++){
        int d_1 = d%10;
        int d_10 = d/10;
        if(d_1<2 || d_10 <2)
            continue;
        
        if(d_1*d_10 <= M){
            ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
void print(int a[],int N)
{
    for(int i=0;i<N;i++)
    {
        if(i>0)
            cout<<" ";
        cout<<a[i];
    }
    cout<<endl;
}
int  bubbleSort(int a[],int N)
{
    int i,j;
    int sum=0;
    for(i=N-1;i>=0;i--)
        for(j=N-1;j>0;j--)
    {
        if(a[j-1]>a[j])
        {
            int temp;
            temp=a[j-1];
            a[j-1]=a[j];
            a[j]=temp;
            sum++;
        }
    }
    print(a,N);
    return sum;

}
int main()
{
    int N;
    int A[105];
    cin>>N;
    for(int i=0;i<N;i++)
    {
        cin>>A[i];
    }
   int sum= bubbleSort(A, N);
   cout<<sum<<endl;


    return 0;

}

Measured memory_bytes: 3088
#ifndef TEMPLATE_HPP
#define TEMPLATE_HPP
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())
using namespace std;
using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename U> vector<U> make_vector(T&& n, U&& val) { return vector<U>(forward<T>(n), forward<U>(val)); }
template <typename T, typename... Args> decltype(auto) make_vector(T&& n, Args&&... args) { return vector<decltype(make_vector(forward<Args>(args)...))>(forward<T>(n), make_vector(forward<Args>(args)...)); }
const int INF = 1001001001;
const i64 LINF = 1001001001001001001ll;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
#endif

void solve(int k) {
  if (k % 2 == 0) {
    cout << -1 << endl;
    return;
  }
  if (k % 5 == 0) {
    cout << -1 << endl;
    return;
  }
  int ans = 0;
  int acc = 0;
  int acc10 = 1;
  while (true) {
    acc = (acc + acc10 * 7) % k;
    ans += 1;
    if (acc == 0) {
      cout << ans << endl;
      return;
    }
    acc10 = acc10 * 10 % k;
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(16);
  cerr << fixed << setprecision(16);
  int k;
  cin >> k;
  solve(k);
  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define P pair<int , int>
#define VLL vector<long long>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

#define MAX_V 200000
struct edge { int to, cost; };
int V;
vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s){
 priority_queue<P, vector<P>, greater<P>>	que;
 fill(d, d + V, INF);
 d[s] = 0;
 que.push(P(0, s));

 while(!que.empty()){
  P p = que.top();	que.pop();
  int v = p.second;
  if(d[v] < p.first)	continue;
  for(int i = 0 ; i < G[v].size() ; i++){
	edge e = G[v][i];
	if(d[v] + e.cost < d[e.to]){
	 d[e.to] = d[v] + e.cost;
	 que.push(P(d[e.to], e.to));
	}
  }
 }
}

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	int M;
	cin >> V >> M;

	REP(i, M){
			int a, b;  cin >> a >> b;
			G[a - 1].push_back(edge{b - 1, 1});
			G[b - 1].push_back(edge{a - 1, 1});
	}

	dijkstra(0);

	if(d[V - 1] == 2)  cout << "POSSIBLE" << endl;
	else               cout << "IMPOSSIBLE" << endl;

	return 0;
}


Measured memory_bytes: 15080
#include <iostream>
#include <vector>

int main()
{
    int N = 0;
    std::cin >> N;
    std::vector<int> A(N);
    std::vector<std::pair<int, int>> max_list;

    max_list.push_back(std::make_pair(-1, 0));

    for (int i = 0; i < N; i++) {
        std::cin >> A[i];
        if (A[i] > max_list.front().second) {
            max_list.insert(max_list.begin(), std::make_pair(i, A[i]));
        } else if (A[i] > max_list[1].second) {
            max_list.insert(max_list.begin() + 1, std::make_pair(i, A[i]));
        }
    }

    for (int i = 0; i < N; i++) {
        if (max_list[0].first == i) {
            std::cout << max_list[1].second << std::endl;
        } else {
            std::cout << max_list[0].second << std::endl;
        }
    }

    return 0;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define root sqrt
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, h, k, n, m, w, ans = 0, count = 0;
  string t;
  cin >> n >> m;
  vi s(m), c(m);

  rep(i, 0, m)
  {
    cin >> s[i] >> c[i];
  }
  rep(i, 0, 1000)
  {
    t = to_string(i);
    if (t.size() != n)
      continue;
    bool flag = true;
    rep(i, 0, m)
    {
      if (t[s[i] - 1] != c[i] + '0')
      {
        flag = false;
        break;
      }
    }
    if (flag)
    {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 256
//AUTHOR - NAVEEN KUMAR(@naveen19991124)
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#inlcude<boost/multiprecision/cpp_dec_float.hpp>
#define ll long long
#define pb push_back
#define f(a) for(ll i = 0;i<a;i++)
#define rep(i,a,b) for(ll i = a;i<b;i++)
#define rrep(i,a,b) for(ll i = a;i>b;i--)
#define v vector<ll>
#define mp make_pair
#define fir first
#define sec second
#define _fast_ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
//using boost :: multiprecision :: cpp_int;
//using boost :: multiprecision :: cpp_dec_float_50;
//using boost :: multiprecision :: cpp_dec_float_100;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}

ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1;
a *= a; a %= mod;} return p % mod;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
int main()
{
    _fast_
    ll t = 1;
    //cin>>t;
    while(t--){
    ll n;
    cin>>n;
    ll arr1[n];
    ll arr2[n];
    ll arr3[n];
    ll dp[n][3];
    memset(dp,0,sizeof(dp));
    f(n)
    {
        cin>>arr1[i];
        cin>>arr2[i];
        cin>>arr3[i];
    }
    dp[0][0] = arr1[0];
    dp[0][1] = arr2[0];
    dp[0][2] = arr3[0];
    for(ll i = 1;i<n;i++)
    {
        dp[i][0] = max(arr1[i]+dp[i-1][1],arr1[i]+dp[i-1][2]);
        dp[i][1] = max(arr2[i]+dp[i-1][0],arr2[i]+dp[i-1][2]);
        dp[i][2] = max(arr3[i]+dp[i-1][0],arr3[i]+dp[i-1][1]);
    }
    ll ans = max(dp[n-1][0],dp[n-1][1]);
    ans = max(ans,dp[n-1][2]);
    cout<<ans<<"\n";
    }
    return 0;
}

Measured memory_bytes: 4992
using System;
using System.Linq;

class Test
{
    static void Main()
    {
        int[] dd = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int a = dd[0];
        int b = dd[1];
        int c = dd[2];
        int p = 0;

        for (int i = a; i <= b; i++)
        {
            if (c % i == 0) p++;
        }
        Console.WriteLine(p);
    }
}


Measured memory_bytes: 18464
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c;
	int ret=-1;
	scanf("%d%d%d",&a,&b,&c);
	while(c<10000){
		if(c%(a+b)<=a){
			ret=c;
			break;
		}
		c+=60;
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 1028
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for(int i = x; i < (int)n; ++i)

int an = 1, cy[100001], md = 1e9 + 7, pairs[100001], fact[100001], invf[100001], inv[100001];
pair<int, int> y[100001], ln[100001];
bool vis[100001];

void no(){
	printf("0\n");
	exit(0);
}

int V;
bool go(int v, int m = 0, int d = 0){
	if (vis[v]){
		if (v == V) { ln[m].first = d; return true; }
		return false;
	}
	vis[v] = true;
	if (!y[v].first) { ln[m].second = d; return false; }
	bool k = go(y[v].first, y[v].second ? v : m, d + 1);
	if (y[v].second)ln[m].first = d, k |= go(y[v].second, v, d + 1);
	return k;
}

inline int ch(int n, int r) { return (ll)fact[n] * invf[r] % md * invf[n - r] % md; }

int pw(int x, int p){
	if (!p)return 1;
	int t = pw(x, p >> 1);
	t = (ll)t * t % md;
	if (p & 1)t = (ll)t * x % md;
	return t;
}

inline void ad(int s, int l){
	int a = 0, z = (s & 1 && s != 1) + 1;
	for (int i = 0; i <= l; i += 2){
		a += (ll)pw(z, l - i) * ch(l, i) % md * pw(s, i >> 1) % md * pairs[i] % md;
		if (a >= md)a -= md;
	}
	an = (ll)an * a % md;
}

int main(){
	int n;
	scanf("%d", &n);
	fact[0] = fact[1] = inv[1] = invf[1] = pairs[0] = invf[0] = 1;
	f(i, 2, n + 1){
		fact[i] = (ll)fact[i - 1] * i % md;
		inv[i] = md - md / i * (ll)inv[md % i] % md;
		invf[i] = (ll)invf[i - 1] * inv[i] % md;
		if (!(i & 1))pairs[i] = (ll)pairs[i - 2] * (i - 1) % md;
	}
	f(i, 1, n + 1){
		int t;
		scanf("%d", &t);
		if (y[t].first){
			if (y[t].second)no();
			y[t].second = i;
		}
		else y[t].first = i;
	}
	f(i, 1, n + 1)if (y[i].second){
		V = i;
		if (!vis[i] && !go(i))no();
		if (!ln[i].second)no();
		if (ln[i].first > ln[i].second){ if ((an <<= 1) >= md)an -= md; }
		else if (ln[i].first < ln[i].second)no();
	}
	f(i, 1, n + 1)if (!vis[i]){
		V = i;
		if (go(i, i))++cy[ln[i].first];
	}
	f(i, 1, n + 1)if (cy[i])ad(i, cy[i]);
	printf("%d\n", an);
}


Measured memory_bytes: 7424
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a1 = new int[N];
		int[] a2 = new int[N];
		for(int i=0; i<N; i++){
			a1[i] = sc.nextInt();
		}
		for(int i=0; i<N; i++){
			a2[i] = sc.nextInt();
		}
		
		int max = -1;
		for(int i=0; i<N; i++){
			int temp = 0;
			for(int j=0; j<N; j++){
				if(j<i) temp += a1[j];
				else if(j==i) temp += a1[j]+a2[j];
				else temp += a2[j];
			}
			max = Math.max(max, temp);
		}
		System.out.println(max);
		return;
	}
}

Measured memory_bytes: 23892
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln = '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    if (*max_element(all(A)) <= 0) {
        int k = max_element(all(A)) - A.begin();
        cout << A[k] << ln;
        cout << N-1 << ln;
        rep(i,N-1-k) cout << N-i << ln;
        rep(i,k) cout << 1 << ln;
        return 0;
    }

    ll vale = 0, valo = 0;
    vector<int> E,O;
    rep(i,N) {
        if (~i&1) {
            if (A[i] > 0) {
                vale += A[i];
                E.emplace_back(i);
            }
        } else {
            if (A[i] > 0) {
                valo += A[i];
                O.emplace_back(i);
            }
        }
    }
    auto solve=[&](vector<int> arr) {
        vector<int> ret;
        int S = arr.size();
        int R = arr.back();
        int L = arr[0];
        rep(i,N-1-R) ret.emplace_back(N-i);
        rep(i,L) ret.emplace_back(1);
        rep(i,S-1) {
            R = arr[i+1];
            L = arr[i];
            int d = R-L-1;
            while (d >= 3) {
                ret.emplace_back(3);
                d -= 2;
            }
            ret.emplace_back(2);
        }
        return ret;
    };

    vector<int> ans;
    if (vale > valo) ans = solve(E);
    else ans = solve(O);

    cout << max(vale,valo) << ln;
    cout << ans.size() << ln;
    for (auto i : ans) cout << i << ln;
}


Measured memory_bytes: 3680
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iostream>
#include <stdlib.h>
#include <iomanip>

using namespace std;

int main()
{
  int n;
  long long int k;
  cin >> n >> k;
  long long int a[100001]={};
  for(int i=0;i<n;i++){
    long long int x,y;
    cin >> x >> y;
    a[x] += y;
  }

  int i=0;
  long long int sum = 0;
  while(true){
    sum += a[i];
    if(sum >= k)
      break;
    else
      i++;
  }

  cout << i << endl;

  return 0;
}

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

int main(){
    int n;
    cin>>n;
    long long ans=1;
    int MOD=1e9+7;
    for(int i=1;i<=n;i++){
        ans=(ans*i)%MOD;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3592
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1;x = (x*x) % p;}return res;}
int main()
{
fast;
ll n,x,y;
cin>>n>>x>>y;
vector<ll>ans(n-1,0);
for(ll i=1;i<n;i++)
{
    for(ll j=i+1;j<=n;j++)
    {
        ll dis1=j-i;
        ll dis2=abs(x-i)+1+abs(y-j);
        ll dis=min(dis1,dis2);
        ans[dis-1]++;
    }
}
for(ll i=0;i<n-1;i++)
{
    cout<<ans[i]<<endl;
}

return 0;
}


Measured memory_bytes: 256
INF = 10 ** 4

n, ma, mb = $stdin.readline.chomp.split.map(&:to_i)
dp = Array.new(n + 1) { Hash.new(INF) }
dp[0][[0, 0]] = 0

n.times do |i|
  a, b, c = $stdin.readline.chomp.split.map(&:to_i)
  dp[i].each do |k, v|
    da, db = k
    dp[i + 1][k] = [dp[i + 1][k], v].min
    dp[i + 1][[a + da, b + db]] = [dp[i + 1][[a + da, b + db]], v + c].min
  end
end

res = nil
dp[n].each do |k, v|
  a, b = k
  if a != 0 && b != 0 && a * mb == b * ma
    res = [(res || INF), v].min
  end
end
puts (res || "-1")

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

int main(){
	int c100, c500, c1000;
	int price, pay;

	while(cin >> price >> pay, price || pay){
		pay -= price;
		c1000 = pay / 1000;
		pay %= 1000;
		c500 = pay / 500;
		pay %= 500;
		c100 = pay / 100;

		cout << c100 << " " << c500 << " " << c1000 << endl;
	}
}

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

int main() {
    int n; cin >> n;
    vector<pair<ll, ll>> a(n);
    for(int i=0; i<n; i++) {
        ll x, l;
        cin >> x >> l;
        a[i].first = x + l;
        a[i].second = x - l;
    }
    sort(a.begin(),a.end());
    ll ans = 0, d = -1e9+7;
    for(int i=0; i<n; i++) {
        if(d <= a[i].second) {
            ans++;
            d = a[i].first;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4824
import sys
import math
import itertools
from heapq import heapify, heappop, heappush
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque


# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")


##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_IL(): return LM(int,stdin)


##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))


##### Library ####


##### main #####
def main():
    A,B = LI()
    
    ans = ""
    if A>8 or B>8:
        ans = ":("
    else:
        ans = "Yay!"

    print(ans)

if __name__ == '__main__':
    main()



Measured memory_bytes: 3444
n,k,s = (int(x) for x in input().split())

if s == 10**9:
    t = 1
else:
    t = 10**9
    
out = []
for i in range(k):
    out.append(str(s))
for i in range(n-k):
    out.append(str(t))
    
print(" ".join(out))

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

int main() {
  int n,ans = 0;
  cin >> n;
  vector<bool>data(n,false);
  for(int i = 0;i < n;i++){
    int a;
    cin >> a;
    if(a-1 == i) data[i] = true;
  }
  for(int i = 0;i < n;i++){
    if(data[i]){
      ans++;
      if(i != n-1 && data[i+1]) i++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <map>

#define MAX_N (100000)
#define NUM_MOD (1000000007L)

using namespace std;

int main() {
  // read inputs
  long N, M, as[MAX_N];
  scanf("%ld %ld", &N, &M);
  for (long i = 0; i < N; i++) {
    scanf("%ld", &as[i]);
  }

  // create mapping
  map<long, long> mod_to_num;
  long sum_a = 0;
  for (long i = 0; i < N; i++) {
    sum_a += as[i];
    mod_to_num[sum_a % M]++;
  }

  // solve
  long ans = 0;
  sum_a = 0;
  for (long i = 0; i < N; i++) {
    const long a = as[i];
    // remove as[i] + ... + as[N - 1] from map
    sum_a += a;
    mod_to_num[sum_a % M]--;
    // add (l, r) where l = i
    const long a_mod_m = a % M;
    ans += a_mod_m == 0;
    ans += mod_to_num[(M - a_mod_m + sum_a) % M];
  }
  printf("%ld\n", ans);
}


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

using P = pair<long long, long long>;

// 1-indexed
template <class T, class E>
struct SegmentTreeLaze {
  // a,b:T c,d:E e:E(unit)
  // g(f(a,b),c) = f(g(a,c),g(b,c))
  // g(g(a,c),d) = g(a,h(c,d))
  // g(a,e) = a
  typedef function<T(T, T)> F;
  typedef function<T(T, E)> G;
  typedef function<E(E, E)> H;
  int n, height;
  F f;
  G g;
  H h;
  T tunit;
  E eunit;
  vector<T> dat;
  vector<E> laz;
  SegmentTreeLaze(){};
  SegmentTreeLaze(int newn, F f, G g, H h, T nt, E ne)
      : f(f), g(g), h(h), tunit(nt), eunit(ne) {
    init(newn);
  }
  void init(int newn) {
    n = 1, height = 0;
    while(n < newn) n <<= 1, ++height;
    dat.assign(n << 1, tunit);
    laz.assign(n << 1, eunit);
  }

  inline T reflect(int k) {
    return laz[k] == eunit ? dat[k] : g(dat[k], laz[k]);
  }

  inline void eval(int k) {
    if(laz[k] == eunit) return;
    laz[k << 1] = h(laz[k << 1], laz[k]);
    laz[(k << 1) | 1] = h(laz[(k << 1) | 1], laz[k]);
    dat[k] = reflect(k);
    laz[k] = eunit;
  }

  inline void thrust(int k) {
    for(int i = height; i; --i) eval(k >> i);
  }

  void recalc(int k) {
    while(k >>= 1)
      dat[k] = f(reflect(k << 1), reflect((k << 1) | 1));
  }
  // [a,b)
  void update(int a, int b, E newdata) {
    thrust(a += n);
    thrust(b += n - 1);
    for(int l = a, r = b + 1; l < r; l >>= 1, r >>= 1) {
      if(l & 1) laz[l] = h(laz[l], newdata), l++;
      if(r & 1) --r, laz[r] = h(laz[r], newdata);
    }
    recalc(a);
    recalc(b);
  }

  void set_val(int k, T newdata) {
    thrust(k += n);
    dat[k] = newdata;
    laz[k] = eunit;
    recalc(k);
  }

  // [a,b)
  T query(int a, int b) {
    thrust(a += n);
    thrust(b += n - 1);
    T vl = tunit, vr = tunit;
    for(int l = a, r = b + 1; l < r; l >>= 1, r >>= 1) {
      if(l & 1) vl = f(vl, reflect(l++));
      if(r & 1) vr = f(reflect(--r), vr);
    }
    return f(vl, vr);
  }
};

long long n, q;

int main() {
  cin >> n >> q;
  auto f = [](P l, P r) {
    return P(min(l.first, r.first), l.second + r.second);
  };
  auto g = [](P l, long long r) {
    return P(l.first + r, l.second);
  };
  auto h = [](long long l, long long r) { return l + r; };
  SegmentTreeLaze<P, long long> seg(n, f, g, h,
                                    P(10000000000, 0), 0);
  for(int i = 0; i < n; ++i) seg.set_val(i, P(0, 1));
  for(int i = 0; i < q; ++i) {
    long long c, s, t, x;
    cin >> c >> s >> t;
    if(c) { cout << seg.query(s, t + 1).first << endl; }
    else {
      cin >> x;
      seg.update(s, t + 1, x);
    }
  }
  return 0;
}


Measured memory_bytes: 8892
def d_string_formation():
    from collections import deque
    S = input()
    Q = int(input())
    Query = [input().split() for _ in range(Q)]

    ans = deque(list(S))
    ordered = True  # ordered -> False のときは「先頭」と「末尾」が替わっている
    for q in Query:
        if q[0] == '1':
            ordered = not ordered
            continue

        _, f, c = q
        if (f == '1' and ordered) or (f == '2' and not ordered):
            operation = ans.appendleft
        else:
            operation = ans.append
        operation(c)
    return ''.join(ans) if ordered else ''.join(reversed(ans))

print(d_string_formation())

Measured memory_bytes: 44644
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b){ return a ? GCD(b % a, a) : b; }
int main(){
    int h;
    cin>>h;
    int a;
    cin>>a;
    int ans = h/a;
    if(h%a) ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 256