akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        string[] s = Console.ReadLine().Split(' ');
        int n = int.Parse(s[0]);
        int y = int.Parse(s[1]);
        if (10000 * n < y || 1000 * n > y)
        {
            Console.WriteLine("-1 -1 -1");
            return;
        }
        int m = y / 10000;
        for(int i = m; i >= 0; i--)
        {
            int a = y - i * 10000;
            int g = a / 5000;
            for(int j = g; j >= 0; j--)
            {
                int a2 = y - (i * 10000 + j * 5000);
                int se = a2 / 1000;
                if(n == se + i + j)
                {
                    Console.WriteLine(i + " " + j + " " + se);
                    return;
                }
            }
        }
        Console.WriteLine("-1 -1 -1");
    }
}

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

int main() {
  long long x;
  cin >> x;
  long long money = 100;
  long long res = 0;
  while (money < x) {
    long long tmp = money / 100;
    money += tmp;
    res++;
  }
  cout << res << endl;
}


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

double root(double x){
	double e = 0.00000001;
	double a = x;
	double b = 0;
	double c;
	while(a - b > e){
		c = (a + b) / 2;
		if(c * c < x){
			b = c;
		}else{
			a = c;
		}
	}
	return a;
}

void move(double &x, double &y){
	if(y == 0){
		if(x > 0){
			y++;
		}else if(x < 0){
			y--;
		}
	}else{
		double k = -(x / y);
		double c = 1 / root(1 + k * k);
		if(y < 0){
			x += c;
			y += c * k;
		}else{
			x -= c;
			y -= c * k;
		}
	}
}

int main(){
	int n;
	while(cin >> n){
		if(n == -1) break;
		double x = 1.0;
		double y = 0.0;
		for(int i = 1; i < n;i++) move(x,y);
		cout << fixed << setprecision(4) << x << endl;
		cout << y << endl;
	}
	return 0;
}

Measured memory_bytes: 0
s = list(input())

abc = "abcdefghijklmnopqrstuvwxyz"

ans = len(s)

for a in abc:
    if a in s:
        t = s.index(a)
        anst = t
        for i in range(t+1,len(s)):
            if s[i]==a:
                anst=max(anst,i-t-1)
                t = i

        anst = max(anst,len(s)-t-1)
        ans = min(ans,anst)

print(ans)


Measured memory_bytes: 63048
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pair;

int main ()
{
  int N,M;
  cin >> N >> M;
  int tmp;
  int bou[10]={0,2,5,5,4,5,6,3,7,6};
  vector<int> A;
  for(int i=0;i<M;i++){
    cin >> tmp;
    A.push_back(tmp);
  }
  sort(A.begin(),A.end());
  int dp[11000];
  for(int i=0;i<11000;i++){
    dp[i]=-10000;
  }
  dp[10]=0;
  int maxK;
  for(int i=11;i<=N+10;i++){
    maxK=-10000;
    for(int j=0;j<A.size();j++){
      maxK=max(maxK,dp[i-bou[A.at(j)]]+1);
    }
    dp[i]=maxK;
  }   
  //cout << dp[N+10] << endl;
  int N2=N;
  for(int i=0;i<dp[N2+10];i++){
    for(int j=A.size()-1;j>=0;j--){
      if(dp[N+10-bou[A.at(j)]]==dp[N+10]-1){
        cout << A.at(j);
  		N-=bou[A.at(j)];
        break;
      }
    }
  }
  return 0;
}

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

int main() {
  ll a;
  double b;
  cin >> a >> b;
  ll ib = b*100+0.5;
  a *= ib;
  a /= 100;
  printf("%lld\n", a);
  return 0;
}

Measured memory_bytes: 3748
//Author: Lixiang
#include<stdio.h>
struct C{
	int N,cnt1,cnt2,cnt3;
	void init(){
		scanf("%d",&N);
		for(int i=1,t;i<=N;i++){
			scanf("%d",&t);
			if(t%4==0)cnt1++;
			else if(t%2==0)cnt2++;
			else cnt3++;
		}
	}
	void work(){
		puts(cnt1>=cnt3?"Yes":(cnt2==0&&cnt1==cnt3-1?"Yes":"No"));
	}
}sol;
int main(){
	sol.init();
	sol.work();
	return 0;
}


Measured memory_bytes: 128
/*
    2020.6.11
    Ве№И 1379
    LTC
*/
#include <bits/stdc++.h>
#define mem(f, x) memset( f, x, sizeof(f) )
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mk(x, y) make_pair(x, y)
#define fi first
#define se second
#define pk push_back
typedef long long LL;
using namespace std;
const int M = 1e5+50;
const int N = 1e5+50;
int m, n;
int ct[N];

int main( ){
    while( scanf( "%d", &n ) != EOF ){
        int x, y;
        mem( ct, 0 );
        LL sum = 0;
        for( int i = 0; i < n; i++ ){
            scanf( "%d", &x );
            sum += x;
            ct[x]++;
        }
        scanf( "%d", &m );
        while( m-- ){
            scanf( "%d %d", &x, &y );
            sum += (y-x)*ct[x];
            printf( "%lld\n", sum );
            ct[y] += ct[x];
            ct[x] = 0;
        }
    }
    return 0;
}


Measured memory_bytes: 4208
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
int next(int n, int l) {
    string s = to_string(n);
    while(s.size() < l) s = "0" + s;
    sort(s.begin(), s.end());
    int low = stoi(s);
    reverse(s.begin(), s.end());
    int high = stoi(s);
    return high - low;
}
int main() {
    int A, L;
    while(cin >> A >> L && L > 0) {
        map<int, int> m;
        int x = A;
        for(int i = 0;;i++) {
            if(m.count(x)) {
                cout << m[x] << " " << x << " " << i - m[x] << endl;
                break;
            }
            m[x] = i;
            x = next(x, L);
        }
    }
    return 0;
}

Measured memory_bytes: 1260
from collections import deque

H,W=map(int,input().split())
S=[]
for i in range(H):
    S.append(input())

q=deque([])
T=[]
seen=[[0]*W for _ in range(H)]
step=[[0,1],[0,-1],[1,0],[-1,0]]
for h in range(H):
    for w in range(W):
        temp=[]
        if seen[h][w]==0:
            temp.append(S[h][w])
            seen[h][w]=1
            q.append([h,w,S[h][w]])
            while q:
                oh,ow,m=q.popleft()
                for dh,dw in step:
                    if 0<=oh+dh<H and 0<=ow+dw<W:
                        if seen[oh+dh][ow+dw]==0 and m!=S[oh+dh][ow+dw]:
                            temp.append(S[oh+dh][ow+dw])
                            seen[oh+dh][ow+dw]=1
                            q.append([oh+dh,ow+dw,S[oh+dh][ow+dw]])
            T.append(temp)

ans=0
for i in range(len(T)):
    black=0
    white=0
    for s in T[i]:
        if s=="#":
            black+=1
        else:
            white+=1
    ans+=black*white

print(ans)




Measured memory_bytes: 24960
n=int(input())
s=list(input())

alpha2num = lambda c: ord(c) - ord('A') + 1
num2alpha = lambda c: chr(c+64)

L=[]
for i in range(len(s)):
    L.append((alpha2num(s[i])+n)%26)


for i in range(len(L)):
    if L[i]==0:
        L[i]=26
    L[i]=num2alpha(L[i])

print(''.join(L))

Measured memory_bytes: 3188
N = int(input())
S_ = input()
s=S_

count = 0
new_left = 0
new_right = 0

for si in s:
    if si == '(':
        count += 1
    else:
        count -= 1

        if count == -1:
            count = 0
            new_left += 1

new_right = count
print('(' * new_left + s + ')' * new_right)

Measured memory_bytes: 61780
package main

import (
	"fmt"
)

func Solve(v, c []int) int {
	var n int
	for i := 0; i < len(v); i++ {
		if v[i] <= c[i] {
			continue
		}
		n += v[i] - c[i]
	}
	return n
}

func main() {
	var n int
	fmt.Scanf("%d", &n)
	v := make([]int, n)
	c := make([]int, n)
	args := make([]interface{}, len(v))
	for i := 0; i < len(v); i++ {
		args[i] = &v[i]
	}
	fmt.Scan(args...)
	args = make([]interface{}, len(c))
	for i := 0; i < len(v); i++ {
		args[i] = &c[i]
	}
	fmt.Scan(args...)
	result := Solve(v, c)
	fmt.Println(result)
}


Measured memory_bytes: 512
import enum
class Direction(enum.Enum):
    N = "N"
    E = "E"
    W = "W"
    S = "S"

    @classmethod
    def value_of(cls, value):
        return [v for v in cls if v.value == value][0]


class Dice:
    def __init__(self, *value_list):
        self.__value_list = list(value_list)

    def rotate(self, direction):
        l = self.__value_list
        if  direction == Direction.N:
            l[0],l[1],l[5],l[4] = l[1],l[5],l[4],l[0]
        elif  direction == Direction.E:
            l[0],l[2],l[5],l[3] = l[3],l[0],l[2],l[5]
        elif  direction == Direction.W:
            l[0],l[2],l[5],l[3] = l[2],l[5],l[3],l[0]
        elif  direction == Direction.S:
            l[0],l[1],l[5],l[4] = l[4],l[0],l[1],l[5]

    def adjust_top_front(self, top_value, front_value):
        for _ in range(2):
            for _ in range(3):
                if self.front_value() == front_value:
                    break
                self.rotate(Direction.N)
            if self.front_value() == front_value:
                break
            self.rotate(Direction.E)
        
        for _ in range(3):
            if self.top_value() == top_value:
                break
            self.rotate(Direction.E)
    
    def is_same_dice(self, othere_dice):
        return (self.top_value() == othere_dice.top_value()
        and self.bottom_value() == othere_dice.bottom_value()
        and self.front_value() == othere_dice.front_value()
        and self.behind_value() == othere_dice.behind_value()
        and self.right_value() == othere_dice.right_value()
        and self.left_value() == othere_dice.left_value())

    def top_value(self):
        return self.__value_list[0]

    def bottom_value(self):
        return self.__value_list[5]

    def front_value(self):
        return self.__value_list[1]

    def behind_value(self):
        return self.__value_list[4]

    def right_value(self):
        return self.__value_list[2]

    def left_value(self):
        return self.__value_list[3]


dice1 = Dice(*input().split())
dice2 = Dice(*input().split())
dice1.adjust_top_front(dice2.top_value(), dice2.front_value())
print("Yes" if dice1.is_same_dice(dice2) else "No")


Measured memory_bytes: 6316
#include <bits/stdc++.h>
using namespace std;
 
#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)
int main(){
	long long N,M,sum = 0;
  cin >> N >> M;
  vector<long long> dist(M);
  vector<long long> x(M);
  froop1(0,M){
    cin >> x.at(i);
  }
  if(N >= x.size()){
    cout << 0 << endl;
    return 0;
  }
  
  sort(x.begin(),x.end());
  sum = x.at(x.size() - 1) - x.at(0);
  froop1(1,M){
    dist.at(i - 1) = x.at(i) - x.at(i - 1);
  }
  sort(dist.begin(),dist.end(),greater<int>());
  froop1(0,N - 1){
    sum -= dist.at(i);
  }
  cout << sum << endl;
}
  

Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }

int main() {
    int x, a; cin >> x >> a;
    cout << (x < a ? 0 : 10) << endl;
    return 0;
}


Measured memory_bytes: 256
N,*P = `dd`.split.map &:to_f

dp = (0..P.size).map{ Array.new(P.size+1, 0.0) }
dp[0][0] = 1.0
P.size.times{ |n|
  q = P[n]
  r = 1 - q
  dpn = dp[n]
  dpnn = dp[n+1]
  (n+1).times{ |k|
    #p [n,k,P[n]]
    dpnn[k]   += dpn[k] * r
    dpnn[k+1] += dpn[k] * q
  }
}
p (0..P.size).select{ |k| k > N/2 }.map{ |k| dp[-1][k] }.inject(:+)

Measured memory_bytes: 184448
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <random>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
//const double EPS = 1e(-12);
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)
#define ALL(a) ((a).begin(), (a).end())

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

ll arr[100010];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(7);

    int N;
    cin >> N;

    long double ans = 0;
    for (int i = 0; i < N; ++i)
    {
        long double x;
        string u;
        cin >> x >> u;
        if (u == "JPY")
        {
            ans += x;
        }
        else if (u == "BTC")
        {
            ans += (x * 380000.0);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,k,n,sum=0;
    cin>>n;
    for(i=1; i<=n; i++)
    {
        for(j=1; j<=n; j++)
        {
            for(k=1; k<=n; k++)
            {
                sum+=__gcd(i,__gcd(j,k));
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3540
#include "bits/stdc++.h"
using namespace std;

struct aa{
	int root;
	int from;
	int data;
	long long int time;
};

typedef int Weight;
map < pair<int, int>, vector<int>>mp;
struct Edge {
	int src, dst;
	Weight weight;
	Edge(int src_, int dst_, Weight weight_) :
		src(src_), dst(dst_), weight(weight_) { }
	Edge(int src_, int dst_) :
		src(src_), dst(dst_) {
	}
};
class Compare {
public:
	//aa?????????????????¶
	bool operator()(const aa&l, const aa&r) {
		return l.time< r.time;
	}
};
vector<int>data_weights;
vector<vector<Edge>>edges;
pair<long long int, vector<int>> dfs(const int now, const int from) {
	long long int amax=0;
	vector<int>max_vs;
	for (auto e : edges[now]) {
		if (e.dst == from)continue;
		auto p(dfs(e.dst, e.src));
		if (amax < p.first+e.weight) {
			amax = p.first+e.weight;
			max_vs = p.second;
		}
	}
	max_vs.emplace_back(now);
	return make_pair(amax, max_vs);
}
void dfs2(const int now, const int from,const vector<int>&max_vs,const int depth, priority_queue<aa, vector<aa>, Compare>&que,const int data_id) {
	for (auto e : edges[now]) {
		if (e.dst == from)continue;
		if (e.dst == max_vs[depth + 1]) {
			dfs2(e.dst, e.src, max_vs,depth+1,que,data_id);
		}
		else {
			auto p=dfs(e.dst, e.src);
			reverse(p.second.begin(), p.second.end());
			mp[make_pair(e.dst, e.src)] = p.second;
			que.push(aa{ e.dst,e.src,data_id,(p.first+e.weight)*data_weights[data_id] });
		}
	}
	return ;
}
int main() {
	int N, M; cin >> N >> M;
	edges.resize(N);
	for (int i = 0; i < N-1; ++i) {
		int a, b, c; cin >> a >> b >> c;
		a--; b--;
		edges[a].push_back(Edge(a, b, c));
		edges[b].push_back(Edge(b, a, c));
	}
	for (int i = 0; i < N; ++i) {
		int a; cin >> a;
		data_weights.emplace_back(a);
	}

	priority_queue<aa, vector<aa>, Compare>que;
	for (int i = 0; i < N; ++i) {
		auto p(dfs(i, -1));
		reverse(p.second.begin(), p.second.end());
		mp[make_pair(i, -1)] = p.second;
		que.push(aa{ i,-1,i,p.first*data_weights[i] });
	}
	long long int ans = 0;
	while (!que.empty()) {
		if (!M)break;
		M--;
		aa atop(que.top());
		que.pop();
		ans += atop.time;
		int d = 0;
		dfs2(atop.root, atop.from, mp[make_pair(atop.root,atop.from)],d, que, atop.data);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 102136
N = int(input())
A = list(map(int, input().split()))
A.sort()
p = 0
ans = 0
for i in range(len(A)):
    if i == 0:
        continue
    if i == 1 or i % 2 == 0:
        p = A.pop()
    ans += p
print(ans)


Measured memory_bytes: 31348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 3e3+10;
ll n, sum, v[maxn], dp[maxn][maxn];
ll solve(int l, int r){
    if(l > r or r < l) return 0;
    if(l == r) return dp[l][r] = v[l];
    if(dp[l][r] != -1) return dp[l][r];
    return dp[l][r] = max((v[l] - solve(l+1, r)), (v[r] - solve(l, r-1)));
}
int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> v[i];
        sum += v[i];
    }
    memset(dp, -1, sizeof dp);
    cout << solve(1, n) << "\n";
    return 0;
}


Measured memory_bytes: 74660
using System;

public class AtCoderB
{
    static void Main()
    {
        string s = Console.ReadLine();

        int answer = 0;
        for (int i = 0; i < s.Length / 2; i++)
        {
            string start = s.Substring(i, 1);
            string end = s.Substring(s.Length - 1 - i, 1);
            if (!start.Equals(end))
            {
                answer++;
            }
        }

        Console.WriteLine(answer);
    }
}

Measured memory_bytes: 11092
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

n = ri()
if n % 2 == 0:
    print(n // 2 - 1)
else:
    print(n // 2)

Measured memory_bytes: 3064
#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=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

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

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

void solve()
{
  ll a,b,c,d; cin>>a>>b>>c>>d;
  a--;

  ll ac = a/c;
  ll bc = b/c;

  ll ad = a/d;
  ll bd = b/d;

  ll cd = lcm(c,d);
  ll acd = a/cd;
  ll bcd = b/cd;

  cout << (b-a)-(bc-ac)-(bd-ad)+(bcd-acd) << endl;
}

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


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

int main()
{
  int n, k;  
  scanf("%d %d", &n, &k);
    
  long long int p[n];
  for(int i=0;i<n;i++){
    scanf("%lld", &p[i]);
  }
  double pd[n], s[n];
  s[0]=0.0;
  
  for(int i=0; i<n; i++) {
  	pd[i] = ((double)p[i]+1.0)/2.0;
  }
  for(int i=0; i<n; i++) {
    s[i+1] = s[i] + pd[i];
  }
  double sum=0.0, max=0.0;

  for(int i=0; i<n-k+1; i++) {
	double sum = s[k+i] - s[i];
    if (max < sum) max = sum;
  }
  printf("%lf", max);
  return 0;
}


Measured memory_bytes: 4864
#include<bits/stdc++.h>
using namespace std;
int r[2003][2003],c[2003][2003],place[2003][2003],n,m,q;
char x[2003][2003];
int main(){
	cin>>n>>m>>q;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin>>x[i][j];
	for(int i=1;i<=n;i++)
		for(int j=1;j<m;j++)
			if(x[i][j]=='1'&&x[i][j+1]=='1')
				r[i][j+1]=1;
	for(int i=1;i<=m;i++)
		for(int j=1;j<n;j++)
			if(x[j][i]=='1'&&x[j+1][i]=='1')
				c[j+1][i]=1; 
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
		{
			c[i][j]=c[i][j]+c[i-1][j]+c[i][j-1]-c[i-1][j-1];
			r[i][j]=r[i][j]+r[i-1][j]+r[i][j-1]-r[i-1][j-1];
			place[i][j]=place[i][j-1]+place[i-1][j]-place[i-1][j-1]+(x[i][j]=='1');
		}
	for(int i=0;i<q;i++){
		int x1,y1,x2,y2;
		cin>>x1>>y1>>x2>>y2;
		//cout<<c[x2][y2]+c[x1][y1-1]-c[x1][y2]-c[x2][y1-1]<<endl;
		cout<<place[x2][y2]+place[x1-1][y1-1]-place[x2][y1-1]-place[x1-1][y2]-r[x2][y2]-r[x1-1][y1]+r[x1-1][y2]+r[x2][y1]
		-c[x2][y2]-c[x1][y1-1]+c[x1][y2]+c[x2][y1-1]<<endl;
	}
}
/*
| | |
| | |
| | |
*/
/*
_______
_______
_______
_______
*/


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

using namespace std;

typedef long long ll;
const int MAXN = 300 + 5;

bool a[MAXN][MAXN];

int main()
{
    int n;
    cin>>n;
    n %= 1000;
    cout<<(1000 - n)%1000<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
	int n/*quiz*/;
	cin>>n;
	int c=0;
	int t[100];
	for(int i=0;i<n;i++){
		cin>>t[i];
		c+=t[i];
	}
	int m/*drink*/;
	cin>>m;
	int p[100],x[100];
	for(int i=0;i<m;i++)cin>>p[i]>>x[i];
	for(int i=0;i<m;i++){
		cout<<c-t[p[i]-1]+x[i]<<endl;
	}
    return 0;
}



Measured memory_bytes: 256
#ifdef _WIN32
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

// 継承可能な型
template <class Type>
struct IN : Type
{
	IN()
	{
		std::cin >> *this;
	}
};

// 継承不可能な型
template <class Type>
struct IN_
{
	Type val;

	IN_()
	{
		std::cin >> val;
	}

	operator Type&()
	{
		return val;
	}

	IN_<Type>& operator=(const Type& _value)
	{
		val = _value;
		return *this;
	}
};

template <class Char, class Type>
std::basic_ostream<Char>& operator <<(std::basic_ostream<Char>& os, const IN_<Type>& value)
{
	return os << value.val;
}

template <class Char, class Type>
std::basic_istream<Char>& operator >>(std::basic_istream<Char>& is, IN_<Type>& value)
{
	return is >> value.val;
}

template <class Type>
void OUT(const Type& value)
{
	std::cout << value << std::endl;
}

template <class Type, class ... Args>
void OUT(const Type& value, const Args& ... args)
{
	std::cout << value << ' ';
	OUT(args...);
}

using ll = long long;
using inll = IN_<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;
using instr = IN<std::string>;

#define FOR(i, m, n) for (ll (i) = (m); (i) < (n); ++(i))
#define REP(i, n) for (ll (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for (ll (i) = (n); (i) >= 0; --(i))
#define ITRREP(it, v) for (auto (it) = (v).begin(); (it) != (v).end(); ++(it))
#define ITRREPR(it, v) for (auto (it) = (v).rbegin(); (it) != (v).rend(); ++(it))
#define DIVUP(a, b) (((a) + (b) - 1) / (b))

void Main();

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

	Main();

#ifdef _DEBUG
	system("pause");
#endif

	return 0;
}

using namespace std;

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

void Main()
{
	inll n, a;

	return OUT(n % 500 <= a ? "Yes" : "No");
}


Measured memory_bytes: 256
H, W, N = map(int, raw_input().split())
AB = [map(int, raw_input().split()) for _ in xrange(N)]

ans = [0 for _ in xrange(10)]
ans[0] = (H - 2) * (W - 2)

status = {}
for i in xrange(N):
    ab = AB[i]
    for h in xrange(ab[0]-2, ab[0]+1):
        if h < 1 or h+2 > H:
            continue
        for w in xrange(ab[1]-2, ab[1]+1):
            if w < 1 or w+2 > W:
                continue
            status[(h, w)] = status.get((h, w), 0) + 1
            ans[status[(h, w)] - 1] -= 1
            ans[status[(h, w)]] += 1

for a in ans:
    print a

Measured memory_bytes: 165168
cards = {
        'S':[r for r in range(1,13+1)],
        'H':[r for r in range(1,13+1)],
        'C':[r for r in range(1,13+1)],
        'D':[r for r in range(1,13+1)],
        }

n = int(input())
for nc in range(n):
    (s, r) = input().split()
    index = cards[s].index(int(r))
    del cards[s][index]

for s in ['S', 'H', 'C', 'D']:
    for r in cards[s]:
        print(s, r)

Measured memory_bytes: 6720
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main()
{
        //input->compute->output//

        int N;
        cin >> N;
        vector<int> V(N), C(N);
        for (int i = 0; i < N; i++)
        {
                cin >> V[i];
        }

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

        int ans = 0;
        for (int i = 0; i < N; i++)
        {
                if (V[i]>C[i])
                {
                        ans += V[i] - C[i];
                }
        }
        

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 256
/*
g++ -std=c++11 -o2 -Wall Educational_DP_D.cpp -o .\out\Educational_DP_D.out
.\out\Educational_DP_D.out
*/

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

typedef long long ll;

constexpr int INF = 1e9;

ll dp[105][100005];

int v[100005];
int w[100005];

int main(){
//  freopen("./input/input.txt", "r", stdin);
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, W;
  cin >> n >> W;
  for (int i = 0; i < n; ++i) {
    cin >> w[i] >> v[i];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= W; ++j) {
      if (j >= w[i]) {
        dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]);
      } else {
        dp[i+1][j] = dp[i][j];
      }
    }
  }
  ll ans = 0;
  for (int j = 0; j <= W; ++j) {
    ans = max(ans, dp[n][j]);
  }
  cout << ans << "\n";
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

const ll N = 5e5 + 10, MOD = 1e9 + 7;
ll inv[N], fac[N], inv_fac[N];

void precalc() {
	inv[1] = 1;
	FOR(n,2,N) inv[n] = -(MOD/n)*inv[MOD%n] % MOD;

	fac[0] = 1;
	FOR(n,1,N) fac[n] = n*fac[n-1] % MOD;

	inv_fac[0] = 1;
	FOR(n,1,N) inv_fac[n] = inv[n]*inv_fac[n-1] % MOD;
}

ll binom(ll n, ll k) {
	if (k < 0 || k > n) return 0;
	ll res = fac[n] * inv_fac[k] % MOD * inv_fac[n-k] % MOD;
	if (res < 0) res += MOD;
	return res;
}


ll mod_exp(ll a, ll n) {
	ll res = 1;
	while (n) {
		if (n&1) res = res*a % MOD;
		a = a*a % MOD;
		n /= 2;
	}
	return res;
}

ll mod_inv(ll a) { return mod_exp(a,MOD-2); }

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	precalc();
	
	ll B, W;
	cin >> B >> W;
	
	ll used_all_B = 0, used_all_W = 0, pow2 = 1;
	
	FOR(n,0,B+W) {
		
		ll other = (pow2 - used_all_B - used_all_W) % MOD;
		ll cur = (other + 2*used_all_W) % MOD;
		if (cur < 0) cur += MOD;
		cur = cur*mod_inv(2*pow2) % MOD;
		cout << cur << endl;

		pow2 = 2*pow2 % MOD;
		used_all_B = (2*used_all_B + binom(n,n+1-B)) % MOD;
		used_all_W = (2*used_all_W + binom(n,n+1-W)) % MOD;
	}

}



Measured memory_bytes: 13952
h,w = list(map(int,input().split()))

a =[]
a.append('.'*(w+2))
for i in range(h):
    a.append('.'+input()+'.')
a.append('.'*(w+2))

b = 0
c = ''
d =[]
for i in range(h):
    for j in range(w):
        if a[i+1][j+1] =='#':
            c += '#'
        else:
            if a[i][j] =='#':
                b += 1
            if a[i+1][j] =='#':
                b += 1
            if a[i+2][j] =='#':
                b += 1
            if a[i][j+1] =='#':
                b += 1
            if a[i+2][j+1] =='#':
                b += 1
            if a[i][j+2] =='#':
                b += 1
            if a[i+1][j+2] =='#':
                b += 1
            if a[i+2][j+2] =='#':
                b += 1
            c += str(b)
            b = 0
    d.append(c)
    c = ''
for i in d:
    print(i)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int N=3005,mo=998244353;
int f[N];
int main(){
	int n,s,ans=0,x;scanf("%d%d",&n,&s);
	for(int i=1;i<=n;i++){
		scanf("%d",&x);
		for(int j=s-x;j>0;j--)(f[j+x]+=f[j])%=mo;
		(f[x]+=i)%=mo;
		(ans+=f[s])%=mo;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
# -*- coding:utf-8 -*-

n = int(input())
w = list(map(int, input().split()))
weight_list = []
for i in range(0,n-1):
        s1 = sum(w[:i+1])
        s2 = sum(w[i+1:])
        weight_list.append(abs(s1-s2))
print(min(weight_list))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int N, W;
vector<int> w;
vector<int> sum;
long long dp[201][10001] = {};

void knapsack() {
    for(int j=0; j<=W; ++j) dp[0][j] = 1;
    for(int i=0; i<N; ++i) {
        for(int j=0; j<=W; ++j) {
            dp[i + 1][j] = dp[i][j];
            if(j - w[i] >= 0) dp[i + 1][j] = (dp[i + 1][j] + dp[i][j - w[i]]) % MOD;
        }
    }
}

int main() {
    cin >> N >> W;
    w.resize(N);
    for(int i=0; i<N; ++i) cin >> w[i];
    
    if(accumulate(begin(w), end(w), 0) <= W) {
        cout << 1 << endl; return 0;
    }
    sort(begin(w), end(w), greater<int>());
    knapsack();

    sum.assign(N + 1, 0);
    for(int i=0; i<N; ++i) sum[i + 1] = sum[i] + w[i];

    long long res = 0;
    for(int i=N; i>0; --i) {
        int sub = W - (sum[N] - sum[i]);
        if(sub < 0) break;

        res += dp[i - 1][sub] - (sub < w[i - 1] ? 0LL : dp[i - 1][sub - w[i - 1]]);
        if(res < 0) res += MOD;
        res %= MOD;
    }
    cout << res << endl;
}


Measured memory_bytes: 18820
# include <iostream>
# include <cmath>
# include <algorithm>
using namespace std;

int main() {
    int n; cin >> n;
    int x[n], y[n];
    for (int i = 0; i < n; ++i) cin >> x[i];
    for (int i = 0; i < n; ++i) cin >> y[i];
    
    double diff[n];
    for (int i = 0; i < n; ++i) diff[i] = 1.0 * abs(x[i] - y[i]);
    
    double p1 = 0, p2 = 0, p3 = 0, p_inf = 0;
    for (int i = 0; i < n; ++i) {
        p1 += diff[i];
        p2 += diff[i] * diff[i];
        p3 += diff[i] * diff[i] * diff[i];
    }
    p2 = pow(p2, 0.5);
    p3 = pow(p3, 0.33333333333);
    p_inf = *max_element(diff, diff + n);
    
    printf("%.8f\n%.8f\n%.8f\n%.8f\n", p1, p2, p3, p_inf);
    
    return 0;
}


Measured memory_bytes: 3312
#include<stdio.h>

int main(){
    long long int N,A,B;
    long long int k,l,ans;

    scanf("%lld %lld %lld", &N, &A, &B);

    k = N / (A+B);
    ans = A * k;

    l = N % (A+B);
    if( A < l ) ans += A;
    else ans += l;

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

    return 0;
}



Measured memory_bytes: 128
#include<iostream>
#include <string>
#include<vector>

using namespace std;

int main(){

	string a,b,c;
	cin >> a >> b >> c;
	char A, B ,C;
	A = toupper(a[0]);
	B = toupper(b[0]);
	C = toupper(c[0]);
	cout << A << B << C <<endl;

	return 0;

}

Measured memory_bytes: 256
import math
n = int(input())
a = 0
for i in range(0,n):
  for j in range(0,n):
    gcd1 = math.gcd(i+1,j+1)
    
    for k in range(0,n):
      gcd2 = math.gcd(gcd1,k+1)
      a = a + gcd2
      
print(a)

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

using namespace std;

// P, W, G, Y
int main(){
    int N;
    cin >> N; 
    vector<char> S(N);
    for(int i = 0; i < N; i++){
        cin >> S[i];
    }
    
    for(int i = 0; i < N; i++){
        if(S[i] == 'Y'){
            cout << "Four\n";
            return 0;
        }
    }
    
    cout << "Three\n";
}

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

int gcd(int a, int b)
{
    int c;

    if (a < b) {
        a+=b; b=a-b; a-=b;
    }

    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }

    return a;
}

int main(void){
    vector<int> an(5);
    int k;
    for (int i = 0; i < 5; i++) {
        cin >> an[i];
    }
    cin >> k;
    for(int i = 0; i < 4; i++) {
        for(int l = 1; l < 5; l++){
            if(an[l] - an[i] > k) {
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
}

Measured memory_bytes: 256
/*
** 本题使用两个stack，一个用来统计总积水，一个用来统计单独的积水面积。
*/

# include <cstdio>
# include <stack>
# include <vector>
using namespace std;

static const int maxn = 20000 + 10;

char buff[maxn];

int main() {
	// freopen("data.in", "r", stdin);
	// freopen("data.out", "w", stdout);
	while (scanf("%s", buff) != EOF) {
		/*
		** ts用来存储每一个'\'字符的位置，然后当出现'/'字符的时候，通过距离计算积水面积
		** ps用来存储每一个'\'所对应的积水面积，默认是0，当出现'/'后，再把面积加进去
		*/
		stack <int> ts, ps;
		int sum = 0;
		for (int i = 0; buff[i] != '\0'; i++) {
			if (buff[i] == 92) { // 92 是 '\'的 ascii码值
				ts.push(i);
				ps.push(0);
			}
			else if (buff[i] == 47 && !ts.empty()) { // 47 是 '/'的 ascii码值
				int s = i - ts.top(); ts.pop();
				sum += s;
				while (ps.top() != 0) { // 找到相对应的'\'，同时累加中间的积水面积
					s += ps.top();
					ps.pop();
				}
				ps.top() += s;
			}
		}
		
		printf("%d\n", sum);
		vector <int> v;
		while (!ps.empty()) {
			if (ps.top() != 0)
				v.push_back(ps.top());
			ps.pop();
		}
		if (v.size() == 0) // 针对积水面积为0的情况
			printf("0\n");
		else {
			printf("%d ", v.size());
			for (int i = v.size()-1; i > 0; i--)
				printf("%d ", v[i]);
			printf("%d\n", v[0]);
		}
	}
	return 0;
}


Measured memory_bytes: 2928
N = int(input())
S = input()

r = S.count('R')
g = S.count('G')
b = S.count('B')
RGB = set(['R', 'G', 'B'])

exclude = 0
for d in range(1, N // 2 + 1):
    for i in range(N - 2 * d):
        if set([S[i], S[i + d], S[i + 2 * d]]) == RGB:
            exclude += 1
ans = r * g * b
print(ans - exclude)

Measured memory_bytes: 9212
package main

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

const (
	initialBufSize = 64 * 1024
	maxBufSize     = 10000000
)

var (
	scanner = bufio.NewScanner(os.Stdin)
)

func main() {
	scanner.Split(bufio.ScanWords)
	n := scanInt()
	s := scanText()

	ans := 0
	for i := 0; i < (n - 2); i++ {
		if s[i:i+3] == "ABC" {
			ans++
			i = i + 2
		}
	}

	fmt.Print(ans)
}

func scanInt() int {
	i, _ := strconv.Atoi(scanText())
	return i
}

func scanInts(size int) []int {
	ints := make([]int, size)
	for i := 0; i < size; i++ {
		ints[i] = scanInt()
	}
	return ints
}

func scanText() string {
	scanner.Scan()
	return scanner.Text()
}

func abs(n int) int {
	return int(math.Abs(float64(n)))
}

func pow(x, y int) int {
	return int(math.Pow(float64(x), float64(y)))
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		 Scanner scan = new Scanner(System.in);

		 int K = scan.nextInt();
		 int X = scan.nextInt();

		 scan.close();

		 for(int i=-(K-1);i<K;i++) {
			 System.out.print(X+i + " ");
		 }
	}
}


Measured memory_bytes: 22228
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()


int main(void){
    ll c[3][3];

    /*
    c11 - a1 = c21 - a2 = c31 - a3
    c12 - a1 = c22 - a2 = c32 - a3
    c13 - a1 = c23 - a2 = c33 - a3
    */

    rep(i, 3) rep(j, 3) cin >> c[i][j];

    For(i, -100, 100){
        For(j, -100, 100){
            For(k, -100, 100){
                bool b1 = (c[0][0] - i == c[1][0] - j && c[1][0] - j == c[2][0] - k);
                bool b2 = (c[0][1] - i == c[1][1] - j && c[1][1] - j == c[2][1] - k);
                bool b3 = (c[0][2] - i == c[1][2] - j && c[1][2] - j == c[2][2] - k);
                if (b1 && b2 && b3){cout << "Yes" << endl; return 0;}
            }
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void){
    int count=0;
    char W[12],end[12]="END_OF_TEXT";
    char T[1003]={'\0'};
    scanf("%s",W);
    while(1){
        scanf("%s",T);
        if(strcmp(T,end)==0){
            break;
        }
        for(int i=0;i<strlen(T);i++){
            if(T[i]>=65 && T[i]<=90){
                T[i]+=32;
            }
        }
        if(strcmp(T,W)==0){
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
}


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

int main() {
	string t;
	while (cin >> t) {
		string w;
		if (t[0] == t[3] && t[3] == t[6] && t[0] != 's') { w = t[0]; }
		else if (t[1] == t[4] && t[4] == t[7] && t[1] != 's') { w = t[1]; }
		else if (t[2] == t[5] && t[5] == t[8] && t[2] != 's') { w = t[2]; }
		else if (t[0] == t[1] && t[1] == t[2] && t[0] != 's') { w = t[0]; }
		else if (t[3] == t[4] && t[4] == t[5] && t[3] != 's') { w = t[3]; }
		else if (t[6] == t[7] && t[7] == t[8] && t[6] != 's') { w = t[6]; }
		else if (t[0] == t[4] && t[4] == t[8] && t[0] != 's') { w = t[0]; }
		else if (t[2] == t[4] && t[4] == t[6] && t[2] != 's') { w = t[2]; }
		else { w = 'd'; }
		cout << w << endl;
	}
	return 0;
}

Measured memory_bytes: 3148
#include <iomanip>
#include <iostream>
#include <cmath>
using namespace std;

int main(){
	int n;
	double a=0 , m=0;
	while(cin>>n && n!=0){
	int *s =new int[n];
	for(int i=0;i<n;i++){
		cin>>s[i];
		m+=s[i];
	}
	m/=n;
	for(int i=0; i<n ; i++){
		a+=((s[i]-m)*(s[i]-m))/n;
	}
	cout << fixed << setprecision(9) << sqrt(a) << endl;
	delete [] s;
	a=m=0;
	}
	return 0;
}

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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll T;
	cin >> T;
	vector<ll> v;
	for (int i = 0; i <= T; i++)
	{
		int temp;
		cin >> temp;
		v.push_back(temp);
	}
	if(T == 0)
	{
		if(v[0] == 1)
		{
			cout << "1";
			return 0;
		}
		else
		{
			cout <<"-1";
			return 0;
		}
		
	}
	if (v[0] >= 1)
	{
		int flag = 0;
		for (int i = 1; i <= T; i++)
		{
			if (v[i] >= 1)
				flag = 1;
		}
		if (flag == 0)
		{
			cout << "1";
			return 0;
		}
		else
		{
			cout << "-1";
			return 0;
		}
	}

	ll num0 = 0;
	ll num1 = 0;
	ll curlevel = 0;
	ll prevlevel = 1;
	ll ans = 1;
	ll flag = 0;
	ll minpar = 0;
	ll maxpar = 0;
	vector<pair<ll, ll>> dp;
	dp.push_back({v[T], v[T]});
	int j = 0;
	for (int i = T - 1; i >= 1; i--)
	{
		if (i <= 60)
		{

			dp.push_back({v[i] + (dp[j].first + 1) / 2, min(ll(pow(2, i)), v[i] + dp[j].second)});
			j++;
		}
		else
		{
			dp.push_back({v[i] + (dp[j].first + 1) / 2, v[i] + dp[j].second});
			j++;
		}
	}
	reverse(dp.begin(), dp.end());
	ans += dp[0].second;
	for (int i = 1; i < dp.size(); i++)
	{
		dp[i] = {dp[i].first, min(2 * (dp[i - 1].second - v[i]), dp[i].second)};
		if (dp[i].first > dp[i].second)
		{
			ans = -1;
			break;
		}
		ans += dp[i].second;
	}
	cout << ans << endl;
}


Measured memory_bytes: 6116
#include <iostream>
#include <stdlib.h>
using namespace std;


int main() {
    int a, b, biggest;

    cin >> a >> b;

    biggest = a+b;
    if( a-b > biggest){
        biggest = a-b;
    }
    if( a*b > biggest){
        biggest = a*b;
    }

    cout << biggest << endl;
}

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

int cnt[100001] = {0};

int main(void) {
	int N, M;
	cin >> N >> M;
	for (int i = 1; i <= N; i++) cnt[i] = 0;
	for (int i = 0; i < M; i++){
		int a, b;
		cin >> a >> b;
		cnt[a]++;
		cnt[b]++;
	}
	bool even = true;
	for (int i = 1; i <= N; i++) {
		if ((cnt[i]&1)==1) even = false;
	}

	if (even) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 640
using System;
 class Program
    {
        static void Main(string[] args)
        {
            int A, B;
            string[] str = Console.ReadLine().Split(' ');

            A = int.Parse(str[0]);
            B = int.Parse(str[1]);

            int a = A + B;
            int b = A - B;
            int c = A * B;

            int max = Math.Max(a, b);
            int max_ = Math.Max(c,max);

            Console.WriteLine(max_);
        }
    }

Measured memory_bytes: 13140
import java.util.*;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int d = Integer.parseInt(sc.next());
        if (Math.abs(b - a) <= d && Math.abs(c - b) <= d) {
            System.out.println("Yes");
        } else if (Math.abs(c - a) <= d){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21716
def isokay(S,T):
    if len(T)-len(S)!=1:
        return False
    else:
        for i in range(len(S)):
            if S[i]!=T[i]:
                return False
    return True

S=input()
T=input()

if isokay(S,T):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 8980
#include <bits/stdc++.h>
#define FAST_INPUT ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long

using namespace std;


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '"' << x << '"';}
void __print(const string &x) {cerr << '"' << x << '"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


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

void solve() {
	string s, t;
	cin >> s >> t;

	vector<vector<pair<int, pair<int, int>>>> dp(
		s.size() + 1, 
		vector<pair<int, pair<int, int>>>(t.size() + 1, make_pair(0, make_pair(0, 0)))
	);
	for (int i = 1; i <= (int) s.size(); i++) {
		for (int j = 1; j <= (int) t.size(); j++) {
			if (s[i - 1] == t[j - 1]) {
				max_self(dp[i][j], make_pair(dp[i - 1][j - 1].first + 1, make_pair(i - 1, j - 1)));
			}
			max_self(dp[i][j], make_pair(dp[i - 1][j].first, make_pair(i - 1, j)));
			max_self(dp[i][j], make_pair(dp[i][j - 1].first, make_pair(i, j - 1)));
		}
	}

	pair<int, pair<int, int>> answer = make_pair(0, make_pair(0, 0));
	for (int i = 0; i <= (int) s.size(); i++) {
		for (int j = 0; j <= (int) t.size(); j++) {
			max_self(answer, make_pair(dp[i][j].first, make_pair(i, j)));
		}
	}

	// debug(answer);

	string res;
	pair<int, int> cur = answer.second;
	while (cur.first != 0 && cur.second != 0) {
		int i = cur.first;
		int j = cur.second;
		pair<int, int> prev = dp[i][j].second;
		if (prev == make_pair(i - 1, j - 1)) { 
			res += s[i - 1];
		}
		cur = prev;
	}

	reverse(res.begin(), res.end());
	cout << res << endl;
}

int main() {
    FAST_INPUT;

    solve();

    return 0;
}


Measured memory_bytes: 105984
//--- pB ---//
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Reader reader;
	public Solution () {
		reader = new Reader();
		while (reader.hasNext()) {
			run_case();
		}
	}
	private void run_case() {
		String s = reader.ns();
		int N = s.length();
		String sa = s.substring(0, ((N-1)/2));
		String sb = s.substring( (N+3)/2 - 1 );

		if (isPalin(s) && isPalin(sa) && isPalin(sb)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		return;
	}
	private boolean isPalin(String s) {
		for (int i=0; i<s.length()/2; i++) {
			if (s.charAt(i) != s.charAt(s.length() - 1 - i)) return false;
		}
		return true;
	}
}

class Reader {
	BufferedReader br;
	StringTokenizer st;
	public Reader(){
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String next() {
		if (st.hasMoreTokens()) return st.nextToken();
		try {
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return st.nextToken();
	}
	public boolean hasNext() {
		try {
			if (!st.hasMoreTokens() && !br.ready()) return false;
			else return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	public int ni() {return Integer.parseInt(this.next());}
	public String ns() {return this.next();}
}


Measured memory_bytes: 22868
import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

@njit((i8, i8, i8, i8[:]), cache=True)
def solve(R,C,K,XYV):
  item = np.zeros((R + 1, C + 1), dtype=np.int64)
  for i in range(0, 3 * K, 3):
    x, y, v = XYV[i:i + 3]
    item[x - 1, y - 1] = v
  dp = np.zeros((C+1,4), dtype=np.int64)
  for i in range(R):
    new_dp = np.zeros((C+1,4), dtype=np.int64)
    #上から移動
    for k in range(4):
      new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,k])
    dp = new_dp
    for j in range(1,C+1):
      #横から移動
      for k in range(4):
        new_dp[j,k] = np.maximum(new_dp[j,k],new_dp[j-1,k])
      #アイテムを取る
      for k in range(2,-1,-1):
        dp[j,k+1] = np.maximum(dp[j,k+1],dp[j,k]+item[i,j-1])
  ans = dp[-1].max()
  return ans

R, C, K = map(int, readline().split())
XYV = np.array(read().split(), np.int64)
print(solve(R,C,K,XYV))


Measured memory_bytes: 186900
#include<iostream>
#include <string.h>

using namespace std;
	int main(void){
		int a, b, c ,d;
		cin >> a;
		d = a % 10;
		c = (a / 10) % 10;
		b = (a / 100) % 10;
		a /= 1000;
		

		int x1, x2, x3;
		int i, k, j;
		for(i = 0; i < 2; i++){
			for(j = 0; j < 2; j++){
				for(k = 0; k < 2; k++){
					int sum = a;
					if(i == 0){
						sum += b;
					}else{
						sum -= b;
					}
					if(j == 0){
						sum += c;
					}else{
						sum -= c;
					}
					if(k == 0){
						sum += d;
					}else{
						sum -= d;
					}
					if(sum == 7){
						x1 = i;
						x2 = j;
						x3 = k;
					}
				}
			}
		}
		char y1, y2, y3;
		if(x1 == 0){
			y1 = '+';
		}else{
			y1 = '-';
		}
		if(x2 == 0){
			y2 = '+';
		}else{
			y2 = '-';
		}
		if(x3 == 0){
			y3 = '+';
		}else{
			y3 = '-';
		}
		cout << a << y1 << b << y2 << c << y3 << d << "=7" << endl;
		
		return 0;
	}
	
	
	

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

int main(void){
	
	int a,b,flag=0;
	char c;
	
	while(1){
	scanf("%d %c %d",&a,&c,&b);
	
	switch(c){
	
	case '+':
		printf("%d\n",a+b);
		break;
	
	case '-':
		printf("%d\n",a-b);
		break;
		
	case '*':
		printf("%d\n",a*b);
		break;
		
	case '/':
		printf("%d\n",a/b);
		break;
		
	default: flag=1;break;
	
	}
	if(flag==1)break;
	}
return 0;}

Measured memory_bytes: 600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int x = scan.nextInt();
		scan.close();
		System.out.println((a<=x && b>=x-a)? "YES":"NO");
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  unsigned long long int N;
  string d;
  cin >> N >> d;
  cout <<(N*int(d.at(0)-'0')*100+N*int(d.at(2)-'0')*10+N*int(d.at(3)-'0'))/100 << endl;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;	cin >> n;
  vector<int> A(n,0);
  for(int i=1;i<n;i++){
    int x;	cin >> x;	x--;
    A.at(x)++;
  }
  
  for(int i:A){
    cout << i << endl;
  }
}

Measured memory_bytes: 4048