akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
 
#include <iostream>
#include <algorithm>
 
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <cstring>
#include <string>
#include <utility>
#include <array>
#include <complex>
#include <valarray>
 
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>
 
 
using namespace std;
#define int long long
 
typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;
 
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
 
const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll INFLL = 1LL<<62;
const double EPS = 1e-12;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;
 
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod
#define inside(y, x, h, w) (0 <= (y) && (y) < (h) && 0 <= (x) && (x) < (w)) ? true : false
 
int n;
pii hp[5005];
int dp[5005][5005];
 
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    rep(i, n) {
        int h, p;
        cin >> h >> p;
        hp[i].fi = h + p;
        hp[i].se = h;
    }
    sort(hp, hp + n);
    rep(i, n + 1)rep(j, n + 1) dp[i][j] = INFLL;
    rep(i, n + 1) dp[i][0] = 0;
    
    rep(i, n) {
        rep2(j, 1, n + 1) {
            dp[i + 1][j] = dp[i][j];
            if (hp[i].se >= dp[i][j - 1]) {
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - 1] + hp[i].fi - hp[i].se);
            }
        }
    }
    int ans = 0;
    rep(j, n + 1){
        if (dp[n][j] != INFLL) ans = j;
    }
    cout << ans << endl;
}

Measured memory_bytes: 195840
<?php
$n = intval(trim(fgets(STDIN)));
fscanf(STDIN,"%d %d", $t, $a);
$mt = explode(" ", fgets(STDIN));
$dif = [];
$m = 0;

for($i = 0; $i <= $n-1; $i++) {
  $dif[$i] = abs($a - ($t - $mt[$i] * 0.006));
 }
$m = array_search(min($dif), $dif) + 1;
echo $m."\n";
?>

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

public class Main {
	public static void main(String args[]) throws IOException {
		// 2020/2/4 No.148
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int a = Integer.parseInt(br.readLine());
		int b = Integer.parseInt(br.readLine());
		int x = 1 ^ 2 ^ 3;
        x ^= a;
        x ^= b;

        System.out.println(x);

	}
}

Measured memory_bytes: 21076
# input
N, M = map(int, input().split())
Cake = [list(map(int, input().split())) for i in range(N)]

Cake_sum = [0 for i in range(N)]

# sum(x_i), sum(y_i), sum(z_i)の正負で8通りに場合分け
# x_i >= 0, y_i >= 0, z_i >= 0
ans1 =  0
for i in range(N):
    Cake_sum[i] = Cake[i][0] + Cake[i][1] + Cake[i][2]

Cake_sum_sorted = sorted(Cake_sum, reverse = True) 

for j in range(M):
    ans1 += Cake_sum_sorted[j]

ans2 = 0
# x_i < 0, y_i >= 0, z_i >= 0
for i in range(N):
    Cake_sum[i] = -Cake[i][0] + Cake[i][1] + Cake[i][2]

Cake_sum_sorted = sorted(Cake_sum, reverse = True) 

for j in range(M):
    ans2 += Cake_sum_sorted[j]

ans3 = 0
# x_i >= 0, y_i < 0, z_i >= 0
for i in range(N):
    Cake_sum[i] = Cake[i][0] - Cake[i][1] + Cake[i][2]

Cake_sum_sorted = sorted(Cake_sum, reverse = True) 

for j in range(M):
    ans3 += Cake_sum_sorted[j]

ans4 = 0
# x_i >= 0, y_i >= 0, z_i < 0
for i in range(N):
    Cake_sum[i] = Cake[i][0] + Cake[i][1] - Cake[i][2]

Cake_sum_sorted = sorted(Cake_sum, reverse = True) 

for j in range(M):
    ans4 += Cake_sum_sorted[j]

ans5 = 0
# x_i < 0, y_i < 0, z_i >= 0
for i in range(N):
    Cake_sum[i] = -Cake[i][0] - Cake[i][1] + Cake[i][2]

Cake_sum_sorted = sorted(Cake_sum, reverse = True) 

for j in range(M):
    ans5 += Cake_sum_sorted[j]

ans6 = 0
# x_i >= 0, y_i < 0, z_i < 0
for i in range(N):
    Cake_sum[i] = Cake[i][0] - Cake[i][1] - Cake[i][2]

Cake_sum_sorted = sorted(Cake_sum, reverse = True) 

for j in range(M):
    ans6 += Cake_sum_sorted[j]

ans7 = 0
# x_i < 0, y_i >= 0, z_i < 0
for i in range(N):
    Cake_sum[i] = -Cake[i][0] + Cake[i][1] - Cake[i][2]

Cake_sum_sorted = sorted(Cake_sum, reverse = True) 

for j in range(M):
    ans7 += Cake_sum_sorted[j]

ans8 = 0
# x_i < 0, y_i < 0, z_i < 0
for i in range(N):
    Cake_sum[i] = -Cake[i][0] - Cake[i][1] - Cake[i][2]

Cake_sum_sorted = sorted(Cake_sum, reverse = True) 

for j in range(M):
    ans8 += Cake_sum_sorted[j]

ans = max(ans1, ans2, ans3, ans4, ans5, ans6, ans7, ans8)

print(ans)

Measured memory_bytes: 3440
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
 
using namespace std;
 
 
int main(){
    int n;
    cin >> n;
 
    string s;
    cin >> s;   
 
    int len = s.size();
 
    vector<int> a(n);
    vector<long long int> num(3);
    num[0] = 0;
    num[1] = 0;
    num[2] = 0;
    
    
 
    for(int i=0;i<len;i++){
        if(s[i] == 'R') {
            a[i] = 0;
            num[0]++;
        }
        if(s[i] == 'G'){
            a[i] = 1;
            num[1]++;
        } 
        if(s[i] == 'B') {
            a[i] = 2;
            num[2]++;
        }
    }
    long long int ans = num[0]*num[1]*num[2];
 
    int k;
 
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            k = 2*j - i;
            if(k < n){
                if(a[i] == a[j] || a[i] == a[k] || a[j] == a[k]) continue;
                ans--;
            }
        }
    }
 
    cout << ans << endl;
 
} 

Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 217
// 44

using namespace std;



int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int n, i;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n;

    vector <int> arr(n + 1);
    for(i = 1; i <= n; i++) {
        cin >> arr[i];
    }

    sort(next(arr.begin()), arr.end());

    vector < pair <int, int> > sol;

    if(arr[n] <= 0) {
        for(i = 1; i < n; i++) {
            sol.push_back({arr[n], arr[i]});
            arr[n] -= arr[i];
        }
    }
    else if(arr[1] >= 0) {
        for(i = 2; i < n; i++) {
            sol.push_back({arr[1], arr[i]});
            arr[1] -= arr[i];
        }
        sol.push_back({arr[n], arr[1]});
        arr[n] -= arr[1];
    }
    else {
        for(i = 2; i < n; i++) {
            if(arr[i] > 0) {
                sol.push_back({arr[1], arr[i]});
                arr[1] -= arr[i];
            }
        }
        for(i = 1; i < n; i++) {
            if(arr[i] <= 0) {
                sol.push_back({arr[n], arr[i]});
                arr[n] -= arr[i];
            }
        }
    }

    cout << arr[n] << "\n";

    for(auto it : sol) {
        cout << it.first << " " << it.second << "\n";
    }


    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef vi poly;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int mod=998244353;
namespace Poly{
	const int N=(1<<20)+5,g=3;
	inline int power(int x,int p){
		int res=1;
		for(;p;p>>=1,x=(ll)x*x%mod)
			if(p&1)res=(ll)res*x%mod;
		return res;
	}
	void dft(poly &A,int n){
		static ull W[N<<1],*H[30],*las=W,mx=0;
		for(;mx<n;mx++){
			H[mx]=las;ull w=1,wn=power(g,(mod-1)>>(mx+1));
			REP(i,1<<mx)*las++=w,w=w*wn%mod;
		}
		static ull a[N];A.resize(1<<n);
		for(int i=0,j=0;i<(1<<n);++i){
			a[i]=A[j];
			for(int k=1<<(n-1);(j^=k)<k;k>>=1);
		}
		for(int k=0,d=1;k<n;k++,d<<=1)
			for(int i=0;i<(1<<n);i+=d<<1){
				ull *l=a+i,*r=a+i+d,*w=H[k],t;
				for(int j=0;j<d;++j,++l,++r){
					t=(*w++)*(*r)%mod;
					*r=*l+mod-t,*l+=t;
				}
			}
		REP(i,1<<n)A[i]=a[i]%mod;
	}
	void idft(poly &a,int n){
		a.resize(1<<n);
		reverse(a.begin()+1,a.end());
		dft(a,n);
		int inv=power(1<<n,mod-2);
		REP(i,1<<n)a[i]=(ll)a[i]*inv%mod;
	}
	poly mul(poly a,poly b){
		int aim=(a.size()+b.size()),n=1;
		while((1<<n)<=aim)n++;
		dft(a,n),dft(b,n);
		REP(i,1<<n)a[i]=(ll)a[i]*b[i]%mod;
		return idft(a,n),a.resize(aim),a;
	}
}

const int N=205,M=8005;
int fac[M],rev[M],f[N][M],n,m;
void init(int n){
	fac[0]=1;
	rep(i,1,n)fac[i]=(ll)fac[i-1]*i%mod;
	rev[n]=Poly::power(fac[n],mod-2);
	per(i,n,1)rev[i-1]=(ll)rev[i]*i%mod;
}

poly A,B,C;

int main(){
	read(m),read(n),init(m+2);
	rep(i,0,m)f[n+1][i]=(ll)fac[m]*rev[i]%mod*rev[m-i]%mod;
	A.resize(m+1),B.resize(m+1);
	per(i,n,1){
		rep(j,1,m){
			A[j]=(ll)fac[j+2]*f[i+1][j]%mod;
			B[m-j]=rev[j+2];
		}
		C=Poly::mul(A,B);
		rep(j,0,m)
			f[i][j]=((ll)C[m+j]*rev[j]
				   +((ll)j*(j+1)/2+1)%mod*f[i+1][j])%mod;
	}
	printf("%d\n",f[1][0]);
	return 0;
}

Measured memory_bytes: 10760
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;


int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (c > min(a, b) && c < max(a, b))
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 256
N = int(input())
U = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(M)]

opened = False
for T_i in T:
    if T_i in U:
        if opened == True:
            print('Closed by ' + T_i)
            opened = False
        else:
            print('Opened by ' + T_i)
            opened = True
    else:
        print('Unknown ' + T_i)


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


int main() {

    int a, b;
    cin >> a >> b;
    cout << 6 - (a+b) << endl;
    return 0;
}

Measured memory_bytes: 256
//...Bismillahir Rahmanir Rahim...
// Code by    Asad Bin Saber

#include <bits/stdc++.h>

using namespace std;

// typedefs...
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;

// constants...
const double PI = acos(-1);
const int Mod = 1e9+7; // 998244353;
const int MXS = 2e5+5;
const int MXI = 1e9+5;
const ll MXL = 1e15+5;
const int INF = 1e5+5;

// defines...
#define MP make_pair
#define PB push_back
#define fi first
#define se second
#define si(a) scanf("%d", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define siii(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sl(a) scanf("%lld", &a)
#define sll(a, b) scanf("%lld%lld", &a, &b)
#define slll(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

// chess moves...
// int dx[] = {+0, +0, -1, +1}; ///Up-down, Left-Right
// int dy[] = {+1, -1, +0, +0};
// int dx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's Move
// int dy[] = {-1,+1,+0,+0,+1,+1,-1,-1};
// int dx[] = {-2, -2, -1, -1,  1,  1,  2,  2}; ///Knight's Move
// int dy[] = {-1,  1, -2,  2, -2,  2, -1,  1};

// structs...
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
}; 

// functions...
ll gcd(ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
ll lcm(ll a, ll b)
{
    return (a/gcd(a, b)*b);
}
ll comb(ll a, ll b, ll M)
{
    ll x = max(a-b, b), ans=1;

    for(ll K=a, L=1; K>=x+1; K--, L++){
        ans *= K;
        ans /= L;
    }

    return ans % M;
}


void task()
{
    //code here...
    
    int n, ans, mn = MXI;
    
    cin >> n;
    int ara[n];
    
    for(int K=0; K<n; K++) cin >> ara[K];
    ans = n;
    
    for(int K=0; K<n; K++){
		mn = min(mn, ara[K]);
		
		if(mn<ara[K]) ans--;
	}
	
	cout << ans << "\n";
}


int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(0);
	
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    task();

    return 0;
}



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

typedef long long ll;

ll N;

bool check() {
  for (ll i = 1; i <= 9; ++i)
    for (ll j = 1; j <= 9; ++j)
      if (i * j == N) return true;
  return false;
}
int main() {
  cin >> N;
  cout << (check() ? "Yes" : "No") << endl;
  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;

int main(){
    // 制約見て！！！デカかったらlong longにすること！
    string s,t;
    cin >>s>>t;

    rep(i,t.size()){
        if(s==t){
            cout << "Yes"<<endl;
            return 0;
        }
        char tail = s[s.size()-1];
        for(int j = s.size()-1;j>0;j--){
            s[j] = s[j-1];
        }
        s[0] = tail;
    }

    cout << "No"<<endl;
}

Measured memory_bytes: 3600
import java.util.Scanner;
public class Main {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int K=sc.nextInt();
		int N=(sc.nextInt());
		int A[]=new int[N];
		int max=0;
		int maxi=0;
		A[0]=sc.nextInt();
		for(int i=1;i<N;i++) {
			A[i]=sc.nextInt();
			if(max<A[i]-A[i-1]) {
				max=A[i]-A[i-1];
				maxi=i;
			}
		}
		if(K-(A[N-1]-A[0])>max) {
			maxi=0;
			max=K-(A[N-1]-A[0]);
		}
		System.out.println(K-max);
	}
}


Measured memory_bytes: 66380
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

int G[100][100];
bool vis[100];

void dfs(int v){
    vis[v]=1;
    REP(u,100){
        if(G[v][u] and !vis[u]) dfs(u);
    }
}

signed main()
{
    int N,M; cin>>N>>M;
    REP(i,M){
        int a,b; cin>>a>>b;
        a--; b--;
        G[a][b]=G[b][a]=1;
    }

    int ans=0;
    REP(i,N-1) for(int j=i+1;j<N;j++){
        if(G[i][j]){
            G[i][j]=G[j][i]=0;
            REP(k,N) vis[k]=0;

            int cnt=0;
            REP(k,N){
                if(!vis[k]){
                    cnt++;
                    dfs(k);
                }
            }
            if(cnt>1) ans++;

            G[i][j]=G[j][i]=1;
        }
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ulli unsigned long long int
#define what_is(x) cerr << #x << " is " << x << endl;
#define pi 2*acos(0.0)
#define F  first
#define S  second
#define endl '\n'
#define all(x) x.begin(),x.end()
using namespace std;
bool sortbysec(const pair<lli,lli> &a,
              const pair<lli,lli> &b)
{
    return (a.second < b.second);
}
lli modulo(string num, lli a)
{
    lli res = 0;
    for (lli i = 0; i < num.length(); i++)
         res = (res*10 + (int)num[i] - '0') %a;

    return res;
}

int main()
{
//cout.precision(9);
//cout.setf(ios::fixed,ios::floatfield);
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
	lli T=1;
    //cin>>T;
	while(T--)
	{
        lli n,i,r,j,z,k=0,ans=0;
        cin>>n>>k;
        vector<lli> h;
        lli dp[n];
        for(i=0;i<n;i++)
        {
            cin>>z;
            h.pb(z);
        }
        if(n==2)
        {
            cout<<h[1]-h[0]<<endl;
            return 0;
        }
        dp[0]=0;
        dp[1]=abs(h[1]-h[0]);
        for(i=2;i<n;i++)
        {
            j=i-1;
            dp[i]=dp[i-1]+abs(h[i]-h[i-1]);
            while(j>=0&&j>=i-k)
            {
                dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
                j--;
            }
        }
        cout<<dp[n-1]<<endl;
    }
}
/*
5
1 2 3 4 5
*/


Measured memory_bytes: 1908
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

int K;
int del[2050][2050];
void docolor2(int sx, int ex, int sy, int ey) {
	sx++, ex++, sy++, ey++;
	del[sx][sy]++;
	del[ex + 1][ey + 1]++;
	del[sx][ey + 1]--;
	del[ex + 1][sy]--;
}
void docolor(int sx, int ex, int sy, int ey) {
	sx %= 2*K;
	ex %= 2*K;
	if (ex < sx) ex += 2*K;
	sy %= 2*K;
	ey %= 2*K;
	if (ey < sy) ey += 2*K;

	vector <pii> Vx;
	vector <pii> Vy;
	if (ex < 2 * K) Vx.emplace_back(sx, ex);
	else {
		Vx.emplace_back(sx, 2 * K - 1);
		Vx.emplace_back(0, ex-2*K);
	}
	if (ey < 2 * K) Vy.emplace_back(sy, ey);
	else {
		Vy.emplace_back(sy, 2 * K - 1);
		Vy.emplace_back(0, ey-2*K);
	}
	for (auto it1 : Vx) for (auto it2 : Vy) docolor2(it1.first, it1.second, it2.first, it2.second);
}
int main() {
	int N, i, j;
	scanf("%d %d", &N, &K);
	while (N--) {
		vector <pii> Vx;
		vector <pii> Vy;

		int X, Y;
		char c[2];
		scanf("%d %d", &X, &Y);
		scanf("%s", c);

		if (c[0] == 'B') {
			docolor(X, X + K - 1, Y, Y + K - 1);
			docolor(X + K, X + 2 * K - 1, Y + K, Y + 2 * K - 1);
		}
		else {
			docolor(X, X + K - 1, Y + K, Y + 2 * K - 1);
			docolor(X + K, X + 2 * K - 1, Y, Y + K - 1);
		}
	}

	int mx = 0;
	for (i = 1; i <= 2 * K; i++) {
		for (j = 1; j <= 2 * K; j++) {
			del[i][j] += del[i - 1][j] + del[i][j - 1] - del[i - 1][j - 1];
			mx = max(mx, del[i][j]);
		}
	}
	return !printf("%d\n", mx);
}

Measured memory_bytes: 16640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);++i)
#define erep(i,j,n) for(int i=(j);i<=(n);++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	int n;
	cin >> n;
	vi a(n + 1);
	erep(i, 1, n) cin >> a[i];
	int cou = 0;
	rep(i, 1, n) {
		if (a[i] == i) {
			cou++;
			swap(a[i], a[i + 1]);
		}
	}
	if (a[n] == n) {
		cou++;
	}
	cout << cou << endl;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  if(n%10==3)
  {
	cout<<"bon";
  }
  else if(n%10==0 || n%10==1 || n%10==6 || n%10==8)
  {
    cout<<"pon";
  }
  else
  {
    cout<<"hon";
  }
  return 0;
}

Measured memory_bytes: 3132
// 5/28
// 2-5-4 ベルマンフォード
// bellman_ford.cppとは違い、ABC061-Dのような、
// 「特定の頂点の値が発散するかどうか」が解けるように改良したもの。
// https://atcoder.jp/contests/abc061/tasks/abc061_d
// ベルマンフォード は負の回路ができると発散すると言われるが、
// 厳密に言うと発散しない点もある。実際に発散するのは負の回路に含まれる頂点か、
// その回路からパスが引ける頂点のみ。

// 完全にC++で実装するとたぶんこんな感じ。
// https://ta7uw.hatenablog.com/entry/2019/12/31/201242

#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>;
const ll INF = LONG_MAX;

struct Edge {
    int from;
    int to;
    ll cost;
    Edge(int f, int t, ll c) : from(f), to(t), cost(c) { }
    bool operator<(const Edge& o) const {
        return cost < o.cost;
    }
};
using Graph = vector<Edge>;

vector<bool> negative;  // 個別の頂点が発散するかどうかを測定
vector<ll> dist;  // 個別の頂点までの最短距離を格納

// 負の回路があるかどうかを返す。
bool bellman_ford(int N, Graph& es, int s) {
    // 初期化
    dist.assign(N, INF);
    dist[s] = 0;
    negative.assign(N, false);

    bool have_negative_cycle = false;

    // 辺の緩和を反復
    rep(i, N) {
        for (auto e : es) {
            if (dist[e.from] != INF && dist[e.to] > dist[e.from] + e.cost) {
                dist[e.to] = dist[e.from] + e.cost;
                if (i == N - 1) {
                    negative[e.to] = true;
                    have_negative_cycle = true;
                }
            }
            if (negative[e.from]) {
                negative[e.to] = true;
                // ここの実装は甘いかもしれない。ABC061-DはAC通る。
                // https://ta7uw.hatenablog.com/entry/2019/12/31/201242
            }
        }
    }

    // 負の回路があるかどうかを返す。
    return have_negative_cycle;
}

// ABC061-Dによる実装サンプル
int main() {
    int N;  // 与えられた有向グラフの頂点の数
    int M;  // 同辺の数（辺の重みは負の場合がある）
    cin >> N >> M;

    vector<Edge> es;
    rep(i, M) {
        int a, b;
        ll c;
        cin >> a >> b >> c;
        a--; b--;
        es.push_back(Edge(a, b, -c));
    }

    bool have_negative_cycle = bellman_ford(N, es, 0);

    // if (d[0] == -1) cout << "inf" << endl;
    if (negative[N - 1]) cout << "inf" << endl;
    else cout << -dist[N - 1] << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] arg) {
		Scanner in = new Scanner(System.in);
		int case_ = 0;
		while (in.hasNext()) {
			int w = in.nextInt();
			if (w != 0) {
				System.out.print("Case ");
				System.out.print(++case_);
				System.out.println(":");
				int[] pack = new int[w + 1];
				int n = in.nextInt();
				int maxNum = 0;
				for (int j = 0; j < n; j++) {
					String[] a = in.next().split(",");
					int p = Integer.valueOf(a[0]);
					int pw = Integer.valueOf(a[1]);
					for (int i = w - pw; i >= 0; i--) {
						pack[i + pw] = Math.max(pack[i + pw], pack[i] + p);
						if (pack[maxNum] <= pack[i + pw]) {
							maxNum = i + pw;
						}
					}
				}
				System.out.println(pack[maxNum]);
				System.out.println(maxNum);
			}
		}
	}
}

Measured memory_bytes: 24212
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

int main(){
  int h,w;cin>>h>>w;
  int a[h][w];
  rep(i,h)rep(j,w) cin>>a[i][j];
  int n=0;
  vector<int> dx,dy;
  dx={1,0,-1,0};
  dy={0,1,0,-1};
  vector<int> v1,v2,v3,v4;
  
  
  
  rep(i,h){
    if(i%2==0){
    rep(j,w){
      if(a[i][j]%2==0) continue;
      rep(u,4){
        if(i+dx[u]>=0&&i+dx[u]<h&&j+dy[u]>=0&&j+dy[u]<w){
          if(a[i+dx[u]][j+dy[u]]%2!=0){
            a[i+dx[u]][j+dy[u]]++;
            a[i][j]--;
            v1.push_back(i+1);v2.push_back(j+1);
            v3.push_back(i+dx[u]+1);v4.push_back(j+dy[u]+1);
            n++;
            break;
          }
        }
      }
      if(a[i][j]%2==0) continue;
      a[i][j]--;
      if(j+1<w) {
        a[i][j+1]++;
        v1.push_back(i+1);v2.push_back(j+1);
        v3.push_back(i+1);v4.push_back(j+2);
        n++;
      }
      else if(i+1==h){
        continue;
      }
      else{
        a[i+1][j]++;
        v1.push_back(i+1);v2.push_back(j+1);
        v3.push_back(i+2);v4.push_back(j+1);
        n++;
      }
    }
    }
    else{
      rep(o,w){
        int j=w-1-o;
      if(a[i][j]%2==0) continue;
      rep(u,4){
        if(i+dx[u]>=0&&i+dx[u]<h&&j+dy[u]>=0&&j+dy[u]<w){
          if(a[i+dx[u]][j+dy[u]]%2!=0){
            a[i+dx[u]][j+dy[u]]++;
            a[i][j]--;
            v1.push_back(i+1);v2.push_back(j+1);
            v3.push_back(i+dx[u]+1);v4.push_back(j+dy[u]+1);
            n++;
            break;
          }
        }
      }
      if(a[i][j]%2==0) continue;
      a[i][j]--;
      if(j-1>=0) {
        a[i][j-1]++;
        v1.push_back(i+1);v2.push_back(j+1);
        v3.push_back(i+1);v4.push_back(j);
        n++;
      }
      else if(i+1==h){
        continue;
      }
      else{
        a[i+1][j]++;
        v1.push_back(i+1);v2.push_back(j+1);
        v3.push_back(i+2);v4.push_back(j+1);
        n++;
      }
      }
    }
  }
  
  cout<<n<<endl;
  rep(i,n){
    cout<<v1[i]<<' '<<v2[i]<<' '<<v3[i]<<' '<<v4[i]<<endl;
  }
}
      




Measured memory_bytes: 5092
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
    int a[3];
    scanf("%d%d%d",&a[0],&a[1],&a[2]);
    sort(a,a+3);
    if(a[0]==5&&a[1]==5&&a[2]==7)
        printf("YES");
    else
        printf("NO");
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int n;
vector<vector<int>> graph;
vector<int> v;
set<int> pathv;

bool dfs(int from, int parent) {
    for (int to : graph[from]) {
        if (to == n - 1) {
            if (from != 0) {
                v.push_back(from);
                pathv.insert(from);
            }
            return true;
        } else if (to != parent) {
            if (dfs(to, from)) {
                if (from != 0) {
                    v.push_back(from);
                    pathv.insert(from);
                }
                return true;
            }
        }
    }
    return false;
}

int count(int from, int parent) {
    int cnt = 1;
    for (int to : graph[from]) {
        if (pathv.count(to) || to == parent)
            continue;
        cnt += count(to, from);
    }
    return cnt;
}

int main() {
    cin >> n;
    graph = vector<vector<int>>(n);
    for (int i = 0; i < n - 1; ++i) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    dfs(0, -1);
    pathv.insert(0);
    pathv.insert(n - 1);
    int score = count(0, -1);
    for (int i = 1; i <= (v.size() + 1) / 2; ++i) {
        score += count(v[v.size() - i], -1);
    }
    if (score * 2 > n) {
        cout << "Fennec" << endl;
    } else {
        cout << "Snuke" << endl;
    }
    return 0;
}

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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define pll         pair<long,long>
#define vi          vector<int>
#define vll         vector<ll>
#define vii         vector<pii>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define f          first
#define s           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define mod        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rem(i,a,b)  for(int i=a;i>b;i--)
#define mp(a,b)     make_pair(a,b)



void solve(){
    ll n,a,b;
    cin>>n>>a>>b;
    ll ansl=b-1;
    ll ansr=n-a;
    ll ans=min(ansr,ansl);
    if((b-a)%2==0){
        ans=min(ans,(b-a)/2);
    }
    else{
        ll ans1=a+(b-a-1)/2;
        ll ans2=n-b+1+(n-(a+n-b+1))/2;
        ans=min(ans,min(ans1,ans2));
    }
    cout<<ans;

}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long t=1;
    //cin>>t;
    while(t--){

        solve();
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(input()) for i in range(N)]
dicta = {}
for i in A:
    if i not in dicta:
        dicta[i] = 1
    else:
        dicta[i] += 1
ans = 0
for v in dicta.values():
    if v%2 == 1:
        ans += 1
print(ans)

Measured memory_bytes: 16268
def z_algo(S):
    # Z-algoirhm  O(n)
    # Z[i] := S と S[i:] で prefix が何文字一致しているか
    # 検証: https://atcoder.jp/contests/arc055/submissions/14179788
    i, j, n = 1, 0, len(S)
    Z = [0] * n
    Z[0] = n
    while i < n:
        while i+j < n and S[j] == S[i+j]:
            j += 1
        if j == 0:
            i += 1
            continue
        Z[i] = j
        d = 1
        while i+d < n and d+Z[d] < j:
            Z[i+d] = Z[d]
            d += 1
        i += d
        j -= d
    return Z


N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_diff = []
a2 = A[-1]
for a in A:
    A_diff.append(a^a2)
    a2 = a
B_diff = []
b2 = B[-1]
for b in B:
    B_diff.append(b^b2)
    b2 = b
A_diff_2 = A_diff + A_diff[:-1]
Z = z_algo(A_diff_2)
A_diff_str = "_".join(map(str, A_diff_2))
B_diff_str = "_".join(map(str, B_diff))
idx = A_diff_str.find(B_diff_str)
if idx==-1:
    exit()
idx = A_diff_str[:idx].count("_")
Ans = []
b0 = B[-idx]
for i, (z, a, b) in enumerate(zip(Z, A, B)):
    if z >= N:
        Ans.append([(idx+i)%N, a^b0])
        # x = [idx, i, a, b, B[-idx]]
        # print(x)
Ans.sort()  # これいる？
for k, x in Ans:
    print(f"{k} {x}")


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

int main(void) {
  int N;
  cin >> N;
  vector<int> P(N);
  for (int i = 0; i < N; i++) {
    cin >> P[i];
  }
  int pre = P[0];
  int ans = 1;
  for (int i = 1; i < N; i++) {
    if (pre >= P[i]) {
      ans++;
    }
    pre = min(pre, P[i]);
  }
  cout << ans << endl;
  return 0;
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1e9+7;
const ll INF = 1LL << 60;


int main() {
    int n; cin >> n;
    if(n < 1200) cout << "ABC" << endl;
    else if(n < 2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;

    return 0;
}


Measured memory_bytes: 3548
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
 
class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        char[] s = Console.ReadLine().ToCharArray();
        int opening = 0, closing = 0;
        for (int i = 0; i < n; i++)
        {
            if (s[i] == '(') opening++;
            else if (s[i] == ')')
            {
                if (opening >= 1) opening--;
                else closing++;
            }
        }
        for (int i = 0; i < closing; i++)
        {
            Console.Write('(');
        }
        Console.Write(s);
        for (int i = 0; i < opening; i++)
        {
            Console.Write(')');
        }
        Console.WriteLine();
        // Console.Write(Enumerable.Repeat('(', closing));

        // string result = new string(Enumerable.Repeat('(', closing).ToArray())
        //               + s 
        //               + new string(Enumerable.Repeat(')', opening).ToArray());
        // Console.WriteLine(result);
    }
}


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

typedef long long ll;
using namespace std;

const ll MOD = 1e9+7;
const ll INF = 1e18+7;

signed main(){
	string s;
	cin >> s;
	int n = s.size();
	vector<vector<int>> dp(2 * n + 1, vector<int>(2 * n + 1, 0));
	vector<int> v(n);
	for(int i = 0; i < n; ++i)
		v[i] = s[i] - '0';
	vector<int> rui(n + 1, 0);
	for(int i = 0; i < n; ++i)
		rui[i + 1] = rui[i] + v[i];
	dp[0][0] = 1;
	for(int i = 0; i < 2 * n; ++i){
		for(int j = 0; j <= 2 * n; ++j){
			if(!dp[i][j])
				continue;
			if(rui[min(n, i + 1)] > j)
				dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % 998244353;
			if(2 * min(n, i + 1) - rui[min(n, i + 1)] > i - j)
				dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % 998244353;
		}
	}
	cout << dp.back()[rui.back()] << endl;
}


Measured memory_bytes: 62976
#include<iostream>
#include<algorithm>
using namespace std;
const long INF = 1e9+1;
int main(){
    int n;
    cin >> n;
    long a[n];
    for(int i = 0;i<n;i++){
        cin >> a[i];
    }
    sort(a,a+n,greater<long>());
    long tem = INF;
    long ans;
    for(int i = 1;i<n;i++){
        if(tem > abs(a[i]-a[0]/2)){
            tem = abs(a[i]-a[0]/2);
            ans = a[i];
        }
    }
    cout << a[0] <<  " " << ans << endl;
}

Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
#define INF 1<<20
using namespace std;

int main(){
  int n,m,s,e,c;

  while(true){
    cin >> n >> m;
    if(n+m == 0)break;
    int lst[n+1][n+1];
    int Graph[n+1][n+1];
    for(int i=0;i<n+1;i++)for(int j=0;j<n+1;j++){
	lst[j][i] = i==j?0:INF;
	Graph[i][j] = INF;
      }
    for(int i=0;i<m;i++){
      cin >> s >> e >> c;
      Graph[s][e] = Graph[e][s] = lst[s][e] = lst[e][s] = c;
    }

    for(int k=1;k<=n;k++)for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)lst[i][j] = min(lst[i][j],lst[i][k]+lst[k][j]);
    int cost = lst[1][n];
    for(int k=1;k<=n;k++){
      for(int i=1;i<=n;i++){
	for(int j=1;j<=n;j++){
	  if(Graph[k][i] != INF &&  Graph[k][j] != INF){	  
	    cost = min(cost,lst[1][i]+lst[j][n]);
	  }
	}
      }
    }
    cout <<  cost << endl;
  }
  return 0;
}

Measured memory_bytes: 1240
import sys

class Node():
    def __init__(self,key):
        self.key = key
        self.left = None
        self.right = None

def insert(t, z):
    y = None
    x = t
    while x is not None:
        y = x
        if z.key < x.key:
            x = x.left
        else:
            x = x.right

    if y is None:
        return z
    else:
        if z.key < y.key:
            y.left = z
        else:
            y.right = z
        return t

def in_order(t):
    s = ""
    l = []
    curr = t
    while True:
        while curr is not None:
            l.append(curr)
            curr = curr.left
        if curr is None and len(l) == 0:
            break
        else:
            curr = l.pop()
            s += " " + str(curr.key)
            curr = curr.right
    return s

def pre_order(t):
    s = ""
    l = []
    curr = t
    while True:
        while curr is not None:
            s += " " + str(curr.key)
            l.append(curr)
            curr = curr.left
        if curr is None and len(l) == 0:
            break
        else:
            curr = l.pop()
            curr = curr.right
    return s

t = None
n = sys.stdin.readline()
lines = sys.stdin.readlines()
for line in lines:
    com = line.split()
    if com[0] == "insert":
        t = insert(t, Node(int(com[1])))
    else:
        print(in_order(t))
        print(pre_order(t))

Measured memory_bytes: 152016
ope = {"+": lambda a, b: b + a,
	   "-": lambda a, b: b - a,
	   "*": lambda a, b: b * a}
stack = []

for c in input().split():
	if c in ope:
		stack.append(ope[c](stack.pop(), stack.pop()))
	else:
		stack.append(int(c))

print(stack[-1])


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORS(i,a,b) for(int i=a+1;i<=b;i++)
#define REP(i,N) FOR(i,0,N)
#define REPS(i,N) FORS(i,0,N)
#define debug(x) cout<<#x<<"="<<x<<endl
#define debugarr(arr,N,M){REP(i,N){REP(j,M){if(arr[i][j]==INF)printf(" INF");\
	else printf(" %3d",arr[i][j]);} cout<<endl;}}
#define pb push_back
#define pob pop_back
typedef long long ll;
const int INF=100000000;
//--------------------------------------//

int n,k;
bool d[10];
int main(){
	cin>>n>>k;
	int _n=n;
	REP(i,10) d[i]=true;
	REP(i,k){
		int a;
		cin>>a;
		d[a]=false;
	}
	int ans=0;
	int s=3;
	if(n<1000) s=2;
	if(n<100) s=1;
	if(n<10) s=0;
	for(int j=s;j>=0;j--){
		int b=1;
		REP(q,j)b*=10;
		FOR(i,n/b,10){
			if(d[i]){
				if((n/b)!=i) n=0; 
				else n-=(n/b)*b;
				ans+=i*b;
				break;
			}
		}
	}
	if(_n>ans){
		ans=0;
		REP(i,s+1){
			int b=1;
			REP(q,i)b*=10;
			REP(j,10){
				if(d[j]){
					ans+=j*b;
					break;
				}
			}
		}
		int b=1;
		REP(q,s+1)b*=10;
		FOR(i,1,10){
			if(d[i]){
				ans+=i*b;
				break;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
// typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

// llong POW(llong a, llong b){
//   if(b == 0) return 1;
//   else{
//     if(b%2 == 0) return POW(a * a % MOD, b / 2) % MOD;
//     else return a * POW(a * a % MOD, b / 2) % MOD;
//   }
// }

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int sum = a + b + c;
  if(max(a, max(b, c)) == sum-max(a, max(b, c))) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  int count=0;
  for(int i=0;i<n;i++){
    count+=a[i];
  }
  int ans=count;
  for(int i=0;i<n;i++){
    count-=2*a[i];
    ans=min(ans,abs(count));
  }
  cout << ans << endl;
}
    

Measured memory_bytes: 256
#include <array>
#include <utility>
#include <iostream>
#include <algorithm>

using std::cin;
using std::cout;
using std::endl;
using std::pair;
using std::array;
using std::for_each;

using t_t = struct _t {int h,m,s;}; // type of time
using e_t = pair<t_t,t_t>; // type of employee

t_t operator-(t_t t1,t_t t2) {
	t_t dt; // delta time
	int b = 0; // borrow
	dt.s = t1.s - t2.s;
	if (dt.s < 0) {
		dt.s += 60;
		b = 1;
	}
	dt.m = t1.m - t2.m - b;
	if (dt.m < 0) {
		dt.m += 60;
		b = 1;
	} else {
		b = 0;
	}
	dt.h = t1.h - t2.h - b;
	return dt;
}

int main() {
	array<e_t,3> es;
	for_each(es.begin(),es.end(),[](e_t &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
	for (auto e : es) {
		t_t dt = e.second - e.first;
		cout << dt.h << " " << dt.m << " " << dt.s << endl;
	}
}

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

int main() {
  string s,t ;
  int c = 0;
  cin >> s >> t;
  for(int i=0; i < s.size() ; i++){
    if(s.at(i)==t.at(i)) c++;
  }
  cout << s.size() - c ;
}


Measured memory_bytes: 3860
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int n;
  cin>>n;
  int p[100];
  for(int i=0;i<n;i++){
    cin>>p[i];
  }
  int result=0;
  for(int l=0;l+2<n;l++){
    if((p[l]<p[l+1]&&p[l+1]<p[l+2])||(p[l]>p[l+1]&&p[l+1]>p[l+2])){
      result++;
    }
  }
  cout<<result<<endl;

  return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<algorithm>

using namespace std;

typedef long long ll;

int const N = 61;
int const MOD = 1e9 + 7;


ll n;
int was[N][2][2][2], dp[N][2][2][2];

int getBit(ll v, int id){
	return (v & (1LL << id) ? 1 : 0);
}

void add(int &a, int b){
	a += b;
	if(a >= MOD){
		a -= MOD;
	}
}

void read(){
	scanf("%lld",&n);
}

int rec(int p, int wu, int wvl, int wve){
	if(p == -1){
		return 1;
	}
	if(was[p][wu][wvl][wve]){
		return dp[p][wu][wvl][wve];
	}
	was[p][wu][wvl][wve] = 1;
	int ret = 0;
	int nbit = getBit(n, p);
	for(int u=0;u<=max(wu, nbit);++u){
		int newWu = max(wu, nbit - u);
		int newWvl, newWve;
		if(u == 1){
			//1 + 0
			if(wvl == 0 && u > nbit){
				continue;
			}
			if(wvl == 0 && u == nbit){
				add(ret, rec(p-1, newWu, 0, 0));
				continue;
			}

			newWvl = 1;
			newWve = wve;
			if(u <= nbit){
				newWve = 1;
			}
			add(ret, rec(p-1, newWu, newWvl, newWve));
		}else{
			//0 + 0
			newWvl = wvl;
			if(wvl){
				newWve = 1;	
			}else{
				if(u < nbit){
					newWvl = 1;
				}
				newWve = 0;
			}
			add(ret, rec(p-1, newWu, newWvl, newWve));

			//1 + 1
			newWvl = wvl;
			if(wvl){
				if(wve == 1){
					newWve = 1;
				}else{
					if(u == nbit){
						newWvl = 0;
					}
					newWve = 0;
				}
			}else{
				continue;
			}

			add(ret, rec(p-1, newWu, newWvl, newWve));
		}
	}


	return dp[p][wu][wvl][wve] = ret;
}

void solve(){
	printf("%d\n",rec(N-1, 0, 0, 0));
}

void prepare(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
}

int main(){
	prepare();
	read();
	solve();




	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

#a b c a
# 1 3 4 

N = list(map(int, input().split()))

a = N[0] + N[1]
b = N[1] + N[2]
c = N[2] + N[0]

ans = min(min(a, b), c)

print(ans)


Measured memory_bytes: 2940
// Aizu Vol-5 0588: Simple Calculator
// 2017.8.30 bal4u@uu

#include <stdio.h>

int main()
{
	int a, b;
	char s[30];

	scanf("%d", &a);
	while (1) {
		scanf("%s", s);
		if (*s == '=') break; 
		scanf("%d", &b);
		if      (*s == '+') a += b;
		else if (*s == '-') a -= b;
		else if (*s == '*') a *= b;
		else if (*s == '/') a /= b;
	}
	printf("%d\n", a);
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

const int C_MAX = 26;

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,Q; cin>>N>>Q;
    string S; cin>>S;
    vector<char> t(Q);
    vi mv(Q);
    rep(i,Q){
        char d; cin>>t[i]>>d;
        mv[i] = (d=='L')?-1:1;
    }
    int l=-1,r=N;
    while(r-l>1){
        int c = (l+r)/2;
        int now = c;
        char nc = S[now];
        bool ng=false;
        rep(i,Q){
            if (nc==t[i]){
                now+=mv[i];
                if (now<0) ng=true;
                if (now<0 || now>=N) break;
                nc = S[now];
            }
        }
        (ng)?l=c:r=c;
    }
    int left = r;
    l=-1,r=N;
    while(r-l>1){
        int c = (l+r)/2;
        int now = c;
        char nc = S[now];
        bool ng=false;
        rep(i,Q){
            if (nc==t[i]){
                now+=mv[i];
                if (now>=N) ng=true;
                if (now<0 || now>=N) break;
                nc = S[now];
            }
        }
        (ng)?r=c:l=c;
    }
    int right = r;
    cout<<right-left<<endl;
    return 0;
}


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

const int N = (int)5005, mod = 1004535809;

int n, k;
int a[N];
int dp[2 * N];

int main() {
    cin >> n >> k;
    for (int i = 0; i < n; ++i) cin >> a[i];
    dp[0] = 1;

    for(int i = 0; i < n; i++) {
        if(a[i] >= k) continue;
        for(int j = k - a[i]; j >= 0; j--) dp[j+a[i]] += dp[j], dp[j+a[i]] %= mod;
    }
    int res = 0;
    for(int i = 0; i < n; i++) {
        if(a[i] >= k) {
            res ++;
            continue;
        }
        for(int j = 0; j <= k - a[i]; j++) dp[j+a[i]] -= dp[j], dp[j+a[i]] = (dp[j+a[i]] + mod) % mod;
        int cnt = 0;
        for(int j = k - a[i]; j < k; j++) if(dp[j] != 0) cnt++;
        if(cnt > 0) res ++;
        for(int j = k - a[i]; j >= 0; j--) dp[j+a[i]] += dp[j], dp[j+a[i]] %= mod;
    }
    cout << n - res << endl;
}

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

using namespace std;

int l_r_rule(string s){
  int len=s.length();
  int res=0;
  char ope='+';
  for(int i=0;i<len;i++){
    if(i%2==0){//??°???
      if(ope=='+') res+=(s[i]-48);
      else res*=(s[i]-48);
    }
    else ope=s[i];
  }
  return res;
}

int m_f_rule(string s){
  s+='+';
  int len=s.length();
  std::vector<int> v;
  int tmp=-1;
  for(int i=0;i<len/2;i++){
    if(s[i*2+1]=='+'){
      if(tmp==-1) v.push_back((s[i*2]-48));
      else v.push_back(tmp);
      tmp=-1;
    }
    else{
      if(tmp==-1) tmp=(s[i*2]-48);
      //cout <<tmp<<endl;
      tmp*=(s[i*2+2]-48);
      //cout <<tmp<<endl;
    }
  }
  int vlen=v.size();
  int res=0;
  for(int i=0;i<vlen;i++) res+=v[i];
  return res;
}

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

  string s;int n;
  cin>>s>>n;
  int mans=m_f_rule(s);
  int lans=l_r_rule(s);
  // cout << mans<<" "<<lans<<endl;
  if(mans==n&&lans==n) cout <<"U"<<endl;
  else if(mans==n) cout <<"M"<<endl;
  else if(lans==n) cout << "L"<<endl;
  else cout <<"I"<<endl;
}

Measured memory_bytes: 3208
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

int main(){
   int n,k,x,y;
   cin>>n>>k>>x>>y;
   int ans=k*x;
   if(n>k)ans+=(n-k)*y;
   else ans+=(n-k)*x;
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc108/tasks/abc108_b

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

int main()
{
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    int dy = y2 - y1;
    int dx = x2 - x1;

    int x3, y3, x4, y4;
    x3 = x2 - dy;
    y3 = y2 + dx;
    x4 = x3 - dx;
    y4 = y3 - dy;

    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
    return 0;
}

// 4 3
// 1 2


Measured memory_bytes: 3564
ans = 0
r,g,b,n = map(int,input().split())
for i in range(n//r+1):
	targ = i*r
	for j in range(n//g+1):
		if (n-i*r-j*g) % b == 0 and (n-i*r-j*g) >= 0:
			ans += 1
print(ans)

Measured memory_bytes: 66888
N = int(input())
H = list(map(int, input().split()))

cnt = 0
res = 0
for i in range(1,len(H)):
    if H[i-1] >= H[i]:
        cnt += 1
    else:
        if cnt > res:
            res = cnt
        cnt = 0
print(max(res,cnt))

Measured memory_bytes: 14252
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            long n = long.Parse(Console.ReadLine());
            long[] a = Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();
            double denominator = 0;
            foreach (long item in a)
            {
                denominator += (double) 1 / item;
            }
            Console.WriteLine(1 / denominator);
            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13396