akhauriyash/Code-Regression huggingface dataset:
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    // let _n: i32 = read();
    const SIZE:usize = 13;
    let mut t_s = [false; SIZE];
    let mut t_h = [false; SIZE];
    let mut t_c = [false; SIZE];
    let mut t_d = [false; SIZE];
    
    let n:i32 = read();
    for _i in 0..n {
        let input:Vec<String> = read_vec();
        let input_n: usize = input[1].parse().unwrap();
        let t_type: &str = &input[0];
        match t_type {
            "S" => t_s[input_n - 1] = true,
            "H" => t_h[input_n - 1] = true,
            "C" => t_c[input_n - 1] = true,
            "D" => t_d[input_n - 1] = true,
            _ => println!("error"),
        }
    }
    for i in 0..t_s.len() {
        if t_s[i] == false {
            println!("S {}", i+1);
        }
    }
    for i in 0..t_h.len() {
        if t_h[i] == false {
            println!("H {}", i+1);
        }
    }
    for i in 0..t_c.len() {
        if t_c[i] == false {
            println!("C {}", i+1);
        }
    }
    for i in 0..t_d.len() {
        if t_d[i] == false {
            println!("D {}", i+1);
        }
    }
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 0x3f3f3f3f;
const ll LINF = 1ll << 55;
const ll MOD = 1e9 + 7;
const ll MAXN = 400 + 5;
const ll MAXK = 1e5 + 10;

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

int main() {
    ll A, B;
    cin >> A >> B;
    vector<vector<char>> grid(100, vector<char>(100, '#'));
    for (int i = 0; i < 50; ++i) {
        for (int j = 0; j < 100; ++j) {
            grid[i][j] = '.';
        }
    }
    bool ok = true;
    bool update = false;
    for (int i = 0; i < B - 1; ++i) {
        update = false;
        for (int j = 0; j < 50 - 1; ++j) {
            for (int k = 0; k < 100; ++k) {
                ok = true;
                for (int x = -1; x <= 1; ++x) {
                    for (int y = -1; y <= 1; ++y) {
                        int dj = j + x;
                        int dk = k + y;
                        if (dj >= 0 && dj < 50 - 1 && dk >= 0 && dk < 100 && grid[dj][dk] != '.') {
                            ok = false;
                            break;
                        }
                    }
                    if (!ok) {
                        break;
                    }
                }
                if (ok) {
                    grid[j][k] = '#';
                    update = true;
                    break;
                }
            }
            if (update) {
                break;
            }
        }
    }

    for (int i = 0; i < A - 1; ++i) {
        update = false;
        for (int j = 51; j < 100; ++j) {
            for (int k = 0; k < 100; ++k) {
                ok = true;
                for (int x = -1; x <= 1; ++x) {
                    for (int y = -1; y <= 1; ++y) {
                        int dj = j + x;
                        int dk = k + y;
                        if (dj >= 51 && dj < 100 && dk >= 0 && dk < 100 && grid[dj][dk] != '#') {
                            ok = false;
                            break;
                        }
                    }
                    if (!ok) {
                        break;
                    }
                }
                if (ok) {
                    grid[j][k] = '.';
                    update = true;
                    break;
                }
            }
            if (update) {
                break;
            }
        }
    }
    cout << 100 << " " << 100 << endl;
    for (int i = 0; i < 100; ++i) {
        for (int j = 0; j < 100; ++j) {
            cout << grid[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
 
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).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 INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
 
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
//ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
int N;
string str;
ll dp[3010]={0};
ll me[3010]={0};
int main(){
	cin>>N;
	cin>>str;
	dp[1]=1;
	for(int i=2;i<=N;i++){
		ll sum=0;
		if(str[i-2]=='<'){
			me[1]=0;
			for(int j=1;j<=i-1;j++){
				sum=(sum+dp[j])%MOD;
				me[j+1]=sum;
			}
		}else{
			me[i]=0;
			for(int j=i-1;j>=1;j--){
				sum=(sum+dp[j])%MOD;
				me[j]=sum;
			}
		}
		rep(k,N+1){
			dp[k]=me[k];
			//cout<<dp[k]<<" ";
		}
		//cout<<endl;
	}
	ll ans=0;
	rep(i,N+1){
		ans=(ans+dp[i])%MOD;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pairA
#define REP(i,n) for(int i=0;i<(n);i++)
int main()
{
    int a,b;
    cin>>a>>b;
    cout<<(a-1)*(b-1)<<endl;
}

Measured memory_bytes: 256
inf = input().split()
info = list(map(int, inf))
o = info[1] + info[2]
if o == 0:
    print(0)
else:
    q, mod = divmod(info[0], o)
    if mod > info[1]:
        print((q+1)* info[1])
    else:
        print(q*info[1] + mod)

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

int main(){
    int H,W,A,B;
    cin >> H >> W >> A >> B;
    rep (i,B){
            rep(k,A) cout << 0;
            rep(k,W-A) cout << 1;
            cout << endl;
        }
    rep(i,H-B){
        rep(k,A) cout << 1;
        rep(k,W-A) cout << 0;
        cout << endl;
        }
        return 0;
}

Measured memory_bytes: 1280
#include <iostream>
using ll = long long;

int main() {
  auto gcd = [](auto a, auto b) {
    auto m = a;
    while (b) {
      m = a % b;
      a = b;
      b = m;
    }
    return a;
  };

  int K;
  std::cin >> K;

  ll res{0};
  for (int a = 1; a <= K;a++)
    for (int b = 1; b <= K;b++)
      for (int c = 1; c <= K; c++) res += gcd(gcd(a, b), c);
  std::cout << res << std::endl;
  return 0;
}

Measured memory_bytes: 3596
#include<stdio.h>
#define MAX 100000
int partition(int *, int, int);

int main(){
  int i,n,q;
  int A[MAX];

  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&A[i]);
  }

  q = partition(A,0,n-1);
  for(i=0; i<q; i++){
    printf("%d ",A[i]);
  }
  printf("[%d] ",A[q]);
  for(i=q+1; i<n; i++){
    printf("%d",A[i]);
    if(i == n-1) break;
    printf(" ");
  }
  printf("\n");

  return 0;
}

int partition(int *A, int p, int r){
  int i,j,x,temp;
  x = A[r];
  i = p-1;
  for(j=p; j<r; j++){
    if(A[j] <= x){
      i = i+1;
      temp = A[i];
      A[i] = A[j];
      A[j] = temp;
    }
  }
  temp = A[i+1];
  A[i+1] = A[r];
  A[r] = temp;

  return i+1;
}



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

int main(){
    int V, E;
    cin >> V >> E;
    vector<vector<int> > edge(10001);
    vector<int> state(V, 0);
    for (int i = 0; i < E; i++) {
        int s, t;
        cin >> s >> t;
        edge[s].push_back(t);
        state[t]++;
    }
    vector<int> ans;
    for (int i = 0; i < state.size(); i++) {
        if (state[i] == 0) ans.push_back(i);
    }
    for (int i = 0; i < ans.size(); i++) {
        for (int j = 0; j < edge[ans[i]].size(); j++) {
            int t = edge[ans[i]][j];
            state[t]--;
            if (state[t] == 0) ans.push_back(t);
        }
        cout << ans[i] << endl;
    }

    return 0;
}



Measured memory_bytes: 3720
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
	string a;
	cin >> a;
	if (a[0] == a[1] || a[2] == a[1] || a[2] == a[3])
	{
		cout << "Bad" << endl;
	}
	else
	{
		cout << "Good" << endl;
	}
	return 0;
}
/*
死のマウス
.　　あり許せん！
　　　∧＿＿∧
　|| （＃｀Д´ ） ||
　|| ( |　 　| | |||
　从| |　 　| |从从
￣) ⊂ノ￣￣!_つ￣て
　フヘ(　　　　ヽヘ(＼

*/

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
struct Edge { LL to, cost; };
LL par[1000000];
LL h, w, n, m, s, t, k, p, q, ans = 0, a[1000000], d[1000000],cnt;
LL find(LL x) { if (par[x] == x)return x; par[x] = find(par[x]); return par[x]; }
void unite(LL x, LL y) { x = find(x); y = find(y); if (x == y)return; par[y] = x; }
bool same(LL x, LL y) { return find(x) == find(y); }
vector<LL>tree[1000000];
bool f[1000000];
int main() {
	cin >> n >> m;
	rep(i, n)
		cin >> a[i];
	for (LL i = 0; i < n; i++)par[i] = i;
	rep(i, m) {
		LL x, y;
		cin >> x >> y;
		unite(x, y);
	}
	rep(i, n) {
		tree[find(i)].push_back(a[i]);
	}
	priority_queue<int, vector<int>, greater<int>> pq;
	rep(i, n) {
		if (f[find(i)] == 0) {
			f[find(i)] = 1;
			cnt++;
			sort(tree[find(i)].begin(), tree[find(i)].end());
			ans += tree[find(i)][0];
			rep(j, tree[find(i)].size() - 1)pq.push(tree[find(i)][j + 1]);
		}
	}
	if (cnt == 1) { cout << 0 << endl; return 0; }
	while (cnt > 2) {
		if (pq.empty()) {
			cout << "Impossible" << endl;
			return 0;
		}
		ans += pq.top();
		pq.pop();
		cnt--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 33152
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int begin = max(a, c);
	int end = min(b, d);
	if (begin < end) { cout << end - begin << endl; }
	else { cout << 0 << endl; }
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

// const abcd = "abcdefghijklnmopqrstuvwxyz"
// const ABCD = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

func main() {
	log.SetFlags(log.Lshortfile)
	scn := newScanner()
	A := scn.nextInt()
	B := scn.nextInt()
	C := scn.nextInt()
	if A == B {
		fmt.Println(C)
	} else if A == C {
		fmt.Println(B)
	} else {
		fmt.Println(A)
	}
}

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

func btoi(b bool) int {
	if b {
		return 1
	}
	return 0
}

func itob(a int) bool {
	if a == 0 {
		return false
	}
	return true
}

func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}

func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 10000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) nextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) nextInt() int {
	v, _ := strconv.Atoi(s.next())
	return v
}
func (s *scanner) nextInt64() int64 {
	v, _ := strconv.ParseInt(s.next(), 10, 64)
	return v
}
func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include <stdio.h>

int main(void){
	int ret;
	int n;
	ret = scanf("%d",&n);
	int  c = 0;
	if(n > 1000000 || n < 1){}
	else{
		if(n%2==0)
			c=n/2-1;
		else
			c=(n-1)/2;
		//if(c != 0)
			printf("%d\n",c);
	}
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int gcd(int a,int b){
    int r;
    if(a<b) swap(a,b);
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int atcoder(){
    //入力
    string a,b;
    cin >> a >> b;
    int ans=0;
    
    //処理
    if(a.length()>b.length()) ans=1;
    else if(a.length()<b.length()) ans=-1;
    else{
        for(int i=0; i<a.length(); i++){
            if(a[i]>b[i]){
                ans=1;
                break;
            }else if(a[i]<b[i]){
                ans=-1;
                break;
            }
        }
    }

    //出力
    if(ans==1) cout << "GREATER" << ENT;
    else if(ans==-1) cout << "LESS" << ENT;
    if(ans==0) cout << "EQUAL" << ENT;
    return 0;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;



int main(){
    string s,t; cin >> s >> t;
    ll cnt = 0;
    rep(i,3) if(s[i]==t[i]) cnt++;
    cout << cnt << endl;
}


Measured memory_bytes: 256
I=input("").split(" ")
t_HP=int(I[0])
t_att=int(I[1])
a_HP=int(I[2])
a_att=int(I[3])

T_turn =True
while t_HP>0 and a_HP>0:
    if T_turn:
        a_HP=a_HP-t_att
        T_turn=False
    else:
        t_HP=t_HP-a_att
        T_turn=True

if t_HP>0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9076
n, m = [int(i) for i in input().split()]
a = [[0, 0] for _ in range(n)]
c = [[0, 0] for _ in range(m)]
for i in range(n):
    a[i] = [int(i) for i in input().split()]
for i in range(m):
    c[i] = [int(i) for i in input().split()]

for i in range(n):
    _min = [10 ** 10, 0]
    for j in range(m):
        if abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1]) < _min[0]:
            _min[0] = abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1])
            _min[1] = j + 1
    print(_min[1])


Measured memory_bytes: 3064
#include<iostream>;
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a < b) {
		cout << "a < b" << endl;
	}
	else if(a>b) {
		cout << "a > b" << endl;
	}
	else {
		cout << "a == b" << endl;
	}
	return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

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

    ll h, a; cin >> h >> a;

    if(h % a == 0){
        cout << h / a << endl;
    }
    else{
        cout << h / a + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
using namespace std;
using ll=long long;

int main(){
	int n,k;
	string s;

	cin>>n>>s>>k;

	for(int i=0;i<n;i++)
		if(s[k-1]!=s[i])s[i]='*';
	cout<<s;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> pii;

int main()
{
  int n,p,j;

  while(1){
    cin>>n>>p;
    if(n==0 && p==0)break;
    int i=0;
    int sum=p;
    int hand[50]={};
    while(1){
      //cout<<p<<endl;
      if(p>0){
	p--;
	hand[i%n]++;
	if(p==0 && sum==hand[i%n]){
	    cout<<i%n<<endl;
	    break;
	}
      }else{
	p+=hand[i%n];
	hand[i%n]=0;
      }
      i++;
    }
  }
}

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

using ll= long long;
#define double long double
#define sz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _set(x) __builtin_popcount(x)
#define _setl(x) __builtin_popcountll(x)
#define PI  3.14159265358979323846264338327950L
#define mod 1000000007LL

void debug(){
	cerr<<"]\n";
}
template<class H,class ... T> void debug(H h,T... t){
	cerr<<h;
	if(sizeof... (t)){
		cerr<<", ";
	}
	debug(t...);
}
#ifdef DEBUG
	#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", debug(__VA_ARGS__)
	#define dpv(...) cerr<< "["#__VA_ARGS__ " : ";for(int i: (__VA_ARGS__)){cerr<<i<<" ";}cerr<<"]\n"
#else
	#define dbg(...) 0
	#define dpv(...) 0
#endif

const int m = 998244353;
void solve(){
	ll n,k;
	cin>>n>>k;
	vector<pair<ll,ll>> seg(k);
	for(int i=0;i<k;i++){
		cin>>seg[i].first>>seg[i].second;
	}
	vector<ll> p(n+2);
	vector<ll> dp(n+1);
	dp[1]=1;
	for(int i=1;i<=n;i++){
		p[i] = (p[i]+p[i-1])%m;
		dp[i] = (dp[i]+p[i])%m;
		for(int j=0;j<k;j++){
			p[min(n+1, i+seg[j].first)] += dp[i];
			p[min(n+1, i+seg[j].first)] %= m;
			p[min(n+1, i+seg[j].second+1)] -= dp[i];
			p[min(n+1, i+seg[j].second+1)] %= m;
		}
	}
	cout<<(dp[n]+m)%m<<"\n";
}


int32_t main(){
	IOS
	// freopen("input.txt","r",stdin);
	int _;
	// cin>>_;
	_=1;
	for(int i=1;i<=_;i++){
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}

/*
   check for overflows int long long
   correct mize of array
*/


Measured memory_bytes: 6360
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using table = vector<vector<int>>;

int main() {
  int r, c;
  cin >> r >> c;

  table t(r + 1, vector<int>(c + 1));
  rep(i, r) rep(j, c) cin >> t[i][j];

  rep(i, r) rep(j, c) t[i][c] += t[i][j];
  rep(i, r) rep(j, c + 1) t[r][j] += t[i][j];

  rep(i, r + 1) rep(j, c + 1) printf("%d%c", t[i][j], (j == c) ? '\n' : ' ');
}


Measured memory_bytes: 3292
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
#define F first
#define S second
const int N = 1e5 + 87, inf = 1e9;
vector<int> g[N];
pii dp[N];
void dfs(int p,int u)
{
    for (int v : g[u]) if (v != p) {
        dfs(u,v);
        dp[u].F = max(dp[u].F,dp[v].F-1);
        dp[u].S = min(dp[u].S,dp[v].S+1);
    }
}
void go(int p,int u)
{
    dp[u].F = max(dp[u].F,dp[p].F-1);
    dp[u].S = min(dp[u].S,dp[p].S+1);
    for (int v : g[u]) if (v != p) {
        go(u,v);
    }
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n - 1; ++i) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    fill_n(dp+1,n,pii(-inf,inf));
    int k;
    cin >> k;
    for (int i = 0; i < k; ++i) {
        int v,p;
        cin >> v >> p;
        dp[v] = pii(p,p);
    }
    bool ok = 1;
    dfs(1,1);
    for (int i = 1; i <= n && ok; ++i)
        ok &= dp[i].F <= dp[i].S;
    go(1,1);
    for (int i = 1; i <= n && ok; ++i) {
        ok &= dp[i].F <= dp[i].S;
        for (int j : g[i])
            ok &= abs(dp[i].F - dp[j].F) == 1;
    }
    if (!ok) {
        cout << "No\n";
        return 0;
    }
    cout << "Yes\n";
    for (int i = 1; i <= n; ++i)
        cout << dp[i].F << '\n';
}


Measured memory_bytes: 13440
S = input()
N = len(S)
if N%2==0:
    pattern_A = "01"*(N//2)
    pattern_B = "10"*(N//2)
else:
    pattern_A = "01"*(N//2)+"0"
    pattern_B = "10"*(N//2)+"1"
error_A, error_B = 0, 0
for i in range(N):
    if pattern_A[i] != S[i]:
        error_A += 1
    if pattern_B[i] != S[i]:
        error_B += 1
ans = error_A if error_A<error_B else error_B
print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
bool Grid[310][310];
int Part[310][310];

int main()
{
  int H, W, K;
  cin >> H >> W >> K;
  char c;
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      cin >> c;
      Grid[i][j] = (c == '#');
    }
  }
  int id = 1;
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      if (Grid[i][j])
      {
        Part[i][j] = id;
        id++;
      }
      else if (j)
      {
        Part[i][j] = Part[i][j - 1];
      }
    }
    for (int j = W - 2; j >= 0; j--)
    {
      if (!Part[i][j])
        Part[i][j] = Part[i][j + 1];
    }
  }
  for (int i = 1; i < H; i++)
  {
    if (Part[i][0] != 0)
      continue;
    for (int j = 0; j < W; j++)
    {
      Part[i][j] = Part[i - 1][j];
    }
  }
  for (int i = H - 2; i >= 0; i--)
  {
    if (Part[i][0] != 0)
      continue;
    for (int j = 0; j < W; j++)
    {
      Part[i][j] = Part[i + 1][j];
    }
  }
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      if (j)
        cout << ' ';
      cout << Part[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 4096
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<queue>
#include<vector>
using namespace std;
char a[105];
int main()
{
	string x;
	//while(cin>>a[++cnt]!=0);无法用在字符数组上
	cin>>x;
	int cnt=x.length();
	cnt--;
	for(int i=0;i<=cnt;i++)
	{
		if(x[i]=='C')
		{
			for(int j=i+1;j<=cnt;j++)
			{
				if(x[j]=='F')
				{
					cout<<"Yes"<<endl;
					return 0;
				}
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N; cin >> N;
  vector<int> P(N);
  int ans = 0;
  int L = 200001;
  for(int i = 0; i < N; ++i){
    cin >> P.at(i);
    if(P.at(i) <= L){
      L = P.at(i);
      ans++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>m;
  if(n+m<10) cout<<n+m<<endl;
  else cout<<"error"<<endl; 
}

int main(){
  solve();
  return 0;
}


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

int main() {
    string s; cin >> s;
    vector<char> t(26, 0);

    for (int i = 0; i < s.size(); i++) {
        int ch = s[i] - 'a';
        t[ch]++;
    }

    for (int i = 0; i < 26; i++) {
        if (t[i] % 2 != 0) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

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

int main() {
  string s;
  cin>>s;
  if(s[2]==s[3]&&s[4]==s[5]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}




Measured memory_bytes: 256
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, D = LI()
    ans = 0
    for _ in range(N):
        X, Y = LI()
        if X ** 2 + Y ** 2 <= D ** 2:
            ans += 1

    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10108
n,k = map(int,input().split())
s = input()
l = [0 for i in range(len(s)+1)]
r = [0 for i in range(len(s)+1)]

count = 0
kukann = 1
for i in range(0,len(s)-1):
    if s[i] != s[i+1]:
        kukann += 1
    if s[i] == 'L' and s[i+1] == 'L':
        count += 1
    elif s[i] == 'R' and s[i+1] == 'R':
        count += 1
if ((kukann-2)//2) >= k:
    count += k*2
elif kukann % 2 == 0:
    if ((kukann-2)//2) >= 0:
        count += ((kukann-2)//2) * 2
    if ((kukann-2)//2) < k and kukann != 1:
        count += 1
else:
    count += min(k*2,(kukann-1))
print(count)

Measured memory_bytes: 46452
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define lowbit(x) ((x)&(-x))
#define inf 0x3f3f3f3f
#define endl "\n"
#define MP(x,y) (make_pair(x,y))
#define pll pair<int,int>
#define pi 3.1415926535
using namespace std;
/*
1 2 3 4 5 6 7
*/
ll n,a[200005];
ll dp[2][2][100005];
int main(){
    scanf("%lld",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
    }
    int x = n/2;
    memset(dp,-0x3f,sizeof(dp));
    dp[0][0][0]=0;
    dp[0][1][1]=a[1];
    for(int i=2;i<=n;i++){
        int mx = min(i/2+1,x);
        int mn = max(0,mx-4);
        for(int j=mn;j<=mx;j++){
            if(j!=0) dp[1][1][j] = a[i] + dp[0][0][j-1];
            dp[1][0][j] = max(dp[0][0][j],dp[0][1][j]);
        }
        for(int j=mn;j<=mx;j++){
            dp[0][0][j]=dp[1][0][j];
            dp[0][1][j]=dp[1][1][j];
        }
    }
    cout<<max(dp[0][0][x],dp[0][1][x]);
}


Measured memory_bytes: 8432
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
 
public class Main {
 
  public static void main(String[] args) {
      Scanner in = new Scanner(System.in);
      int result;
      String a = in.nextLine();
      String b = in.nextLine();
 
      BigInteger aa = new BigInteger(a);
      BigInteger bb = new BigInteger(b);
 
      result = aa.compareTo(bb);
 
      if (result == 0) {
        System.out.println("EQUAL");
      } else if (result == 1) {
        System.out.println("GREATER");
      } else if (result == -1) {
          System.out.println("LESS");
      }
  }
}

Measured memory_bytes: 21972
void main()
{
    long n, m;
    rdVals(n, m);
    long[] s = new long[m], c = new long[m];
    foreach (i; 0 .. m)
    {
        rdVals(s[i], c[i]);
    }

    long[] x = new long[n];
    x[] = -1;
    foreach (u, v; zip(s, c))
    {
        if (x[u-1] == -1) x[u-1] = v;
        else if (x[u-1] != v)
        {
            writeln(-1);
            return;
        }
    }
    if (x[0] == -1)
    {
        if (n >= 2) x[0] = 1;
        else x[0] = 0;
    }

    if (n >= 2 && x[0] == 0)
    {
        writeln(-1);
        return;
    }

    foreach (y; x)
    {
        if (y >= 0) y.write;
        else 0.write;
    }
    writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    ll N; cin >> N;
    map<string, int> m;
    REP(i, N)
    {
        string str; cin >> str;
        sort(ALL(str));
        if(m.find(str) == m.end()) m.insert(make_pair(str, 1));
        else m[str]++; 
    }
    ll ans = 0;
    for(auto itr = m.begin(); itr != m.end(); itr++)
    {
        ll n = itr->second;
        ans += n * (n-1) / 2;
    }
    cout << ans << endl;
} 
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 11264
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include <bitset>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
  ll A, B; cin >> A >> B;

  if(A == B){
    cout << A << endl;
  	return 0;
  }

  B++;

  vector<ll> abit(40, 0);
  vector<ll> bbit(40, 0);


  ll div = 2;
  int pos = 0;
  while(B * 2 > div){
    ll quot = B/div;
    ll rest = B%div;
    bbit[pos] = quot * (div/2);
    if(rest > div/2) bbit[pos] += rest - div/2;
    div *= 2;
    pos++;
  }

  div = 2;
  pos = 0;
  while(A * 2 > div){
    ll quot = A/div;
    ll rest = A%div;
    abit[pos] = quot * (div/2);
    if(rest > div/2) abit[pos] += rest - div/2;
    div *= 2;
    pos++;
  }

  ll ans = 0;
  ll num = 1;
  for(int i= 0; i < 40; i++){
    if ((bbit[i] - abit[i]) % 2 == 1) ans += num;
    num *= 2;
  }

  cout << ans << endl;
  return 0;
}


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

int main()
{
  int n, tmp, cnt, pre;
  cnt = 0;
  tmp = 0;
  int min_cnt = 0;
  int maxv = 0;
  bool judge = true;
  std::cin >> n;
  while (cnt < n) {
    pre = tmp;
    std::cin >> tmp;
    if (pre > tmp && judge) {
      maxv = pre;
      judge = false;
    } else if (pre < tmp && judge == false) {
      judge = true;
      min_cnt += (maxv - pre);
      maxv = 0;
    }
    cnt++;
  }
  min_cnt += tmp;
  if (judge == false) {
    maxv = min_cnt += (maxv - tmp);
  }
  std::cout << min_cnt << std::endl;
  return 0;
}


Measured memory_bytes: 3648
def main():
    from collections import deque
    N, M, K = map(int, input().split())
    f = [set() for _ in range(N + 1)]
    b = [set() for _ in range(N + 1)]

    for _ in range(M):
        i, j = map(int, input().split())
        f[i].add(j)
        f[j].add(i)
    for _ in range(K):
        i, j = map(int, input().split())
        b[i].add(j)
        b[j].add(i)
    
    visited = [False] * (N + 1)
    ans = [0] * (N + 1)

    for i in range(1, N+1):
        if visited[i]:
            continue
        visited[i] = True
        link = {i}
        todo = deque([i])
        while len(todo) != 0:
            c = todo.pop()
            for p in f[c]:
                if not(visited[p]):
                    link.add(p)
                    todo.append(p)
                    visited[p] = True
        for j in link:
            ans[j] = len(link) - len(link & f[j]) - len(link & b[j]) - 1
    
    print(*ans[1:])

if __name__ == '__main__':
    main()

Measured memory_bytes: 100552
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a[10001];
	int num=0;
	for(int i=1;i<=16;i++)
	cin>>a[i];
	if(a[1]!='C')
	num++;
	if(a[2]!='O')
	num++;
	if(a[3]!='D')
	num++;
	if(a[4]!='E')
	num++;
	if(a[5]!='F')
	num++;
	if(a[6]!='E')
	num++;
	if(a[7]!='S')
	num++;
	if(a[8]!='T')
	num++;
	if(a[9]!='I')
	num++;
	if(a[10]!='V')
	num++;
	if(a[11]!='A')
	num++;
	if(a[12]!='L')
	num++;
	if(a[13]!='2')
	num++;
	if(a[14]!='0')
	num++;
	if(a[15]!='1')
	num++;
	if(a[16]!='6')
	num++;
	cout<<num<<endl;
	return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.algorithm;
import std.array;
import std.string;

string fmt(int n) {return format("%5d", n);}
string join_num(int[] arr) {return arr.map!(fmt).join("");}
void show(int[] arr) {writeln(arr.join_num, "", arr.reduce!("a + b").fmt);}

void main() {
  int times;
  while((times = readln.chomp.to!(int)) != 0) {
    int[] cols = new int[](times);
    foreach(t; 0..times) {
      int[] arr = readln.chomp.split(" ").map!((x) => x.to!(int)).array;
      foreach(int i, ref c; cols) c += arr[i];
      show(arr);
    }
    show(cols);
  }
}

Measured memory_bytes: 1232
#include<iostream>

using namespace std;

int main(){
	int N,M;
		
	while(cin>>N>>M,N||M){
		int Expected[11]={0};
		int sum=0;
		int p,d;
		
		for(int i=0;i<N;i++){
			cin>>d>>p;
			Expected[p]+=d;
		}
		
		for(int i=10;i>=0 && M>=0;i--){
			if(Expected[i]<=M){
				M-=Expected[i];
				Expected[i]=0;
			}
			else{
				Expected[i]-=M;
				M=0;
			}
		}
		
		for(int i=10;i>=0;i--){
			if(Expected[i]>0){
				sum+=Expected[i]*i;
			}
		}
		cout<<sum<<endl;
	}
}

Measured memory_bytes: 1164
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long int ll;

#define C(I) cout<<(I)<<endl

ll n,m,a,b,c,x,y,z,aa[100010],ba[100010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc;
vector<ll> va,vb,vc;
set<int> sta;

int main(){
    cin>>a>>b;
    cin>>s;
    r=true;
    for(int i=0;i<a+b+1;i++){
        if(i==a) r=r and s[i]=='-';
        else r=r and int(s[i])<=int('9') and int(s[i])>=int('0');
        
    }
    C(r ? "Yes":"No");
    
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define SORTR(v,n) sort(v, v+n, greater<int>());
// #define int long long    // %d=>%lld
#define pb push_back
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;

int x;
int y;



signed main(){


    scanf("%d", &x);
    scanf("%d", &y);

    int a[12]={1,3,1,2,1,2,1,1,2,1,2,1};

    if(a[x-1] == a[y-1]){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 256
n = gets.to_i
s = gets.chomp
arr = [0, 0]
s.each_char{|c|
    if c < "a"
        if c < "N"
            arr[0] += 1
        else
            arr[0] -= 1
        end
    else
        if c < "n"
            arr[1] += 1
        else
            arr[1] -= 1
        end
    end
}
puts arr.map{|x| x.abs}.inject(:+)
crypt = ""
if arr[0] >= 0
    crypt += ("A" * arr[0])
else
    crypt += ("N" * (- arr[0]))
end
if arr[1] >= 0
    crypt += ("a" * arr[1])
else
    crypt += ("n" * (- arr[1]))
end
puts crypt


Measured memory_bytes: 7064
package main

import "fmt"

func main() {
	var a, b, c int

	fmt.Scan(&a, &b, &c)

	if a == b {
		if a != c {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	} else if b == c {
		if b != a {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	} else if c == a {
		if c != b {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll N;
  cin >> N;

  if(N == 0){
    cout << 2 << endl;
  } else if(N == 1){
    cout << 1 << endl;
  } else{
    vl lucas(N + 1, 0);
    lucas[0] = 2;
    lucas[1] = 1;

    rep2(i, 2, N + 1){
      lucas[i] = lucas[i - 1] + lucas[i - 2];
    }

    cout << lucas[N] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H ,W;
  cin >> H >> W;

  cout << string(W+2, '#')  << endl;

  vector<string> A(H);
  for (int i = 0; i < H; i++) {
    cin >> A.at(i);
    cout << '#' << A.at(i) << '#' << endl;
  }

  cout << string(W+2, '#')  << endl;

}

Measured memory_bytes: 256
w, h, n = map(int, input().split())
cell = []
for i in range(h):
    cell.append([0 for i in range(w)])
    
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        for i in range(h):
            for j in range(x):
                cell[i][j] = 1
            
    elif a == 2:
        for i in range(h):
            for j in range(x, w):
                cell[i][j] = 1
                
    elif a == 3:
        for i in range(y):
            for j in range(w):
                cell[i][j] = 1
                
    elif a == 4:
        for i in range(y, h):
            for j in range(w):
                cell[i][j] = 1

ans = 0            
for i in range(h):
    ans += cell[i].count(0)
print(ans)
        

Measured memory_bytes: 9092
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

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

    int n, y;
    cin >> n >> y;
    for(int y10000 = 0; y10000*10000 <= y; y10000++){
        for(int y5000 = 0; y5000*5000 + y10000*10000 <= y; y5000++){
            int y1000 = n - y10000 - y5000;
            if(y1000 >= 0 && y5000*5000 + y10000*10000 + y1000*1000 == y){
                cout << y10000 << " " << y5000 << " " << y1000 << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}


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

using namespace std;

int main()
{
    string n;
    cin>>n;
    if(n[0]!=n[1] && n[2]==n[3] && n[4]==n[5] && n.length()==6)
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

int main() {
    int A, B, C, K; cin >> A >> B >> C >> K;
    int ans = 0;
    while(1) {
        if (K == 0) {
            break;
        }
        if (A > 0) {
            A--;
            K--;
            ans++;
        } else if (B > 0) {
            B--;
            K--;
        } else {
            C--;
            K--;
            ans--;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << 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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
// const ll MOD = 1e9 + 7;
const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	int n, d;
	cin >> n >> d;
	int ans = 0;
	rep(i, n) {
		ll x, y;
		cin >> x >> y;
		double dist = sqrt(x * x + y * y);
		if (dist <= d) ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int n,k;
  cin >> n >> k;
  set<int> s;
  rep(i,k) {
    int d;
    cin >> d;
    vector<int> a(d);
    rep(j,d) {
      cin >> a[j];
      s.insert(a[j]);
    }
  }
    int ans=n-s.size();
    cout << ans << endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)
#define Pr(a) (#a)<<"="<<(a)<<" "
#define pr1(a) cerr<<Pr(a)<<endl
#define pr2(a,b) cerr<<Pr(a)<<Pr(b)<<endl
#define pr3(a,b,c) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<endl
#define pr4(a,b,c,d) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<endl
#define pr5(a,b,c,d,e) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<endl
#define pr6(a,b,c,d,e,f) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<Pr(f)<<endl
#define int long long
#define double long double
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}


signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  typedef tuple<int,int,char,int,string> T;
  int n;
  cin>>n;
  vector<T> A;
  for(int i=0;i<n;i++){
    int v;
    int w;
    char t;
    int d;
    string s;
    cin>>v>>w>>t>>d>>s;
    A.push_back(T(v,w,t,d,s));
  }

  sort(A.begin(), A.end());
  
  for(auto a:A){
    int v;
    int w;
    char t;
    int d;
    string s;
    tie(v, w, t, d, s) = a;
    cout<<v<<" "<<w<<" "<<t<<" "<<d<<" "<<s<<endl;
  }
  
  return 0;
}



Measured memory_bytes: 11844
#include <stdio.h>

int judge(int n)
{
  int i;
  int small = 1, large = n;

  for(i=2;i<=9;i++){
    if(n%i==0){
      small = i;
      large = n/small;
    }
  }

  if(large<=9)return 1;
  else return 0;
}

int main(void)
{
  int N;
  scanf("%d",&N);
  if(judge(N))puts("Yes");
  else puts("No");

  return 0;
}


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

int main(){
  int n;
  while(cin >> n){
    int a, b, c, d, cnt = 0;
    for(int a = 0; a < 10; a++){
      for(int b = 0; b < 10; b++){
        for(int c = 0; c < 10; c++){
          for(int d = 0; d < 10; d++){
            if(a + b + c + d == n)
             cnt++;
          }
        }
      }
    }
    cout << cnt << endl;
  }

}

Measured memory_bytes: 3004