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

using namespace std;

bool check(vector< vector< int > > vv){
		for (int i = 0; i <= 20; i++){
				for (int j = 0; j <= 20; j++){
						if (vv[i][j] ) return false;
				}
		}
		return true;
}

int main(){
		while(1){
				int n; cin >> n;
				if (n == 0) break;
				vector< vector< int > > field(22, vector<int>(22, 0));
				vector<int> x(n),y(n);
				for (int i = 0; i < n; i++){
						cin >> x[i] >> y[i];
						field[x[i]][y[i]] = 1;
				}

				int m; cin >> m;
				int nx = 10; 
				int ny = 10;
				for (int i = 0; i < m; i++){
						//N:1, E:2, S:3, W:4
						char dir; cin >> dir;
						int dis; cin >> dis;
						if (dir == 'N'){
								for (int j = 1; j <= dis; j++){
										ny++;
										field[nx][ny] = 0;
								}
						}else if (dir == 'E'){
								for (int j = 1; j <= dis; j++){
										nx++;
										field[nx][ny] = 0;
								}
						}else if (dir == 'S'){
								for (int j = 1; j <= dis; j++){
										ny--;
										field[nx][ny] = 0;
								}
						}else if (dir == 'W'){
								for (int j = 1; j <= dis; j++){
										nx--;
										field[nx][ny] = 0;
								}
						}

				}
				if (check(field)){
						cout << "Yes" << endl;
				}else{
						cout << "No" << endl;
				}
		}
		return 0;
}

Measured memory_bytes: 3024
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int dp[101][10001];
int main(void)
{
	int n,i,j,sum,s[100],x;
	scanf("%d",&n);
	for(i=0;i<n;i++)	scanf("%d",&s[i]);
	sum=0;
	for(i=0;i<n;i++)	sum+=s[i];
	for(i=0;i<=n;i++)	{
		for(j=0;j<=sum;j++)	dp[i][j]=0;
	}
	dp[0][0]=1;
	for(i=0;i<n;i++)	{
		for(j=0;j<=sum;j++)	{
			if(dp[i][j]==1)	{
				dp[i+1][j]=1;
				dp[i+1][j+s[i]]=1;
			}
		}
	}
	for(i=0;i<=sum;i++)	{
		if(dp[n][i]==1)	{
			x=sum-i;
			if(x%10!=0)	break;
		}
	}
	printf("%d\n",x);
	return 0;
}


Measured memory_bytes: 4096
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<60;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 5010
#define M 210
ll s[N][N];
ll a[N], b[M][N], *c;
P v[N];
ll n, m;

ll dat[8*N], seg_n;
void init(int n){
	seg_n = 1;
	while(seg_n<n) seg_n<<=1;
	rep(i, 2*seg_n-1) dat[i] = -INF;
}

// v[k] <- a
void update(int k, ll a){
	k += seg_n - 1;
	dat[k] = a;
	while(k>0){
		k = (k-1)/2;
		dat[k] = max(dat[k*2+1], dat[k*2+2]);
	}
}

// min(v[a], v[a+1],..., v[b-1])
// to use: query(a, b, 0, 0, seg_n);
ll rmq(int a, int b, int k, int l, int r){
	if(r <= a || b <= l) return -INF;
	if(a <= l && r <= b) return dat[k];
	return max(rmq(a, b, k*2+1, l, (l+r)/2), rmq(a, b, k*2+2, (l+r)/2, r));
}

void g(int l, int r){
	if(l>=r) return;
	ll mx = rmq(l, r, 0, 0, seg_n);
	ll p = lower_bound(v, v+n, P(mx, l))->snd;
	//cerr<<l<<" "<<r<<" "<<mx<<" "<<p<<endl;
	s[l][p] += mx;
	s[l][r] -= mx;
	s[p+1][p] -= mx;
	s[p+1][r] += mx;
	g(l, p);
	g(p+1, r);
}

void f(int item){
	//cerr<<item<<endl;
	rep(i, n) v[i] = P(b[item][i], i);
	sort(v, v+n);
	//rep(i, n) cerr<<v[i].fst<<" "<<v[i].snd<<endl;
	//while(1);
	init(n);
	rep(i, n) update(i, b[item][i]);
	g(0, n);
}

int main(){
	cin>>n>>m;
	rep(i, n-1) cin>>a[i];
	rep(i, n) rep(j, m) cin>>b[j][i];
	//rep(i, m) rep(j, n) cerr<<b[i][j]<<(j==n-1?"\n":" ");
	rep(j, m){
		f(j);
	}
	rep(i, n) rep(j, n) s[i][j+1]+=s[i][j];
	rep(j, n) rep(i, n) s[i+1][j]+=s[i][j];
	ll res = 0;
	rep(i, n){
		ll sum = 0;
		for(int j = i; j < n; j++){
			chmax(res, s[i][j]-sum);
			sum += a[j];
		}
	}
	cout<<res<<endl;
	//rep(i, n) for(int j = i; j < n; j++) cerr<<i<<" "<<j<<": "<<s[i][j]<<endl;
	return 0;
}


Measured memory_bytes: 204416
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    long x=sc.nextLong();
    for(long h=1;h<=3500;h++){
      for(long n=h;n<=3500;n++){
        if((4*h*n-n*x-h*x)>0&&(h*n*x)%(4*h*n-n*x-h*x)==0){
          System.out.println(h+" "+n+" "+((h*n*x)/(4*h*n-n*x-h*x)));
          return;
        }
      }
    }
  }
}

Measured memory_bytes: 39496
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {

            var rList = new List<string>();

            while (true)
            {
                var line = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();

                if (!IsLoop(line)) break;

                rList.Add(Calc(line));
            }

            Output(rList);

        }

        static bool IsLoop(int[] line)
        {
            if (line.Any(a => a != -1))
                return true;
            return false;
        }

        static string Calc(int[] line)
        {
            var center = line[0];
            var last = line[1];
            var retest = line[2];
            var sum = center + last;

            if (center == -1 || last == -1) return "F";

            if (sum >= 80)
            {
                return "A";
            }
            else if (sum >= 65)
            {
                return "B";
            }
            else if (sum >= 50)
            {
                return "C";
            }
            else if (sum >= 30)
            {
                return retest >= 50 ? "C" : "D";
            }
            else
            {
                return "F";
            }
        }

        static void Output(List<string> result)
        {
            foreach (var r in result)
            {
                Console.WriteLine(r);
            }
        }
    }

}



Measured memory_bytes: 18456
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define pb push_back
#define mod 1000000007
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int k, n;
	cin >> n >> k;
	vector<ll> a(n);
	vector<ll> pos, neg, zero;
	vector<ll> b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] < 0) neg.pb(a[i]);
		else if (a[i] > 0) pos.pb(a[i]);
		else zero.pb(a[i]);
		b[i] = abs(a[i]);
	}
	sort(pos.begin(), pos.end());
	sort(neg.begin(), neg.end());
	reverse(neg.begin(), neg.end());
	sort(b.begin(), b.end());
	int pp = pos.size(), nn = neg.size(), zz = zero.size();
	if ((nn == n && (k & 1)) || (k == n && (nn & 1))) {
		if (zz) {
				cout << "0\n";
				return 0;
		}
		ll ans = 1;
		for (int i = 0; i < k; i++)
			ans = ans * b[i] % mod;
		ans = (mod - ans) % mod;
		cout << ans << "\n";
	} else {
		ll ans = 1;
		if (k & 1) {
			if (!pp && zz) {
				cout << "0\n";
				return 0;
			}
			ans = pos.back();
			pos.pop_back();
			k--;
		}
		while (k) {
			ll P = (pos.size() >= 2) ? (pos.back() * pos[pos.size()-2]) : 0;
			ll N = (neg.size() >= 2) ? (neg.back() * neg[neg.size()-2]) : 0;
			if (P > N) {
				ans = P % mod * ans % mod;
				if (P) {pos.pop_back(); pos.pop_back();}
			} else {
				ans = N % mod * ans % mod;
				if(N) {neg.pop_back(); neg.pop_back();}
			}
			k -= 2;
		}
		cout << ans << "\n";
	}
	return 0;
}

Measured memory_bytes: 8460
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

ull gcd(ull x, ull y)
{
    if(!y) return x;
	else return gcd(y,(ull)x%y);
}


int main(){
	string  s,t;
  	cin >> s >> t;
  	char cs[s.size()],ct[t.size()];
  
  	rep(i,0,t.size()){
		ct[i] = t[i];
    }
  	rep(i,0,s.size()){
		cs[i] = s[i];
    }
  
  	sort(cs,cs+(int)s.size());
  	sort(ct,ct+(int)t.size(),greater<char>());
  
  	if(t.size() > s.size()){
      rep(i,0,s.size()){
        if(cs[i] > ct[i]){
          break;
        }
        else if(i == s.size()-1){
          cout << "Yes" << endl;
          return 0;
        }
      }
      
      
      rep(i,0,s.size()){
        if(cs[i] > ct[i]){
			cout << "No" << endl;
          	return 0;
        }
        else if(cs[i] < ct[i]){
          	cout << "Yes" << endl;
          	return 0;
        }
      }
      
      cout << "Yes" << endl;
    }
  	else{
      rep(i,0,t.size()){
        if(cs[i] < ct[i]){
			cout << "Yes" << endl;
          	return 0;
        }
        else if(cs[i] > ct[i]){
			cout << "No" << endl;
          	return 0;
        }
      }
      
      cout << "No" << endl;
    }
  
  	
  
  
  	
  	
  
  	
	return 0;
}

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

typedef long long ll;

int max(int a, int b){
  if(a > b) return a;
  else return b;
}
int min(int a, int b){
  if(a < b) return a;
  else return b;
}

ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  else return (gcd(y, x%y));
}

ll lcm(ll a,ll b){
  ll g = gcd(a,b);
  return a/g *b;
}

int main(){

  int n;
  scanf("%d",&n);

  ll t[100] = {0};
  for(int i = 0; i < n; ++i){
    scanf("%lld",&t[i]);
  }

  ll ans = 1;
  for(int i = 0; i < n; ++i){
    ans = lcm(ans, t[i]);
  }

  printf("%lld",ans);

  return 0;

}


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

using namespace std;

typedef long long ll;

int main(){
  int n,flag=1;
  cin >> n;
  ll h[n];
  for(int i=0;i<n;i++){
    cin >> h[i];
  }
  h[0]-=1;
  for(int i=1;i<n;i++){
    if(h[i]==h[i-1]){
      continue;
    }
   	if(h[i]>h[i-1]){
      h[i]=h[i]-1;
      continue;
    }
    if(h[i]<h[i-1]){
      cout << "No" <<endl; 
      flag=0;
      break;
    }
  }
  if(flag) cout << "Yes" <<endl;
  //cout <<  << endl;
  return 0;
}

Measured memory_bytes: 1024
N = int(raw_input())
a = map(int, raw_input().split())
n = max(a)
if n % 2 == 0:
    med = n/2
    nearest = min([abs(k - med) for k in a])
    if med - nearest in a:
        print(str(n) + " " + str(med - nearest))
    else:
        print(str(n) + " " + str(med + nearest))

else:
    med_1 = (n - 1)/2
    med_2 = (n + 1)/2
    med = (float(med_1) + float(med_2))/2
    nearest = min([abs(k - med) for k in a])
    if int(med - nearest) in a:
        print(str(n) + " " + str(int(med - nearest)))
    else:
        print(str(n) + " " + str(int(med + nearest)))

Measured memory_bytes: 11324
import sys

sx,sy,tx,ty = map(int, raw_input().split())
for x in range(0,tx-sx):
 sys.stdout.write('R')
for x in range(0,ty-sy):
 sys.stdout.write('U')
for x in range(0,tx-sx):
 sys.stdout.write('L')
for x in range(0,ty-sy):
 sys.stdout.write('D')
sys.stdout.write('D')
for x in range(0,tx-sx+1):
 sys.stdout.write('R')
for x in range(0,ty-sy+1):
 sys.stdout.write('U')
sys.stdout.write('L')
sys.stdout.write('U')
for x in range(0,tx-sx+1):
 sys.stdout.write('L')
for x in range(0,ty-sy+1):
 sys.stdout.write('D')
sys.stdout.write('R')

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

int main() {
  string s; cin >>s;
  string ans;
  string emp = "";
  string pre = emp + s.at(0) + s.at(1);
  string lat = emp + s.at(2) + s.at(3);
  if ((pre=="00"||pre>="13")&&(lat=="00"||lat>="13")) ans = "NA";
  
  else if (pre>="13"||pre=="00") ans = "YYMM";
  else if (lat>="13"||lat=="00") ans = "MMYY";
  else ans = "AMBIGUOUS";
  
  cout <<ans;
  cout <<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
using namespace std;
static const uint64_t MOD = 1000000007LL; /* 10^9 + 7 */
uint64_t dp[100005][13];

/*
 * (X1 + X2) / 2 == A1;
 * (X2 + X3) / 2 == A2;
 * (X3 + X1) / 2 == A3;
 * ....
 */
int main()
{
    int n;
    cin >> n;
    vector<long> a(n+1);
    vector<long> x(n+1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    long tmp = 0;
    for (int j = 1; j <= n;  j++) {
        if (j % 2 == 1)
            tmp += a[j];
        else
            tmp -= a[j];
    }
    x[1] = tmp;
    for (int i = 2; i <= n; i++) {
        x[i] = 2 * a[i - 1] - x[i - 1];
    }

    for (int i = 1; i <= n; i++) {
        cout << x[i] << " ";
    }

    cout << endl;
}

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

using namespace std;

const int Maxn = 10010;

int a[110];
vector<int> vec,tmp;
int main()
{
    int K,T;
    cin>>K>>T;
    for(int i = 0;i < T;i ++)
        cin>>a[i];
    sort(a,a + T);
    int k = 0;
    for(int i = 0;i < a[T - 1];i ++)
        vec.push_back(T - 1);
    for(int i = T - 2;i >= 0;i--)
    {
        for(int j = 0;j < a[i];j ++)
        {
            if(k >=vec.size())
            {
                vec.clear();
                vec = tmp;
                k = 0;
                tmp.clear();
            }
            tmp.push_back(vec[k++]);
            tmp.push_back(i);
        }
    }
    for(;k < vec.size();k ++)
        tmp.push_back(vec[k]);
    int cnt = 0;
    for(int i = tmp.size() - 1;i > 0;i --)
    {
        if(tmp[i] == tmp[i - 1])
            cnt ++;
    }
    cout<<cnt<<endl;

    return 0;
}


Measured memory_bytes: 384
#include <iostream>

int gcd(int a, int b) {
  if (a % b == 0)
    return b;
  return gcd(b, a % b);
}

int solve(int a, int b, int k) {
  int d = gcd(a, b);
  for (int i = d; i >= 1; --i) {
    if (d % i == 0) {
      --k;
      if (k == 0) {
        return i;
      }
    }
  }
  return -1;
}

int main() {
  int a, b, k;
  std::cin >> a >> b >> k;
  std::cout << solve(a, b, k) << std::endl;
  return 0;
}


Measured memory_bytes: 256
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let m = 1_000_000_007;
    let mut dp = vec![vec![vec![vec![0; 5]; 5]; 5]; n+1];
    dp[0][0][0][0] = 1;
    for idx_n in 0..n {
        for i in 0..5 {
            for j in 0..5 {
                for k in 0..5 {
                    for l in 1..5 {
                        if i == 1 && j == 2 && l == 3 {
                            continue;
                        }
                        if i == 1 && k == 2 && l == 3 {
                            continue;
                        }
                        if j == 1 && k == 2 && l == 3 {
                            continue;
                        }
                        if j == 2 && k == 1 && l == 3 {
                            continue;
                        }
                        if j == 1 && k == 3 && l == 2 {
                            continue;
                        }
                        dp[idx_n+1][j][k][l] += dp[idx_n][i][j][k];
                        dp[idx_n+1][j][k][l] %= m;
                    }
                }
            }
        }
    }

    let mut ans = 0u64;
    for i in 1..5 {
        for j in 1..5 {
            for k in 1..5 {
                ans += dp[n][i][j][k];
                ans %= m;
            }
        }
    }
    println!("{}", ans);

}

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

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

Measured memory_bytes: 4352
#include <string>
#include <vector>
#include <numeric>
#include <iostream>

#include<algorithm>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)





int main(){
    long Aorg, A,Borg, B, r;
    cin >> Aorg >> Borg;
    A = Aorg;
    B = Borg;
    if (A < B){
        long tmp = A;
        A = B;
        B = tmp;
    }

    r = A % B;
    while(r !=0){
        A = B;
        B = r;
        r = A % B;
    }

    cout << Aorg * Borg / B << endl;
    return 0;

}

Measured memory_bytes: 256
#include<stdio.h>

int main (void){

    int point = 0;
    int total = 0;
    int avel = 0;

    int i;

    for(i=0;i<5;i++){
        scanf("%d",&point);
        if(point < 40){
            total += 40;
        }else{
            total += point;
        }
    }
    avel = total / 5;

    printf("%d\n",avel);

    return 0;
}

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

class Program
{
    static void Main(string[] args) {
        int n = int.Parse(Console.ReadLine());
        int[] x = new int[n];
        int[] y = new int[n];
        int[] h = new int[n];
        for (int i = 0; i < n; i ++) {
            int[] tmp = Console.ReadLine().Split().Select(int.Parse).ToArray();
            x[i] = tmp[0]; y[i] = tmp[1]; h[i] = tmp[2];
        }
        solve(x,y,h,n);
    }

    static void solve(int[] x, int[] y, int[] h, int n) {
        for(int cx = 0; cx <= 100; ++cx) {
            for(int cy = 0; cy <= 100; ++cy) {
                int hmax = int.MaxValue;
                int high = -1;
                for(int i = 0; i<n; ++i) {
                    var d = Math.Abs(x[i]-cx) + Math.Abs(y[i]-cy);
                    if(h[i]==0) hmax = Math.Min(hmax,d);
                    else {
                        if(high==-1) high = d + h[i];
                        else if(high != d+h[i]) goto end;
                    }
                }
                if(high>hmax || hmax<1) goto end;
                if(high==-1) high = hmax;
                Console.WriteLine("{0} {1} {2}", cx, cy, high);
                return;
                end:;
            }
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	int x , k ;
	cin >> x >> k; 
	if(x*500 >=k){
		cout << "Yes\n";
		return;
	}
	cout << "No\n";
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


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


using namespace std;
double pi=3.14159265358979323846264338;


inline void ex(){cout<<"Yes"<<endl;exit(0);}
long long a,b,c,d;


long long n,k,ind;
bool ok[1000001];
long long arr2[200001];
map<long long,long long>ma;
long long arr3[200001];
long long N;
long long T(long long t){
	if(t<0)return t+N;
	else return t%N;
}

int main(){
	cin>>n>>k;
	long long cnt=0;
	a=n,b=n;
	for(int i=2;i<n;i++)arr2[i]=n-1,arr3[i]=n-1;
	for(int i=0;i<k;i++){
		cin>>c>>d;
		if(c==1){
			
			if(d<b){
				
				cnt+=max(0LL,a-2);
				for(int j=d+1;j<b;j++)arr2[j]=a-1;
				b=d;
				arr2[b]=1;
			} else {
				cnt+=max(0LL,arr2[d]-1);
				arr2[d]=1;
			}
		}
		if(c==2){
			
			if(d<a){
				cnt+=max(0LL,b-2);
				
				
				for(int j=d+1;j<a;j++)arr3[j]=b-1;
				a=d;
				arr3[a]=1;
			
			} else {
				cnt+=max(0LL,arr3[d]-1);
				arr3[d]=1;
			}
		}
	}
	cout<<(n-2)*(n-2)-cnt<<endl;
	return 0;

}

Measured memory_bytes: 6736
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define INF (int)1e9+4
#define INFL (ll)1e18+4
#define md (int)1e9+7
#define mx 10000000  //use fixed<<setprecion 
#define mk make_pair
#define pi pair<int,int>
#define ss second
#define ff first
#define pb emplace_back 
#define onell(x) __builtin_popcountll(x)
#define one(x) __builtin_popcount(x)
#define all(s) s.begin(),s.end()
#define rall(x) (x).rbegin(), (x).rend()
#define trav(x, a) for (auto& x: a)
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define rf(i,a,b) for(int i=a;i>=b;i--)
#define sz(x) ((long long)x.size())
#define mez(s) memset(s,0,sizeof s)
#define mex(s) memset(s,-1,sizeof s)
#define metr(s) memset(s,true, sizeof s)
typedef vector<int> vi; 
typedef vector<ll>vl;
typedef map<int,int> mp;
typedef queue<int> que;
typedef vector<pi> vp;
void solve(){
int n=0,x=0,y=0,z=0,m=0,k=0;
string st;
cin>>st;
rep(i,0,sz(st)){
	y+=(st[i]-'0');
}
if(y%9==0)cout<<"Yes\n";
else cout<<"No\n";
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t=1;
 // cin>>t;
  while(t--){
  	solve();
  }
  return 0;
}

Measured memory_bytes: 3780
count=0
str=gets.chomp
num=Array.new
number=str.split
for i in 0..2 do
  num[i]=number[i].to_i
end
for j in 0..10000 do
  if j==num[0] && count<2 then
    print "#{j} "
    count+=1
  elsif j==num[0] && count==2 then
    print "#{j}"
    count+=1
  end
  if j==num[1] && count<2 then
    print "#{j} "
    count+=1
  elsif j==num[1] && count==2 then
    print "#{j}"
    count+=1
  end
  if j==num[2] && count<2 then
    print "#{j} "
    count+=1
  elsif j==num[2] && count==2 then
    print "#{j}"
    count+=1
  end
end
print "\n"

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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

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

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

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

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
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);
}

int main() {
  char c;
  cin >> c;
  if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') cout << "vowel" << endl;
  else cout << "consonant" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdbool.h>
#define LENGTH 256


int main(void) {
    char input[LENGTH];
    int N;
    fgets(input, LENGTH-1, stdin);
    sscanf(input, "%d", &N);
    int acCount = 0;
    int waCount = 0;
    int tleCount = 0;
    int reCount = 0;
    
    char input2[LENGTH];
    char test[LENGTH];
    for(int i = 0;i < N;i++){
        fgets(input2, LENGTH-1, stdin);
        sscanf(input2, "%s", &test);
        if(strcmp(test,"AC") == 0){
            acCount++;
        }else if(strcmp(test,"WA") == 0){
            waCount++;
        }else if(strcmp(test,"TLE") == 0){
            tleCount++;
        }else{
            reCount++;
        }
    }
    printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d",acCount,waCount,tleCount,reCount);
    
    return 0;
}


Measured memory_bytes: 1712
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <queue>

typedef long long ll;
const ll LL_MAX (1LL<<60);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

const ll MOD (1000000007);

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

    ll n, m;
    cin >> n >> m;
    vector<bool> broken(n, false);
    rep(i,1,m+1)
    {
        ll x;
        cin >> x, broken[x] = true;
    }

    //rep(i,0,n)
    //    cout <<broken[i] << endl;

    vector<ll> dp(n+10);

    dp[0] = 1;
    rep(i,0,n)
    {
        if (!broken[i+1])
            dp[i+1] += dp[i], dp[i+1] = dp[i+1] % MOD; 

        if (!broken[i+2])
            dp[i+2] += dp[i], dp[i+2] = dp[i+2] % MOD;
    }

    cout << dp[n] << endl;

    return 0;
}


Measured memory_bytes: 1024
package main

import (
	"fmt"
	"math"
)

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

	a := make([]int, n+2)
	allCost := 0
	position := 0
	for i := 1; i <= n; i++ {
		fmt.Scan(&a[i])
		allCost += int(math.Abs(float64(position) - float64(a[i])))
		position = a[i]
	}
	allCost += int(math.Abs(float64(position) - float64(0)))

	for i := 1; i <= n; i++ {
		diff := math.Abs(float64(a[i-1])-float64(a[i])) + math.Abs(float64(a[i])-float64(a[i+1])) - math.Abs(float64(a[i-1]) - float64(a[i+1]))
		ans := allCost - int(diff)
		fmt.Println(ans)

	}

}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,h;
    cin>>n>>h;
    vector<int>arr(n),brr(n);
    int maxx =0;
    for(int i=0; i<n; i++)
    {
        cin>>arr[i]>>brr[i];
        maxx = max(maxx,arr[i]);
    }
    sort(brr.begin(),brr.end());
    reverse(brr.begin(),brr.end());
    int cnt =0;
    for(int i=0; i<n; i++)
    {
        if(brr[i]>=maxx)
        {
            cnt++;
            h-=brr[i];
            if(h<=0)
            {
                cout<<cnt<<endl;
                return 0;
            }
        }
    }
    if(h%maxx==0)
    {
        cnt+=h/maxx;
        cout<<cnt<<endl;
    }
    else
    {
        cnt+=h/maxx+1;
        cout<<cnt<<endl;
    }
}


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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> G(3 * N);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        for (int k = 0; k < 3; k++) {
            G[k * N + a].push_back(((k + 1) % 3) * N + b);
        }
    }
    int S, T;
    cin >> S >> T;
    S--, T--;

    const ll INF = 1e18 + 10;
    vector<ll> dist(3 * N, INF);

    priority_queue<pll, vector<pll>, greater<pll>> Q;
    Q.push({0, S});
    vector<int> visited(3 * N);
    while(!Q.empty()) {
        pll p = Q.top(); Q.pop();
        if (dist[p.second] <= p.first) continue;
        dist[p.second] = p.first;
        for(int i = 0; i < G[p.second].size(); i++) {
            if (dist[G[p.second][i]] > p.first + 1 && !visited[G[p.second][i]]) {
                Q.push({p.first + 1, G[p.second][i]});
                visited[G[p.second][i]] = 1;
            }
        }
    }



    if (dist[T] == INF) {
        cout << -1 << endl;
    } else {
        cout << dist[T] / 3 << endl;
    }
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

Measured memory_bytes: 20224
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

bool solve(){
  int n;
  int k[SIZE];
  char c[SIZE];
  
  scanf("%d",&n);
  
  if(n == 0) return false;

  for(int i=0;i<n;i++){
    scanf("%d",k+i);
  }

  scanf("%s",c);
  
  for(int i=0;c[i]!='\0';i++){

    for(int j=0;j<k[i%n];j++){
      if(c[i] == 'a')
        c[i] = 'Z';
      else if(c[i] == 'A')
        c[i] = 'z';
      else
        c[i]--;
    }
    
  }

  printf("%s\n",c);
  
  return true;

}

int main(){

  while(solve());
  
  return 0;
}

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

int main()
{
  int64_t N, K, d;
  cin >> N >> K;
  vector<int64_t> D(N);
  vector<int64_t> S(N + 1, 0);
  for (int i = 0; i < N; i++)
  {
    cin >> D.at(i);
  }
  for (int k = 0; k < K; k++)
  {
    for (int i = 0; i < N; i++)
    {
      S.at(max((int64_t)(0), (int64_t)(i - D[i])))++;
      S.at(min(N, (int64_t)(i + D[i] + 1)))--;
    }
    int64_t cnt = 0; // Nの数
    for (int i = 0; i < N; i++)
    {
      S[i + 1] += S[i];
      D[i] = S[i];
      S[i] = 0;
      if (D[i] == N)
        cnt++;
    }
    S[N] = 0;
    if (cnt == N)
    {
      break;
    }
  }
  for (int i = 0; i < N; i++)
  {
    cout << D[i];
    if (i < N - 1)
      cout << ' ';
  }
  cout << endl;
}

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

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main() {
  int rp[100010];
  rp[0]=0;
  rep(i,100001){
    if(IsPrime(i+1)&&IsPrime((i+1+1)/2))rp[i+1]=rp[i]+1;
    else rp[i+1]=rp[i];
  }
  int q;
  cin>>q;
  rep(i,q){
    int l,r;
    cin>>l>>r;
    cout<<rp[r]-rp[l-1]<<endl;
  }
}

Measured memory_bytes: 1024
fun main(args: Array<String>) {
    val (A, B, C, D) = readLine()!!.split(" ").map(String::toLong)
    val c = B / C - (A - 1) / C
    val d = B / D - (A - 1) / D
    val cd = B / lcm(C, D) - (A - 1) / lcm(C, D)
    println(B - (A - 1) - c - d + cd)
}

// 最小公倍数
fun lcm(a: Long, b: Long): Long {
    return a / gcd(a, b) * b
}

// 最大公約数
tailrec fun gcd(a: Long, b: Long): Long {
    if (a < b) return gcd(b, a)
    if (b == 0L) return a
    if (a <= 0L) throw IllegalArgumentException()
    return gcd(b, a % b)
}

Measured memory_bytes: 38068
loop do
    n = gets.to_i
    break if n == 0
    s = gets.split.map(&:to_i)
    avg = s.inject(:+)/n.to_f
    a2 = 0
    n.times do |i|
        a2 += (s[i]-avg)**2
    end
    a2 /= n
    puts Math.sqrt(a2)
end


Measured memory_bytes: 6932
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

pub fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

fn solve(a:i64, b:i64,c:i64, d:i64) -> bool {
    if b > d { return false }
    if b > a { return false }
    if c >= b-1 { return true }
    let g = gcd(b, d);
    let m = (b - (a%g) - 1) / g * g + (a % g);
    m <= c
}

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

    input!{
      t: usize,
      abcds: [(i64,i64,i64,i64);t],
    }

    for i in 0..t {
        let (a, b, c, d) = abcds[i];
        let ans = solve(a, b, c, d);
        if ans {
            puts!("{}\n", "Yes");
        } else {
            puts!("{}\n", "No");
        }
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
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;}


int main() {
    int n;
    cin >> n;
    vector<int>a(n);
    rep(i,n) cin >> a[i];
    //偶数番目が正、奇数番目が負の場合
    ll sum = 0;
    ll ans = 1e18;
    ll tmp = 0;
    rep(i,n) {
        sum += a[i];
        if(i%2==0 && sum <=0) {
            tmp += abs(sum)+1;
            sum = 1;
        } else if(i%2==1 && sum>=0) {
            tmp += sum+1;
            sum = -1;
        }
    }
    ans = min(ans,tmp);
    //偶数番目が負、奇数番目が正の場合
    sum = 0;
    tmp = 0;
    rep(i,n) {
        sum += a[i];
        if(i%2==0 && sum >=0) {
            tmp += abs(sum)+1;
            sum = -1;
        } else if(i%2==1 && sum<=0) {
            tmp += abs(sum)+1;
            sum = 1;
        }
    }
    ans = min(ans,tmp);
    cout << ans << endl;

}

Measured memory_bytes: 3792
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n;
	cin>>n;
	cout<<"Christmas";
	FORD(i,25,n){
		cout<<" Eve";
	}
	cout<<endl;

    return 0;
}


Measured memory_bytes: 256
import numpy as np
a,b,c=map(int,input().split())
a=np.array(a)
b=np.array(b)
c=np.array(c)
a=a.astype(np.float128)
b=b.astype(np.float128)
c=c.astype(np.float128)
d=a*b
if c-(a+b+2*(d**0.5))>0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 12468
#include <bits/stdc++.h>
using namespace std;
string S;
long long K, C;
vector<int> dp, cnt, can;
bool dfs(int ind, int cnt1){
    if(dp[ind] != 0){
        if(dp[ind] == cnt1) return true;
        return false;
    }
    auto ite = upper_bound(can.begin(), can.end(), can[ind] + C);
    if(ite == can.end()){
        if(cnt1 == K){
            dp[ind] = cnt1;
            cnt[cnt1]++;
            return true;
        }
        return false;
    }
    int ind2 = ite - can.begin();
    bool flag = dfs(ind2, cnt1 + 1);
    if(flag){
        dp[ind] = cnt1;
        cnt[cnt1]++;
        return true;
    }
    return false;
}
int main(){
    long long N;
    cin >> N >> K >> C;
    cin >> S;
    can.resize(0);
    for(int i = 0; i < N; i++){
        if(S[i] == 'o') can.push_back(i + 1);
    }
    int size= can.size();
    dp.resize(size, 0);
    cnt.resize(K + 1, 0);
    dfs(0, 1);
    int flag = 0;
    for(int i = 0; i < size; i++){
        if(dp[i] == K) flag = 1;
        if(dp[i] > K){
            cout << endl;
            return 0;
        }
    }
    if(flag == 0){
        cout << endl;
        return 0;
    }
    for(int i = 0; i < size; i++){
        if(dp[i] != 0) continue;
        int temp;
        if(can[i] - C - 1 < can[0]) temp = 1;
        else{
            int inde = upper_bound(can.begin(), can.end(), can[i] - C - 1) - can.begin() - 1;
            if(inde >= 0 && inde != i) temp = dp[inde] + 1;
            else continue;
        }
        dfs(i, temp);
    }
    for(int i = 0; i < size; i++){
        if(cnt[dp[i]] == 1) cout << can[i] << endl;
    }
}

Measured memory_bytes: 11980
/*
 _____ ____ _____   ___   ___  __  ___  
|_   _/ __ \_   _| |__ \ / _ \/_ |/ _ \ 
  | || |  | || |      ) | | | || | (_) |
  | || |  | || |     / /| | | || |\__, |
 _| || |__| || |_   / /_| |_| || |  / / 
|_____\____/_____| |____|\___/ |_| /_/   
*/
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define per(i, a, b) for (long long i = (a); i > (b); i--)
#define a(x) (x.begin(), x.end())
#define ar(x) (x.rbegin(), x.rend())
#define pb push_back
#define Pb() pop_back()
#define ll long long int
#define ull unsigned long long int
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sc scanf
#define scin(x) sc("%d", &(x))
#define scln(x) sc("%lld", &(x))
#define pf prllf
#define ms(a, b) memset(a, b, sizeof(a))
#define mp make_pair
#define db double
#define EPS 10E-10
#define ff first
#define ss second
#define sqr(x) (x) * (x)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define vll vector<vector<ll>>
#define DBG pf("HI\n")
#define MOD 1000000007
#define CIN                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define RUN_CASE(t, T) for (__typeof(t) t = 1; t <= T; t++)
#define CASE(t) prllf("Case %d: ", t)
#define CASEL(t) prllf("Case %d:\n", t)
#define intlimit 2147483647
#define longlimit 9223372036854775807
#define infinity (1 << 28)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * (b) / gcd(a, b))
#define PI 2 * acos(0.0)
using namespace std;
int main()
{
    CIN;
    string s,t;
    cin >> s >> t;
    int sum = 0;
    rep(i,0,s.size()){
        if(s[i]==t[i]){
            sum++;
        }
    }
    cout << sum;
}

Measured memory_bytes: 256
s=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(s[k-1])

Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

#define OVER 10000

typedef struct root{
  int cost;
  int time;
}root;

int cmp_time(const void *x, const void *y) {
  return ((root *)x)->time - ((root *)y)->time;
}

int cmp_cost(const void *x, const void *y) {
  return ((root *)x)->cost - ((root *)y)->cost;
}

int main() {
  int n, t, j=0;
  scanf("%d%d", &n, &t);
  root a[n+1];
  for (int i=0; i<n; i++) scanf("%d%d", &(a[i].cost), &(a[i].time));
  a[n].cost = OVER;
  a[n].time = t+1;
  qsort(a, n+1, sizeof(root), cmp_time);
  while (a[j].time<=t) {
    j++;
  }
  if (j==0) {
    printf("TLE\n");
    return 0;
  }
  qsort(a, j, sizeof(root), cmp_cost);
  printf("%d\n", a[0].cost);
  return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var nm = ReadInts();
            var a = new List<int>();
            var b = new List<int>();
            for (int i = 0; i < nm[1]; i++)
            {
                var lr = ReadInts();
                a.Add(lr[0]);
                b.Add(lr[1]);
            }
            if (a.Max() <= b.Min())
            {
                WriteLine(b.Min()-a.Max()+1);
            }
            else
            {
                WriteLine(0);
            }
           
        }
        

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        //最大公約数
        
        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
    }
}


Measured memory_bytes: 19272
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
V = []

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

for i in range(X):
  for j in range(Y):
    for k in range(Z):
      if((i+1)*(j+1)*(k+1) <= K):
        V.append(A[i] + B[j] + C[k])
      else:
        break
    if((i+1)*(j+1) > K):
       break

V.sort(reverse=True)
for i in range(K):
  print(V[i])
       


Measured memory_bytes: 8708
#include <iostream>
#include <fstream>
#include <iomanip>

#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>

#include <algorithm>
#include <numeric>
#include <random>

#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define endl '\n'

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7;
const int MAXN = static_cast<int>(1e6) + 17;

int n, m;
vector<int> g[MAXN], g1[MAXN];
bool used[MAXN];
int col[MAXN];

bool read() {
    if (!(cin >> n >> m))
        return false;

    forn (i, m) {
        int u, v;
        cin >> u >> v;
        g[u - 1].push_back(v - 1);
        g[v - 1].push_back(u - 1);
        g1[v - 1].push_back(n + u - 1);
        g1[n + u - 1].push_back(v - 1);
        g1[u - 1].push_back(n + v - 1);
        g1[n + v - 1].push_back(u - 1);
    }

    return true;
}

int dfs(int v) {
    int res = 1;
    used[v] = true;

    for (auto to : g[v])
        if (!used[to])
            res += dfs(to);

    return res;
}

int dfs1(int v) {
    int res = 1;
    used[v] = true;

    for (auto to : g1[v])
        if (!used[to])
            res += dfs1(to);

    return res;
}

bool bip(int v, int cur) {
    col[v] = cur;

    for (auto to : g[v])
        if (col[to] == 0) {
            if (!bip(to, -cur))
                return false;
        } else {
            if (col[to] == col[v])
                return false;
        }

    return true;
}

void solve() {
    fill(used, used + 2 * n, false);
    int kek, kok, lol;
    kek = kok = lol = 0;

    forn (i, n)
        if (!used[i]) {
            if (used[n + i])
                --lol;

            auto cur = dfs1(i);

            if (cur == 1)
                ++kok;
            else
                ++lol, ++kek;
        }

    ll ans = 1ll * n * n;
    fill(used, used + n, false);

    forn (i, n)
        if (!used[i]) {
            auto cur = dfs(i);

            if (cur == 1)
                continue;

            ans -= 1ll * cur * n;

            if (bip(i, 1)) {
                ans += 1ll * cur * kok + kek;
            } else {
                ans += 1ll * cur * kok + lol;
            }
        }

    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::mt19937 rand('S' + 'E' + 'R' + 'E' + 'Z' + 'H' + 'K' + 'A');

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 66560