akhauriyash/Code-Regression huggingface dataset:
def LI():return list(map(int,input().split()))
def II():return int(input())
#def yes():return print("Yes")
#def no():return print("No")
#INF=float("inf")
from collections import deque, defaultdict, Counter
# from heapq import heappop, heappush
# from itertools import product, combinations
# from functools import reduce, lru_cache
# from math import pi, gcd
# from decimal import Decimal

# class Combination:
#     """
#     O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
#     n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
#     使用例：
#     comb = Combination(1000000)
#     print(comb(5, 3))  # 10
#     """
#     def __init__(self, n_max, mod=10**9+7):
#         self.mod = mod
#         self.modinv = self.make_modinv_list(n_max)
#         self.fac, self.facinv = self.make_factorial_list(n_max)

#     def __call__(self, n, r):
#         return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

#     def make_factorial_list(self, n):
#         # 階乗のリストと階乗のmod逆元のリストを返す O(n)
#         # self.make_modinv_list()が先に実行されている必要がある
#         fac = [1]
#         facinv = [1]
#         for i in range(1, n+1):
#             fac.append(fac[i-1] * i % self.mod)
#             facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
#         return fac, facinv

#     def make_modinv_list(self, n):
#         # 0からnまでのmod逆元のリストを返す O(n)
#         modinv = [0] * (n+1)
#         modinv[1] = 1
#         for i in range(2, n+1):
#             modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
#         return modinv

# class Unionfind:
#     def __init__(self, N):
#         self.p = list(range(N))
#         self.rank = [0] * N
#         self.size = [1] * N

#     def root(self, x):
#         if self.p[x] != x:
#             self.p[x] = self.root(self.p[x])

#         return self.p[x]

#     def same(self, x, y):
#         return self.root(x) == self.root(y)

#     def unite(self, x, y):
#         u = self.root(x)
#         v = self.root(y)

#         if u == v: return

#         if self.rank[u] < self.rank[v]:
#             self.p[u] = v
#             self.size[v] += self.size[u]
#             self.size[u] = 0
#         else:
#             self.p[v] = u
#             self.size[u] += self.size[v]
#             self.size[v] = 0

#             if self.rank[u] == self.rank[v]:
#                 self.rank[u] += 1

#     def count(self, x):
#         return self.size[self.root(x)]

n=II()
a=LI()
b=LI()
c=b[::-1]
bb=deque(b)
ac=Counter(a)
bc=Counter(b)

for i in range(n):
    if ac[i]+bc[i]>n:
        print("No")
        exit()
        
# bd=bc.most_common()

# ans=[-1]*n

import time
# import random
t1=time.time()
for i in range(10000000):
    if time.time()-t1>1.5:
        print("No")
        exit()        
    tmp=bb.popleft()
    bb.append(tmp)
    if any(d==e for d,e in zip(a,bb)):
        continue
    print("Yes")
    print(*bb)
    exit()


Measured memory_bytes: 171600
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
#define INF ( 1 << 30 )
#define fr first
#define sc second
typedef pair < int , int > Pi;
typedef pair < Pi , Pi > Pii;
const int dy[] = { 0, 1, -1, 0}, dx[] = { 1, 0, 0, -1};
int h, w, Sx, Sy, Gx, Gy;
vector< Pi > hoge[5];
int dp[1000][1000], num;
char c;
int dis(Pi x1,Pi x2){
  return abs(x1.fr - x2.fr) + abs(x1.sc - x2.sc);
}
int rec(int now,int y, int x){
  if(dp[y][x] != -1) return dp[y][x];
  int ret = INF, next = ( now + 1 ) % 5;
  if(now == num) ret = dis(Pi(y,x),Pi(Gy,Gx));
  else for(int i = 0 ; i < hoge[next].size() ; i++ ){
    ret = min( ret, rec( next, hoge[next][i].fr, hoge[next][i].sc) + dis(Pi(y,x),hoge[next][i]));
  }
  return dp[y][x] = ret;
}
int main(){
  while(cin >> w >> h , w){
    for(int i = 0 ; i < 5 ; i++ ) hoge[i].clear();
    for(int i = 0 ; i < h ; i++ ){
      for(int j = 0 ; j < w ; j++ ){
        cin >> c;
        if(c == 'S') Sy = i, Sx = j;
        else if(c == 'G') Gy = i, Gx = j;
        else if(c != '.') hoge[c-'1'].push_back(Pi(i,j));
      }
    }
    Pi ret = Pi(INF,INF);
    for(int i = 0 ; i < 5 ; i++ ){
        for(int k = 0 ; k < h ; k++ )
          for(int l = 0 ; l < w ; l++ ) dp[k][l] = -1;
      num = ( i + 4 ) % 5;
      ret = min( ret, Pi( rec( i, Sy, Sx), i + 1));
    }
    if( ret.fr == INF ) cout << "NA" << endl;
    else cout << ret.sc << " " << ret.fr << endl;
  }
}

Measured memory_bytes: 5148
// D - I hate Factorization
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
	ll X; cin>>X;
	for(ll a=-119; a<=119; ++a)
		for(ll b=-118; b<=118; ++b)
			if(pow(a,5) - pow(b,5) == X){ cout<<a<<" "<<b<<endl; return 0; }
}


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

int main(){
    int r,c;
    int num;
    cin >> r >> c;
    int table[r+1][c+1];
    int i,j;
    for(i=0;i<r;i++){
        for(j=0;j<c;j++){
            cin >> table[i][j];
        }
    }
    int total;
    total = 0;
    for(i=0;i<r;i++){// 縦について
        num = 0;
        for(j=0;j<c;j++){
            num = num + table[i][j];
        }
        total = total + num;
        table[i][c]=num;
    }
    for(j=0;j<c;j++){
        num=0;
        for(i=0;i<r;i++){
            num = num  + table[i][j];
        }
        table[r][j]=num;
        total = total + num;
    }
    
    table[r][c] = (total/2);
    
    for(i=0;i<r+1;i++){
        for(j=0;j<c+1;j++){
            if((i<r+1)and(j<c)){
                cout << table[i][j] << " ";
            } 
            else if(j=c){
                cout << table[i][j] << endl;
            }
            
        }
    }
}


Measured memory_bytes: 3132
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>

typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n;i>s;i--)
#define rep_re(i,s,n)for(ll i = n;i>=s;i--)
using namespace std;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_N = 100001;

int main() {
	string x; cin >> x;
	ll k; cin >> k;

	bool ok = true;
	rep(i, 1, x.size()) ok &= x[i] == x[i - 1];
	if (ok) {
		cout << x.size()*k / 2 << endl;
		return 0;
	}
	if (x[0] != x[x.size() - 1]) {
		ll ans = 0;
		string s = x;
		rep(i, 0, s.size()) {
			if (s[i] == s[i + 1]) {
				s[i + 1] = '.';
				ans++;
			}
		}
		cout << ans * k << endl;
		return 0;
	}

	ll i = 0;
	while (x[i] == x[i + 1])i++;

	ll j = x.size() - 1;
	while (x[j] == x[j - 1])j--;
	i++;
	j = x.size() - j;

	ll ans = ((i + j)/2) *(k - 1);
	ans += i / 2;
	ans += j / 2;

	string s = x;
	ll ans_b = 0;
	rep(p, i, s.size() - j) {
		if (s[p] == s[p + 1]) {
			s[p + 1] = '.';
			ans_b++;
		}
	}
	ans += ans_b * k;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

int main(void) {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    while (1) {
        C -= B;
        if (C <= 0) {
            cout << "Yes" << endl;
            break;
        }

        A -= D;
        if (A <= 0) {
            cout << "No" << endl;
            break;
        }
    }

    return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = input[0];
            int a = input[1];
            int b = input[2];
            int sum = 0;
            int total = 0;
            int num = 0;

            for (int i = 1; i <= n; i++)
            {
                total = 0;
                num = i;

                for (int j = 0; j < 5; j++)
                {
                    total += num % 10;
                    num /= 10;
                }

                if ((a <= total) && (total <= b))
                {
                    sum += i;
                }
            }

            Console.WriteLine(sum);
        }
    }
}



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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { cout << p.first << ' ' << p.second; return os; }

void solve() {
  int N, M, R; cin >> N >> M >> R;
  vi32 r(R); cin >> r;
  rep(i, R) r[i]--;
  vector<vi32> dist(N, vi32(N, 1e9));
  rep(i, N) dist[i][i] = 0;
  rep(i, M) {
    int a, b, c; cin >> a >> b >> c;
    a--, b--;
    dist[a][b] = dist[b][a] = c;
  }

  rep(k, N) rep(i, N) rep(j, N) amin(dist[i][j], dist[i][k] + dist[k][j]);

  int ans = 1e9;
  sort(all(r));
  do {
    int sum = 0;
    rep(i, R - 1) {
      sum += dist[r[i]][r[i + 1]];
    }
    amin(ans, sum);
  } while (next_permutation(all(r)));

  cout << ans << '\n';
}


Measured memory_bytes: 384
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()

ans = 0
if n % 2 == 1:
    ans = 0
else:
    div = 10
    while div <= n:
        ans += n // div
        div *= 5

print(ans)

Measured memory_bytes: 31056
#define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <memory.h>
#include <set>
#include <ctime>
#include <map>
#include <cstring>
#include <iterator>
#include <queue>
#include <assert.h>
#include <bitset>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <functional>

//#pragma comment(linker, "/STACK:512000000")

using namespace std;

#define pb emplace_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define forab(i, a, b) for (int i = (a); i < (b); ++i)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int infi = 1e9 + 7;
const ll infl = (ll)1e18 + (ll)7;

const string k = "keyence";

int32_t main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    //srand(time(NULL));
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    //freopen("customs.in", "r", stdin); freopen("customs.out", "w", stdout);
    string s;
    cin >> s;
    int n = s.size();
    if (s == k) {
        cout << "YES";
        return 0;
    }
    for (int i = 0; i < n; ++i) {
        for (int j = i; j < n; ++j) {
            string tmp = s;
            tmp.erase(i, j - i + 1);
            if (k == tmp) {
                cout << "YES";
                return 0;
            }
        }
    }
    cout << "NO";


    return 0;
}

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

int main()
{
  int A,B;
  cin >> A >> B;
  if(A>=1 and A<=9){
    if(B>=1 and B<=9){
      A = A*B;
      cout << A << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

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

int main(){
  int n;cin>>n;bool f=0;
  if(n/100==7) f=1;
  if((n/10)%10==7) f=1;
  if(n%10==7) f=1;

  cout<<(f?"Yes":"No");
}


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

int memo[101][4][4];
int N, K;
int A, B;
int plan[101];

int rec(int d, int y, int a){
	if(d == N + 1)return 1;
	if(memo[d][y][a] != -1)return memo[d][y][a];
	
	if(plan[d] != 0){
		if(a == y && y == plan[d]){
			return 0;
		}
		else {
			return rec(d + 1, plan[d], y) % 10000;
		}
	}
	
	int best = 0;
	for(int next = 1; next <= 3; next++){
		if(a == y && y == next){
			continue;
		}
		else{
			best += rec(d + 1, next, y) % 10000;
		}
	}
	
	return memo[d][y][a] = best % 10000;
}

int main() {
	for(int i = 0; i <= 100; i++)
		for(int j = 0; j < 4; j++)
			for(int k = 0; k < 4; k++)
				memo[i][j][k] = -1;
				
	cin >> N >> K;
	
	for(int i = 0; i < K; i++){
		cin >> A >> B;
		plan[A] = B;
	}
		
	
	cout << rec(1, 0, 0) << endl;
	
	return 0;
}

Measured memory_bytes: 1168
N,M=list(map(int,input().split()))
l=[[] for i in range(N)]
l_c=[0 for i in range(N)]
for i in range(M):
   a,b=list(map(int,input().split()))
   a-=1;b-=1
   l[a].append(b)
   l[b].append(a)
from collections import deque
def search(start):
   cnt=1
   que=deque([start])
   l_c[start]=1
   while que:
      A=que.popleft()
      for i in l[A]:
         if l_c[i]==0:
            cnt+=1
            l_c[i]=1
            que.append(i)
   return cnt
ans=0
for i in range(N):
   if l_c[i] ==0:
      ans=max(ans,search(i))
print(ans)

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

int main() {
  int N;
  cin>>N;
  long H[N];
  for (int i = 0; i < N;i++) cin>>H[i];
  std::vector<int> S;
  S.resize(N);
  S[N-1] = 0;

  for (int i = N-1; i >=1;i--) {
    if (H[i-1]>=H[i]) S[i-1] = S[i] +1;
    else S[i-1] = 0;
  }

  int ans = *std::max_element(S.begin(),S.end());
  cout<<ans<<endl;


  return 0;
}

Measured memory_bytes: 1408
def myAnswer(N:int,M:int,A:list,B:list) -> int:
   dic = {key:[] for key in range(1,N+1)}
   for a,b in zip(A,B):
      dic[a].append(b)
   for i in dic[1]:
      for value in dic[i]:
         if(N == value):
            return "POSSIBLE"
   else:
      return "IMPOSSIBLE"

def modelAnswer():
   return
def main():
   N,M = map(int,input().split())
   A = []
   B = []
   for _ in range(M):
      a,b = map(int,input().split())
      A.append(a)
      B.append(b)
   print(myAnswer(N,M,A[:],B[:]))
if __name__ == '__main__':
   main()

Measured memory_bytes: 58632
#include <iostream>
#include <cstdint>
#include <cmath>

int main()
{
	std::uint32_t n;
	std::cin >> n;
	for (std::uint32_t i = 0; i < n; ++i) {
		double x_a, y_a, r_a, x_b, y_b, r_b;
		std::cin >> x_a >> y_a >> r_a >> x_b >> y_b >> r_b;
		double const dist = std::hypot(x_a - x_b, y_a - y_b);
		if (dist + r_b < r_a) {
			std::cout << 2 << std::endl;
		}
		else if (dist + r_a < r_b) {
			std::cout << -2 << std::endl;
		}
		else if (dist <= r_a + r_b) {
			std::cout << 1 << std::endl;
		}
		else {
			std::cout << 0 << std::endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1244
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long dump=0; dump<n; ++dump) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	ll ret=0;
	REP(i,n) {
		ll l,r;
		cin>>l>>r;
		ret+=(r-l+1);
	}
	cout<<ret<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
vector<int> to[100010];
vector<int> ans(100010,-1);
void bfs(){
	queue<int> qi;
	qi.push(0);
	while(!qi.empty()){
		int x = qi.front();
		qi.pop();
		for(auto u : to[x]){
			if(ans[u]==-1){
				ans[u] = x;
				qi.push(u);
			}
		}
	}
}
int main(){
	cout << fixed << setprecision(10);
	int n,m;
	cin >> n >> m;
	rep(i,m){
		int a,b;
		cin  >> a >> b;
		a--;b--;
		to[a].push_back(b);
		to[b].push_back(a);
	}
	bfs();
	cout << "Yes" << endl;
	for(int i = 1;i < n; i++){
		cout << ans[i]+1 << endl;
	}
	return 0;
}

Measured memory_bytes: 10148
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

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

ll euler_phi(ll n) {
  ll ret = n;
  for(ll i = 2; i * i <= n; i++) {
    if(n % i == 0) {
      ret -= ret / i;
      while(n % i == 0) n /= i;
    }
  }
  if(n > 1) ret -= ret / n;
  return ret;
}

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n;
  cin >> n;
  cout << euler_phi(n) << endl;
}



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

int main() {
  int N;
  cin >> N;
  
  for ( int m=0; m < N; m++ ) {
    
    string S;
    cin >> S;
    if ( S == "Y" ) {
      cout << "Four" << endl;
      break;
    }
    else if ( m == N - 1 ) {
    cout << "Three" << endl;
    }
  }
}
    
  
  


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

int main(void)
{
	int N, M;
	cin >> N >> M;
	int K = M / N;
	for (int i = K; i >= 1; i--){
		if (M % i == 0){
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n,m;
  cin >> n >> m;
  if (n == 1 || m == 1) {
    if (n == 1 && m == 1) {
      cout << 1;
    } else if (n == 1) {
      cout << m - 2;
    } else {
      cout << n - 2;
    }
  } else {
    cout << (n - 2) * (m - 2);
  }
}

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

namespace ALDS1_2_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int flag = 1;
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int s = 0;
            int l = 0;
            while (flag == 1)
            {
                flag = 0;
                for (int i = n-1; i > 0; i--)
                {
                    if (a[i] < a[i - 1])
                    {
                        s = a[i];
                        a[i] = a[i - 1];
                        a[i - 1] = s;
                        flag = 1;
                        l++;
                    }
                }
            }
            for (int i = 0; i < n-1; i++)
            {
                Console.Write(a[i]+" ");
            }
            Console.WriteLine(a[n - 1]);
            Console.WriteLine(l);
        }
    }
}



Measured memory_bytes: 18312
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define pb push_back
#define mod 1000000007
#define inf 10000000007
#define ff first
#define ss second
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main()
{
    IOS
    int n,m,x,y;
    cin>>n>>m>>x>>y;
    int a[n],b[m];
    for(int i=0;i<n;i++)
    	cin>>a[i];
    for(int i=0;i<m;i++)
    	cin>>b[i];
    sort(a,a+n);
    sort(b,b+m);
    int l = a[n-1],r = b[0];
    if(l>=r)
    {
    	cout<<"War";
    	return 0;
    }
    for(int i=l+1;i<=r;i++)
    {
    	if(x<i && i<=y)
    	{
    		cout<<"No War";
    		return 0;
    	}
    }
    cout<<"War";
    return 0;

}


Measured memory_bytes: 256
import java.util.PriorityQueue
import kotlin.comparisons.compareByDescending
fun main(args: Array<String>) {
    var (N, M) = listOfInt()
    val A = listOfLong()
    val Q = PriorityQueue<Long>(N, compareByDescending { it })
    A.forEach { Q.add(it) }
    repeat (M) {
        val e = Q.poll()!!
        Q.add(e / 2)
    }
    var ans = 0L
    while (Q.size > 0) {
        ans += Q.poll()!!
    }
    println(ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }
fun listOfLong(delta: Long = 0L) = listOfString().map { java.lang.Long.parseLong(it) + delta }


Measured memory_bytes: 71888
# A=gets.to_i
# B=gets.split.map(&:to_i)
# C=N.times.map{gets.to_i}
# D=N.times.map{gets.split.map(&:to_i)}
# S=gets.chomp

MOD=1000000007
N,M=gets.split.map(&:to_i)
A=M.times.map{gets.to_i}

DP=Array.new(N+2,0)

DP[0]=1

N.times do |i|
  if A[1]!=i && A[0]!=i
    DP[i+2]=(DP[i+2]+DP[i])%MOD
  end
  if A[0]!=i
    DP[i+1]=(DP[i+1]+DP[i])%MOD
  end
  if A[0]==i
    A.shift
  end
end
puts DP[N]

Measured memory_bytes: 4020
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>

#define lowbit(x) (x&(-x))
#define MAX(a,b) (a<b?b:a)
#define MIN(a,b) (a<b?a:b)
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int N = 1e7;
const int maxn = 2e3 + 5;
ll mod = 1e9 + 7;

struct Edge
{
	int u, v, nxt;
	Edge(int _u = 0, int _v = 0, int _nxt = 0)
	{
		u = _u;
		v = _v;
		nxt = _nxt;
	}
}edg[maxn<<1];

int n, k;
int g[maxn], ecnt;

queue<int> q;
int vis[maxn], d[maxn];
int bfs()
{
	int cnt = 0;
	int u;
	while (!q.empty())
	{
		u = q.front(); q.pop();
		for (int i = g[u]; ~i; i = edg[i].nxt)
		{
			int &v = edg[i].v;
			if (!vis[v])
			{
				d[v] = d[u] + 1;
				vis[v] = 1;
				if(d[v] > k / 2) ++cnt;
				q.push(v);
			}
		}
	}
	return cnt;
}

int main()
{
	memset(g, ecnt = -1, sizeof(g));
	scanf("%d%d", &n, &k);
	for (int i = 1; i < n; i++)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		edg[++ecnt] = Edge(u, v, g[u]); g[u] = ecnt;
		edg[++ecnt] = Edge(v, u, g[v]); g[v] = ecnt;
	}

	int ans = n;
	if (k & 1)
	{
		for (int i = 0; i <= ecnt; i+=2)
		{
			memset(vis, 0, sizeof(vis));
			q.push(edg[i].u); q.push(edg[i].v);
			d[edg[i].u] = d[edg[i].v] = 0;
			vis[edg[i].u] = vis[edg[i].v] = 1;
			ans = min(ans, bfs());
		}
	}
	else
	{
		for (int i = 1; i <= n; i++)
		{
			memset(vis, 0, sizeof(vis));
			q.push(i);
			d[i] = 0; vis[i] = 1;
			ans = min(ans, bfs());
		}
	}
	printf("%d", ans);
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n, k;
    cin >> n >> k;

    vl h(n);
    rep(i, n) {
        cin >> h[i];
    }
    sort(rall(h));
    
    ll ans = INF;
    rep(i, n-k+1) {
        chmin(ans, h[i] - h[i+k-1]);
    }

    out(ans);
    re0;
}

Measured memory_bytes: 1024
//#define _XCODE_DEBUG

#include <iostream>
#include <vector>

#ifdef _XCODE_DEBUG
    #include <fstream>
#endif

using ll = long long;


int main() {
    #ifdef _XCODE_DEBUG
        std::ifstream in("input.txt");
        std::cin.rdbuf(in.rdbuf());
    #endif
    
    ll N, K;
    std::cin >> N >> K;
    ll remainder = N % K;
    ll ans = std::min(remainder, std::abs(remainder-K));
    std::cout << ans << "\n";
    
    return 0;
}

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

int main() {
	int N;
	int K;
	int r;

	r = 0;
	cin >> N >> K;
	for (int i = 0; i < N; i++)
	{
		int x;
		int b;

		cin >> x;
		if (x > K)
			b = x - K;
		else
			b = K - x;
		if (x < b)
			r += x * 2;
		else
			r += b * 2;
	}
	cout << r << endl;
}


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

int n;
int a[212345];

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  cin >> n;
  for(int i = 0; i < n; i++) cin >> a[i];
  vector<int> ord(n);
  iota((ord).begin(), (ord).end(), 0);
  sort((ord).begin(), (ord).end(), [&](int x, int y) { return a[x] > a[y]; });
  int T = 0, f = 0;
  int last = ord[0];
  for(int i = 1; i < n; i++) {
    if(T > 0) {
      // ord[i] , ord[i + 1], f
      vector<int> v{ord[i], ord[i - 1], f};
      for(int t = 0; t < 3; t++) {
        tie(v[0], v[1], v[2]) = make_tuple(v[1], v[2], v[0]);
        if(v[0] < v[1] && v[1] < v[2]) break;
        if(v[0] > v[1] && v[1] > v[2]) {
          f = ord[i - 1];
          T++;
          break;
        }
      }
    } else {
      if(ord[i] < last);
      else T = 1, f = last;
      last = ord[i];
    }
  }
  cout << T << endl;
  return 0;
}


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

int main()
{
  
  #ifndef ONLINE_JUDGE
freopen("finput.txt", "r", stdin);
freopen("foutput.txt", "w", stdout);
#else
// online submission
#endif
ll n,k;
cin>>n>>k;
ll arr[n];
for(ll i=0;i<n;i++)
{
	cin>>arr[i];

}
ll i=1;
for(ll j=k;j<n;j++)
{
	if(arr[j]>arr[i-1])
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;

	}
	i++;
}









}


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

const char s[] = {'R', 'Y', 'G', 'B'};

int n, m, d;
int a[505][505], b[505][505];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m >> d;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			int sum = i + j;
			sum /= d;
			if (sum & 1) a[i][j] = 1;
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			int dif = i - j;
			if (dif >= 0) dif /= d;
			else if (dif < 0) {
				if (dif % d == 0) dif /= d; else dif = dif / d - 1;
			}
			if (dif & 1) b[i][j] = 1;
		}
	}

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			int cur = 2 * a[i][j] + b[i][j];
			cout << s[cur];
		}
		cout << endl;
	}
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> v(n + 1, vector<int>(0));
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    vector<int> res(n + 1, -1);
    vector<int> v1, v2;
    v1.push_back(1);
    while (v1.size() > 0) {
        v2.clear();
        for (auto node : v1) {
            for (auto next : v[node]) {
                if (res[next] != -1) continue;
                res[next] = node;
                v2.push_back(next);
            }
        }
        v1 = v2;
    }
    for (int i = 2; i <= n; i++) {
        if (res[i] == -1) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for (int i = 2; i <= n; i++) {
        cout << res[i] << endl;
    }
}


Measured memory_bytes: 10512
N = int(input())
C = [int(input()) for _ in range(N)]

dp = [0 for _ in range(N)]
dp[0] = 1

MOD = 10**9 + 7

r = [-1 for _ in range(N)]
prev = [-1 for _ in range(max(C) + 1)]

for i in range(N):
    if prev[C[i]] != -1 and prev[C[i]] + 1 != i:
        r[prev[C[i]]] = i
    prev[C[i]] = i

for i in range(N - 1):
    if r[i] != -1:
        dp[r[i]] += dp[i]
        dp[r[i]] %= MOD
    dp[i + 1] += dp[i]
    dp[i + 1] %= MOD

print(dp[N-1] % MOD)


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

ll mod=1e9+7;

ll mpow(ll x, ll n) {
  ll ans=1;
  while(n>0) {
    if(n&1) {
      ans=ans*x%13;
    }
    x=x*x%13;
    n>>=1;
  }
  return ans;
}

int main() {
  string s;
  cin >> s;
  ll n=s.size();
  vector<vector<ll>> dp(n+1,vector<ll>(13));
  dp[0][0]=1;
  for(ll i=0;i<n;i++) {
    for(ll j=0;j<13;j++) {
      if(s[n-i-1]=='?') {
        for(ll k=0;k<10;k++) {
          ll temp=k*mpow(10,i);
          dp[i+1][(j+temp)%13]+=dp[i][j];
          dp[i+1][(j+temp)%13]%=mod;
        }
      }
      else {
        ll temp=int(s[n-i-1]-'0')*mpow(10,i)%13;
        dp[i+1][(j+temp)%13]+=dp[i][j];
        dp[i+1][(j+temp)%13]%=mod;
      }
    }
  }
  cout << dp[n][5] << endl;
}

Measured memory_bytes: 13696
#include <stdio.h>
int main(){
  int a, b;
  scanf("%d%d", &a, &b);
  int ans = -1;
  for(int i=1;i<=1000;i++){
    if (i * 2 / 25 == a && i / 10 == b) {
      ans = i;
      break;
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
int main(void){
    int a,b,c,d,e;
    e=0;
    scanf("%d %d %d\n",&a,&b,&c);
    for(d=a;d<=b;d++){
        if(c%d==0){
            e++;
        }
    }
    printf("%d\n",e);
    
    return 0;
}


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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define N             (int)(1e6+5)
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int solve(){
    string s,t; cin>>s>>t;
    cout<<t<<s;
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}


Measured memory_bytes: 256
// @author :: Amirul Islam 

#include <bits/stdc++.h>
using namespace std;
#define LLI long long int

const int mx = 1e5;
const double pi = acos(-1.0);

int main() {
    // freopen("in", "r", stdin);
    
    string n;
    while (cin >> n && n != "0") {
        int sum = 0;
        for (int i = 0; i < n.size(); i++) sum += (n[i] - '0');
        cout << sum << endl;
    }
}


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <sstream>

using namespace std;

int main(int argc, char *argv[]) {
  int a, b;
  vector<int> result;
  stringstream ss;

  while (true) {
    cin >> a >> b;
    if (cin.eof())
      break;
    result.push_back(a+b);
    cin.clear();
  }
  for (int i = 0; i < result.size(); i++) {
    ss << result[i];
    cout << ss.str().size() << endl;
    ss.str("");
  }
}

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

int main(){
  vector<string> seq(3);
  cin >> seq[0] >> seq[1] >> seq[2];
  
  vector<int> ct(3,0);
  int turn=0;
  
  while(1){
    if(seq[turn][ct[turn]]=='a'){
      ct[turn]++;
      turn=0;
      if(ct[0]==seq[0].size()){
        cout << "A" << endl;
        return 0;
      }
    }else if(seq[turn][ct[turn]]=='b'){
      ct[turn]++;
      turn=1;
      if(ct[1]==seq[1].size()){
        cout << "B" << endl;
        return 0;
      }
    }else{
      ct[turn]++;
      turn=2;
      if(ct[2]==seq[2].size()){
        cout << "C" << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,M,P=map(int,input().split())
    edge=[]
    for _ in range(M):
        A,B,C=map(int1,input().split())
        C+=1
        edge.append((A,B,P-C))
    d=[INF]*N
    d[0]=0
    f=False
    for i in range(N*2):
        for a,b,c in edge:
            if d[b]>d[a]+c:
                if i<N-1:
                    d[b]=d[a]+c
                else:
                    if d[a]<10**17:
                        d[b]=-INF
                    if b==N-1:
                        f=True
    if f:
        print(-1)
    else:
        print(max(-d[N-1],0))

if __name__ == '__main__':
    main()


Measured memory_bytes: 41328
#include<stdio.h>
int main(){
  int a,b;
  scanf("%d %d",&a,&b);
  int gt=0;
  for(int i=0;i<2;i++){
  if(a>=b){
    gt+=a--;
  }else{
    gt+=b--;
  }
  }
  printf("%d\n",gt);
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

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

  int A, B, C, D;
  cin >> A >> B >> C >> D;

  int ans = min(A, B) + min(C, D);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    m: usize,
  }

  if m == n {
    puts!("Yes\n");
  } else {
    puts!("No\n");
  }
}


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

using namespace std;

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

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

struct F{
  ld x;
  ld y;
  bool operator< (const F &R) const {
    return atan2(x,y) < atan2(R.x, R.y);
  }
};

int main(){
  fastIO;
  int n;
  cin >> n;
  vector<F> ps(n);
  for(int i = 0 ; i < n ; i ++ ){
    cin >> ps[i].x >> ps[i].y;
  }
  sort(ps.begin(), ps.end());
  ld ans = 0;
  ld cx, cy;
  for(int i = 0 ; i < n; i ++ ){
    cx = 0, cy = 0;
    for(int j = 0 ; j < n; j ++ ){
      cx += ps[(i+j)%n].x;
      cy += ps[(i+j)%n].y;
      ans = max(ans, cx * cx + cy * cy);
    }
  }
  cout << fixed << setprecision(15) << sqrt(ans) << "\n";
  return 0;
}

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

namespace abc107_d
{
	class Program
	{
		static void Main(string[] args)
		{
			int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
			long[,] dp = new long[x[0], x[0]];
			for (int i = 0; i < x[1]; i++)
			{
				int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
				a[0]--; a[1]--;
				dp[a[0], a[1]]++;
			}
			for (int i = 1; i < x[0]; i++)//len
			{
				for (int j = 0; j < x[0] - i; j++)//start
				{
					dp[j, j + i] += dp[j, j + (i - 1)] + dp[j + 1, j + i] - dp[j + 1, j + (i - 1)];
				}
			}
			for (int i = 0; i < x[2]; i++)
			{
				int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
				Console.WriteLine(dp[a[0] - 1, a[1] - 1]);
			}
		}
	}
}

Measured memory_bytes: 19704
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<string> S(N);
  vector<int> T(N);
  rep(i, N) { cin >> S[i] >> T[i]; }
  string X;
  cin >> X;
  int idx = 0;
  for (auto s : S) {
    idx++;
    if (X == s) break;
  }
  int ans = 0;
  for (int i = idx; i < N; ++i) {
    ans += T[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
a, b = list(map(int,input().split()))
x = input()
if not (x[0:a].isdigit()) & (len(x[0:a]) == a):
    print('No')
    sys.exit()
if x[a] != '-':
    print('No')
    sys.exit()
if not (x[a+1:a+1+b].isdigit()) & (len(x[a+1:a+1+b]) == b):
    print('No')
    sys.exit()
print('Yes')

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

#define int long long int
#define ff first
#define ss second
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int mod = 1e9 + 7;
const int cmod = 998244353;
const int N = 2e5 + 5;
const int inf = 1e16 + 2;


void solve(int Case) {
    int a;
    cin >> a;
    cout << a + a*a + a*a*(a) << '\n';
}
/*
 */

int32_t main()
{
    fastio
    int testcase = 1;
    //cin >> testcase;
    int Case = 1;
    while(testcase --) {
        solve(Case ++);
    }
    return 0;
}
 



Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[4],i,j;
    int sum=0;
    for(i=0;i<3;i++)
        cin>>a[i];
    sort(a,a+3);
    for(i=0;i<2;i++)
        sum+=a[i];
    cout<<sum<<endl;




    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, j, n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;
 
typedef long long i64;
typedef pair<int, int> pi;
 
template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcm(i64 n, i64 m) {return (n / gcd(n, m) * m);}

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

  int d;
  cin >> d;
  switch(d) {
    case 22 : cout << "Christmas Eve Eve Eve"; break;
    case 23 : cout << "Christmas Eve Eve"; break;
    case 24 : cout << "Christmas Eve"; break;
    case 25 : cout << "Christmas"; break;
  }
  cout << endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A01Matrix solver = new A01Matrix();
        solver.solve(1, in, out);
        out.close();
    }

    static class A01Matrix {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int h = in.nextInt();
            int w = in.nextInt();
            int a = in.nextInt();
            int b = in.nextInt();
            int ans[][] = new int[h][w];
            for (int i = 0; i < b; i++) {
                for (int j = 0; j < a; j++) {
                    ans[i][j] = 1;
                }
            }
            for (int i = b; i < h; i++) {
                for (int j = a; j < w; j++) {
                    ans[i][j] = 1;
                }
            }
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++)
                    out.print(ans[i][j]);
                out.println();
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 46800
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	long double t, x;
	cin >> t >> x;

	printf("%.5Lf\n", t / x);


}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){int N;string S;cin >> N >> S;for(int i=0;i<S.length();i++){if(S[i]+N > 90){cout << (char)(S[i]+N - 90 +64);}else{cout << (char)(S[i]+N);}}return 0;}


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

int main(){
  int k=0;
  for(int i=0;i<3;i++){
    int a;
    cin >> a;
    k+=a;
  }
  if(k>=22)
    cout << "bust" << endl;
  else
    cout << "win" << endl;
}

Measured memory_bytes: 256