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

int main()
{
  string s1,s2;
  cin>>s1>>s2;
  int n,m;
  n=s1.length();
  m=s2.length();
  string ans="";
  int lcs[3005][3005]={0},b1=0,ml=INT_MIN;
  for(int i=1;i<=n;i++)
  {
    for(int j=1;j<=m;j++)
    {
      if(s1[i-1]==s2[j-1])
      {
         lcs[i][j]=1+lcs[i-1][j-1];
      }
      else
      {
        lcs[i][j]=max(lcs[i-1][j],lcs[i][j-1]);
      }
      ml=max(ml,lcs[i][j]);
    }
  }  
  int i=n,j=m;
  while(i>0 && j>0)
  {
    if(lcs[i][j]==ml)
    {
      if(s1[i-1]==s2[j-1])
      {
        ans+=s1[i-1];
        ml--;
        i--;
        j--;
      }
      else
      {
        if(lcs[i-1][j]>lcs[i][j-1])
          i--;
        else
          j--;
      }
    }   
  }  
  reverse(ans.begin(),ans.end());
  cout<<ans<<"\n";
  return 0;
}

Measured memory_bytes: 38904
#include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#define rep(i,x,y) for(int i=x; i<=y; ++i)

using namespace std;
const int N=100005;
int n,h[N],cnt,id[N],S[N],hg[65536],mx[65536],ans;
struct edge{int v,n;} e[N<<1];

int getint()
{
	char ch;
	while(!isdigit(ch=getchar()));
	int x=ch-48;
	while(isdigit(ch=getchar())) x=x*10+ch-48;
	return x;
}

void addedge(int u,int v)
{
	e[cnt]=(edge){v,h[u]},h[u]=cnt++;
	e[cnt]=(edge){u,h[v]},h[v]=cnt++;
}

int high(int s)
{
	if(!s) return -1;
	if(!(s&65535)) return 16+hg[s>>16];
	return hg[s&65535];
}

int mex(int s)
{
	if((s&65535)==65535) return 16+mx[s>>16];
	return mx[s&65535];
}

void dfs(int x,int fa)
{
	int s0=0,s1=0;
	for(int i=h[x]; i!=-1; i=e[i].n)
		if(e[i].v!=fa)
		{
			dfs(e[i].v,x);
			s0|=S[e[i].v]&s1,s1|=S[e[i].v];
		}
	int p=high(s0);
	id[x]=mex(s1>>p+1)+p+1;
	S[x]=(s1>>id[x]<<id[x])|(1<<id[x]);
}

int main()
{
	n=getint();
	memset(h,-1,sizeof(h));
	rep(i,0,15) hg[1<<i]=i;
	rep(i,1,65535) if(!hg[i]) hg[i]=hg[i^(i&-i)];
	rep(i,0,65535) rep(j,0,15) if(!(i&(1<<j))) {mx[i]=j; break;}
	rep(i,1,n-1) addedge(getint(),getint());
	dfs(1,0);
	rep(i,1,n) ans=max(ans,id[i]);
	printf("%d\n",ans);
	return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const int MOD = 1e9 + 7;

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

    int n;cin>>n;
    set<int> st;
    st.insert(0);st.insert(n+1);
    vector<int> a(n+1);
    for(int i=1;i<=n;i++){
        int p;cin>>p;
        a[p]=i;
    }
    ll res=0;
    for(int i=1;i<=n;i++){
        int idx=a[i];
        st.insert(idx);
        auto itr=st.find(idx);//itr--; cout<<*itr<<endl;
        itr--;ll l=*(itr)+1;itr++;
        itr++;ll r=*(itr)-1;
        res+=(idx-l+1)*(r-idx+1)*i;
        //cout<<l<<" "<<idx<<" "<<r<<endl;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 10368
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#define rad M_PI/3
#define N 500001
#define Max 10000
#define NTL -1
int n;
int heap[Max];
int main(){
  int i,parent,left,right;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&heap[i]);
  }
  for(i=0;i<n;i++){
    printf("node %d: key = %d, ",i+1, heap[i]);
    parent = (i-1)/2;
    left = i*2+1;
    right = i*2+2;
    if(i!=0) printf("parent key = %d, ",heap[parent]);
    if(left<n)printf("left key = %d, ",heap[left]);
    if(right < n) printf("right key = %d, ", heap[right]);
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    
    cout << b+min((a+b+1),c) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    int N;
    cin >> N;
    vector<ll> A(N,0);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }

    sort(A.rbegin(),A.rend());
    ll ans=A[0];
    int cnt=2;
    for(int i=1; i<N && cnt<N; i++){
        if(N-cnt==1){
            ans+=A[i];
            cnt++;
        }else{
            ans+=A[i]*2;
            cnt+=2;
        }
        //cout << i << ' ' << ans << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4836
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

ll qty(int x) {
    if (x <= 0) return 1;
    ll total = 0;
    ll pot = 26;
    fori (i, 0, x) {
        total += pot;
        pot *= 26;
    }
    return total;
}

const int MAX = 100;
ll pot[MAX];

void solve() {
    pot[0] = 1;
    fori (i, 1, MAX) {
        pot[i] = pot[i - 1] * 26LL;
    }
    ll n;
    cin >> n;
    int sz = 0;
    fori (i, 1, 1000) {
        if (pot[i] >= n) {
            sz = i;
            break;
        }
        n -= pot[i];
    }
    string ans = "";
    fori (i, 0, sz) {
        int rest = sz - i;
        fori (j, 0, 26) {
            ll k = pot[rest - 1];
            if (n > k) {
                n -= k;
            }
            else {
                ans += (j + 'a');
                break;
            }
        }
    }
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
        solve();
    return 0;
}



Measured memory_bytes: 3644
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
#define pb push_back
#define mp make_pair
#define inff 100000
#define ff first
#define ss second
#define sz(x) ((int) (x).size())
#define fast cin.sync_with_stdio(0);cin.tie(0)
#define rep(i,N) for(int i = 0;i < N;i++)
#define frep(i,a,b) for(int i = a;i <= b;i++)
#define pii pair<int , int>
#define pll pair<ll , ll>
#define vii vector<int>
#define vpii vector< pii >
#define fill(A,v) memset(A,v,sizeof(A))
#define setbits(x) __builtin_popcountll(x)
#define print(A,j,k) for(int ii=j;ii<k;ii++)cout<<A[ii]<<" ";cout<<"\n"
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
#define CASES int t;cin>>t;while(t--)
#define FILE freopen("inp.txt" , "r" , stdin);
#define ld long double

const int MOD = 1e9 + 7;
const int N = 2e5 + 5;
const int K = (1 << 17) + 10;
const ll INF = 2e18 + 500;
const int inf = 0x7fffffff;
const int SQRT = 500;
const int lgN = 20;

int main(int argc, char const *argv[])
{
	fast;

	int n , x;
	cin >> n >> x;

	vii A(n + 2 , 0);
	rep(i , n)
		cin >> A[i];

	ll ans = 0;
	for(int i = 0;i < n - 1;i++) {
		int s = A[i] + A[i + 1];
		if (s >= x) {
			int sub = s - x;
			// cout << "sub " << sub << '\n';
			int rem = min(sub , A[i + 1]);
			A[i + 1] -= rem;
			sub -= rem;
			ans += rem;
			if (sub > 0) {
				ans += sub;
			}
		}
	}
	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 640
#include<iostream>

int main(void){
    std::string s, t;
    std::cin >> s >> t;
    int n = s.size();
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == t[i]) ans++;
    }
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 3612
import java.util.*;

public class Main{
	public static long fu(int n){
		if(n>0){
			return (long)n*(long)(n-1)/2;
		}else{return (long)0;}
	}
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int n=sc.nextInt();
  	long f=0;
  	int[] a=new int[n],b=new int[n];
  	long[] c=new long[n];
  	for(int i=0;i<n;i++){
  		b[i]=0;
  		c[i]=0;
  	}
  	for(int i=0;i<n;i++){
  		a[i]=sc.nextInt();
  		b[a[i]-1]++;
  		c[a[i]-1]=fu(b[a[i]-1]);
  	}
  	for(int i=0;i<n;i++){
  		f+=c[i];
  	}
  	for(int i=0;i<n;i++){
  		long e=f;
  		if(b[a[i]-1]>1){
  			e=(e-c[a[i]-1])+fu(b[a[i]-1]-1);
  		}else{e=e;}
  		System.out.println(e);
  	}
  }
}

Measured memory_bytes: 105544
#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const double PI=4*atan(1.0);
const int MAX_SIZE = 10000;

int main(){

    int n;
    cin>>n;
    for(int i = 0; i < n; i++){
        string order;
        cin>>order;
        string given;
        cin>>given;
        for(int i = order.size()-1; i >= 0; i--){
            if(order[i]=='A'){
                reverse(given.begin(),given.end());
            }
            else if(order[i]=='J'){
                char ch=given[given.size()-1];
                given=given.substr(0,given.size()-1);
                given=ch+given;
            }
            else if(order[i]=='M'){
                for(int j = 0; j < given.size(); j++){
                    if(given[j]>='0'&&given[j]<='9'){
                        int num=(given[j]-'0'+1)%10;
                        given[j]=num+'0';
                    }
                }
            }
            else if(order[i]=='P'){
                for(int j = 0; j < given.size(); j++){
                    if(given[j]>='0'&&given[j]<='9'){
                        int num=(given[j]-'0'-1+10)%10;
                        given[j]=num+'0';
                    }
                }
            }
            else if(order[i]=='C'){
                char ch=given[0];
                given=given.substr(1,given.size()-1);
                given+=ch;
            }
            else if(order[i]=='E'){
                if(given.size()%2==0){
                    string prv=given.substr(0,given.size()/2);
                    string nxt=given.substr(given.size()/2,given.size()/2);
                    given=nxt+prv;
                }
                else{
                    string prv=given.substr(0,given.size()/2);
                    string nxt=given.substr((given.size()/2)+1,given.size()/2);
                    char ch=given[given.size()/2];
                    given=nxt+ch+prv;
                }
            }
        }
        cout<<given<<endl;
    }

    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
  	int x, y ,z;
 	cin >> x >> y >> z;
  	int a[] = {x , y , z};
  	sort(a , a + 3);
  	cout << a[2]*10 + a[1] + a[0] << endl;
 	return 0; 
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<long long>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, s, t, q, sum, last, cnt, ans,a[2000000];
string str;
bool f;
char  c;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> str;
	rep(i, str.size()) {
		a[str[i] - 'a']++;
	}
	Mfor(i, 26) {
		if (a[i] > 1)
			f = 1;
		if (a[i] == 0)
			c = i + 'a';
	}
	if (c == 0&&f==0) {
		LL b[26] = {};
		Mfor(i, str.size()) {
			rep(j, 26) {
				if (str[i] - 'a' < j&&b[j] == 1) {
					for (int k = 0; k < i;k++)
						cout << str[k];
					cout <<(char)( j + 'a') << endl;
					return 0;
				}
			}
			b[str[i] - 'a']++;
		}
		f = 1;
	}
	if (f == 1)
		cout << -1 << endl;
	else cout << str << c << endl;
	return 0;
}

Measured memory_bytes: 764
/**
  @file b.cpp
  @title B - 754
  @url https://atcoder.jp/contests/abc114/tasks/abc114_b
**/

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

typedef long long LL;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, N) for (int i = 0; i < (N); ++i)

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

  int ret = 1e9 + 7;
  REP(i, S.size() - 2) {
    int tmp = stoi(S.substr(i, 3));
    ret     = min(ret, abs(753 - tmp));
  }

  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
flag=[0 for i in range(64)]

def Test(flag,i):
    print(flag[i])

def Set(flag,i):
    flag[i]=1
    return flag

def Clear(flag,i):
    flag[i]=0
    return flag

def Flip(flag,i):
    if flag[i]==0:
        flag[i]=1
    else:
        flag[i]=0
    return flag

def All(flag):
    if all(flag)==True:
        print(1)
    else:
        print(0)

def Any(flag):
    if any(flag)==True:
        print(1)
    else:
        print(0)

def none(flag):
    if not any(flag)==True:
        print(1)
    else:
        print(0)

def Val(flag):
    a=''.join(map(str,flag[::-1]))
    print(int(a,2))

q=int(input())
for i in range(q):
    query=list(map(int,input().split()))
    if query[0]==0:
        Test(flag,query[1])
    elif query[0]==1:
        flag=Set(flag,query[1])
    elif query[0]==2:
        flag=Clear(flag,query[1])
    elif query[0]==3:
        flag=Flip(flag,query[1])
    elif query[0]==4:
        All(flag)
    elif query[0]==5:
        Any(flag)
    elif query[0]==6:
        none(flag)
    elif query[0]==7:
        print(flag.count(1))
    else:
        Val(flag)



Measured memory_bytes: 5628
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>

using namespace std;


int main() {
	int N; cin >> N;
	double sum = 0;
	for (int i = 0; i < N; i++) {
		double a; cin >> a;
		a = 1.0 / a;
		sum += a;
	}

	sum = 1.0 / sum;
	printf("%.9f\n", sum);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
 
using namespace std;
 
int main(){
    int H,W;
    while(true){
        scanf("%d %d",&H,&W);
        if(H == 0 && W == 0) break;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 2528
#include <iostream>
int main() {
  int W, H, x, y, r;
  std::cin >> W >> H >> x >> y >> r;
  if (x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x7f
#define MAX_INF_VAL 0x7f7f7f7f
#define pi 3.141592653589
#define eps 1e-10
//#define p 2173412051LL
#define sz 2

using namespace std;

ll f[ 10 ][ 10 ];

int main() {
	int n;
	int x, y;
	ll ans = 0, tmp;
	scanf( "%d", &n );
	for( int i = 1; i <= n; ++i ) {
		y = i % 10;
		x = i;
		while( x > 9 )
			x /= 10;
		++f[ x ][ y ];
	}
	for( int i = 1; i <= 9; ++i ) {
		for( int j = i + 1; j <= 9; ++j )
			ans += f[ i ][ j ] * f[ j ][ i ] * 2;
		ans += f[ i ][ i ] * f[ i ][ i ];
	}
	printf( "%lld", ans );
	return 0;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(std::string S){
    int ans = 0;
    string prev = "";
    string now = "";
    REP(i, S.size()) {
        now += S[i];

        if(prev == now) {
            continue;
        }
        prev = now;
        now = "";
        ans++;
    }

    cout << ans << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 772
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define ll long long
//map<key,value>
int main(){
string s;
int n,co=0;
cin >> s;
for(int i=0;i<4;i++){
  co=0;
  for(int j=0;j<4;j++){
    if(s[i] == s[j])co++;
  }
  if(co != 2){
    cout << "No";
    return 0;
  }
}
cout << "Yes";
return 0;
}


Measured memory_bytes: 256
n = int(input())
a = sorted([int(x) for x in input().split()])
b = sorted([int(x) for x in input().split()])
c = sorted([int(x) for x in input().split()])

def func1(list_1, list_2):
    res = []
    cnt = 0
    i = 0
    for x in list_2:
        while i <= n-1 and list_1[i] < x:
            cnt += 1
            i += 1
        res.append((x, cnt))
    return res

def func2(list_res, list_3):
    res = 0
    cnt = 0
    i = 0
    for x in list_3:
        while i <= n-1 and list_res[i][0] < x:
            cnt += list_res[i][1]
            i += 1
        res += cnt
    return res

ans = func2(func1(a, b), c)

print(ans)

Measured memory_bytes: 25908
#include <bits/stdc++.h>
#define LL              long long
#define SL(n)           scanf("%lld",&n)
#define LF              double
#define SF(n)           scanf("%lf",&n)

#define pb              push_back
#define ff              first
#define ss              second
#define mp              make_pair

#define ON(n,i)         (n|(1<<i))
#define OFF(n,i)        (n&(~(1<<i)))
#define CHK(n,i)        (n&(1<<i))

#define SET(arr)        memset( arr , -1 , sizeof arr)
#define RESET(arr)      memset( arr,0,sizeof arr)

#define srt(v)          sort(v.begin(),v.end())
#define uniq(v)			v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define found( s,d )    (s.find(d) != s.end())

#define FOR(i,s,e)      for( LL i = s ; i<=e ; i++ )

#define FILEIN          freopen("in.txt","r",stdin)
#define FILEOUT         freopen("out.txt","w",stdout)

using namespace std;

#define lim 100100

struct dsuNode{
    LL parent , Distance;
}Info[lim];

LL ParentOf( LL u ){
    if( Info[u].parent == u ) return u;
    LL p = ParentOf( Info[u].parent );
    Info[u].Distance += Info[ Info[u].parent ].Distance;
    return Info[u].parent = p;
}

bool Union( LL u, LL v, LL w ){

    ParentOf(u); ParentOf(v);
    w = w - Info[u].Distance + Info[v].Distance;
    u = ParentOf(u);
    v = ParentOf(v);
    if( u == v ) return true;
    Info[u].parent = ParentOf(v);
    Info[u].Distance = w;
    return false;

}

int main(){
    //FILEIN;
    LL n,m;
    SL(n); SL(m);
    FOR(i,1,n){
        Info[i].parent = i;
        Info[i].Distance = 0;
    }
    while(m--){
        LL t;
        SL(t);
        if(t==0){
            LL x,y,z;
            SL(x); SL(y); SL(z);
            x++,y++;
            Union(x,y,z);
        }
        else{
            LL x,y;
            SL(x); SL(y);
            x++,y++;
            //cout<<"DEBUG: "<<ParentOf(x)<<' '<<ParentOf(y)<<endl;
            if( ParentOf(x)!=ParentOf(y) ) printf("?\n");
            else{
                ParentOf(x); ParentOf(y);
                printf("%lld\n", ( Info[x].Distance - Info[y].Distance ));
            }
        }
    }

return 0;}





Measured memory_bytes: 5996
import java.util.*

fun main(args : Array<String>) {
    val (n, q) = readLine()!!.split(" ").map { it.toInt() }
    val nodes = Array(n) { mutableListOf<Int>() }
    val scores = LongArray(n) { 0L }
    val counters = LongArray(n) { 0L }

    repeat(n-1) {
        val (a, b) = readLine()!!.split(" ").map { it.toInt() }
        nodes[a-1].add(b-1)
        nodes[b-1].add(a-1)
    }

    repeat(q) {
        val (p, x) = readLine()!!.split(" ").map { it.toInt() }
        scores[p-1] += x + 0L
        counters[p-1] += x + 0L
    }

    val stack = Stack<Int>()
    val seen = Array(n){ false }
    stack.add(0)

    while (stack.isNotEmpty()) {
        val idx = stack.pop()
        seen[idx] = true

        nodes[idx].forEach {
            if (!seen[it]) {
                stack.push(it)
                counters[it] += counters[idx]
            }
        }
    }

    println(counters.joinToString(separator = " "))
}

Measured memory_bytes: 156620
def bb093():
    a,b,k = list(map(int, input().split()))

    c = a+k if (b-a) > k else b+1
    l = list(range(a, c))
    #print(l)

    c = b-k if (b-a) > k else a-1
    l.extend(list(range(b, c, -1)))
    #print(l)

    l = list(set(l)) # uniq 重複を削除
    l.sort()
    for i in l:
        print(i)

bb093()


Measured memory_bytes: 3060
#include <stdio.h>
int main(void){
    int n, m, l, i, j, k;
    unsigned long long int A[101][101],B[101][101],C[101][101];    
    scanf("%d %d %d", &n, &m, &l);
    for(j=0;j<101;j++){
        for(i=0;i<101;i++){
            C[j][i]=0;
            A[j][i]=0;
            B[j][i]=0;
        }
    }
    for( i = 1; i <= n; i++){
        for( j = 1; j <= m; j++){        
            scanf("%lld", &A[i][j]);
        }
    }
    for( i = 1; i <= m; i++){
        for( j = 1; j <= l; j++){
            scanf("%lld", &B[i][j]);
        }
    }
    for( i = 1; i <= n; i++){
        for( j = 1; j <= l; j++){
            for( k = 1; k <= m; k++){
                C[i][j] = C[i][j] + A[i][k] * B[k][j];
            }
        }
    }
    for( i = 1; i <= n; i++){
        for( j = 1; j <= l; j++){
            printf("%llu", C[i][j]);
            if( j != l )    printf(" ");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2072
/*input
3 8
3 30
4 50
5 60
*/

#include <functional>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <utility> 
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>

using namespace std;

using ll = long long;
using ld = long double;

const int SINF = 1000000009;
const ll INF =  1000000000000000018;

#define sp          cout << " "
#define nl          cout << "\n"
#define all(c)      (c).begin(),(c).end()
#define prec(n)     cout << fixed << setprecision(n)
#define PI          3.14159265358979323846264338327951
#define ifalse      ios_base::sync_with_stdio(false), cin.tie(NULL)

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T, typename U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.first >> p.second;
  return is;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for(auto x: v) {
    os << x << " ";
  }
  return os;
}

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

/******************************** START *********************************/
const int N = 100005;
vector < pair < int, int > > v;
ll dp[101][100001];

int func(int n, int val)
{
  if(val <= 0) {
    return 0;
  }
  if(n == 0) {
    return SINF;
  }
  if(dp[n][val] > -1) {
    return dp[n][val];
  }

  int a = func(n - 1, val);
  int b = v[n - 1].first + func(n - 1, val - v[n - 1].second);
  return dp[n][val] = min(a, b);
}

int main()
{
  ifalse;
  int n, w;
  cin >> n >> w;
  int sum = 0;
  for(int i = 0; i < n; i ++) {
    int x, y;
    cin >> x >> y;
    sum += y;
    v.push_back({x, y});
  }

  memset(dp, -1, sizeof(dp));
  for(int i = sum; i >= 0; i --) {
    ll res = func(n, i);
    if(res <= w) {
      cout << i, nl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 79232
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
void solve(){
	int n = read.to!int;
	long[] ds;
	
	foreach(i; 0 .. n) ds ~= read.to!long;
	
	ds.sort();
	
	long ans = ds[n / 2] - ds[n / 2 - 1];
	
	ans.writeln;
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] s = Console.ReadLine().Split(' ').Select(e =>int.Parse(e)).ToArray();
            int res = 1;
            int cnt = 0;
            while (res<s[1])
            {
                cnt++;
                res = s[0] * cnt - (cnt-1);
            }

            Console.WriteLine(cnt);
        }
    }
}


Measured memory_bytes: 13268
import math
a,b,x=map(int,input().split())
L=b*a**2
if L==x:
  alfa=0
elif x >= L/2:
  h=x/(a**2)
  beta=math.atan((a/2)/(b-h))
  alfa=(math.pi)/2 - beta
else:
  alfa=math.atan(b/(2*x/(a*b)))
print(math.degrees(alfa))

Measured memory_bytes: 9320
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);

    int n, k;
    cin >> n >> k;
    int happy = 0;
    string s;
    cin >> s;
    char before = 0;
    for (auto c : s) {
        if (c != before) {
            before = c;
        } else {
            happy++;
        }
    }

    happy += k * 2;
    if (happy > (int) s.length() - 1) happy = (int) s.length() - 1;
    cout << happy << endl;


    return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000



int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    char b;
    cin >> b;
    if(b == 'A') cout << 'T' << endl;
    else if (b == 'T') cout << 'A' << endl;
    else if (b == 'G') cout << 'C' << endl;
    else cout << 'G' << endl;

    return 0;
}


Measured memory_bytes: 256
SHIFT_COUNT = int(input())
encryptionStr = input()
result = ""
excludeStr = "{}_"

for c in encryptionStr :
    # 除外する文字列ならば変換せず、そのままにする
    if excludeStr.find(c) != -1 :
        result = result + c
        continue

    # 暗号化する処理
    if ord('a') <= ord(c) <= ord('z') :
        result = result + chr(abs(((ord(c) + SHIFT_COUNT - ord('a')) % 26)) + ord('a'))
    else :
        result = result + chr(abs(((ord(c) + SHIFT_COUNT - ord('A')) % 26)) + ord('A'))

print (result)

Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(pair<int, int> a, pair<int, int> b) {
	return a < b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

int main() {
	string s;
	cin >> s;
	vint a;
	vint b(s.size(), 0);
	rep(i, s.size() - 1) {
		if (s[i] == 'R' && s[i + 1] == 'L') {
			a.push_back(i + 1);
		}
	}
	int now = 0;
	rep(i, s.size()) {
		if (s[i] == 'R') {
			if (a[now] < i) {
				now++;
			}
			if ((a[now] - i) % 2 == 0) {
				b[a[now]]++;
			}
			else {
				b[a[now] - 1]++;
			}
		}
		else {
			if ((a[now] - i) % 2 == 0) {
				b[a[now]]++;
			}
			else {
				b[a[now] - 1]++;
			}
		}
	}
	rep(i, s.size()) {
		cout << b[i] << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
const int N = 250000;

int arr[N];
vector<int> prim;
 
void Erat(){
	for(int i = 0; i < N; i++){
		arr[i] = 1;
	}
	for(int i = 2; i < sqrt(N); i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) < N; j++){
				arr[i *(j + 2)] = 0;
			}
		}
	}
 
	for(int i = 2; i < N; i++){
		if(arr[i]){
			//cout << i << endl;
            prim.push_back(i);
		}
	}
}

int main(){
    //素数を生成
    Erat();
while(1){    
    
    int n;
    cin >> n;
    if(n == 0) break;
    int cnt = 0;
    for(int i=0; i < (int)prim.size(); i++){
    	if(n < prim[i] and prim[i] <= 2 * n) cnt++;
    }
    cout << cnt << endl;
	
	//debug
	//cout << "p" << endl;
	//for(int i=0; i<(int)prim.size(); i++) cout << prim[i] << endl;
	
}//end	
	
	return 0;
}


Measured memory_bytes: 4232
//vec[i]の範囲外エラー表示
#define _GLIBCXX_DEBUG
//includeとusing
#include <bits/stdc++.h>
using namespace std;
//型名省略
using ll = long long;
using st = string;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using pcc = pair<char, char>;
//定数
const ll INF = 1e9;
const ll MOD = 1e9+7;
const vl dx = {1,0,-1,0,1,0,-1,0};
const vl dy = {0,1,0,-1,0,1,0,-1};
//マクロ
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define rrep(i,n) for(ll i = (ll) n - 1; i >= 0;i--)
#define REP(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define RREP(i,x,n) for(ll i = (ll) n - 1; i >= x; i--)
#define each(i,A) for(ll i: (vl) A)
#define all(A) A.begin(), A.end()
#define Size(A) ll(A.size())
//入力
template<typename T> T input() {T x; cin >> x; return x;}
//正誤判定
void Yes(bool ans){cout << (ans? "Yes" : "No") << endl;}
void YES(bool ans){cout << (ans? "YES" : "NO") << endl;}
//余り切り上げ
ll ceil(ll a,ll b) {return (a + b - 1) / b;}
//最大値・最小値
template <typename T> bool chmax(T &a, const T& b) {if(a < b) {a = b; return true;} return false;}
template <typename T> bool chmin(T &a, const T& b) {if(a > b) {a = b; return true;} return false;}
//最大公約数
ll gcd(ll a,ll b){if(a<b)swap(a,b); if(a%b==0)return b; return gcd(b,a%b);}
//最小公倍数
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//n乗の余り
ll modpow(ll x,ll n,ll mod){ll res=1;for(ll i=0;i<n;i++){res=res*x%mod;}return res;}
ll MODpow(ll x,ll n){ll res=1;for(ll i=0;i<n;i++){res=res*x%MOD;}return res;}


/*--------------------------------------------------------------------------*/

//main関数
int main() {
    ll a,b,h; cin >> a >> b >> h;
    cout << (a + b) * h / 2 << endl;
}



Measured memory_bytes: 3628
N  = input()
Hs = list(map(int,input().split(" ")))
limit = len(Hs)
ans = 0
for i in range(limit):
    h = Hs[i]
    flag = True
    for another in Hs[:i]:
        if h < another:
            flag = False
    if flag:
        ans += 1
print(ans)

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

#define _ << " " <<
#define tr(x) cout << #x _ x << endl
#define fi first
#define se second

#ifdef _WIN32
#define LD "%I64d"
#else
#define LD "%ld"
#endif

using namespace std;

typedef long long ll;

const int az = 'z' - 'a' + 1;

int n;
char s[105];
int hist[az];

int read() {
    if (scanf("%s", s) < 1) {
        return 0;
    }
    n = strlen(s);
    return 1;
}

void solve() {
    for (int i = 0; i < n; i++) {
        hist[s[i] - 'a']++;
    }
    int can = 1;
    for (int i = 0; i < az; i++) {
        if (hist[i] % 2 != 0) can = 0;
    }
    if (can) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
}

int main(int argc, char *argv[]) {
    while (read()) {
        solve();
    }
}


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

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;

struct UnionFind{
  vector<int> par;
  vector<int> siz;

  UnionFind(int N){
    par.resize(N);siz.resize(N);
    for(int i=0;i<N;i++) par[i]=i;
    for(int i=0;i<N;i++) siz[i]=1;
  }

  int root(int x){
    if(par[x]==x) return x;
    else return par[x]=root(par[x]);
  }

  bool unite(int x,int y){
    int rx=root(x);
    int ry=root(y);
    if (rx == ry) return false;
    if(siz[rx] < siz[ry]) swap(rx,ry);
    siz[rx] += siz[ry];
    par[ry] = rx;
    return true;
  }

  bool sameroot(int x,int y){
    return root(x)==root(y);
  }

  int size(int x){
    return siz[root(x)];
  }
};

int main(){
  int N,M;
  cin>>N>>M;
  UnionFind uf(N);
  for(int i(0);i<M;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    uf.unite(a,b);
  }
  int ans(0);
  for(int i(0);i<N;i++){
    ans = max(ans,uf.size(i));
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 4836
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
using namespace std;
using i32 = int32_t; using i64 = int64_t; using f64 = double_t; using str = string;
template <typename T> using vec = vector<T>;
template <typename T> using heap = priority_queue<T, vec<T>, greater<T>>;
#define times(n, i) for (i32 i = 0; i < (n); ++i)
#define range(n, m, i) for (i32 i = (n); i < (m); ++i)
#define upto(n, m, i) for (i32 i = (n); i <= (m); ++i)
#define downto(n, m, i) for (i32 i = (n); i >= (m); --i)
#define foreach(xs, x) for (auto &x : (xs))
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define uniqueall(xs) (xs).erase(unique(all(xs)), (xs).end())
#define maximum(xs) (*max_element(all(xs)))
#define minimum(xs) (*min_element(all(xs)))
#define even(x) (((x) & 1) == 0)
#define odd(x) (((x) & 1) == 1)
#define append emplace_back
const i64 MOD = 1000000007;

i32 n, x;

i32 main()
{
    cin >> n >> x;
    i64 pre = 0, ans = 0;
    cin >> pre;
    if (pre > x) {
        ans += pre-x;
        pre = pre - (pre-x);
    }
    times(n-1, i) {
        i32 a; cin >> a;
        if (pre + a > x) {
            ans += (pre + a) - x;
            pre = a - ((pre + a) - x);
        } else {
            pre = a;
        }
    }

    cout << ans << 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() {

  int a;
  cin >> a;
  int n = a;
  
  int s = 0;
  while(a > 0) {
    s += a%10;
    a /= 10;
  }
  
  if(n%s == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define pb push_back 
#define mp make_pair
typedef long long ll;

int main(){
	int n,k; cin>>n>>k;
	vector<ll> A(n);
	for(int i=0;i<n;i++) cin>>A[i];
		
	sort(all(A));
	
	ll ans=0;
	for(int i=0;i<n-k;i++) ans+=A[i];
	
	cout<<ans;
		
	
	return 0;
}


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

signed main() {
    int N,M;
    cin >> N >> M;
    int ans = 1;
    if(N == 1) {
        cout << M << endl;
    }
    else {
        for(int i = 1; i*i <= M; i++) {
            if(M%i == 0){
                if(i*N <= M) {
                    ans = max(ans,i);
                }
                if(M/i*N <= M) {
                    ans = max(ans,M/i);
                }
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	static int days(int Y, int M, int D) {
		int days = 0;

		for (int y = 1; y < Y; ++y) {
			if (y % 3 == 0) {
				// 3年，6年，9年，…のように，3で割り切れる年には，小の月は訪れず，10すべての月を大の月とする．
				days += 20 * 10;
			} else {
				// ふつうの年は，1月が大の月，2月は小の月，3月は大の月，そして最後の10月は小の月というように，大の月と小の月が交互に訪れる
				days += 19 * 5 + 20 * 5;
			}
		}

		for (int m = 1; m < M; ++m) {
			if (Y % 3 == 0 || m % 2 == 1) {
				days += 20;
			} else {
				days += 19;
			}
		}

		days += D;

		return days;
	}

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

		int n = sc.nextInt();

		int premium = days(1000, 1, 1);

		for (int i = 0; i < n; ++i) {
			int Y = sc.nextInt();
			int M = sc.nextInt();
			int D = sc.nextInt();
			System.out.println(premium - days(Y, M, D));
		}
	}
}



Measured memory_bytes: 26604
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair

using namespace std;

const int INF = 2000000000;
const double pi = 3.1415926;
const int base = 1000000007;

int n, m, sum;

int main()
{
//    ifstream cin ("house.in");
//    ofstream cout ("house.out");
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.precision(25);
    cout.setf(ios_base::fixed);
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int t;
        cin >> t;
        sum += t;
    }
    cout << max(n - sum, -1);
    return 0;
}


Measured memory_bytes: 3660
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"

#define lp(n) for (int i = 0; i < n; i++)
#define LP(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nya_n "(=^･ω･^=)"
typedef long long ll;
using namespace std;

/*
ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	ll g = gcd(x, y);
	return x / g * y;
}*/

int n, m, a;
ll s[100000], cnt;
map<int, int>mp;


int main(){
	cnt = 0;
	cin >> n >> m;
	cin >> s[0];
	lp(n - 1) {
		cin >> a;
		s[i + 1] = s[i] + a;
	}
	lp(n) {
		s[i] = s[i] % m;
		if (s[i] == 0)cnt++;
		if (mp.find(s[i]) == mp.end())
			mp[s[i]] = 1;
		else
			mp[s[i]]++;
	}
	lp(n) {
		cnt += ll(mp[s[i]])*ll(mp[s[i]]-1) / 2;
		mp[s[i]] = 0;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3968
#include<iostream>
#include<algorithm>
#define ll long long
#include<vector>
 
using namespace std;

const ll mod = 998244353;
const ll N = 200000 + 10;

ll inv[N];
ll f[N];

ll ksm(ll a, ll b)
{
	ll rul = 1;
	while(b)
	{
		if(b & 1) rul = rul * a % mod;
		b >>= 1;
		a = a * a % mod;
	}
	return rul;
}

ll c(ll a, ll b)
{
	return f[a] * inv[a-b] % mod * inv[b] % mod; 
}

int main()
{
	ll n,m,k;
	cin>>n>>m>>k;
	
	int maxn = max(n,m);
	f[0] = 1;
	for(ll i = 1; i<=maxn; i++) f[i] = f[i-1] * i % mod;
	inv[maxn] = ksm(f[maxn], mod-2);
	for(ll i = maxn-1; i>=0; i--) inv[i] = inv[i+1] * (i+1) % mod;
	
	ll ans = 0;//C(n-1,n-1-k)*m*(m-1)^(n-1-k) //n-1-k为隔板数 
	ll tem = ksm(m-1,n-1-k); 
	for(int i=n-1-k; i<=n-1; i++)
	{
		ans = ans + c(n-1, i) % mod * m % mod * tem % mod;
		ans = ans % mod;
		tem = tem * (m-1) % mod;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 6284
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

n=gets.to_i
a=get_i
MAX_N=10**5
cnt=array(MAX_N,1,0)
a.each do|num|
  cnt[num]+=1
end
max=cnt[0]+cnt[1]
for i in 1..MAX_N-1
  if i==MAX_N-1
    val=cnt[i-1]+cnt[i]
  else
    val=cnt[i-1]+cnt[i]+cnt[i+1]
  end
  max=val if max<val
end
puts max

Measured memory_bytes: 9484
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//V,P(大文字)使用不可

const ll INF=1000000000000000000;

signed main(){
    ll n,k,q;
    cin>>n>>k>>q;
    V<ll> a(n,0);
    ll p=q;
    while(q--){
        ll b;
        cin>>b;
        b--;
        a[b]++;
    }
    rep(i,n){
        if(p-a[i]<k) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

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

int main(){
	int X=0;
	int Y=0;
	int sum=0;

	cin >> X >> Y;

	if(3 == X){
		sum += 100000;
	}else if(2 == X){
		sum += 200000;
	}else if(1 == X){
		sum += 300000;
	}else{
	}

	if(3 == Y){
		sum += 100000;
	}else if(2 == Y){
		sum += 200000;
	}else if(1 == Y){
		sum += 300000;
	}else{
	}

	if(1 == X && 1 == Y){
		sum += 400000;
	}
	cout << sum;

	return 0;
}

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

int main() {
    int n, cnt=0;
    cin >> n;
    int tmp;
    bool bl;

    for (int i = 0; i < n; i++)
    {
        bl=1;
        cin >> tmp;
        if(tmp==2) {
            ++cnt;
            continue;
        }
        for (int j = 2; j < sqrt(tmp)+1; j++)
        {
            if (tmp%j ==0) {
                bl=0;
                break;
            } 
        }
        if (bl==1) ++cnt;
    }
    cout << cnt << endl;
    
}
//g++ -o proc.exe proc.cpp


Measured memory_bytes: 3080
// "include" {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <tuple>
// }}}

using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int long long
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9+7;

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

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	map<int,bool> mp;
	int cnt = 0;
	rep(i,n){
		int x;
		cin >> x;
		if(mp[x]){
			mp[x] = false;
			--cnt;
		}
		else{
			mp[x] = true;
			++cnt;
		}
	}
	cout << cnt << '\n';
	return 0;	
}


Measured memory_bytes: 6528
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    if sc
        .chars()
        .into_iter()
        .enumerate()
        .all(|(i, c)| (i % 2 == 0 && c != 'L') || (i % 2 == 1 && c != 'R'))
    {
        println!("Yes");
    } else {
        println!("No");
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
/*
 * SKP🔥🔥🔥
*/
#include <bits/stdc++.h>
using namespace std;

//TYPEDEF
typedef long long ll;

// DEFINE SECTION
#define fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(nullptr);                 \
    cout.tie(nullptr);

//IMPORTANT_FUNCTIONS
void io_file()
{
}
// OTHER_FUNCTIONS
//MAIN
int main()
{
    io_file();
    fio;
    ll t;
    cin >> t;
    int a[t], b[t];
    int z[t];
    for (int i = 0; i < t; i++)
    {
        cin >> a[i] >> b[i];
    }
    int count=0;
    for (int i = 0; i < t; i++)
    {
        if (a[i] - b[i] == 0)
         count++;
        else
        {
            count=0;
        }
        if(count==3)
            break;
         
            
    }
    if(count==3)
    cout<<"Yes\n";
    else
    cout << "No\n";
    return 0;
}


Measured memory_bytes: 3604