akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> P;

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

  int mp[600][600] = { };
  REP(i, M) {
    int L, R; cin >> L >> R;
    mp[L][R]++;
  }

  REP(i, N) {
    REP(j, N) {
      mp[i][j + 1] += mp[i][j];
    }
  }

  REP(i, N) {
    REP(j, N + 1) {
      mp[i + 1][j] += mp[i][j];
    }
  }

  REP(i, Q) {
    int p, q; cin >> p >> q;
    cout << mp[q][q]-mp[p-1][q]-mp[q][p-1]+mp[p-1][p-1] << endl;
  }

	return 0;
}



Measured memory_bytes: 2304
import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限
a = list(map(int,input().split()))
for i in range(1,(2**3)-1):
    distribution = [0,0]
    
    for j in range(3):
        distribution[(i>>j)&1]+= a[j]
    if distribution[0] == distribution[1]:
        break
if distribution[0] == distribution[1]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vb   = vector<bool>;
using vvb  = vector<vb>;
using pii  = pair<int,int>;
using vpii = vector<pii>;
 

int main() {
    int N; cin >> N;
    set<int> d; 
    for(int i = 0; i < N; i++) {
        int tmp; cin >> tmp;
        d.insert(tmp);
    }
    
    int tmp_min=0, ans = 0;
    for (auto value : d) {
        if(value != tmp_min) ans++;

    }
    cout << ans;

}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;

ll permutation(ll n, ll r){
  if (n == 1){
    return 0;
  }
  if (r == 1) {
    return n;
  }
  return n + permutation(n-1, r);
}


int main(int argc, const char * argv[]) {
  int n, a, b;
  cin >> n >> a >> b;
  if(a == b){
    cout << 1 << endl;
    return 0;
  }
  if (b - a < 0){
    cout << 0 << endl;
    return 0;
  }
  if (n==2 & a != b){
    cout << 1 << endl;
  }
  if (n < 2){
    cout << 0 << endl;
    return 0;
  }
  ll n_type = b-a + 1;
  long long max_r = n-2;
  cout << b*max_r - a*max_r + 1 << endl;
  return 0;
}


Measured memory_bytes: 256
mod = 10 ** 9 + 7

frac = [1]*2001
fracinv = [1]*2001
for i in range(2,2001):
    frac[i] = (frac[i-1] * i) % mod

fracc = frac[0:2001]

modd = 10 ** 9 + 5
while modd:
    if modd % 2:
        for i in range(2,2001):
            fracinv[i] *= fracc[i]
            fracinv[i] %= mod
    modd //= 2
    for i in range(2,2001):
        fracc[i] *= fracc[i]
        fracc[i] %= mod

S = int(input())
if S <= 2:
    print(0)
    exit()

ans = 0
for i in range(1,S // 3 + 1):
    j = (frac[S - 2 * i - 1] * fracinv[S - 3 * i]) % mod
    j = (j * fracinv[i - 1]) % mod
    ans += j
    ans %= mod

print(ans)

Measured memory_bytes: 66472
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String A = scan.next();
        String B = scan.next();
        String C = scan.next();
        String K = scan.next();
        int a = Integer.parseInt(A);
        int b = Integer.parseInt(B);
        int c = Integer.parseInt(C);
        int k = Integer.parseInt(K);
 
        if (k < a) {
          System.out.println(k);
        }
        else if (k <= a + b) {
          System.out.println(a);
        } else {
          System.out.println(a - (k - (a + b)));
        }
        
        scan.close();
    }
}

Measured memory_bytes: 35684
// 2015/07/21 Tazoe

#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	while(true){
		int N;
		cin >> N;

		if(N==0)
			break;

		if(N%1111==0){			// 全桁が同じ数字
			cout << "NA" << endl;
			continue;
		}

		int cnt = 0;

		while(N!=6174){
			int n[4];
			n[0] = N/1000;		// 千の位
			n[1] = N/100%10;	// 百の位
			n[2] = N/10%10;		// 十の位
			n[3] = N%10;		// 一の位

			sort(n, n+4);		// ソート

			int L = n[3]*1000+n[2]*100+n[1]*10+n[0];
			int S = n[0]*1000+n[1]*100+n[2]*10+n[3];

			N = L-S;
			cnt++;
		}

		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 1180
//package com.company;
import java.util.*;
import java.lang.*;
import java.io.*;
//****Use Integer Wrapper Class for Arrays.sort()****
public class Main{
    static int ans;
    public static void main(String[] Args){
        FastReader scan=new FastReader();
        int n=scan.nextInt();
        boolean[] temp=new boolean[n];
        P[] arr=new P[n];
        for(int i=0;i<n;i++){
            arr[i]=new P(n);
            int ai=scan.nextInt();
            Map<Integer,Boolean> cur=arr[i].m;
            for(int j=0;j<ai;j++){
                int x=scan.nextInt();
                int y=scan.nextInt();
                if(y==0){
                    cur.put(x-1,false);
                }else{
                    cur.put(x-1,true);
                }
            }
        }
        ans=0;
        bruteForce(0,n,temp,arr);
        System.out.println(ans);
    }
    static void bruteForce(int i,int n,boolean[] cur,P[] arr){
        if(i==n){
            int flag=0;
            int val=0;
            for(int j=0;j<n;j++){
                if(cur[j]){
                    val++;
                    Map<Integer,Boolean> c=arr[j].m;
                    for(Integer k:c.keySet()){
                        boolean v=c.get(k);
                        if(cur[k]!=v){
                            flag=1;
                            break;
                        }
                    }
                    if(flag==1){
                        break;
                    }
                }
            }
            if(flag==0){
                ans=Math.max(ans,val);
            }
            return;
        }
        bruteForce(i+1,n,cur,arr);
        cur[i]=true;
        bruteForce(i+1,n,cur,arr);
        cur[i]=false;
    }
    static class P{
        int a;
        Map<Integer,Boolean> m;
        P(int a){
            this.a=a;
            m=new HashMap<>();
        }
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

}


Measured memory_bytes: 33280
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
ll n, m;
string s;
int prime[1002];
void e() {
	rep(i, 1002) prime[i] = 1;
	for (int i = 2; i <= 1000; i++) {
		for (int j = i*i; j <= 1000; j += i) {
			prime[j] = 0;
		}
	}
}
int main() {
	cin >> n;
	ll ans = 1;
	e();
	map<int, ll> mp;
	for (int i = 2; i <= n; i++) {
		for (int j = 2; j <= i; j++) {
			if (i == 64) {
				int db = 1;
			}		if (i%j == 0 && prime[j]) {

				for (int k = sqrt(i)+1; k > 0; k--) {
					ll tp = 1;
					for (int l = 0; l < k; l++)tp *= j;
					if (i%tp == 0) {
						mp[j] += k;
						break;
					}
				}
			}

		}
	}
	for (auto kv : mp) {
		ans = (ans*(kv.second + 1) % mod);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n,k;
    cin >> n >> k;
    vector<ll>a(n);
    for(ll i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=k;i<n;i++){
        if(a[i]>a[i-k]){
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 4840
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x,y,n,k,i=1,ans= 0;
  cin >> n;
  cin >> k;
  cin >> x;
  cin >> y;
  if (k>=n){
    ans = n*x;
  }else{
   ans = k*x + (n-k)*y;
  }
cout << ans << endl;
  
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Net;
using System.Numerics;
using System.Reflection.Metadata;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics.X86;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;

namespace AtCoder
{
	public class Program
	{
		static void Main()
		{
			int n = int.Parse(Console.ReadLine());
			var set = new HashSet<int>();
			for (int i = 0; i < n; i++) {
				int d = int.Parse(Console.ReadLine());
				set.Add(d);
			}

			int ans = set.Count;
			Console.WriteLine(ans);
		}
	}
}


Measured memory_bytes: 27808
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		bool chk = S[0] == S[1] || S[1] ==S[2] || S[2] == S[3];
		Console.WriteLine(!chk ? "Good" : "Bad");
		
	}
	String S;
	public Sol(){
		S = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

string S, T;

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

    int ans = 0;
    for (int i = 0; i < 3; i++) {
        if (S[i] == T[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-12;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

struct state {
	int p, c, r;
	state(int p, int c, int r) : p(p), c(c), r(r) {};
	bool operator<(const state &o)const {
		return o.c<c;
	}
};

int main() {
	int N;
	while(cin >> N, N) {
		int S, T, M, A, B;
		vvi dist(N+1, vi(N+1, INF));
		cin >> S >> T >> M;
		int num = 1;
		REP(i, M) {
			cin >> A >> B;
			dist[A][B] = min(dist[A][B], num);
			num++;
		}

		priority_queue<state> Q;
		Q.push(state(S, 0, 0));
		vi ncost(N+1, INF), rcost(N+1, INF), road(N+1, INF);
		int ans = INF, ansr = INF;
		while(!Q.empty()) {
			state st = Q.top();
			Q.pop();

			if(ans < st.c) {
				break;
			}

			if(st.p == T) {
				if(st.c < ans) {
					ans = st.c;
					ansr = st.r;
					continue;
				} else if(st.c == ans && st.r < ansr) {
					ansr = st.r;
					continue;
				}
			}

			FOR(i, 1, N) {
				if(dist[st.p][i] != INF) {
					if(st.r == 0) {
						if(st.c+1 < ncost[i]) {
							ncost[i] = st.c+1;
							Q.push(state(i, st.c+1, 0));
						}
					} else  {
						if(st.c+1 < rcost[i]) {
							rcost[i] = st.c+1;
							road[i] = st.r;
							Q.push(state(i, st.c+1, st.r));
						} else if(st.c+1 == rcost[i] && st.r < road[i]) {
							road[i] = st.r;
							Q.push(state(i, st.c+1, st.r));
						}
					}
				}
				if(dist[i][st.p] != INF && st.r == 0) {
					if(st.c+1 < rcost[i]) {
						rcost[i] = st.c+1;
						road[i] = dist[i][st.p];
						Q.push(state(i, st.c+1, dist[i][st.p]));
					} else if(st.c+1 == rcost[i] && st.r < road[i]) {
						road[i] = dist[i][st.p];
						Q.push(state(i, st.c+1, dist[i][st.p]));
					}
				}
			}
		}

		cout << ans << " " << ansr << endl;
	}	

	return 0;
}

Measured memory_bytes: 5172
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
	int a;
	string s;
	cin >> a >> s;
	if (a >= 3200) {cout << s << endl;}
	if (a < 3200) {cout << "red" << endl;}
} 


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	bool flag=0;
	for(double i=1;i<=10000;i++){
		if(floor(i*0.08)==a&&floor(i*0.1)==b){
			flag=1;
			cout<<i<<endl;
			break;
		}
	}
	if(!flag)cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<ctime>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath> 
#include<cstring> 
#include<cassert>
#include<string>
#include<sstream>
#include<fstream>
#include<deque>
#include<queue>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<set>
#include<bitset>
#include<iomanip>
#include<utility>
#include<functional>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cwchar>
#include<cwctype>
#include<exception>
#include<locale>
#include<numeric>
#include<new>
#include<stdexcept>
#include<limits>
using namespace std;

#define ll long long
#define INF 1e9
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define repd(i,n) for(int (i)=n-1;(i)>=0;i--)
#define REPD(i,n) for(int (i)=n;(i)>0;i--) 
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
#define pii pair<int,int>
#define sz(s) s.size()
#define all(s) (s.begin(),s.end())

char readchar(){
	char c;
	while(c=getchar(),c!='Y'&&c!='N');
	return c;
} 

int digit=1;
char ans,junk;

bool check(ll x){
	printf("? %lld\n",x-1);
	fflush(stdout);
	ans=readchar();
	if(ans=='N')return true;
	return false;
}

ll guess(ll base){
	int l=0,r=10;
	while(r-l>1){
		ll mid=(l+r)/2;
		printf("? %lld\n",(base*10+mid)*(ll)INF); 
		fflush(stdout);
		ans=readchar();
		if(ans=='Y')r=mid;
		else l=mid;
	}
	if(check((base*10+(ll)r)*INF))return base*10+(ll)r;
	return base*10+(ll)l;
}

int main(){
	ll cur=1;
	REP(i,10){
		cur*=10;
		digit++;
		printf("? %lld\n",cur);
		fflush(stdout);
		ans=readchar();
		if(ans=='N')break;
	}
	if(digit>10){
		cur=10;
		digit=1;
		REP(i,9){
			printf("? %lld\n",cur-1);
			fflush(stdout);
			ans=readchar();
			if(ans=='Y')break;
			digit++;
			cur*=10;
		}
		printf("! %lld",cur/10);
		return 0; 
	}
	digit--;
	cur=0;
	REP(i,digit){
		ll now=guess(cur);
		cur=now;
	}
	printf("! %lld",cur);
	fflush(stdout);
	return 0;
}

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

bool voted(int x, int N, int M, int V, int P, std::vector<int>& A){
  if(x < P) return true;
  if(A[x] + M < A[P - 1]) return false;
  
  long long v = (long long)(V - P) * (long long)M;
  v -= (long long)(N - x - 1) * (long long)M;
  
  for(int i = P - 1; i < x; i++){
    if(v <= 0ll) break;
    v -= (long long)std::min(A[x] + M - A[i], M);
  }
  
  return v <= 0ll;
}

int count(int N, int M, int V, int P, std::vector<int>& A){
  int ok = P - 1;
  int ng = N;
  while(ng - ok > 1){
    int mid = (ok + ng) / 2;
    (voted(mid, N, M, V, P, A) ? ok : ng) = mid;
  }
  
  return ok + 1;
}

int main(){
  int N, M, V, P;
  std::cin >> N >> M >> V >> P;
  
  std::vector<int> A(N);
  for(int i = 0; i < N; ++i) std::cin >> A[i];
  sort(A.rbegin(), A.rend());
  
  std::cout << count(N, M, V, P, A) << std::endl;
  
  return 0;
}

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

using namespace std;

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

	if (a == 'H') {
		//at正直
		if (b == 'H') {
			//top正直
			cout << "H" << endl;
		}
		else if (b == 'D') {
			//topうそつき
			cout << "D" << endl;
		}
	}
	else if (a == 'D') {
		//atうそつき
		if (b == 'H') {
			//top正直
			cout << "D" << endl;
		}
		else if (b == 'D') {
			//topうそつき
			cout << "H" << endl;
		}
	}
	
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	ll n,l;
	cin >> n;
	vector<ll> a(n+1);
	a[0] = 0;
	for(int i = 1; i < n+1; i++) {
		cin >> l;
		a[i] += a[i - 1] + l;
	}
	ll ans = LINF;
	ll A,B;
	for(int i = 1; i < n; i++) {
		A = a[i];
		B = a[n] - a[i]; 
		// cout << 'A' << A << 'B' << B << endl;
		ans = min(ans,abs(A - B));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
use std::io::BufRead;

fn main() {
    let stdin = std::io::stdin();
    let mut w = stdin.lock().gets().into_bytes();
    let mut badsp = vec![false; w.len() + 1];
    check_from_left(&w, &mut badsp);
    w.reverse();
    badsp.reverse();
    check_from_left(&w, &mut badsp);
    if !badsp[0] && !badsp[w.len()] {
        println!("1");
        println!("1");
    } else {
        let count = badsp[1..w.len()].into_iter().filter(|&x| !x).count();
        if count == 0 {
            println!("{}", w.len());
            println!("1");
        } else {
            println!("2");
            println!("{}", count);
        }
    }
}

fn check_from_left(w: &[u8], badsp: &mut [bool]) {
    let mut done = vec![false; w.len() / 2 + 1];
    for len in 1..w.len() / 2 + 1 {
        if done[len] {
            continue;
        }
        let mut start = len;
        while start + len <= w.len() && w[..len] == w[start..start + len] {
            badsp[start + len] = true;
            start += len;
        }
        let mut mul = len * 2;
        while mul <= std::cmp::min(w.len() / 2, start) {
            done[mul] = true;
            mul += len;
        }
    }
}

trait Gets { fn gets(&mut self) -> String; }
impl<T: std::io::BufRead> Gets for T {
    fn gets(&mut self) -> String { self.lines().next().unwrap().unwrap() } }


Measured memory_bytes: 4476
use std::io;
//use std::collections::HashMap;
//use std::collections::BinaryHeap;
//use std::collections::HashSet;
//use std::mem; // mem::swap(&mut x,&mut y);
//use std::cmp; // cmp::max,cmp::min

#[allow(dead_code)]
fn read_line() -> String{
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn read_charvec() -> Vec<char>{
    read_line().chars().collect()
}

#[allow(dead_code)]
fn read_ints() -> Vec<i64>{
    let s = read_line();
    let split:Vec<&str> = s.split(" ").collect();
    split.iter().map(|&x| x.to_string().parse().unwrap()).collect()
}

#[allow(dead_code)]
fn read_int() -> i64{
    read_ints()[0]
}

#[allow(dead_code)]
fn reverse(s: &String) -> String{
    s.chars().rev().collect::<String>()
}

#[allow(dead_code)]
fn read_lines(n:i64) -> Vec<String>{
    let mut xs = Vec::new();

    for _i in 0..n{
        xs.push(read_line());
    }

    xs
}

#[allow(dead_code)]
fn read_ints2(n:i64) -> Vec<i64>{
    read_lines(n).iter().map(|x| x.parse().unwrap()).collect()
}

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






fn solve()->i64{
    let xs = read_ints();
    let mut y = xs[0];
    let mut m = xs[1];
    let mut d = xs[2];
    let mut s = 0;

    while !(y==1000&&m==1&&d==1){
        let monthday = if m%2 == 1 || y%3==0{
            20
        }else{
            19
        };

        s += monthday - d + 1;
        m += 1;
        d = 1;

        if m == 11 {
            y += 1;
            m=1;
        }
    }

    s
}

fn main(){
    let n = read_int();

    for _i in 0..n{
        println!("{}",solve());
    }

}



/*
DOCS

///////////////// Vec関係 /////////////////

let v = vec![0;2]; // [0,0]
let sum_x = xs.iter().fold(0,|s,i|s+i); // xs : Vec<i64>

s.chars().nth(i as usize).unwrap();

let xs : Vec<i32> = read_charvec().iter().map(|&c| 
    if c == 'A'{
        0
    }else if c == 'B'{
        1
    }else if c == 'X'{
        2
    }else{
        3
    }
).collect();

// 検索
let i = match xs.iter().find(|&&m| m==0){
    Some(v) => true,
    None => false,
};

///////////////// ハッシュマップ /////////////////

let mut h = HashMap::new();
let a = 5;
h.insert(a,true);
match h.get(&a){
    Some(v) => println!("{}",v),
    None    => println!("none"),
}

///////////////// swap /////////////////

let mut x = 5;
let mut y = 1;
mem::swap(&mut x,&mut y);

///////////////// priority queue /////////////////

// https://doc.rust-lang.org/std/collections/struct.BinaryHeap.html
let mut heap = BinaryHeap::new();

heap.push(1);
heap.push(5);
heap.push(2);

assert_eq!(heap.pop(), Some(5));
assert_eq!(heap.pop(), Some(2));
assert_eq!(heap.pop(), Some(1));
assert_eq!(heap.pop(), None);

let mut vs = heap.into_vec();
vs.reverse();

*/



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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int ok[1010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	ok[0]=ok[1]=1;
	for(i=2;i<=1000;i++) {
		for(x=i*i;x<=1000;x*=i) ok[x]=1;
	}
	
	cin>>N;
	for(i=N;i>=0;i--) if(ok[i]) break;
	cout<<i<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout<<v<<endl;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;

ll gcd(ll a,ll b) {
    while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
    }
    return a;
}

map<ll, ll> prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

vector<ll> Eratosthenes( const ll N )
{
    std::vector<bool> is_prime( N + 1 );
    for( ll i = 0; i <= N; i++ )
    {
        is_prime[ i ] = true;
    }
    std::vector<ll> P;
    for( ll i = 2; i <= N; i++ )
    {
        if( is_prime[ i ] )
        {
            for( ll j = 2 * i; j <= N; j += i )
            {
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    return P;
}
int main(){
    ll N;
    cin >> N;
    vector<ll> A(N+1,0);
    for(ll i=0;i<N+1;i++)cin>>A[N-i];
    vl E=Eratosthenes(10001);
    ll e=E.size();
    set<ll>ans;
    for(ll i=0;i<e&&E[i]<=N;i++){
        ll p=E[i];
        vl B=A;
        if(A[0]%p!=0)continue;
        for(ll k=N;k>=p-1;k--){
            B[k-p+1]+=B[k];
            B[k]=0;
        }
        bool check=0;
        for(ll k=0;k<=N;k++){
            ll x=B[k];
            if(x%p!=0){check=1;break;}
        }
        if(!check)ans.insert(p);
    }

    ll L=abs(A[0]);
    for(ll i=1;i<=N;i++)L=gcd(L,abs(A[i]));
    Map M=prime_factor(L);
    for(auto p: M)ans.insert(p.first);
    for(auto p: ans)print(p)

    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main()
{
    int x,a,b,dis1,dis2;
    scanf("%d %d %d",&x,&a,&b);
    dis1=a-x;
    dis2=b-x;
    if(dis1<0)
        dis1=-1*dis1;
    if(dis2<0)
        dis2=-1*dis2;
    if(dis1<dis2)
       printf("A\n");
    else
        printf("B\n");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 1000000007
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=1001 ;
int main()
{
   fast ;
   ll h,n ;
   cin>>h>>n ;
  ll sum=0 ;
  for(ll i=0;i<n;i++)
  {
      ll x ;
      cin>>x ;
      sum+=x ;
  }
  if(sum>=h)
    cout<<"Yes"<<endl ;
  else
    cout<<"No"<<endl ;


}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<string.h>
#include<math.h>

using namespace std;

int main()
{
  int tab[5];
  for(int i=0;i<5;i++)
  {
    cin>>tab[i];
  }
for(int i=0;i<5;i++)
{
  if(tab[i]==0){
    cout<<i+1;
  }
}
return 0;
}


Measured memory_bytes: 3604
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

int main()
{
    string s;
    cin>>s;
    string str[3]={"Sunny","Cloudy","Rainy"};
    
    if(s==str[0])
     cout<<str[1]<<endl;
     
    if(s==str[1])
     cout<<str[2]<<endl;
     
    if(s==str[2])
     cout<<str[0]<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  dodecagon
//
//  Created by SZhang on 7/20/19.
//  Copyright © 2019 SZhang. All rights reserved.
//

#include <iostream>
using namespace std;

int main() {
    // insert code here...
    int n,d;
    cin>>n>>d;
    cout<<(n/(2*d+1)+(n/(2*d+1)*(2*d+1)==n ? 0:1))<<endl;
    return 0;
}


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

int binary_search(vector<int> a, int key) {
    int left = 0;
    int right = a.size();
    while (left < right) {
        int mid = (left+right) / 2;
        if (key == a.at(mid)) return mid;
        else if (key < a.at(mid))
            right = mid;
        else
            left = mid+1;
    }
    //cout << " " << key << endl;
    return -1;
}
int main() {
    int n; cin >> n;
    vector<int> s(n);
    rep(i, n) cin >> s.at(i);
    int q; cin >> q;
    vector<int> t(q);
    rep(i, q) cin >> t.at(i);

    int ans = 0;
    rep(i, q) {
        if (binary_search(s, t.at(i)) != -1) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3728
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	console.log(input[0][0]+input[1][1]+input[2][2]);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
import java.io.*;
import java.util.*;

public class Main {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static final PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    public static void main(String[] args) throws IOException {
        String s = br.readLine();

        int count = 0;
        if (s.charAt(1) == 'R')
            count = 1 + ((s.charAt(0) == 'R' ? 1 : 0)) + ((s.charAt(2) == 'R' ? 1 : 0));
        else
            count = ((s.charAt(0) == 'R' ? 1 : 0)) | ((s.charAt(2) == 'R' ? 1 : 0));

        pw.println(count);
        pw.close();
    }
}


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

int main()
{
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++)
  {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());

  int Alice = 0, Bob = 0;
  for (int i = 0; i < N; i++)
  {
    if (i % 2 == 0)
    {
      Alice += vec.at(i);
      continue;
    }
    Bob += vec.at(i);
  }

  cout << Alice - Bob << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    string s; cin >> s;
    sort(s.begin(), s.end());
    if (s == "abc") {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(char &c){
  int i;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
char A[102];
char B[102];
char C[102];
int As;
int Bs;
int Cs;
int main(){
  int t='a';
  As = rd(A);
  Bs = rd(B);
  Cs = rd(C);
  reverse(A, A+As);
  reverse(B, B+Bs);
  reverse(C, C+Cs);
  for(;;){
    if(t=='a' && As==0){
      wt_L('A');
      wt_L('\n');
      break;
    }
    if(t=='b' && Bs==0){
      wt_L('B');
      wt_L('\n');
      break;
    }
    if(t=='c' && Cs==0){
      wt_L('C');
      wt_L('\n');
      break;
    }
    if(t=='a'){
      t = A[--As];
      continue;
    }
    if(t=='b'){
      t = B[--Bs];
      continue;
    }
    if(t=='c'){
      t = C[--Cs];
      continue;
    }
  }
  return 0;
}
// cLay varsion 20190822-2

// --- original code ---
// char A[102], B[102], C[102];
// int As, Bs, Cs;
// {
//   int t = 'a';
//   rd(A@As, B@Bs, C@Cs);
//   reverse(A, A+As);
//   reverse(B, B+Bs);
//   reverse(C, C+Cs);
//   for(;;){
//     if(t=='a' && As==0) wt('A'), break;
//     if(t=='b' && Bs==0) wt('B'), break;
//     if(t=='c' && Cs==0) wt('C'), break;
//     if(t=='a') t = A[--As], continue;
//     if(t=='b') t = B[--Bs], continue;
//     if(t=='c') t = C[--Cs], continue;
//   }
// }


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll, ll> lltpl;



/******************************************************************************************/


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



template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}

struct Z_algorithm
{
	vector< int > prefix;

	void build(const string& s)
	{
		prefix.assign(s.size(), 0);
		for (int i = 1, j = 0; i < s.size(); i++) {
			if (i + prefix[i - j] < j + prefix[j]) {
				prefix[i] = prefix[i - j];
			}
			else {
				int k = max(0, j + prefix[j] - i);
				while (i + k < s.size() && s[k] == s[i + k]) ++k;
				prefix[i] = k;
				j = i;
			}
		}
		prefix[0] = (int)s.size();
	}

	int operator[](const int k) const
	{
		return (prefix[k]);
	}

	size_t size()
	{
		return(prefix.size());
	}
};


int main() {
	
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		string T = s.substr(i);

		Z_algorithm tapi;
		tapi.build(T);

		for (int j = 0; j < T.size(); j++)
		{
			ans = max(ans, min(tapi.prefix[j],j));
		}

	}

	cout << ans << endl;



}


Measured memory_bytes: 256
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;


using ll = long long;

//#define int ll

using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;



const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 6e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


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

int n, m, x, a[22][22], c[22], b[22], ans = -1;
main() {
  file("threesum");
  ios;
  cin >> n >> m >> x;
  fo(i, 1, n, 1) {
    cin >> c[i];
    fo(j, 1, m, 1) cin >> a[i][j];
  }
  for (int mask = 0; mask < (1 << n); ++mask) {
    int res = 0;
    fo(j, 1, m, 1) b[j] = 0;
    for (int i = 0; i < n; ++i) {
      if ((mask >> i) & 1) {
        res += c[i + 1];
        for (int j = 0; j < m; ++j) {
          b[j + 1] += a[i + 1][j + 1];
        }
      }
    }
    bool flag = 0;
    fo(j, 1, m, 1) flag |= (b[j] < x);
    if (!flag and (ans == -1 || ans > res)) ans = res;
  }
  cout << ans;
  return 0;
}
/**

*/


Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <map>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	string s; cin >> s;
	sort(s.begin(),s.end());
	if(s[0]==s[2]){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}
}

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

int main()
{   
    int N;
    cin>>N;
    int a[N];
    int ans=0;
    for(int i=0;i<N;i++){
        cin>>a[i];
        if(a[i]==a[i-1]){
            a[i]=10001;
            ans++;
        }
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
#define UM unordered_map
#define US unordered_set
#define ALL(a) (a).begin(),(a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 60);
typedef pair<ll,ll> pii;
typedef vector<pii> vpii;
const ll MOD=1000000007;
int main() {
  ll n,m; cin>>n>>m;
  vi a(n); REP(i,n) {cin>>a[i]; a[i]--;}
  vpii v(n-1);
  REP(i,n-1) {
    if(a[i]<a[i+1]) v[i]={a[i],a[i+1]};
    else v[i]={a[i],a[i+1]+m};
  }
  vi x(2*m),y(2*m),z(2*m),w(2*m);
  //dump(v);
  REP(i,n-1) {
    x[v[i].first+1]++;
    y[v[i].second]++;
    w[v[i].second]+=(v[i].second-v[i].first-1);
  }
  {
    ll cnt=0;
    REP(i,2*m) {
      cnt+=x[i]-y[i];
      z[i]=cnt;
    }
  }
  vi p(2*m+1);
  {
    p[0]=0;
    REP(i,2*m) {
      p[i+1]=p[i]+z[i]-w[i];
    }
  }
  vi k(m);
  REP(i,m) k[i]=p[i]+p[i+m];
  ll ma=0; for(ll i:k) ma=max(ma,i);
  //dump(ma);

  //dump(x);
  //dump(y);
  //dump(z);
  //dump(w);
  //dump(p);

  ll sum=0;
  REP(i,n-1) {
    if(a[i]<a[i+1]) sum+=a[i+1]-a[i];
    else sum+=a[i+1]-a[i]+m;
  }
  //dump(sum);
  cout<<sum-ma<<endl;
}


Measured memory_bytes: 11136
import sys
sys.setrecursionlimit(2 * 10 ** 5 + 10)

mod = 10 ** 9 + 7

N, *AB = map(int, open(0).read().split())

E = [[] for _ in range(N)]
for i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):
    E[a - 1].append((b - 1, i))
    E[b - 1].append((a - 1, i))

X = [0] * N

def dfs(u, p):
    res = 1
    for v, c in E[u]:
        if p != c:
            res += dfs(v, c)
    X[p] = res
    return res

dfs(0, -1)

I = [1] * (N + 1)
inv = pow(2, mod - 2, mod)
for i in range(N):
    I[i + 1] = I[i] * inv % mod

ans = - inv * N - I[N] + 1 + sum((1 - I[x]) * (1 - I[N - x]) for x in X)
ans %= mod

print(ans)

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

int main() {
  int N, A, B, C;
  cin >> N >> A;
  B = N / 500;
  C = B;
    if(N - C * 500<=A){
	  cout << "Yes" << endl;
  }
  else if(N - C * 500>A){
    cout << "No" << endl;
  }
}







Measured memory_bytes: 256
#sを読み取り昇順にする
s = input()
s_asc = ''.join(sorted(s))
#tを読み取り降順にする
t = input()
t_desc = ''.join(sorted(t, reverse = True))
#並べ替えた文字列を比較する
if s_asc < t_desc:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 2940
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
MOD = 10**9 + 7

n = int(input())

ret = pow(10, n, MOD)
ret -= pow(9, n, MOD)
ret -= pow(9, n, MOD)
ret += pow(8, n, MOD)

print(ret % MOD)

Measured memory_bytes: 61484
h, w = map(int, input().split())
field = []
ans = 0
white = 0
for i in range(h):
    t = list(input())
    white += t.count(".")
    field.append(t)

next_point = []
next_point_cand = []

start = (0, 0)
d = [(0, 1), (0, -1), (1, 0), (-1, 0)]
count = 1 
next_point.append(start)
field[0][0] = 0

while True:
    for (y, x) in next_point:
        for (dy, dx) in d:
            if 0 <= (x + dx) <= (w - 1) and 0 <= (y + dy) <= (h - 1):
                if field[y + dy][x + dx] == ".":
                    field[y + dy][x + dx] = count
                    next_point_cand.append((y + dy, x + dx))
    next_point.clear()
    next_point.extend(next_point_cand)
    next_point_cand.clear()
    count += 1

    if len(next_point) == 0:
        ans = -1
        break

    if (h - 1, w - 1) in next_point:
       ans = count 
       break


if ans == -1:
    print(-1)

else:
    print(white - count)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
using namespace std;
int min(int a, int b) {
  if (a <= b) {
    return a;
  } else {
    return b;
  }
}
int main() {
  string str1, str2;
  cin >> str1 >> str2;
  int m;
  for (m = 0; m < min(str1.length(), str2.length()); m++) {
    cout << str1[m] << str2[m];
  }
  if (str1.length() > str2.length()) {
    cout << str1[m] << endl;
  } else if (str1.length() < str2.length()) {
    cout << str2[m] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vc= vector<char>;
using vs= vector<string>;
#define REP(i,x,n) for(int i=x; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()

int main(){
  int n;
  ll ans=0;
  cin >> n;
  vs s(n);
  map<string, ll> mp;

  rep(i,n){//入力、ソート、カウント
    cin >> s[i];
    sort(all(s[i]));
    mp[s[i]]++;
  }
  
  for(auto p : mp){//カウント→ペア数
    ll n= p.second;
    ans+= n*(n-1)/2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 18176
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W, x, y, z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
typedef long long ll;
typedef pair<ll, ll> Pa;

class UnionFind {
public:
	vector <ll> par; // 各元の親を表す配列
	vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}

	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}
};

typedef pair<ll, Pa> edge;

vector<edge> edges;

int main() {
	cin >> V >> E;
	UnionFind tree(V);
	rep(i, E) {
		cin >> A >> B >> C;
		edges.push_back(edge(C, Pa(A, B)));
	}
	sort(edges.begin(), edges.end());
	ll sum = 0;
	rep(i, E) {
		if (!tree.issame(edges[i].second.first, edges[i].second.second)) {
			tree.merge(edges[i].second.first, edges[i].second.second);
			sum += edges[i].first;
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 6132
// #pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define Nmax 100001
#define INF (ll)1e18
#define pll pair<ll,ll>
#define mp make_pair
#define fi first
#define se second
#define vv vector
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(ll i=m;i<(n);i++)
#define repr(i,n) repr2(i,n,0)
#define repr2(i,m,n) for(ll i=m;i>=(n);i--)
#define get(n) ll (n); scanf("%lld",&(n));
#define get2(n,k) ll (n),(k); scanf("%lld%lld",&(n),&(k));
#define get3(n,m,k) ll (n),(m),(k); scanf("%lld%lld%lld",&(n),&(m),&(k));
#define gets(s) string (s); cin >> (s);
#define ALL(c) (c).begin(),(c).end()
#define fill_nums(A,n) vector<ll> A((n)); for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}
#define pi 3.1415926535897
#define noop

int main() {

    get(n);
    rep2(i,1,50001) {
        if(floor(i*1.08)==n) {
            printf("%lld\n", i);
            return 0;
        }
    }
    printf(":(\n");


    return 0;  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int main(){
	int a,b;
  cin>>a>>b;
  while(a!=0 && b!=0){
    rep(i,a){
      rep(i,b){
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
    cin>>a>>b;
  }
	
}


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

int main() {
    int N;
    string S;
    cin >> N >> S;
    int r = 0, b = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'R') r++;
        else b++;
    }
    if (r > b) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

typedef long long ll;

int main()
{
	string s, t, u;
	int a, b;
	cin >> s >> t >> a >> b >> u;
	if (s == u)a--;
	else b--;
	cout << a << " " << b;
	return 0;
}

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

const int MAXN = 2.1e5;
int N;
int A[MAXN];
int D[MAXN];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i <= N; i++) {
		D[i] = A[i+1] - A[i];
	}
	N++;

	using ll = long long;
	int ans = 0;
	// min amount of non-source-flow for ans+cost
	ll v0 = 0, v1 = 0; // v2 is 0
	for (int i = 0; i < N; i++) {
		// tot flow is A[i]
		int totFlow = A[i];
		if (D[i] == 0) {
			continue;
		} else if (D[i] > 0) {
			// automatically adds D[i], pay 1 to not add, pay 2 to make it 0
			ll nv0 = v0 + D[i];
			ll nv1 = min(v0, v1 + D[i]);
			v0 = nv0;
			v1 = nv1;
		} else if (D[i] < 0) {
			// pay nothing to charge D[i], pay 1 to decrease non-source-flow, pay 2 to make it 0
			ll v = -D[i];
			ll nv0 = ll(1e18);
			ll nv1 = max(0ll, v0 - v);
			if (totFlow - v1 >= v) {
				nv1 = min(nv1, v1);
			}
			if (totFlow - v0 >= v) {
				nv0 = v0;
			} else {
				// not feasible to keep
				ans++;
				nv0 = nv1;
				nv1 = 0;
			}
			v0 = nv0;
			v1 = nv1;
		} else assert(false);
	}
	cout << ans << '\n';

	return 0;
}

// +1 +1 -1 +1 -1 -1
// +2 -1 +1 -1 +1 -2


Measured memory_bytes: 1792