akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

char input[101];

int main()
{
	int ans=0;
	while (scanf(" %s",input)!=EOF) {
		bool flag=true;
		for (int i=0; i<strlen(input)/2; i++) {
			if (input[i]!=input[strlen(input)-i-1]) flag = false;
		}
		if (flag) ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<long long,long long> pll;

const int MAX=100005;
const int oo=1000000009;
ll dp[MAX][105];
int weights[MAX];
int value[MAX];
int W,n;

int main() {
    #ifndef LOCAL
    fastIO;
    #endif
    memset(dp,0,sizeof(dp));
    cin >> n >> W;
    for(int i=0;i<n;i++){
        cin >> weights[i] >> value[i];
    }
    for(int i=1;i<=W;i++){
        for(int j=1;j<=n;j++){
            if(i-weights[j-1]>-1) dp[i][j]=max(dp[i][j-1],dp[i-weights[j-1]][j-1]+value[j-1]);
            else dp[i][j]=dp[i][j-1];
        }
    }
    cout << dp[W][n] << endl;
    return 0;
}

Measured memory_bytes: 85672
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

class SegmentTreeSum
{
public:
    ll N = 0;
    vector<ll> Data;

public:
    SegmentTreeSum(ll n, ll x = 0)
    {
        for (N=1;N<n;N<<=1);
        Data.assign(N * 2 - 1, x);
    }

    void add(ll k, ll x)
    {
        k += N - 1;
        Data[k] += x;

        while (k)
        {
            k = (k - 1) >> 1;
            Data[k] += x;
        }
    }

    ll query(ll a, ll b) const { return query(a, b, 0, N, 0); }
    ll query(ll a, ll b, ll l, ll r, ll k) const
    {
        if(r <= a || b <= l) { return 0; }
        if(a <= l && r <= b) { return Data[k]; }

        const auto mid = (l + r) >> 1;
        const auto lhs = query(a, b, l, mid, (k << 1) + 1);
        const auto rhs = query(a, b, mid, r, (k << 1) + 2);
        return lhs + rhs;
    }
};

struct Query
{
    ll ID, L, R;
};

int main()
{
    ll N, Q;
    cin >> N >> Q;

    vector<ll> C(N);
    rep (i, N) { cin >> C[i]; --C[i]; }

    vector<Query> queries(Q);
    rep (i, Q)
    {
        auto& query = queries[i];
        query.ID = i;

        cin >> query.L >> query.R;
        --query.L;
        --query.R;
    }

    sort(queries.begin(), queries.end(), [](const auto& a, const auto& b)
    {
        return a.R < b.R;
    });

    vector<ll> ans(Q);
    vector<ll> last(N, -1);

    SegmentTreeSum seg(N);
    ll index = 0;

    for (const auto& query : queries)
    {
        while (index <= query.R)
        {
            if (last[C[index]] != -1) { seg.add(last[C[index]], -1); }
            seg.add(index, 1);

            last[C[index]] = index;
            ++index;
        }

        ans[query.ID] = seg.query(query.L, query.R + 1);
    }

    for (const auto& x : ans) { cout << x << endl; }

    return 0;
}


Measured memory_bytes: 35464
#! ruby -Ku

y,x = gets.chomp.split(" ").map(&:to_i)

check = 0
m = Array.new(y){Array.new(x)}
field = Array.new(10){Array.new(10)}

10.times do |i|
	field[i] = gets.chomp.split(" ").map(&:to_i)
end

10.times do |k|
	10.times do |i|
		10.times do |j|
			if field[i][j] > field[i][k]+field[k][j] then
				field[i][j] = field[i][k] + field[k][j]
			end
		end
	end
end

y.times do |i|
	m[i] = gets.chomp.split(" ").map(&:to_i)
end

y.times do |i|
	x.times do |j|
		next if (m[i][j] == 1 || m[i][j] == -1)
		check += field[m[i][j]][1]
	end
end

puts check


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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
//const ll MOD = 1000000007;
const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// #define mp make_pair
//#define endl '\n'


int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  cout << max(0, c - (a - b)) << endl;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
P = list(map(int, input().split()))

m = [(e + 1) / 2 for e in P]

t = sum(m[0:K])
ans = t
for i in range(N - K):
    t -= m[i]
    t += m[i + K]
    if t > ans:
        ans = t
print(ans)

Measured memory_bytes: 25060
_input = list(map(int, input().split()))
results = []
for i in range(2):
    if _input[0] > _input[1] or _input[0] == _input[1]:
        results.append(_input[0])
        if _input[0] > 3:
            _input[0] -= 1
    elif _input[0] < _input[1]:
        results.append(_input[1])
        if _input[1] > 3:
            _input[1] -= 1


print(sum(results))

Measured memory_bytes: 3064
import collections
s = input()
t = input()
dd = collections.defaultdict(str)
dd2 = collections.defaultdict(str)
for i in range(len(s)):
    key = s[i]
    key2 = t[i]
    if dd[key] != '' and dd[key] != key2 or dd2[key2] != '' and dd2[key2] != key:
        print('No')
        exit()
    dd[key] = key2
    dd2[key2] = key
print('Yes')

Measured memory_bytes: 3888
K,X = [int(s) for s in input().split(" ")]
num_min =  1000000*(-1)
num_max =  1000000

blk_min = max(num_min, X - (K-1))
blk_max = min(num_max, X + (K-1))
out = ""
for i in range(blk_min, blk_max+1):
    out=out+str(i)+" "
    
print(out[:-1])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long int 
#define mod 1000000007
#define se second
#define fi first
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971
#define MAX 9223372036854775807
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
//	cout<<fixed<<setprecision(10);
	ll n;
	cin>>n;
	ll sum=0;
	ll arr[n];
	map<ll,ll> mp;
	for(int a=0;a<n;a++)
	{
		cin>>arr[a];
		sum+=arr[a];
		mp[arr[a]]++;
	}
	ll q;
	cin>>q;
	ll x,y,z;
	while(q--)
	{
		cin>>x>>y;
		sum-=(x*mp[x]);
		sum+=(y*mp[x]);
		mp[y]+=mp[x];
		mp[x]=0;
		cout<<sum<<endl;
	}
	return 0;
}

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

using namespace std;

const long long MOD = 1000000007;
const long long MAX = 2000000;


int main() {
    int N;
    cin>>N;
    int A[N];
    vector<vector<int> >x(N);
    vector<vector<int> >y(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
        for(int j=0;j<A[i];j++){
            int xx,yy;
            cin>>xx>>yy;
            x[i].push_back(xx);
            y[i].push_back(yy);
        }
    }
    int maxx=-1;
    for(int bit=0;bit<(1<<N);bit++){
        vector<int>S;
        for(int i=0;i<N;i++){
            if(bit&(1<<i)){
                S.push_back(i);
            }

        }

        int flag[N][2];
        for(int i=0;i<N;i++){
            for(int j=0;j<2;j++){
                flag[i][j]=0;
            }
        }
        for(int i=0;i<(int)S.size();i++){
            for(int j=0;j<A[S[i]];j++){
                flag[x[S[i]][j]-1][y[S[i]][j]]=1;
            }
        }
        bool fla=true;
        int tmp=0;
        for(int i=0;i<N;i++){

            if(flag[i][0]&&flag[i][1]){
                fla=false;
                break;

            }
            if(flag[i][1]){
                bool flagg=false;
                for(int k=0;k<(int)S.size();k++){
                    if(S[k]==i){
                        flagg=true;
                    }
                }
                if(flagg){
                tmp++;
                }else{
                    fla=false;
                    break;
                }
            }else if(flag[i][0]){
                bool flagg=true;
                for(int k=0;k<(int)S.size();k++){
                    if(S[k]==i){
                        flagg=false;
                    }
                }
                if(!flagg){
                    fla=false;
                    break;
                }

            }

        }
        //cout<<""<<endl;
        if(fla){
            if((int)S.size()>tmp){
                tmp=(int)S.size();
            }


            if(tmp>maxx){
                maxx=tmp;
            }
        }




    }
    cout<<maxx<<endl;



}


Measured memory_bytes: 256
N,Y = (int(x) for x in input().split())
temp = [-1 for n in range(3)]
myflag = False
for x in range(N+1):
  if myflag:break
  for y in range(N+1-x):
    if myflag:break
    z = N - x - y
    if 10000*x + 5000*y + 1000*z == Y:
      temp=[x,y,z]

print('{} {} {}'.format(temp[0],temp[1],temp[2]))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
struct Node{
	int key;
	Node *right,*left,*parent;
};
Node *root,*NIL;
void insert(int k){
	Node *x=root;
	Node *y =NULL;
	Node *z=(Node *)malloc(sizeof(Node));
	z->key=k;z->left=NULL;z->right=NULL;
	while(x!=NULL){
		y=x;
		if(x->key>z->key){
			x=x->left;
		}
		else x=x->right;
	}
	z->parent=y;
	if(y==NULL)root=z;
	else {
		if(y->key>z->key){
			y->left=z;
		}
		else y->right=z;
	} 
	
}
Node * find(Node *u,int k){
	while(u!=NULL&&u->key!=k){
		if(u->key>k)u=u->left;
		else u=u->right; 
	}
	return u; 
}
Node * treeMinimum(Node *x){
	while(x->left!=NULL)x=x->left;
	return x;
}
//Node * treeSuccessor(Node *x){
//	if(x->right!=NULL)return treeMinimum(x->right);
//	Node *y=x->parent;
//	while(y!=NULL&&x==y->right){
//		x=y;
//		y=y->parent;
//	}return y;
//}
void treeDelete(Node *z){
	Node *y;//ÒªÉ¾³ýµÄ¶ÔÏó 
	Node *x;//yµÄ×Ó½áµã 
	if(z->left==NULL||z->right==NULL)y=z;
	else y=treeMinimum(z->right);
	//È·¶¨yµÄ×Ó½áµãx
	if(y->right!=NULL){
		x=y->right;
	}else
	x=y->left;
	if(x!=NULL)x->parent=y->parent;
	if(y->parent==NULL){
		root=x;
	}else{
		if(y==y->parent->left)y->parent->left=x;
		else y->parent->right=x;
	}
	if(y!=z)z->key=y->key;
	free(y);
} 
void inorder(Node *u){
	if(u==NIL)return ;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
} 

void preorder(Node *u){
	if(u==NIL)return ;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}
int main(){
	int n,i,x,k;
	string com;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		cin>>com;
		if(com=="insert"){
			scanf("%d",&x);
			insert(x); 
		}else if(com=="print"){
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
		else if(com=="find"){
			scanf("%d",&k);
			if(find(root,k)!=NULL)printf("yes\n");
			else printf("no\n");
		}
		else if(com=="delete"){
			scanf("%d",&k);
			treeDelete(find(root,k));
		}
			} 
} 


Measured memory_bytes: 22060
a = [int(x) for x in input()]
l = len(a)

a = a[::-1]

ans = 0

for i in range(l):
    if a[i] == 10:
        if i != l-1:
            a[i] = 0
            a[i+1] += 1
        else:
            ans += 1
            break
    if a[i] <= 4:
        ans += a[i]
    elif a[i] == 5:
        if i != l-1 and a[i+1] <= 4:
            ans += 5
        elif i != l-1:
            ans += 5
            a[i+1] += 1
        else:
            ans += 5
    else:
        ans += 10-a[i]
        if i != l-1:
            a[i+1] += 1
        else:
            ans += 1
            break

print(ans)


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int n, x, t;
	cin >> n >> x >> t;
	if (n % x == 0) {
		cout << (n / x) * t << endl;
	}
	else cout << ((n / x)+1) * t << endl;
	return 0;
}



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

int main()
{
    int w, h, n;
    cin >> w >> h >> n;
    int x0 = 0;
    int x1 = w;
    int y0 = 0;
    int y1 = h;
    for (int i = 0; i < n; i++) {
        int x, y, a;
        cin >> x >> y >> a;
        if (a == 1) {
            x0 = max(x0, x);
        } else if (a == 2) {
            x1 = min(x1, x);
        } else if (a == 3) {
            y0 = max(y0, y);
        } else {
            y1 = min(y1, y);
        }
    }
    int ww = max(x1-x0, 0);
    int hh = max(y1-y0, 0);
    cout << ww*hh << endl;
    return 0;
}

Measured memory_bytes: 256
// SeeAlso: https://atcoder.jp/contests/abc123/tasks/abc123_b

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <limits>

using namespace std;

#define MAX 5

int main() {
    int A[MAX];

    cin >> A[0];
    cin >> A[1];
    cin >> A[2];
    cin >> A[3];
    cin >> A[4];

    int ans = 0;
    int maxnum = 0;

    for(int i = 0; i < MAX; i++) {
        int adition;
        if ((A[i] % 10) > 0) {
            adition = 10 - (A[i] % 10);
        } else {
            adition = 0;
        }

        ans += A[i] + adition; 
        if (adition > 0) {
            maxnum = max(maxnum, adition);
        }
    }

    cout << (ans - maxnum) << endl;
    return 0;
}


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

using namespace std;

int main()
{
    string str;
    int n, ac = 0, wa = 0, tle = 0, re = 0;
    cin >> n;
    for(int i = 0 ; i < n ; i++)
    {
        cin >> str;
        if(str == "AC")
            ac++;
        else if(str == "WA")
            wa++;
        else if(str == "TLE")
            tle++;
        else
            re++;
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re;
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    //#include "testlib.h"
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007
    #define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
    #define GCD(m,n) __gcd(m,n)
    #define LCM(m,n) m*(n/GCD(m,n))
    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    #define pii pair<int,int>
    #define REVERSE(v) reverse(ALL(v))
    #define display(x) trav(a,x) cout<<a<<" ";cout<<endl
    #define debug cerr<<"bhau"<<endl
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        std::cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}
    void amax(int &a,int b){a=max(a,b)%M; }
    void amin(int &a,int b){ a=min(a,b)%M;}
    void inc(int &a,int b){a=(a+b)%M;}
    void dec(int &a,int b){a=(a-b+M)%M;}


    
     int solve()
     {  
      int n,k;cin>>n>>k;
      int ans=0;
      rep0(n){
        int a;cin>>a;
        if(a>=k) ans++;
      }
      cout<<ans;

        r0   
     }
    signed main()
    {   
        asdf
        
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

int main()
{
	char a;
	cin >> a;

	if ('A' <= a && a <= 'Z') {
		cout << "A" << endl;
	}
	else {
		cout << "a" << endl;
	}

	
}


Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

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

      String line;
      while(true) {

        if( (line = br.readLine()) == null || line.isEmpty() ) break;

        Dice dice1 = new Dice(line.split(" "));
        System.out.println(dice1.doRotate(br.readLine()));
      }
    }
  }
}

class Dice {
  private int[] side;

  public Dice( int[] ia ) {
    side = Arrays.copyOf(ia, ia.length);
  }
  public Dice( String[] s ) {
    side = new int[s.length];
    for ( int i=0; i < 6; i++)
      side[i] = Integer.parseInt(s[i]);
  }

  public int doRotate(String s) {
    for ( int i=0; i < s.length(); i++ ) {
      rotate(s.substring(i, i+1));
    }
    return side[0];
  }

  private void rotate(String o) {
    switch(o) {
      case "N" :
        rotateN();
        break;
      case "S" :
        rotateS();
        break;
      case "W" :
        rotateW();
        break;
      case "E":
        rotateE();
        break;
      default :
    }
  }

  private void rotateN() {
    int tmp = side[0];
    side[0] = side[1]; side[1] = side[5]; side[5] = side[4];
    side[4] = tmp;
  }
  private void rotateS() {
    int tmp = side[0];
    side[0] = side[4]; side[4] = side[5]; side[5] = side[1];
    side[1] = tmp;
  }
  private void rotateW() {
    int tmp = side[0];
    side[0] = side[2]; side[2] = side[5]; side[5] = side[3];
    side[3] = tmp;
  }
  private void rotateE() {
    int tmp = side[0];
    side[0] = side[3]; side[3] = side[5]; side[5] = side[2];
    side[2] = tmp;
  }
}


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

int main(){
  int a,b,k;
  cin >> a >> b >> k;
  
  if(k%2 == 1){
  for(int i=0; i<k/2;i++){ 
    if(a%2 == 1){
      b += (a-1)/2;
      a = (a-1)/2;
    }
    else {
      b += a/2;
      a = a/2;
    }
    
    if(b%2 == 1){
      a += (b-1)/2;
      b = (b-1)/2;
    }
    else {
      a += b/2;
      b = b/2;
    }
    
  }
    if(a%2 == 1){
      b += (a-1)/2;
      a = (a-1)/2;
    }
    else {
      b += a/2;
      a = a/2;
    }
  }
  
  if(k%2 == 0){
  for(int i=0; i<k/2;i++){ 
    if(a%2 == 1){
      b += (a-1)/2;
      a = (a-1)/2;
    }
    else {
      b += a/2;
      a = a/2;
    }
    
    if(b%2 == 1){
      a += (b-1)/2;
      b = (b-1)/2;
    }
    else {
      a += b/2;
      b = b/2;
    }
    
  }
  }
  
    
  
  cout << a <<" " << b << endl;
  
  
  return 0;
}

Measured memory_bytes: 256
import sys
from collections import Counter
def input(): return sys.stdin.readline().rstrip()


def main():
    n=int(input())
    wlist=[]
    for _ in range(n):
        n=input()
        n=list(n)
        n.sort()
        n=''.join(n)
        wlist.append(n)
    cnt=Counter(wlist)
    ans=0
    for c in cnt.values():
        ans+=c*(c-1)//2
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 24020
D,G = [int(x) for x in input().split()]
pc = []
for i in range(D):
  p,c = [int(x) for x in input().split()]
  pc.append([p,c])
res = 1<<29
for bit in range(1<<D):
  ans = 0
  num = 0
  for j in range(D):
    if bit&(1<<j):
      ans += pc[j][0]*(j+1)*100+pc[j][1]
      num += pc[j][0]
  if ans >=G:
    res = min(num,res)
  else:
    for j in range(D-1,-1,-1):
      if bit&(1<<j):
        continue
      else:
        for i in range(pc[j][0]):
          if ans>=G:
            break
          ans += 100*(j+1)
          num +=1
    res = min(num,res)
print(res)
  
      



Measured memory_bytes: 3064
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
const long double PI=3.14159265358979323846264338327950;
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vlong a(n);
  vlong ze(n);
  long long count=0,sum=0,min=INF;
  rep(i,n){
    cin>>a[i];
    if(a[i]<0){
      count++;
    }
    ze[i]=abs(a[i]);
    sum+=ze[i];
    chmin(min,ze[i]);
  }
  if(count%2==0){
    cout<<sum<<'\n';
  }
  else{
    cout<<sum-(min*2)<<'\n';
  }
  return(0);
}

Measured memory_bytes: 4772
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<String> s = new ArrayList<>();


        for (int i = 0; i < n; i++) {
            s.add(sc.next());
        }
        List<String> list = new ArrayList<>(new HashSet<>(s));

        System.out.println(list.size());
    }
}

Measured memory_bytes: 73292
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func divFloor(a, b int) int {
	return (a + (b - 1)) / b
}

func max(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n, a, b := nextInt(), nextInt(), nextInt()
	h := nextInts(n)

	// x回の攻撃で倒せるか
	canKillAll := func(x int) bool {
		acnt := 0
		for i := 0; i < n; i++ {
			acnt += divFloor(max(0, h[i]-b*x), a-b)
		}
		return acnt <= x
	}

	low, high := 0, 1000000000
	for low+1 < high {
		mid := (low + high) / 2
		if canKillAll(mid) {
			high = mid
		} else {
			low = mid
		}
	}

	puts(high)
}


Measured memory_bytes: 3200
#!/usr/bin/env python3
import sys
#sys.setrecursionlimit(150000)


def solve(S: str, T: str):
    ans=0
    for i in range(3):
        if S[i]==T[i]:
            ans+=1
    print(ans)
    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
    T = next(tokens)  # type: str
    solve(S, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  stringstream ss;
  REP(i, 3){ char c; cin >>c; ss << c; };
  string s = ss.str();
  if(s == "100" || s == "010" || s == "000") cout <<"Close" <<endl;
  else cout <<"Open" <<endl;
  return 0;
}

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

int main(){
  int A, B, K;
  cin >> A >> B >> K;
  if(A + K - 1 < B - K + 1){
    rep(i, K) cout << A + i << endl;
    rep(i, K) cout << B - K + 1 + i << endl;
  } else rep(i, B - A + 1) cout << A + i << endl;
  return 0;
}

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

int main(void)
{
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;

  if(x - r < 0 || y - r < 0 ||  x + r > W || y + r > H ){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }

  
  return 0;
}

Measured memory_bytes: 3100
var
  n,i,ans:longint;
  a:array[1..200] of longint;
procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]>x do
            inc(i);
           while x>a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;  
begin
  readln(n);
  for i:=1 to 2*n do
    read(a[i]);
  sort(1,2*n);    
  for i:=1 to n do
    ans:=ans+a[i*2];
  writeln(ans);    
end.

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

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template <class T>
bool chmax(T &a, const T &b) {if (a < b){ a = b; return 1;} return 0;}
template <class T>
bool chmin(T &a, const T &b) {if (a > b){ a = b; return 1;}return 0;}
template <class T>
void printv(vector<T> v) {for (T t : v) {cout << t << " ";}cout << '\n';}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#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 ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" <<endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main()
{

    int n;
    cin >> n;

    int ans ;
    if (n % 2 == 0) cout << n/2-1 << endl;
    else cout << n/2 << endl;

    return 0;
}


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

#define INFTY 2000000000

typedef struct{
  char mark;
  int num;
} Card;

int partition(Card *,int,int);
void quicksort(Card *,int,int);
void merge(Card *,int,int,int);
void mergeSort(Card *,int,int);

int main(){
  Card C[100000],B[100000],k;/*C、クイック　B、マージ*/
  int c,i,j,n,result = 0,flag = 1;
  char kaigyou,E[1];
  
  scanf("%d%c",&n,&kaigyou);
  if(n < 1 || n > 100000)return 0;
   
   for(i = 0; i < n; i++){
     scanf("%c%d%c",&C[i].mark,&C[i].num,&kaigyou);
     if(C[i].num < 0 || C[i].num > 1000000000)return 0;
     B[i] = C[i];
   }
  
   quicksort(C,0,n-1);
   mergeSort(B,0,n);
  

   /*安定かどうか判定*/
   for(i = 0;i < n; i++){
     if(strcmp(&C[i].mark,&B[i].mark)!=0){
       result = 1;
       break;
     }
   }
   /*出力*/
 if(result == 0)printf("Stable\n");
 else printf("Not stable\n");

  for(i = 0; i < n; i++){
    printf("%c %d\n",C[i].mark,C[i].num);
  }
   
   return 0;
}

int partition(Card A[],int p,int r){
  int i,j,x;
  Card y;
  i = p-1;
  x = A[r].num;
  
  for(j = p; j < r;j++){
    if(A[j].num <= x){    
      i += 1;
      y = A[j];
      A[j] = A[i];
      A[i] = y;
    }
  }
  y = A[i+1];
  A[i+1] = A[r];
  A[r] = y;

  return i+1;
}

void quicksort(Card A[],int p,int r){
  int q;
  if(p < r){
    q = partition(A,p,r);
    quicksort(A,p,q-1);
    quicksort(A,q+1,r);
  }
}

void merge(Card s[],int left,int mid,int right){
  int i = 0,j = 0,k,n1,n2;
  Card L[50001],R[50001];
 
  n1 = mid - left;
  n2 = right - mid;
  for(i = 0;i < n1;i++){
    L[i] = s[left + i];
  }
  for(i = 0;i < n2;i++){
    R[i] = s[mid + i];
  }
  L[n1].num = INFTY;
  R[n2].num = INFTY;
  i = 0;
  j = 0;
  for(k = left;k < right;k++){
    if(L[i].num <= R[j].num){
      s[k] = L[i];
      i += 1;
     
    }
    else{
      s[k] = R[j];
      j += 1;
    
    }
  }
}

void mergeSort(Card s[],int left,int right){
  int mid;
 
  if(left + 1 < right){
    mid = (left + right)/2;
    mergeSort(s,left,mid);
    mergeSort(s,mid,right);
    merge(s,left,mid,right);
  }
  
}




Measured memory_bytes: 4100
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a1, a2, a3, b1, b2, b3;
		int[][] grid = new int[3][3];
		for (int i=0; i<3; i++) {
			for (int j=0; j<3; j++) {
				grid[i][j] = sc.nextInt();
			}
		}
		String res = "No";
		for (a1=0; a1<=grid[0][0]; a1++) {
			b1 = grid[0][0] - a1;
			b2 = grid[0][1] - a1;
			b3 = grid[0][2] - a1;
			a2 = grid[1][0] - b1;
			a3 = grid[2][0] - b1;
			if (a2+b2 == grid[1][1]
					&& a2+b3 == grid[1][2]
					&& a3+b2 == grid[2][1]
					&& a3+b3 == grid[2][2]) res = "Yes"; 
		}
		System.out.println(res);
	}
}


Measured memory_bytes: 23764
#include <iostream>
#include <cstdio>
#include <cstring>

char str[110];

int cnt1[26];
int cnt2[26];


int main()
{
	int i, len, j, res, cnt;
	while(~scanf("%d", &len)){
		scanf("%s", str);
		memset(cnt1, 0, sizeof(cnt1));
		memset(cnt2, 0, sizeof(cnt2));
		for(i = 0; i < len; i++){
			cnt1[str[i] - 'a']++;
		}
		res = 0;
		for(i = 0; i < len; i++){
			cnt1[str[i] - 'a']--;
			cnt2[str[i] - 'a']++;
			cnt = 0;
			for(j = 0; j < 26; j++){
				if(cnt1[j] == 0 || cnt2[j] == 0) continue;
				cnt++;
			}
			res = std::max(res, cnt);
		}
		printf("%d\n", res);
	}

	
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	string s; cin >> s;

	int ans = INT_MAX;

	for (int i = 0;i < s.size()-2;i++){
		int a = (s[i]-'0')*100 + (s[i+1]-'0')*10 + (s[i+2]-'0');
		ans = min(abs(753-a),ans);
	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 256
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
ans = 0
mod = 10 ** 9 + 7

for i in range(60):
    x, y = 0, 0    
    B = A >> i & 1
    x = np.count_nonzero(B)
#     for Ai in A:
#         if Ai >> i & 1:
#             x += 1
    y = N - x
    ans += (x * y) * (2 ** i)
    
print(ans%mod)

Measured memory_bytes: 48868
n = gets.to_i
as = gets.split(" ").map(&:to_i)
h = Hash.new(0)

as.each do |a|
  h[a] += 1
end

max = 0
(0..10**5).each do |i|
  a = h[i]
  b = h[i+1]
  c = h[i+2]
  max = [max, a+b+c].max
end

puts max

Measured memory_bytes: 14724
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPR(i, n) for (int i = (int)(n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (int)(b) - 1; i >= (a); i--)

using namespace std;

void to(int &x, int y) {
  x = max(x, y);
}

int dp0[186][186][186]; // rightward
int dp1[186][186][186];
int ep0[186][186][186]; // downward
int ep1[186][186][186];
int cnt[186][186];

int f(int y0, int y1, int x0, int x1) {
  return cnt[y1][x1] - cnt[y0][x1] - cnt[y1][x0] + cnt[y0][x0];
}

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> A(H);
  REP(i, H) cin >> A[i];
  REP(i, H) REP(j, W) cnt[i+1][j+1] = cnt[i+1][j] + cnt[i][j+1] - cnt[i][j] + (A[i][j] == '#');
  REP(i, H) REP(j, W) FOR(k, i+1, H+1) {
    int l = j;
    int r = W+1;
    while (r - l > 1) {
      int m = (l + r) / 2;
      if (f(i, k, j, m) == 0 || f(i, k, j, m) == (k - i) * (m - j)) {
        l = m;
      } else {
        r = m;
      }
    }
    dp0[i][j][k] = l;
  }
  REP(i, H) REP(j, W) FOR(k, j+1, W+1) {
    int l = i;
    int r = H+1;
    while (r - l > 1) {
      int m = (l + r) / 2;
      if (f(i, m, j, k) == 0 || f(i, m, j, k) == (m - i) * (k - j)) {
        l = m;
      } else {
        r = m;
      }
    }
    ep0[i][j][k] = l;
  }
  for (int level = 0;; level++) {
    if (dp0[0][0][H] == W) {
      cout << level << '\n';
      break;
    }
    REP(i, H) REP(j, W) FOR(k, i+1, H+1) {
      dp1[i][j][k] = dp0[i][j][k];
    }
    REP(i, H) REP(j, W) FOR(k, j+1, W+1) {
      ep1[i][j][k] = ep0[i][j][k];
    }
    REP(i, H) REP(j, W) FOR(k, i+1, H+1) {
      int r = dp1[i][j][k];
      to(dp0[i][j][k], dp1[i][r][k]);
      int rr = dp1[i][r][k];
      to(ep0[i][j][rr], k);
    }
    REP(i, H) REP(j, W) FOR(k, j+1, W+1) {
      int b = ep1[i][j][k];
      to(ep0[i][j][k], ep1[b][j][k]);
      int bb = ep1[b][j][k];
      to(dp0[i][j][bb], k);
    }
    for (int d = H; d >= 1; d--) REP(j, W) {
      for (int i = 0; i + d <= H; i++) {
        int k = i + d;
        if (i > 0) to(dp0[i][j][k], dp0[i-1][j][k]);
        if (k < H) to(dp0[i][j][k], dp0[i][j][k+1]);
      }
    }
    for (int d = W; d >= 1; d--) REP(i, H) {
      for (int j = 0; j + d <= W; j++) {
        int k = j + d;
        if (j > 0) to(ep0[i][j][k], ep0[i][j-1][k]);
        if (k < W) to(ep0[i][j][k], ep0[i][j][k+1]);
      }
    }
  }
}


Measured memory_bytes: 100864
N = int(input())
A = list(map(int, input().split()))
f = True
for i in range(N):
    if A[i] % 2 == 0:
        if (A[i] % 3 == 0) or (A[i] % 5 == 0):
            pass
        else:
            f = False
            break
if f:
    print("APPROVED")
else:
    print("DENIED")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr int  mod = 1e9 + 7;
int main() {
	int n, m;
	cin >> n >> m; ll res = 0;
	vector<int>v(m);
	for (int i = 0; i < m; ++i) {
		int val; cin >> val; v[i] = val;
		res += val;
	}
	if (res > n)cout << -1;
	else {
		for (int ele : v) {
			n -= ele;
		}
		cout << n;
	}
	return 0;
}

Measured memory_bytes: 3664
import java.util.*;

public class Main{
    final int MOD = 1000000007;
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        if(Math.abs(n - m) >= 2){
            System.out.println(0);
            return;
        }
        long out = 1;
        for(int i = 1; i <= n; i++){
            out *= i;
            if(out > MOD) out %= MOD;
        }
        for(int i = 1; i <= m; i++){
            out *= i;
            if(out > MOD) out %= MOD;
        }
        if(n == m) System.out.println((out * 2) % MOD);
        else System.out.println(out % MOD);
    }


    public static void main(String[] args){
        new Main().solve();
    }
}


Measured memory_bytes: 35676
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long double n,d;
  cin>>n>>d;
  long double count=0;
  rep(i,n){
    long double p,q;
    cin>>p>>q;
    if(sqrt(p*p+q*q)<=d){
      count++;
    }
  }
  cout<<count<<'\n';
  return(0);
}


Measured memory_bytes: 3828
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.F
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var s = ReadText();
            var t = ReadText();
            var dp = new long[s.Length + 1, t.Length + 1];
            for (int i = 1; i <= s.Length; i++)
            {
                for (int j = 1; j <= t.Length; j++)
                {
                    var a = dp[i - 1, j - 1] + 1;
                    var b = dp[i - 1, j];
                    var c = dp[i, j - 1];
                    if (s[i - 1] == t[j - 1])
                    {
                        dp[i, j] = Math.Max(a, Math.Max(b, c));
                    }
                    else
                    {
                        dp[i, j] = Math.Max(b, c);
                    }
                }
            }

            if (dp[s.Length, t.Length] == 0) return "";

            var length = dp[s.Length, t.Length];
            var x = s.Length;
            var y = t.Length;
            var result = new char[length];
            while (length > 0)
            {
                while (x > 0 && length == dp[x - 1, y])
                {
                    x--;
                }
                while (y > 0 && length == dp[x, y - 1])
                {
                    y--;
                }

                x--;
                y--;
                length--;
                result[length] = s[x];
            }

            return new string(result);
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 96116
package main

import "fmt"

func main() {
	var w, h, n int
	fmt.Scan(&w, &h, &n)

	minx, miny := 0, 0
	maxx, maxy := w, h
	for i := 0; i < n; i++ {
		var x, y, a int
		fmt.Scan(&x, &y, &a)
		switch a {
		case 1:
			if x > minx {
				minx = x
			}
		case 2:
			if x < maxx {
				maxx = x
			}
		case 3:
			if y > miny {
				miny = y
			}
		case 4:
			if y < maxy {
				maxy = y
			}
		}
	}

	s := 0
	if maxx > minx && maxy > miny {
		s = (maxx - minx) * (maxy - miny)
	}

	fmt.Println(s)
}


Measured memory_bytes: 512
#include<cstdio>

int K,S;
bool binary_search(int n);

int main(){
	scanf("%d %d",&K,&S);
	int cnt = 0;
	for(int i=0;i<=K;i++){ 
		for(int j =0;j<=K;j++){
			if(binary_search(S-i-j)) cnt++;
		}
	}
	
	printf("%d\n",cnt);
}

bool binary_search(int n){
	int l = 0,r = K+1;
	
	while(r - l >= 1){
		int i = (r + l) / 2;
//		printf("%d\n",i,n);
		if(n == i) return true;
		else if(n > i) l = i + 1;
		else r = i;
	}
	
	return false;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	long double a, b; cin>>a>>b;
  cout<<(ll)(a*b)<<endl;
    return 0;
}


Measured memory_bytes: 3684
//g++ -std=gnu++14 a.cpp

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
#include <stdio.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

ll tansaku(vector<ll> &v, ll x){
  ll ok = 0;
  ll ng = v.size();
  while(ng-ok > 1){
    if(v[(ok+ng)/2] <= x)ok = (ok+ng)/2;
    else ng = (ok+ng)/2;
  }
  return ok;
}

int main(){
  ll N,M,K;
  cin >> N >> M >> K;
  vector<ll> A(N),B(M);
  rep(i,N)cin >> A[i];
  rep(i,M)cin >> B[i];

  ll sum = 0;
  ll cnt = 0;
  int i = 0;
  int j = 0;

  vector<ll> sumA(N+1,0);
  vector<ll> sumB(M+1,0);
  ll suma = 0;
  ll sumb = 0;
  for(int i = 1;i <= N;i++){
    suma += A[i-1];
    sumA[i] = suma;
  }
  for(int i = 1;i <= M;i++){
    sumb += B[i-1];
    sumB[i] = sumb;
  }

  ll ans = 0;

  rep(i,N+1){
    ll s = sumA[i];
    if(K-s >= 0){
      ll j = tansaku(sumB,K-s);
      if(i+j > ans){
        //cout  << i << j << endl;
        ans = i+j;
      }
    }

  }

  cout << ans << endl;

}


Measured memory_bytes: 9600
import java.io.*;
import java.util.ArrayList;
public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
		String str=input.readLine();
		int n=Integer.parseInt(str);
		ArrayList<String> list=new ArrayList<String>();
		for(int i=0;i<n;i++){
			list.add(input.readLine());
		}
		for(int i=1;i<14;i++){
			if(list.contains("S "+i)==false)
			System.out.println("S"+" "+i);
			}
		
		for(int i=1;i<14;i++){
			if(list.contains("H "+i)==false)
			System.out.println("H"+" "+i);
		}
		for(int i=1;i<14;i++){
			if(list.contains("C "+i)==false)
			System.out.println("C"+" "+i);
		}
		for(int i=1;i<14;i++){
			if(list.contains("D "+i)==false)
			System.out.println("D"+" "+i);
		}
	}
}

Measured memory_bytes: 24256
#include<iostream>
#include<algorithm>
#include<vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main()
{
    string s;
    int n,m;
    cin >> n >> s >> m;
    if(s == "+")
    {
        cout << n + m;
    }
    else
    {
        cout << n - m;
    }
}


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

#include "atcoder/dsu.hpp"

#define LOG(FMT...) fprintf(stderr, FMT)

#define fir first
#define sec second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

ostream& operator<<(ostream& os, const pair<char, int>& unit) {
  return os << unit.first << "^" << unit.second;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int main() {
#ifdef ELEGIA
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, q;
  cin >> n >> q;
  atcoder::dsu dsu(n);
  while (q--) {
    int t, u, v;
    cin >> t >> u >> v;
    if (t == 0) dsu.merge(u, v);
    else cout << dsu.same(u, v) << '\n';
  }

#ifdef ELEGIA
  LOG("Time: %dms\n", int ((clock()
      -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}



Measured memory_bytes: 3916
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a,x=0,y=1,z=0;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a&1) x++;
        else if(a%4==0) y++;
        else z++;
    }

    if(z) x++;
    if(y>=x) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
return 0;
}


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

using namespace std;

int N, M;
vector<int> SconeData;
set<int> DpScone;

void solve() {
	int sum, maxScone;
	set<int>::iterator it;

	sum = 0;
	for (int i = 0; i < N; ++i) {
		sum += SconeData[i] % M;
		SconeData[i] = sum%M;
	}

	maxScone = 0;
	for (int i = 0; i < N; ++i) {
		it = DpScone.upper_bound(SconeData[i]);
		if (it != DpScone.end()) {
			maxScone = max(maxScone, (SconeData[i] - *it + M) % M);
		}
		else {
			maxScone = max(maxScone, SconeData[i]);
		}
		DpScone.insert(SconeData[i]);
	}
	
	cout << maxScone << endl;
}

int main() {
	int num;

	while (cin >> N >> M, N) {
		SconeData.clear();
		DpScone.clear();
		for (int i = 0; i < N; ++i) {
			cin >> num;
			SconeData.push_back(num);
		}
		solve();
	}
	
	return 0;
}



Measured memory_bytes: 4236
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
typedef long long ll;
const int MAX = 999999999;

int main(){
    int x, t;
    cin >> x >> t;

    cout << max(0, x-t) << endl;
}

Measured memory_bytes: 256