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

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()

template<typename U, typename T>
void chmin(U &x, T y) { x = min(x, y); }

template<typename U, typename T>
void chmax(U &x, T y) { x = max(x, y); }

typedef long long int lli;
typedef long double ld;
typedef pair<int,int> P;

const int INF = INT_MAX/3;
const double EPS = 1e-14;
const int dx[4] = {0, 1, 0, -1}; // {-1,  0,  1, -1, 1, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0}; // {-1, -1, -1,  0, 0,  1, 1, 1};

lli s;

lli pw(lli a, lli n) {
  if (n == 0) return 1;
  if (n % 2 == 0) return pw(a * a, n / 2);
  return a * pow(a, n - 1);
}

lli width(lli idx, lli base) {
  lli p = 0;
  while (idx >= pw(10, p)) p++;
  lli val = -((pw(10, p) - 1)/base - idx/base) * p;
  while (p > 0) {
    val += p * (pw(10, p) - pw(10, p - 1)) / base;
    p--;
  }
  return val;
}

lli string_width(lli idx) {
  lli val = width(idx,1)-width(idx,3)-width(idx,5)+width(idx,15);
  val += (idx/3 + idx/5) * 4;
  return val;
}

string fizzbuzz20(lli start) {
  string str;
  for (lli n = start; n < start + 20; n++) {
    if (n % 15 == 0) str += "FizzBuzz";
    else if (n % 3 == 0) str += "Fizz";
    else if (n % 5 == 0) str += "Buzz";
    else str += to_string(n);
  }
  return str;
}

int main() {
  cout << fixed << setprecision(10);
  cin >> s;
  lli lb = 0, ub = 1e17;
  while (ub - lb > 1) {
    lli mid = (lb + ub) / 2;
    if (string_width(mid) >= s) ub = mid;
    else lb = mid;
  }
  string ans = fizzbuzz20(lb + 1);
  
  ans = ans.substr(s - string_width(lb) - 1);
  cout << ans.substr(0,20) << endl;
  return 0;
}

Measured memory_bytes: 1276
def main():
  n = int(input())
  alist = [int(input()) for _ in range(n)]
  maxn, maxc, max2n = 0, 0, 0
  for a in alist:
    if maxn <= a:
      if maxn == a:
        maxc += 1
      else:
        max2n = maxn
        maxn = a
        maxc = 1
    elif max2n < a:
      max2n = a

  for a in alist:
    if a == maxn:
      if maxc > 1:
        print(maxn)
      else:
        print(max2n)
    else:
      print(maxn)


if __name__ == '__main__':
  main()


Measured memory_bytes: 12532
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long  ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;


void solve() {
	int n; cin >> n;
	int a[2], b[2];
	cin >> a[0] >> a[1] >> b[0] >> b[1];
	rep(i, 2) {
		a[i]--; b[i]--;
	}
	string s; cin >> s;
	if (b[0] < b[1]) {
		Rep(i, a[0], b[0]) {
			if (s[i] == '#'&&s[i + 1] == '#') {
				cout << "No" << endl;
				return;
			}
		}
		Rep(i, a[1], b[1]) {
			if (s[i] == '#'&&s[i + 1] == '#') {
				cout << "No" << endl;
				return;
			}
		}
		cout << "Yes" << endl;
	}
	else {
		Rep(i, a[0], b[0]) {
			if (s[i] == '#'&&s[i + 1] == '#') {
				cout << "No" << endl; return;
			}
		}
		Rep(i, a[1] - 1, b[1]) {
			if (s[i] == '.'&&s[i + 1] == '.'&&s[i + 2] == '.') {
				cout << "Yes" << endl; return;
			}
		}
		cout << "No" << endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(5);
	//while (cin >> n)solve();
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 592
local n, k = io.read("*n", "*n")
local a = {}
for i = 1, n do
  a[i] = io.read("*n")
end
local map = {}
local len = 0
map[1] = 0
local src = 1
local rem = 0
while true do
  len = len + 1
  local dst = a[src]
  if len == k then
    print(dst)
    os.exit()
  end
  if map[dst] then
    local offset = map[dst]
    local loopSize = len - offset
    rem = k - offset
    rem = rem % loopSize
    src = dst
    break
  else
    map[dst] = len
  end
  src = dst
end
for i = 1, rem do
  local dst = a[src]
  src = dst
end
print(src)


Measured memory_bytes: 14724
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <climits>
#include <tuple>
#include <queue>
#include <cassert>
//#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define el '\n'
 


bool is_ok(int x, int y, int n, int m){
	if (x < 0 || x >= n) return false;
	if (y < 0 || y >= m) return false;
	return true;
}

vector<vector<bool>> ok;
vector<vector<char>> gr;
queue<pair<int, int> > q1, q2, qs;
vector<vector<int>> sol;
vector<int> Xs = {0, 0, -1, 1};
vector<int> Ys = {1, -1, 0, 0};

vector<int> Xss;
vector<int> Yss;
int n,m;
void bfs1(){
		while(!q1.empty()){
		int X = q1.front().F;
	 	int Y = q1.front().S;
		q1.pop();
		if (ok[X][Y]) continue;
		//cout << X<<" "<<Y<<el;
		ok[X][Y] = true;
		int val = sol[X][Y];
		for (int i = 0; i < 4; i++){
			int nx = Xs[i] + X, ny = Ys[i] + Y;
			if (!is_ok(nx, ny,n,m))continue;
			if (!ok[nx][ny] && gr[nx][ny] == '.'){
				sol[nx][ny] = val;
				q1.push(MP(nx,ny));
			}
		}

		for (int i = 0; i < Xss.size(); i++){
			int nx = Xss[i] + X, ny = Yss[i] + Y;
			if (!is_ok(nx, ny,n,m))continue;
			if (!ok[nx][ny] && gr[nx][ny] == '.'){
				sol[nx][ny] = min(sol[nx][ny],val + 1);
				q2.push(MP(nx,ny));
			}
		}
	}

}

void bfs2(){
		int X = q2.front().F;
	 	int Y = q2.front().S;
		q2.pop();
		if (ok[X][Y]) return;
	//	cout << X<<" "<<Y<<el;
		ok[X][Y] = true;
		int val = sol[X][Y];
		for (int i = 0; i < 4; i++){
			int nx = Xs[i] + X, ny = Ys[i] + Y;
			if (!is_ok(nx, ny,n,m))continue;
			if (!ok[nx][ny] && gr[nx][ny] == '.'){
				sol[nx][ny] = val;
				q1.push(MP(nx,ny));
			}
		}

		for (int i = 0; i < Xss.size(); i++){
			int nx = Xss[i] + X, ny = Yss[i] + Y;
			if (!is_ok(nx, ny,n,m))continue;
			if (!ok[nx][ny] && gr[nx][ny] == '.'){
				sol[nx][ny] = min(sol[nx][ny], val + 1);
				q2.push(MP(nx,ny));
			}
		}
}
 


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int x, y, ex,ey;
	cin >> n>>m;
	cin >> x>>y;
	cin >> ex>>ey;
	x--; y--;
	ex--; ey--;
	gr.resize(n,vector<char>(m));
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			cin >> gr[i][j];
		}
	}

	q1.push(MP(x,y));

	//vector<vector<bool>> ok(n,vector<bool>(m));
	ok.resize(n,vector<bool>(m));
//	vector<vector<int>> sol(n,vector<int>(m));
	sol.resize(n,vector<int>(m, INT_MAX));
	sol[x][y] = 0;


	for (int i  = 0; i < 5; i++){
		for (int j = 0 ; j < 5; j++){
			Xss.PB(i - 2);
			Yss.PB(j - 2);
		}
	}

	// for (int i = 0; i < Xss.size(); i++){
	// 	cout << Xss[i]<<" ";
	// }
	// cout <<el;
	// for (int i = 0; i < Xss.size(); i++){
	// 	cout << Yss[i]<<" ";
	// }
	// cout <<el;




	while(!q1.empty() || !q2.empty()){
		if (!q1.empty()){
			bfs1();
		} else{
			bfs2();
		}
	}


	// for (int i = 0; i < n; i ++){
	// 	for (int j = 0; j < m; j++){
	// 		cout << sol[i][j]<<" ";
	// 	}
	// 	cout <<el;
	// }

	if (ok[ex][ey])
	cout << sol[ex][ey]<<el;
	else
		cout << -1<<el;
    return 0;
}

Measured memory_bytes: 8476
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;
constexpr long double PI = 3.1415926535'8979323846'2643383279;

int main(void) {
    long double R;
    cin >> R;
    printf("%.15Lf\n", 2.0*PI*R);
    return 0;
}


Measured memory_bytes: 3792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#define ll long long

using namespace std;

int main()
{
	int a,b;
	cin >> a >> b;
	if (a-2*b>=0)
	{
		cout << a-2*b;
	}
	else
	{
		cout << 0;
	}
}



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

using namespace std;

using ll = long long;

ll a[100010], sum[100010];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	cin >> a[0];
	vector<int> minus;
	for (int i = 1; i < n; i++) {
		char op;
		cin >> op >> a[i];
		if (op == '-') minus.push_back(i);
	}

	for (int i = n - 2; i >= 0; i--) {
		sum[i] = sum[i + 1] + a[i + 1];
	}

	ll ans = 0, hoge = 0;
	if (minus.empty()) {
		for (int i = 0; i < n; i++) {
			ans += a[i];
		}
	} else {
		for (int i = 0; i < minus.front(); i++) hoge += a[i];
		for (int i = 0; i < minus.size(); i++) {
			hoge -= a[minus[i]];
			if (i + 1 == minus.size()) {
				hoge += sum[minus[i]];
				ans = max(ans, hoge);
			} else {
				ll tmp = sum[minus[i]] - sum[minus[i + 1] - 1];
				ans = max(ans, hoge + sum[minus[i + 1] - 1] - tmp);
				hoge += tmp;
			}
		}
	}

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

Measured memory_bytes: 2296
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

struct edge{int to,rev;};
vector<edge> G[100005];

int main(void){
	int n;
	cin>>n;
	int a,b;
	rep(i,n-1){
		cin>>a>>b;
		a--;b--;
		G[a].push_back(edge{b, (int)(G[b].size())});
		G[b].push_back(edge{a, (int)(G[a].size()-1)});
	}
	int c;
	vector<int> C;
	ll val = 0;
	rep(i,n){
		cin>>c;
		C.push_back(c);
		val += c;
	}
	sort(all(C));
	val -= C[C.size()-1];

	vector<int> count;
	vector<int> ans;
	rep(i,n){
		count.push_back(G[i].size());
		ans.push_back(-1);
	}
	int idx = 0;

	while(true){
		bool check = false;
		rep(i,n){
			if(count[i] == 1){
				check = true;
				count[i]--;
				ans[i] = C[idx];
				idx++;
				rep(j,G[i].size()){
					if(G[i][j].to != -1){
						count[G[i][j].to]--;
						G[G[i][j].to][G[i][j].rev].to = -1;
						break;
					}
				}
			}
		}
		if(!check) break;
	}

	cout<<val<<endl;
	rep(i,ans.size()){
		cout<<(ans[i]==-1?C[C.size()-1]:ans[i])<<" ";
	}
	cout<<endl;

	return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

long long int gcd(long long int , long long int);
long long int gcd(long long int [], long long int);

//最大公約数を求める(二変数)
long long int gcd(long long int a, long long int b){
    long long int r;
    while(1){
        if(a < b){
            long long int tmp = a;
            a = b;
            b = tmp;
        }
        r = a % b;
        if(r == 0){
            return b;
        }
        a = r;
    }
}

//最大公約数を求める(多変数)
long long int gcd(long long int a[], long long int size){
    long long int x = a[0];
    for(long long int i=1; i<size; i++){
        x = gcd(x, a[i]);
    }
    return x;
}

int main(){
    int N, M;
    long long int xList[100100] = {0};
    cin >> N >> M;
    for(int i=0; i<N; i++){
        cin >> xList[i];
    }
    xList[N] = M;
    sort(xList, xList+N+1);
    long long int dxList[100100] = {0};
    for(int i=0; i<N; i++){
        dxList[i] = xList[i+1]-xList[i];
    }
    if(N == 1){
        cout << dxList[0];
        return 0;
    }
    cout << gcd(dxList, N);
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define ll unsigned long long int
#define test long int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
#define mm 1000000007

bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int binaryExponentiation(int x, int n) //function to calculate x raise to power n
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x;
		x = x * x;
		n = n / 2;
	}
	return result;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-______________________________________________________________________________

	int n;
	cin >> n;
	ll a[n];
	map<ll, ll>m;
	zip(i, 0, n)
	{
		cin >> a[i];
		m[a[i]]++;

	}
	ll cnt = 0;
	auto itr = m.begin();
	for (itr = m.begin(); itr != m.end(); itr++)
	{
		ll x = itr->ss;
		cnt += (x * (x - 1)) / 2;
	}
	//cout << cnt << en;
	rep(i, 1, n)
	{
		ll y = m[a[i - 1]];
		ll ans = cnt - ((y - 1) * y) / 2 + ((y - 1) * (y - 2)) / 2;
		cout << ans << en;


	}


	return 0;
}


Measured memory_bytes: 11136
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// スペース区切りの整数の入力
		int N= sc.nextInt();
		int Sum=0;
		// 出力
       for (int i=1;i<=N;i++){
         Sum+=i;
       }
       System.out.println(Sum);
   }
}


Measured memory_bytes: 22100
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
using namespace std;

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

	char s1, s2;
	cin >> s1 >> s2;
	a = (s1 - '0') * 10 + (s2 - '0');
	cin >> s1 >> s2;
	b = (s1 - '0') * 10 + (s2 - '0');

	if (a > 12 || a == 0)
	{
		if (b >= 1 && b <= 12)
		{
			cout << "YYMM" << endl;
		}
		else
		{
			cout << "NA" << endl;
		}
	}
	else if (b > 12 || b == 0)
	{
		if (a >= 1 && a <= 12)
		{
			cout << "MMYY" << endl;
		}
		else
		{
			cout << "NA" << endl;
		}
	}
	else
	{
		cout << "AMBIGUOUS" << endl;
	}


	return 0;
}


Measured memory_bytes: 256
while true do
  y1, m1, d1, y2, m2, d2 = gets.split.map(&:to_i)
  break if y1 == -1
  day1 = Time.local(y1, m1, d1)
  day2 = Time.local(y2, m2, d2)
  p ((day2 - day1)/60/60/24).to_i
end

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

using namespace std;
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvs = vector<vector<string>>;
template<typename T> using vv = vector<vector<T>>;
template<typename T> using vvv = vector<vector<vector<T>>>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using pqg = priority_queue<T, vector<T>, greater<T>>;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};

#define _sel(_1, _2, x, ...) x
#define repn(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, ...) _sel(__VA_ARGS__, reps, repn)(i, __VA_ARGS__)
#define reppn(i, n) for (ll i = 1; i <= (n); i++)
#define repps(i, a, b) for (ll i = (a); i <= (b); i++)
#define repp(i, ...) _sel(__VA_ARGS__, repps, reppn)(i, __VA_ARGS__)
#define rrepn(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, a, b) for (ll i = (b) - 1; i >= (a); i--)
#define rrep(i, ...) _sel(__VA_ARGS__, rreps, rrepn)(i, __VA_ARGS__)
#define rreppn(i, n) for (ll i = (n); i >= 1; i--)
#define rrepps(i, a, b) for (ll i = (b); i >= (a); i--)
#define rrepp(i, ...) _sel(__VA_ARGS__, rrepps, rreppn)(i, __VA_ARGS__)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define rng(v) (v).begin(), (v).end()
#define rrng(v) (v).rbegin(), (v).rend()
#define siz(x) int((x).size())
#define pow2(x) (1ll << (x))
#define bit(x, n) ((x) >> (n) & 1)
#define prt(x) cout << (x) << endl
#define dbg(x) dbgn(#x, x)

template<typename T, typename U> inline bool umax(T& m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U> inline bool umin(T& m, U x) { if (m > x) { m = x; return true; } return false; }
template<typename T> inline void errv(T& v) { for (auto x: v) cerr << x << " "; cerr << endl; }
inline void errv(vb& v) { for (auto x: v) cerr << (x ? 1 : 0) << " "; cerr << endl; }
template<typename T> inline void dbgn(string n, T x) { cerr << n << ": " << x << endl; }
template<typename T> inline void dbgn(string n, vector<T>& v) { cerr << n << ": "; errv(v); }
template<typename T> inline void dbgn(string n, vv<T>& m) { cerr << n << ":" << endl; for (auto& v: m) errv(v); }


int main() {
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;

    int a = h1 * 60 + m1;
    int b = h2 * 60 + m2;
    prt((b - a) - k);

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    int a[5];
    rep(i, 0, 5) cin >> a[i];
    sort(a, a + 5);
    repb(i, 4, 0){
        if(i != 4) cout << " ";
        cout << a[i];
    }
    cout << endl;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define fr(i,a,b) for(ll i=a;i < b;i++)
#define fe(i,a,b) for(ll i=a;i <= b;i++)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fir first
#define sec second
#define tr(it,x) for(auto it = x.begin();it != x.end();it++)
#define mp make_pair
#define sz(x) (ll)x.size()
#define rep(i,n) for(ll i=0;i<n;i++)
#define double long double
#define accuracy ll precision = numeric_limits<double>::digits10
#define pll pair<ll,ll>
#define MAXN 100005
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define case(x) cout<<"Case #"<<x+1<<": "
#define endl "\n"
#define preturn(X) cout<<(X)<<endl; return 0
const int MOD = 1e9+7;
ll powmod(ll a,ll b,ll m=MOD){ll r=1;while(b>0){if(b&1)r=r*a%m;a=a*a%m;b>>=1;}return r;}
ll power(ll a,ll b){ll r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
ll gcd(ll a,ll b){if(!b)return a;return gcd(b,a%b);}
ll inv(ll a, ll m = MOD){return powmod(a,m-2,m);}
ll lcm(ll a,ll b){return(a*b)/gcd(a,b);}

int32_t main(){
    int N,K;
    cin>>N>>K;
    vector<int> a(N);
    rep(i,N)cin>>a[i];
    vector<int> dp1(1e5+7,-1),dp2(1e5+7,-1);
    sort(all(a));
    int sm = a[0];
    // dp1[0] = dp2[0] = 0; // If count is zero in current turn they win
    for(int i = 0; i < sm; i++){
        dp1[i] = dp2[i] = 1; // if we cant take any number opponent wins
    }
    for(int i = sm; i <= K; i++){
        // compute dp1[i] and dp2[i] knowing all previous values have been computed;
        bool win = false;
        for(int j = 0; j < N; j++){
            // check the possibility of winning by taking a[j]
            if(a[j] > i)break;
            if(dp2[i - a[j]] == 1){
                win = true;
                break;
            }
        }
        dp1[i] = !win;
        win = false;
        for(int j = 0; j < N; j++){
            // check the possibility of winning by taking a[j]
            if(a[j] > i)break;
            if(dp1[i - a[j]] == 1){
                win = true;
                break;
            }
        }
        dp2[i] = !win;       
    }
    if(dp1[K] == 0)cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}

Measured memory_bytes: 1792
s=input()
t=input()
ns,nt=len(s),len(t)
#dp=np.zeros((ns+1,nt+1),np.int64)
dp=[[0]*(nt+1) for _ in range(ns+1)]
# dp[i+1][j+1]:sのi文字目まで、tのj文字目まで考えた時の最長
for i in range(ns):
      for j in range(nt):
            if s[i]==t[j]:
                  dp[i+1][j+1]=dp[i][j]+1
            dp[i+1][j+1]=max(dp[i+1][j+1],dp[i+1][j],dp[i][j+1])
lg=dp[-1][-1]
ans=[]
#print(dp)
i,j=ns,nt
while i>0 and j>0:
      if dp[i][j]==dp[i][j-1]:
            j-=1
      elif dp[i][j]==dp[i-1][j]:
            i-=1
      else:
            i-=1
            j-=1
            ans.append(s[i])
s=''
for _ in range(lg):
      s+=ans.pop()
print(s)
      

Measured memory_bytes: 113884
#!/usr/bin/env python3
import sys


def solve(S: str):
    print("x"*len(S))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>

using namespace std;

typedef long long ll;
typedef vector <ll> v_ll;
typedef vector <vector <ll> > vv_ll;
typedef vector < pair <ll,ll> > vp_ll;
typedef pair <ll,ll> p_ll;

string S;
ll N;

int main(){
  cin >> S;
  N=S.length();
  S=" "+S;
  if (S[N]=='1'){cout << -1 << endl; return 0;}
  if (S[N-1]=='0'){cout << -1 << endl; return 0;}
  if (S[1]=='0'){cout << -1 << endl; return 0;}
  v_ll A;
  for (ll i=1;i<=N-1;i++){
    if (S[i]!=S[N-i]){cout << -1 << endl; return 0;}
  }
  ll last=N;
  for (ll i=1;i<=N-1;i++){
    cout << last << " " << i << endl;
    if (S[i]=='1')last=i;
  }
}


Measured memory_bytes: 1536
s = list(map(int,input().split()))
s.sort()
count = 0
while True:
    if s[1] != s[2]:
        s[0] += 1
        s[1] += 1
        count += 1
    if s[1] == s[2]:
        break

if (s[2] - s[0])%2 == 0:
    print((s[2]-s[0])//2 + count)
else:
    print((s[2]-s[0]+1)//2 + count + 1)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <numeric>
#include <climits>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int main(){
    string x;
    string y;
    cin >> x >> y;
    if(x > y) cout << ">" << endl;
    else if(x == y) cout << "=" << endl;
    else cout << "<" << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int dp[10001];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,w;
	cin >> n >> w;
	vector<int> we(n);
	vector<int> va(n);
	for(int i=0;i<n;i++)cin >> va[i] >> we[i];
	//入力
	for(int i=0;i<n;i++)for(int j=w;j>=0;j--){
		if(j<we[i])continue;
		dp[j]=max(dp[j],dp[j-we[i]]+va[i]);
	}

	cout << dp[w] << endl;
}


Measured memory_bytes: 3236
#include<bits/stdc++.h>
using namespace std;
#define yes "Yes"
#define no "No"

string solve(int A, int B, string S) {
  bool answer = true;
  if ((A>=1) && (B<=5) && (S[A]=='-')) {
    for (int i=0; i<(A+B+1); i++) 
  	  if (!(('0'<=S[i]) && (S[i]<='9')) && (i!=A))
  		answer &= false;
  } else
    answer = false;
  
  return (answer) ? yes : no;
}

int main() {
  int A, B;
  string S;
  cin >> A >> B >> S;
  cout << solve(A, B, S) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
#define MAX_N 1000000

int sosuu[MAX_N];

void sosu(void)
{
  int i,j;
  for(i=2;i<=MAX_N;i++){
    sosuu[i] = 1;
  }
  
  sosuu[0]=0;
  sosuu[1]=0;

  for(i=2;i<=MAX_N;i++){
    if(sosuu[i]){
      for(j=i*2;j<=MAX_N;j+=i){
	sosuu[j]=0;
      }
    }
  }
}


int main(void)
{
  sosu();

  for(;;){
    int a,d,n;
    scanf("%d %d %d",&a,&d,&n);
    if(a==0 || d==0 || n == 0)return 0;
    
    int count=0;
    int i;
    for(i=a;;i+=d){
      //printf("count=%d i=%d\n",count,i);
      if(sosuu[i]==1)count++;
      if(count==n)break;
    }
    printf("%d\n",i);

  }
  return 1;
}

Measured memory_bytes: 5092
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
int dx[] = { -1, 0, 0, 1 }; int dy[] = { 0, -1, 1, 0 };
//[int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 }; int dy[] = { 0, -1, 1, -1, 1, 0, -1, 1 };
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
int place(int x, int y, int w) { return w*x + y; }

/*--------------------template--------------------*/

int main()
{
	int w, h;
	while (cin >> w >> h, w)
	{
		vs fld(h);
		REP(i, h) cin >> fld[i];
		int x, y;
		REP(i, h)REP(j, w)
		{
			if (fld[i][j] == '@')
			{
				x = i, y = j;
				fld[i][j] = '.';
			}
		}
		queue<pii> que;
		que.push(pii(x, y));
		int cnt = 0;
		while (que.size())
		{
			int tx = que.front().first, ty = que.front().second;
			que.pop();
			if (fld[tx][ty] == '.')
			{
				fld[tx][ty] = '$';
				cnt++;
			}
			REP(i, 4)
			{
				int nx = tx + dx[i], ny = ty + dy[i];
				if (valid(nx, ny, h, w) && fld[nx][ny] == '.')
				{
					que.push(pii(nx, ny));
				}
			}
		}
		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 6328
#include <stdio.h>

int main() {
	double W, H;
	int x, y;
	scanf("%lf %lf %d %d", &W, &H, &x, &y);
	printf("%lf %d\n", (W * H) / 2, ((x + x == W) && (y + y == H)));
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO ios::sync_with_stdio(0); cin.tie(NULL);
typedef long long ll;
using namespace std;

unordered_map<int,int>par,sz;



void make_set(int i){
  par[i] = i;
  sz[i] = 1;
}
int find_set(int i){
  if(par[i] == i){
    return  i;
  }
  
  return par[i] = find_set(par[i]);
}
void union_set(int a, int b){
  a = find_set(a);
  b = find_set(b);
  
  if(a==b) return;
  
  if(sz[a]<sz[b]) swap(a,b);
  par[b] = a;
  sz[a] += sz[b];
  
}

int main(){
    fastIO
    int n,q; cin>>n>>q;
    //vector<int>par(n+1), sz(n+1);
    for(int i=1; i<=n; i++){
      make_set(i);
    }
    
    while(q--){
      int a,b;
      cin>>a>>b;
      union_set(a,b);
    }
    
    int ans = 0;
    
    for(auto [i,j]: sz)
      ans = max(ans, j);
      
    
    
    cout<<ans;
    
    return 0;
}

Measured memory_bytes: 19716
#include <cstdio>
#define RANK_SIZE 13
#define TRUMP_SIZE (RANK_SIZE * 4)

char num_to_mark_array[] = {'S', 'H', 'C', 'D'};

char num_to_mark(int num) {
  return num_to_mark_array[num];
}

int mark_to_num(int mark) {
  for(int i = 0; i < sizeof(num_to_mark_array); i++) {
    if(num_to_mark_array[i] == mark) {
      return i;
    }
  }

  return -1;
}

struct Card {
  char mark;
  int rank;
};

int card_to_index(Card card) {
  return  mark_to_num(card.mark) * RANK_SIZE + (card.rank - 1);
}

Card index_to_card(int index) {
  Card card;
  card.mark = num_to_mark(index / RANK_SIZE);
  card.rank = index % RANK_SIZE + 1;
  return card;
}

int main() {
  int having_size;
  bool is_having_trump[TRUMP_SIZE] = {false};

  scanf("%d%*c", &having_size);
  for(int i = 0; i < having_size; i++) {
    Card card;
    scanf("%c %d%*c", &card.mark, &card.rank);

    is_having_trump[card_to_index(card)] = true;
  }

  for(int i = 0; i < TRUMP_SIZE; i++) {
    if(!is_having_trump[i]) {
      Card card = index_to_card(i);
      printf("%c %d\n", card.mark, card.rank);
    }
  }
}



Measured memory_bytes: 2760
import math
def sosu(n) :
    for i in range(3, int(math.sqrt(n))+1, 2) :
        if n % i == 0 :
            return False
    return True

S = [0, 0, 1, 2, 2, 3, 3, 4, 4, 4, 4]
for i in range(11, 1000000) :
    if i % 2 == 0 :
        S.append(S[i-1])
    elif sosu(i) :
        S.append(S[i-1]+1)
    else :
        S.append(S[i-1])


while True :
    try :
        n = int(input())
    except EOFError :
        break
    
    print(S[n])
    






Measured memory_bytes: 15996
#include <bits/stdc++.h>
using namespace std;
char str[1000001];
int l,r;
void add(vector<char> &b,vector<char> &e){
    for (auto ch:b){
        --l;
        str[l]=ch;
    }
    for (auto ch:e){
        ++r;
        str[r]=ch;
    }
}
vector<char> b,e;
int main(){
    scanf("%s",str+300000);
    l=300000;
    r=strlen(str+300000)+300000-1;
    int q;
    scanf("%d",&q);
    bool rev=false;
    while (q--){
        int t;
        scanf("%d",&t);
        if (t==1){
            if (rev) add(e,b);
            else add(b,e);
            rev=!rev;
            b.clear(); e.clear();
        } else {
            int f;
            char ch;
            scanf("%d %c",&f,&ch);
            if (f==1) b.push_back(ch);
            else e.push_back(ch);
        }
    }
    if (rev) add(e,b);
    else add(b,e);
    if (rev){
        for (int i=r;i>=l;--i) printf("%c",str[i]);
    } else {
        for (int i=l;i<=r;++i) printf("%c",str[i]);
    }
}

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

int main(void){
	int N;
	cin >> N;
	vector<int> A(N);
	rep(i,N) cin >> A[i];
	int s=0;
	rep(i,N)
		if(A[i]==(s+1)) s++;
	if(s==0)
		cout << -1 << endl;
	else if(s==N)
		cout << 0 << endl;
	else
		cout << N-s << endl;
	return 0;
}

Measured memory_bytes: 1024
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
import Data.List
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Control.Monad
-- import Control.Monad.ST
-- import Debug.Trace

solve :: Int -> Int -> [Int] -> Int
solve n k as = n - freq where
  cnt = VU.toList $ VU.create $ do
    v <- VUM.replicate (n+1) 0
    forM_ as $ \a -> VUM.modify v (+ 1) a
    return v

  freq = sum $ take k $ sortOn (* (-1)) cnt

readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

tmain :: B.ByteString -> Int
tmain cont =
  let remLines0 = map B.words (B.lines cont)
      [bs_n,bs_k]:remLines1 = remLines0
      n = readBInt bs_n
      k = readBInt bs_k
      line2:remLines2 = remLines1
      as = map readBInt line2
  in solve n k as

outAnswer :: Int -> IO ()
outAnswer = putStrLn . show

main :: IO ()
main = outAnswer . tmain =<< B.getContents


Measured memory_bytes: 33148
/* {{{ Definitions */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <ios>
#include <utility>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
/* }}}------------------------------------------- */
int A, B;
void solve(){
	if(B % A == 0){
		cout << A + B << endl;
	}
	else{
		cout << B - A << endl;
	}
}
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> A >> B;
	solve();
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
const long mod=1e9+7;
int S;
long dp[2020];
main()
{
	cin>>S;
	dp[0]=1;
	for(int i=0;i+3<=S;i++)
	{
		for(int j=3;i+j<=S;j++)
		{
			(dp[i+j]+=dp[i])%=mod;
		}
	}
	cout<<dp[S]<<endl;
}


Measured memory_bytes: 3636
#include<stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int a[n];
  for(int i=0; i<n; i++){
    scanf("%d",&a[i]);
  }
  int c=0;
  for(int i=1; i<n-1; i++){
    if((a[i-1]<a[i]&&a[i]<a[i+1])||(a[i-1]>a[i]&&a[i]>a[i+1])){
      c++;
    }
  }
  printf("%d",c);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main() {
    string m,p;
    cin>> m;
    int cont=0,k=0;
    for(int i=0;i<m.size();i++){
        if(m[i]=='A'){
            for(int j =m.size()-1;;j--){
                if(m[j]=='Z'){
                    cout<<m.size()-cont;
                    return 0;
                }else{
                    cont++;
                }
            }
        }else{
            cont++;
        }
    }
    return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> dist(m);
  set<int> st;
  multiset<int> all;
  for (int i = 0; i < m; i++) {
    st.insert(i);
    all.insert(0);
  }
  const int inf = (int) 1e9;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    --l;
    int Min = inf;
    auto it = st.lower_bound(l);
    while (it != st.end() && *it <= r) {
      int x = *it;
      Min = min(Min, dist[x] + r - x);
      it = st.erase(it);
      all.erase(all.find(dist[x]));
      dist[x] = inf;
    }
    if (r != m && Min != inf) {
      dist[r] = min(dist[r], Min);
      st.insert(r);
      all.insert(dist[r]);
    }
    if (all.empty()) {
      cout << -1 << '\n';
    } else {
      cout << *all.begin() + i + 1 << '\n';
    }
  }
  return 0;
}


Measured memory_bytes: 22664
#include<bits/stdc++.h>
using namespace std;
#define ll long long
struct P
{
    ll x,y;
}H[200000];
int main()
{
    ll n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>H[i].x>>H[i].y;
    }
    ll sum=0;
    for(int i=n;i>=1;i--)
    {
        H[i].x+=sum;
        if((H[i].x)%H[i].y==0)
        {
            continue;
        }
        else
        {
            ll pos=(H[i].x)/H[i].y+1;
            sum+=(pos*H[i].y)-H[i].x;
          //  cout<<pos<<" "<<((pos*H[i].y)-H[i].x)<<endl;
        }
    }
    cout<<sum<<endl;
    return 0;
}


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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)


typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
//////////////////////////




int main(){fastio
    ll n;cin>>n;
    vector<l_l> a(n);rep(i,0,n-1){cin>>a[i].fi;a[i].se=i;}
    SORT(a);
    reverse(a.begin(),a.end());
    ll dp[n+1][n+1];rep(i,0,n)rep(j,0,n)dp[i][j]=-inf;
    dp[0][0]=0;
    rep(i,0,n-1){
        ll val=a[i].fi;
        ll pos=a[i].se;
        rep(j,0,i){
            ll k=i-j;
            chmax(dp[j+1][k],dp[j][k]+abs(pos-j)*val);
            chmax(dp[j][k+1],dp[j][k]+abs(pos-(n-1-k))*val);
        }
    }/*
    rep(i,0,n){
        rep(j,0,n)cout<<dp[i][j]<<" ";
        cout<<endl;
    }
    */
    ll ans=0;
    rep(i,0,n){
        chmax(ans,dp[i][n-i]);
    }
    cout<<ans<<endl;
    
    return 0;
}



Measured memory_bytes: 34960
#include <algorithm>
// #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
// #include <bitset>
const int oo=2139063143;
const int N=1010000;
const int P=1000000007;
using namespace std;
typedef long long LL;
typedef double db;
#define pritnf printf
//char buf[1<<22],*p1=buf,*p2=buf,obuf[1<<22],*O=obuf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <typename T>
inline void sc (T &x)
{
    x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
}
template <typename T>
inline void print (T x)
{
	if (x< 0) putchar('-'),x=-x;
	if (x>=10) print(x/10);
	putchar(x%10+'0');
}
template <typename T>
inline void pr (T x) { print(x),putchar('\n'); }
int del(int x) { return x>=P?x-P:x; }
void add(int &x,int y) { x=del(x+y); }
int ksm (int a,int b)
{
	int ans=1;
	while (b)
	{
		if (b&1) ans=(LL)ans*a%P;
		a=(LL)a*a%P,b>>=1;
	}
	return ans;
}
struct EDGE { int v,nx; }lb[N]; int tot=1,top[N];
void adde (int u,int v) { lb[++tot]=(EDGE){v,top[u]},top[u]=tot; }
int siz[N],son[N],faa[N],dep[N];
void dfs0 (int u,int fa)
{
	dep[u]=dep[faa[u]=fa]+(siz[u]=1);
	for (int kb=top[u]; kb; kb=lb[kb].nx)
	{
		int v=lb[kb].v;
		dfs0 (v,u);
		siz[u]+=siz[v];
		if (siz[v]> siz[son[u]]) son[u]=v;
	}
}
int topf[N],dfn[N];
void dfs00 (int u,int topf)
{
	dfn[u]=++dfn[0];
	::topf[u]=topf;
	if (son[u]) dfs00 (son[u],topf);
	for (int kb=top[u]; kb; kb=lb[kb].nx)
	{
		int v=lb[kb].v;
		if (v==son[u]) continue;
		dfs00 (v,v);
	}
}
int lca (int x,int y)
{
	while (topf[x]!=topf[y])
	{
		if (dep[topf[x]]< dep[topf[y]]) swap (x,y);
		x=faa[topf[x]];
	}
	return dep[x]< dep[y]?x:y;
}
vector <int> G[N];
#define pb push_back
int st[N],z=0;
void ins (int u)
{
	if (z<=1) return st[++z]=u,void ();
	int x=lca (st[z],u);
	if (x==st[z]) return st[++z]=u,void ();
	while (z> 1&&dep[st[z-1]]>=dep[x]) G[st[z-1]].pb (st[z]),--z;
	if (st[z]!=x) G[x].pb (st[z--]),st[++z]=x;
	st[++z]=u;
}
int f[N],a[N],mi[N];
void dfs (int u)
{
	siz[u]=a[u],f[u]=a[u];
	int m=1;
	for (int v:G[u])
	{
		dfs (v);
		siz[u]+=siz[v];
		m=(LL)m*del(mi[siz[v]]-f[v]+P)%P;
	}
	if (G[u].size ()) for (int v:G[u])
		add(f[u],(LL)m*ksm (del(mi[siz[v]]-f[v]+P),P-2)%P*f[v]%P);
	G[u].clear (),a[u]=0;
}
vector <int> v[N];
int b[N];
int main ()
{
	// freopen (".in","r",stdin);
	// freopen (".out","w",stdout);
	int n; sc(n); ++n;
	for (int i=2; i<=n; i++)
	{
		int f; sc(f); ++f;
		adde (f,i);
	}
	dfs0 (1,0);
	dfs00 (1,1);
	int ma=0;
	for (int i=1; i<=n; i++)
		v[dep[i]].pb (i),ma=max (ma,dep[i]);
	mi[0]=1;
	for (int i=1; i<=n; i++)
		mi[i]=del(mi[i-1]<<1);
	int ans=0;
	// memset (siz,0,sizeof (siz));
	for (int i=1; i<=ma; i++)
	{
		z=b[0]=0;
		for (int x:v[i])
			b[++b[0]]=x,a[x]=1;
		if (!a[1]) b[++b[0]]=1;
		sort (b+1,b+b[0]+1,[](int A,int B) { return dfn[A]< dfn[B]; });
		for (int i=1; i<=b[0]; i++)
			ins (b[i]);
		while (z> 1) G[st[z-1]].pb (st[z]),--z;
		dfs (1);
		add(ans,(LL)f[1]*mi[n-siz[1]]%P);
	}
	pr(ans);

	return 0;
}


Measured memory_bytes: 93696
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定
#include <list> //前後に数値を入れれる配列



#define REP(i,m,n) for(int i = (int) (m);i < (int) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = 3.141592653589793; //円周率

//常設関数↓

//最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

//degree → radian
ll chg_DegRad(int deg) {
	return deg * PI / 180.0;
}

//radian → degree
ll chg_RadDeg(int rad) {
	return rad * 180.0 / PI;
}

//提出コード↓

ll d, n;
ll ans = 1;


int main() {
	cin >> d >> n;
	rep(i, d) {
		ans *= 100;
	}
	if (n != 100) cout << ans * n << endl;
	else cout << ans * 101 << endl;


	return 0;
}



Measured memory_bytes: 256
public class Main {
	public static void main(String[] args) {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			int r = sc.nextInt();
			int c = sc.nextInt();
			int[][] matrix = new  int[r+1][c+1];
			
			for (int i = 0; i < matrix.length; i++) {
				StringBuilder sb = new StringBuilder();
				for (int j = 0; j < matrix[i].length; j++) {
					if (i < r) {
						if (j < c) {
							matrix[i][j] = sc.nextInt();
							matrix[i][c] += matrix[i][j];
						}
						matrix[r][j] += matrix[i][j];
					}
					sb.append(matrix[i][j] + " ");
				}
				System.out.println(sb.toString().trim());
			}
			
		}
	}
}


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


int main() {
    string S;
    int Q;
    cin>>S>>Q;

    int len =S.size()-1;

    vector<char>data(S.size());
    rep(i,S.size()) data[i]=S[i];
    int count=0;

    rep(i,Q){
        int T;
        cin>>T;
        if(T==1){
            count++;
    }
    else {
        int F;
        char C;
        cin>>F>>C;
        if(F==1){
            if(count%2==0){
                data.insert(data.begin()+0,C);
            }
            else  data.emplace_back(C);
        }
        else {
            if(count%2==0){
                data.emplace_back(C);
            }
            else  data.insert(data.begin()+0,C);
        len++;
    }
}

}
if(count%2!=0)reverse(data.begin(),data.end());
for(auto p:data){
    cout<<p;
}
cout<<endl;
}

Measured memory_bytes: 1212
a, b, c, x = map(int, [input() for i in range(4)])
ans = 0

for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1

print(ans)


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

#include <string>
void _150() {
    int n;
    string s;
    cin >> n;
    cin >> s;

    int count = 0;
    for (int i = 0; i < s.size() - 2; ++i) {
        if (s.substr(i, 3) == "ABC") {
            count++;
        }
    }
    cout << count << endl;
}

void _151() {
    int n, k, m;
    cin >> n >> k >> m;
    int a[100];
    int goal = m * n;
    for (int i = 0; i < n - 1; ++i) {
        cin >> a[i];
        goal -= a[i];
    }

    if (goal > k) {
        cout << -1 << endl;
    } else {
        cout << max(goal, 0) << endl;
    }
}

void _152() {
    int a, b;
    cin >> a >> b;

    string result("");
    if (a < b) {
        for (int i = 0; i < b; ++i) {
            result += to_string(a);
        }
    } else {
        for (int i = 0; i < a; ++i) {
            result += to_string(b);
        }
    }
    cout << result << endl;
}

void _153() {
    long long h;
    int n, a;
    cin >> h >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        h -= a;
        if (h <=0) {
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;
    return;
}

void _154() {
    string s;
    cin >> s;

    for (int i = 0; i < s.size(); ++i) {
        cout << 'x';
    }
    cout << endl;
}

int main()
{
    _154();
    return 0;
}



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


#define SIZE 3005

struct Info{
	bool operator<(const struct Info &arg) const{

		return TIME < arg.TIME;
	}
	int TIME,value;
};

int dp[2][2*SIZE];
Info info[SIZE];


int main(){

	int N,T;
	scanf("%d %d",&N,&T);

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

		scanf("%d %d",&info[i].TIME,&info[i].value);
	}

	sort(info,info+N);

	int CURRENT = 0,NEXT = 1;
	for(int k = 0; k < 2*SIZE; k++){

		dp[CURRENT][k] = -BIG_NUM;
	}


	dp[CURRENT][0] = 0;

	for(int i = 0; i < N; i++){
		for(int k = 0; k < 2*SIZE; k++){

			dp[NEXT][k] = dp[CURRENT][k];
		}

		for(int k = 0; k <= T-1; k++){
			if(dp[CURRENT][k] == -BIG_NUM)continue;

			dp[NEXT][k+info[i].TIME] = max(dp[NEXT][k+info[i].TIME],dp[CURRENT][k]+info[i].value);
		}
		swap(CURRENT,NEXT);
	}

	int ans = 0;

	for(int i = 0; i < 2*SIZE; i++){

		ans = max(ans,dp[CURRENT][i]);
	}

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

	return 0;
}


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

int main()
{   int i,a,p,q,m,n,b[7]={1,3,5,7,8,10,12},c[4]={4,6,9,11},d[1]={2};
while(~scanf("%d%d",&a,&m))
{n=0,p=0,q=0;
 for(i=0;i<7;i++)
 {if(a==b[i])
  n++;
  if(m==b[i])
  n++;
 }
 for(i=0;i<4;i++)
 {if(a==c[i])
  p++;
  if(m==c[i])
  p++;
 }
 for(i=0;i<1;i++)
 {if(a==d[i])
  q++;
  if(m==d[i])
  q++;
 }
 if(n==2||p==2||q==2)
 printf("Yes\n");
 if(n!=2&&p!=2&&q!=2)
 printf("No\n");
}
    return 0;
}


Measured memory_bytes: 128
from itertools import groupby

s = input()
k = int(input())
r = len(s) * k // 2
a = [len(list(g)) & 1 for _, g in groupby(s)]
if len(a) > 1:
  r -= sum(a) * k // 2
  if s[0] == s[-1] and a[0] & a[-1]:
    r += k - 1
print(r)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
ll strtoint(string str);
int main(){
	fast;
	ll n,p=1e9+7,cnt=0; cin>>n;
	vector<ll> arr(n);
	for(auto i=0;i<n;++i)cin>>arr[i];
	for(auto i=0;i<n;++i){
		if(arr[i]<p){
			++cnt;
			p=arr[i];
		}
	}
	cout<<cnt<<'\n';
	return 0;
}
ll strtoint(string str){
	ll x=0;
	stringstream ss;
	ss<<str;
	ss>>x;
	return x;
}

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

typedef long long ll;

int main(){
    int N,M;
    cin >> N >> M;
    ll MOD = 1000000000  + 7;
    map<int, bool> m;
    for(int i = 0; i < M; i++){
        int tmp;
        cin >> tmp;
        m[tmp] = true;
    }
    ll dp[N+1];
    for(int i =0; i <= N; i++){
        dp[i] = 0;
    }
    dp[0] = 1;
    for(int i = 0; i < N; i++){
        if(i+1 <= N){
            if(m.count(i+1) == 0){
                dp[i+1] += dp[i];
                dp[i+1] %= MOD;
            }
        }
        if(i+2 <= N){
            if(m.count(i+2) == 0){
                dp[i+2] += dp[i];
                dp[i+2] %= MOD;
            }
        }
    }
    cout << dp[N] % MOD << endl;


}


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

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define siz(x) (x).size()
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int mpow(int a, int b) {
	if (b & 1)return a * mpow(a, b - 1);
	return mpow(a * a, b >> 1);
}
int mpow(int a, int b, int m) {
	if (b & 1)return a * mpow(a, b - 1, m) % m;
	return mpow(a * a % m, b >> 1, m) % m;
}
vector<int> graph;
void dfs(int cur, int prev = -1) {
	//visit[cur] = true;
	for (auto& i : graph) {
		if (i == prev)continue;
		dfs(i, cur);
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int r; cin >> r;
	cout.precision(10);
	cout << fixed << r * 2 * 3.14159265358979;
	return 0;
}

Measured memory_bytes: 3804
A, B, K = map(int, input().split())

if(K >= A):
    result1 = 0
    x = K - A
    B = B - x
    result2 = B if B >= 0 else 0
else:
    result1 = A - K
    result2 = B

print('{} {}'.format(result1, result2))

Measured memory_bytes: 3060