akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
 
int len(char s[20]){
    int length = 0;
    while(s[length])    {
        length ++;
    }
    return length;
}
 
long long min (long long a, long long b)
{
    if(a>b) return b;
    else return a;
}
int main(void)
{
    long long N;
    scanf("%lld",&N);
    char s[N][20];
    int b[N];
    long long i;
    for (i = 0; i < N; i ++)    {
        scanf("%s",s[i]);
        if(i != N-1)    scanf("%d",&b[i]);
    }   //入力テスト済み//
    long long ans;
    ans = 0;
    for (i = 0; i < N; i++) {
        for (int j = 0; j < 10; j ++)   {
            if(s[i][j] == 'A' && s[i][j+1] =='B')   ans ++;
        }
    }
    long long lasta = 0;
    long long firstb = 0;
    long long both = 0;
    for (i = 0; i < N; i++) {
        if(s[i][0] == 'B')  firstb ++;
        if(s[i][len(s[i])-1] == 'A')  {
            lasta ++; 
           // printf("%lld\n",i);//
        }
        if(s[i][0] == 'B' && s[i][len(s[i])-1] == 'A')    both ++;
    }
    firstb -= both;
    lasta -= both;
   //printf("%lld %lld %lld",firstb,lasta,both);//
    //puts("");//
    if(both == 0)   ans += min(firstb,lasta);
    else    {
        if(lasta + firstb != 0) {
            ans += min(firstb,lasta) + both;
        }
        else {
            ans += both -1;
        }
    }
    printf("%lld",ans); 
}

Measured memory_bytes: 384
using System;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.IO;
using System.Text;
using N = System.Int32;

static class Program
{
    static public void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        var solver = new Solver();
        solver.Solve();
        Console.Out.Flush();
    }
}

public class Solver
{
    public void Solve()
    {
        string s = rs, t = rs;
        N x = 0, m = 0;
        for(int i = 0; i <= s.Length-t.Length; i++)
        {
            x = 0;
            for(int j = 0; j < t.Length; j++)
            {
                if (s[i + j] == t[j]) x++;
            }
            if (x > m) m = x;
        }
        Write(t.Length - m);
    }

    N rn { get { return sc.Integer(); } }
    double rd { get { return sc.Double(); } }
    string rs { get { return sc.Scan(); } }
    public StreamScanner sc = new StreamScanner(Console.OpenStandardInput());

    void Write<T>(T t) { Console.WriteLine(t.ToString()); }
    void YN(bool t) { Console.WriteLine(t ? "YES" : "NO"); }
    void Yn(bool t) { Console.WriteLine(t ? "Yes" : "No"); }
    void yn(bool t) { Console.WriteLine(t ? "yes" : "no"); }
}



public class StreamScanner
{
    public StreamScanner(Stream stream) { str = stream; }
    private readonly Stream str;
    private readonly byte[] buf = new byte[1024];
    private int len, ptr;
    public bool isEof = false;
    public bool IsEndOfStream { get { return isEof; } }
    private byte read()
    {
        if (isEof) throw new EndOfStreamException();
        if (ptr >= len)
        {
            ptr = 0;
            if ((len = str.Read(buf, 0, 1024)) <= 0)
            {
                isEof = true;
                return 0;
            }
        }
        return buf[ptr++];
    }
    public char Char()
    {
        byte b = 0;
        do b = read();
        while (b < 33 || 126 < b);
        return (char)b;
    }
    public string Scan()
    {
        var sb = new StringBuilder();
        for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
            sb.Append(b);
        return sb.ToString();
    }
    public N Integer()
    {
        N ret = 0; byte b = 0; var ng = false;
        do b = read();
        while (b != '-' && (b < '0' || '9' < b));
        if (b == '-') { ng = true; b = read(); }
        for (; true; b = read())
        {
            if (b < '0' || '9' < b)
                return ng ? -ret : ret;
            else ret = ret * 10 + b - '0';
        }
    }
    public double Double() { return double.Parse(Scan()); }
}


Measured memory_bytes: 23824
#include <stdio.h>

int main() {
  int A, B, K;

  int i;

  scanf("%d%d%d", &A, &B, &K);
  i = A + 1;
  while (K > 0) {
    i--;
    if (A % i == 0 && B % i == 0) {
      K--;
    }
  }
  printf("%d\n", i);
  return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

// 最長増加部分列の長さを返す O(n log n)
// 増加部分列の中で同じ数が複数含まれることを許す
// ※同じ数が複数含まれないようにするには、 upper_bound を lower_bound に変更すると OK
ll lis(const vector<ll>& v) {
    ll ret = 0;
    // 増加部分列の長さが i のとき、一番右に来る数字の最小値(dp 内の値は単調増加になる)
    vector<ll> dp(v.size(), LLINF);
    for(int i = 0; i < v.size(); ++i) {
        //auto it = upper_bound(dp.begin(), dp.end(), v[i]);
        auto it = lower_bound(dp.begin(), dp.end(), v[i]);  // 同じ数を含まないようにする場合
        *it = v[i];
        ret = max(ret, static_cast<ll>(it - dp.begin()));
    }
    // LLINF でない最大のインデックス + 1 が LIS になる
    return ret + 1;
}

// 最長減少部分列の長さを返す O(n log n)
ll lds(const vector<ll>& v) {
    vector<ll> minus_v;
    for(auto& val : v) { minus_v.push_back(-val); }
    return lis(minus_v);
}

ll N;
vector<ll> H;

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

    cin >> N;
    H.resize(N);
    REP(i, N) { cin >> H[i]; }

    if(lds(H) > 2) {
        printf("No\n");
        return 0;
    }
    for(int i = 1; i < N; ++i) {
        if(H[i-1] - 1 > H[i]) {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


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

int main() {
    int N, A;
    cin >> N >> A;
    bool flag = false;
    for (int i = 0; i <= A; i++){
        if ((N - i) % 500 == 0){
            flag = true;
        }
    }
    if (flag){
        puts("Yes");
    }else{
        puts("No");
    }

}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

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

	int len = s.length();

	int posA = 0;
	for (int i = 0;i < len;i++) {
		if (s[i] == 'A') {
			posA = i;
			break;
		}
	}
	int posZ = 0;
	for (int i = len - 1;i >= 0;i--) {
		if (s[i] == 'Z') {
			posZ = i;
			break;
		}
	}

	

	cout << posZ-posA+1 << endl;
	return 0;
}

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}

signed main() 
{
  string s; cin>>s;
  int k=in();
  set<string> ss;
  rep(i,s.size())
  {
    REPS(j,1,7)
    {
      ss.emplace(s.substr(i,j));
    }
  }
  auto itr=ss.begin();
  rep(i,k-1) ++itr;
  print(*itr);

  return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <string.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <stdlib.h>
using namespace std;
typedef long long int lld;
typedef long double ld;
const lld mod = 998244353;
lld dp[222222],vis[222222];
bool can(string a,string b){
	for(int e=0;e<a.size();e++){
		if(a[e]>b[e]) return true;
		if(a[e]<b[e]) return false;
	}
	return true;
}
int main(void){
	lld n;
	string a;
	cin >> n >> a;
	dp[0] = 1;
	for(int e=1;e<222222;e++) dp[e] = (dp[e-1]*2)%mod;
	lld ans = 0;
	for(int e=0;e<n;e++) if(a[e]=='1') ans = (ans+dp[n-e-1]*n*2)%mod;
	ans = (ans+2*n)%mod;
	vector<lld> v;
	for(int e=1;e<n;e++) if(n%e==0&&(n/e)%2) v.push_back((lld)e);
	for(int e=0;e<v.size();e++){
		lld val = 0;
		for(int p=0;p<v[e];p++) if(a[p]=='1') val = (val+dp[v[e]-p-1])%mod;
		string f = "",s="",t="";
		for(int p=0;p<v[e];p++) f += a[p];
		for(int p=0;p<v[e];p++){
			if(a[p]=='1') s += "0";
			else s += "1";
		}
		for(int p=0;p<n/v[e];p++){
			if(p%2==0) t += f;
			else t += s;
		}
		if(can(a,t)) val = (val+1)%mod;
		val = (val-vis[v[e]]+mod*mod)%mod;
		ans = (ans - 2*val*n + 2*val*v[e]+mod*mod)%mod;
		for(int p=v[e];p<=n;p+=(v[e]*2)) vis[p] = (vis[p]+val)%mod;
	}
	printf("%lld",ans);
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  vector<int> vec(26);

  if (s.size() == 26) {
    for (int i = 25; i > 0; i --) {
      vec.at(s.at(i) - 'a') ++;
      if (s.at(i) > s.at(i - 1)) {
        for (int j = s.at(i - 1) - 'a' + 1; j < 26; j ++) {
          if (vec.at(j)) {
            cout << s.substr(0, i - 1) << char(j + 'a') << endl;
            return 0;
          }
        }
      }
    }
    cout << -1 << endl;
    return 0;

  } else {
    for (int i = 0; i < s.size(); i ++) {
      vec.at(s.at(i) - 'a') ++;
    }
    for (int i = 0; i < 26; i ++) {
      if (!vec.at(i)) {
        cout << s << char(i + 'a') << endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 256
tarop, hanakop = 0, 0
n = int(input())

for i in range(n):
    taroc, hanakoc = input().split()
    if taroc > hanakoc:
        tarop += 3
    elif taroc < hanakoc:
        hanakop += 3
    elif taroc == hanakoc:
        tarop += 1
        hanakop += 1

print(tarop, hanakop)


Measured memory_bytes: 5600
#include <string>
#include <iostream>
using namespace std;
string s;
int main() {
	cin >> s;
	string ret;
	for (char c = 'a'; c <= 'z'; c++) {
		if (s.find(c) == string::npos) {
			ret = s + c;
			break;
		}
	}
	if (!ret.empty()) cout << ret << endl;
	else {
		for (int i = s.size() - 1; i >= 0 && ret.empty(); i--) {
			string sub = s.substr(0, i);
			for (char j = s[i] + 1; j <= 'z'; j++) {
				if (sub.find(j) == string::npos) {
					ret = sub + j;
					break;
				}
			}
		}
		if (!ret.empty()) cout << ret << endl;
		else cout << -1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
    }
    let mut ok = false;
    for i in (1..10) {
        for j in (1..10) {
            if i * j == n {
                ok = true
            }
        }
    }
    println!("{}", if ok { "Yes" } else { "No" });
}


Measured memory_bytes: 2200
import Foundation

func main() {
    let aryKeyItem = ["AC","WA","TLE","RE"]
    var dicCount = ["AC": 0,"WA": 0,"TLE": 0,"RE": 0]
    
    let n = Int(readLine()!)!
    
    for _ in 1...n {
        dicCount[readLine()!]! += 1
    }
    
    aryKeyItem.forEach({
        print("\($0) x \(dicCount[$0]!)")
    })
}
main()


Measured memory_bytes: 13428
n, m, x, y = map(int, input().split())
areaX = list(map(int, input().split()))
areaY = list(map(int, input().split()))

areaX.append(x)
areaY.append(y)

if max(areaX) < min(areaY):
    print("No War")
else:
    print("War")


Measured memory_bytes: 3316
/*  -*- coding: utf-8 -*-
 *
 * p.cc: P - Independent Set
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 100000;
const int MOD = 1000000007;

/* typedef */

typedef long long ll;
typedef vector<int> vi;
typedef queue<int> qi;

/* global variables */

vi nbrs[MAX_N];
int prts[MAX_N], cns[MAX_N], dp[MAX_N][2];

/* subroutines */

inline void addmod(int &a, int b) { a = (a + b) % MOD; }
inline void mulmod(int &a, int b) { a = (ll)a * b % MOD; }

/* main */

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

  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--, b--;
    nbrs[a].push_back(b);
    nbrs[b].push_back(a);
  }

  prts[0] = -1;
  qi q;
  q.push(0);

  while (! q.empty()) {
    int u = q.front(); q.pop();
    int &up = prts[u];
    vi &nbru = nbrs[u];
    for (vi::iterator vit = nbru.begin(); vit != nbru.end(); vit++) {
      int &v = *vit;
      if (v != up) {
	cns[u]++;
	prts[v] = u;
	q.push(v);
      }
    }
  }

  for (int i = 0; i < n; i++) {
    dp[i][0] = dp[i][1] = 1;
    if (cns[i] == 0) q.push(i);
  }

  while (! q.empty()) {
    int u = q.front(); q.pop();
    int &up = prts[u];

    if (up >= 0) {
      mulmod(dp[up][0], (dp[u][0] + dp[u][1]) % MOD);
      mulmod(dp[up][1], dp[u][0]);
      if (--cns[up] == 0) q.push(up);
    }
  }

  printf("%d\n", (dp[0][0] + dp[0][1]) % MOD);
  return 0;
}


Measured memory_bytes: 8268
#include<cstdio>
#include<cstring>

char s[111];
int len, pre, suf;
char t[11] = "keyence";

int main() {
	scanf("%s", s);
	len = strlen(s);
	
	pre = -1; suf = 111;
	for(int i=0;i<7;i++)
		if(s[i] == t[i]) pre = i;
		else break;
	for(int i=0;i<7;i++) 
		if (s[len-i-1] == t[7-i-1]) suf = 7-i-1;
		else break;
	//printf("%d %d\n", pre, suf);
	puts(pre>=suf-1 ? "YES" : "NO");
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(){

    int A, B;
    cin >> A >> B;

    if (A > 0){
        cout << "Positive" << endl;
    }else if(A < 0 && B > 0){
        cout << "Zero" << endl;
    }else if(A == 0 || B == 0){
        cout << "Zero" << endl;
    }else if (A == B){
        cout << "Positive" << endl;
    }else{
        int deg = B - A;
        if (deg % 2 == 0){
            cout << "Negative" << endl;
        }else{
            cout << "Positive" << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

using namespace std;

const int MAX_WIDTH = 1005, MAX_HEIGHT = 1005, MOD = 1e9 + 7;
const char WALL = '#';
char grid[MAX_WIDTH][MAX_HEIGHT];
long long no_of_paths[MAX_WIDTH][MAX_HEIGHT];

int main()
{
    int height, width;
    scanf("%d %d", &height, &width);

    for(int i = 1; i <= height; i++)
        scanf("%s", grid[i] + 1);

    memset(no_of_paths, 0, sizeof(no_of_paths));

    for(int i = 1; i <= height; i++)
    {
        for(int j = 1; j <= width; j++)
        {
            if(grid[i][j] == WALL) continue;

            if(i == 1 && j == 1)
            {
                no_of_paths[i][j] = 1;
            }
            else
            {
                no_of_paths[i][j] = (no_of_paths[i - 1][j] + no_of_paths[i][j - 1])%MOD;
            }
        }
    }

    printf("%lld", no_of_paths[height][width]);
    return 0;
}


Measured memory_bytes: 9088
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;


int main(){
    LL K;
    cin >> K;
    puts("50");
    LL t=K/50+49;
    for(int i=0;i<50;i++){
        if(K%50==0) cout << t << (i==49?"\n":" ");
        else if(i>=50-K%50) cout << t+1 << (i==49?"\n":" ");
        else cout << t-K%50 <<" ";
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <sysexits.h>
#include<stdlib.h>
#include<math.h>
int main(void){
  int j,N,tmp,sum,v[20],c[20],i,mod[5],s[5],k;
   if(scanf("%d",&N)>1){
    exit(0);
  }
  for(i=0;i<N;i++){
    if(scanf("%d",&v[i])>1){
    exit(0);
  }
  }
   for(i=0;i<N;i++){
    if(scanf("%d",&c[i])>1){
    exit(0);
  }
   }
   sum =0;
  for(i=0;i<N;i++){
    if(v[i]>c[i]){
      sum = sum +v[i]-c[i];
    }
  }
  printf("%d",sum);
  return 0;
}


Measured memory_bytes: 128
k = int(input())
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'
sl = s.split(', ')
print(sl[k-1])

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#ifdef dbg
#include "./printer.hpp"
#else
#define dump(x) void(0)
#endif

using namespace std;

#define MOD 1000000007
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define ll long long
#define ull unsigned long long
#define pb push_back
#define ALL(x) ((x).begin(), (x).end())
#define sync(); ios_base::sync_with_stdio(0);

inline long  toInt(string s) {long  v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main() {
  sync();
  string s;
  cin >> s;
  cout << s.substr(0,4) << ' ' << s.substr(4,8) << endl;
  return 0;
  

}


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

int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    
    if (a == b && b == c && a==c || a != b && b != c && a!=c){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    
    
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>


using namespace std;

typedef long long ll;

const ll MOD_CONST = 1000000007;



int main() {
	int x, y, z, k;
	cin >> x >> y >> z >> k;
	vector<ll> a(x);
	for (int i = 0; i < x;i++) {
		cin >> a[i];
	}
	vector<ll> b(y);
	for (int i = 0; i < y;i++) {
		cin >> b[i];
	}
	vector<ll> c(z);
	for (int i = 0; i < z;i++) {
		cin >> c[i];
	}

	vector<ll> ab;
	for (int i = 0; i < x; i++) {
		for (int j = 0; j < y;j++) {
			ab.emplace_back(a[i] + b[j]);
		}
	}

	sort(ab.begin(), ab.end(),greater<ll>());

	vector<ll> abc;
	for (int i = 0; i < min(x*y, k);i++) {
		for (int j = 0; j < z;j++) {
			abc.emplace_back(ab[i] + c[j]);
		}
	}

	sort(abc.begin(), abc.end(),greater<ll>());

	for (int i = 0; i < min(x*y*z, k); i++) {
		cout << abc[i] << endl;
	}


}


Measured memory_bytes: 43376
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

mint factorial(ll n) {
  mint answer = 1;
  while (n > 1) {
    answer *= n;
    n--;
  }
  return answer;
}

mint combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

mint permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

// setprecision(8) 桁数指定
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

vector<ll> Eratosthenes(const ll N) {
  bool is_prime[1000000 + 1];
  vector<ll> P;
  for (ll i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (ll i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  int x, t;
  cin >> x >> t;
  cout << max(x - t, 0) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int n;
    scanf("%d", &n);
    int h[n];
    int i;
    for (i = 0; i < n; i++)
        scanf("%d", &h[i]);
    int s = 0;
    int m = 0;
    for (i = 0; i < n - 1; i++) {
        if (h[i] >= h[i + 1]) {
            s++;
        } else {
            if (s > m)
                m = s;
            s = 0;
        }
    }
    if (s > m)
        m = s;
    printf("%d\n", m);
    
    return 0;
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }

ll combination(ll n, ll a){  // nCa
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}

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

  int n;
  cin >> n;
  vs s(n);
  rep(i,n) {
    cin >> s[i];
    sort(all(s[i]));
  }
  sort(all(s));
  ll ans = 0;
  ll cnt = 1;
  s.push_back("aa");
  REP(i,n+1) {
    if (s[i] != s[i-1]) {
      ans += combination(cnt, 2);
      cnt = 0;
    }
    cnt++;
  }
  cout << ans << endl;
}

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

/*
まず, １つ目の条件を満たす組の数を求める：
それは, Rの個数 * Gの個数　* Bの個数である

次に, １つ目の条件を満たす組のうち
j-i = k-jとなる組の個数を求める
（j-i != k-jは扱いにくい. そのため, complementを取ったほうが考えやすい）

*/


int main(void){
   
    int n;
    cin >> n;
    
    string s;
    cin >> s;
    
    long long numberOfR = 0;
    long long numberOfG = 0;
    long long numberOfB = 0;
    
    for (int i = 0; i < n; i++){
        if (s[i] == 'R') numberOfR++;
        else if (s[i] == 'G') numberOfG++;
        else numberOfB++;
    }
    
    long long condition1 = numberOfR * numberOfG * numberOfB;
    
    long long condition2 = 0;
    
    for (int i = 0; i < n-2; i++){
        for (int j = i+1; j < n-1; j++){
            int k = 2*j-i;
            
            if (k >= n) continue;
            
            if (s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) condition2++;
        }
    }
    
    long long ans = condition1 - condition2;
    
   
    cout << ans << endl;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=3e5;
const long inf=1e14;
int N,M; int S;
vector<pair<pair<int,int>,long>> g[50][2500];
long dist[50][2500];
void dijkstra(int a){// O(NlogN+M)
	priority_queue<pair<long,pair<int,int>>> pq;
	rep(i,0,N)rep(j,0,2500){
		if(i == 0 && j == S){ dist[0][S] = 0; pq.push({0, {0, S}}); }
		else{ dist[i][j] = inf; pq.push({-inf, {i, j}}); }
	}
	while(!pq.empty()){
		int v = pq.top().second.first;
		int t = pq.top().second.second;
		pq.pop();
		for(pair<pair<int,int>,long> p:g[v][t]){
            int u = p.first.first;
            int k = p.first.second;
			long temp = dist[v][t] + p.second;
			if(dist[u][k] > temp){
				dist[u][k] = temp;
				pq.push({-dist[u][k], {u, k}});
			}
		}
	}return;
}
int main(){
	cin>>N>>M>>S; S = min(S, 2499);
	int a; long b;
	rep(i,0,M){
		int u,v;
		cin>>u>>v>>a>>b; u--; v--;
		rep(t,a,2500){
			g[u][t].push_back({{v, t-a}, b});
			g[v][t].push_back({{u, t-a}, b});
		}
	}
	int c; long d;
	rep(i,0,N){
        cin>>c>>d;
		rep(t,0,2500-c){
			g[i][t].push_back({{i, t+c}, d});
		}
	}
	dijkstra(0);
	long ans = 0;
	for(long i = 1; i < N; i++){
		ans = inf;
		for(long j = 0; j < 2500; j++) ans = min(ans, dist[i][j]);
		cout<<ans<<endl;
	}//pprint(dist,,N,10);
}

Measured memory_bytes: 26276
#include <bits/stdc++.h>
#define ll          long long int
#define pii         pair<int,int>
#define uu          first
#define vv          second
#define fastIO      ios::sync_with_stdio(0);cin.tie(0);
using namespace std;

const int MAX = 1e6 + 6;
const int INF = 1e9;

int main()
{
    fastIO;
    int n;
    cin>>n;
    vector<int>h(n+1), dp(n+1);
    
    for(int i =1 ; i<=n ; i++ ) cin>>h[i];
    dp[0] = INF;
    for(int i =2; i<=n ; i++) {
        dp[i] = min( dp[i-1] + abs(h[i]- h[i-1]) , dp[i-2] + abs(h[i]- h[i-2]) );
    }
    cout<<dp[n]<<'\n';
    return 0;
    
}

Measured memory_bytes: 3960
import java.util.*;

public class Main {
	public static void main(String[] args) {
		ALDS1_2_B();
	}
        
	public static void ALDS1_2_B() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int countAns = 0;
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++) {
			int minj = i;
			for(int j = i; j < n; j++) {
				if(a[j] < a[minj]) {
					minj = j;
				}
			}
			if(minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				countAns++;
			}
		}

		for(int i = 0; i < n; i++) {
			System.out.print(a[i]);
			if(i != n - 1)
				System.out.print(" ");
		}
		System.out.println();
		System.out.println(countAns);
	}
}


Measured memory_bytes: 26356
import math
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**6)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7


n, m = MAP()
a = MAP()
p = [(a[i], 1) for i in range(n)]
for j in range(m):
    b, c = MAP()
    p.append((c, b))
p.sort(reverse=True)
ans, cnt = 0, n
for (v, c) in p:
    use = min(c, cnt)
    ans += use * v
    cnt -= use
print(ans)

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

int main() {
    long long a, b, c, ans = 0;
    cin >> a >> b >> c;
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) ans = 0;
    else ans = min(a * b, min(b * c, c * a));

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

Measured memory_bytes: 256
#include <functional>
#include <iomanip>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include<complex>
#include <numeric>
#include <string>
#include<iostream>
#include <fstream>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include<cmath>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
using namespace std;
const double PI = acos(-1.0);
const double  EPS = 1e-11;
typedef long long ll;
//freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
void fast()
{
	std::ios_base::sync_with_stdio(0);
}
int main()
{
	int n;
	cin >> n;
	vector<int>arr(n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}
	sort(arr.begin(), arr.end());
	if (n == 2)
	{
		cout << arr[1] << " " << arr[0] << endl;
		return 0;
	}
	int mx = arr[n - 1] / 2;
	int t = 1000000009;
	int ans = -1;
	for (int i = 0; i < n; i++)
	{
		if (abs(arr[i] - mx) <= t)
		{
			t = abs(arr[i] - mx);
			ans = arr[i];
		}
	}
	cout << arr[n-1] << " " << ans << endl;

	return 0;
}

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

int main() {
  string s; cin >> s;
  string ans = "";
  for(int i = 0; i<s.size(); i++){
    if(s[i]=='0') ans+='0';
    if(s[i]=='1') ans+='1';
    if(s[i]=='B' && ans.size()>0) ans.pop_back();
  }
  cout << ans << endl;
  return 0;
}




Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n1 = scanner.nextInt();
        int n2 = scanner.nextInt();
        int x = n1*n2;
        int y = (n1+n2)*2;
        System.out.print(x);
        System.out.println(" "+y);
    }
}


Measured memory_bytes: 26120
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using VI = vector<int>;
using VB = vector<bool>;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;

int main()
{
  int n;
  cin >> n;
  VI x(110);
  rep(i, n) cin >> x.at(i);
  // intの無限大の値
  int ans = 1001001001;
  rep(i, 100){
    int now =0;
    rep(j, n) now += (x.at(j) - i) * (x.at(j) -i);
    // ansで答えを保持しつつ、最小値を求めるための記法
    ans = min(ans, now);
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
    long long a, b, c, d, ans; cin >> a >> b >> c >> d;
    ans = a * c;
    if (ans < a * d) ans = a * d;
    if (ans < b * c) ans = b * c;
    if (ans < b * d) ans = b * d;
    cout << ans << endl;
}

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

int main()
{long long H;
long long sum = 1;
long long last = 0;
cin >> H;
for(int i = 0;H > 0;i++){
  H = H/2;
  sum *= 2;
}
for(int i = 0;sum>1;i++){
  sum = sum/2;
  last +=sum;
}
cout << last;
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>
#include<math.h>
using namespace std ;

int main(){
	
	int n ;
	int a,b,c,d ;
	int y[101]={} ;
	int min = 1000 , distance[2] ;
	
	cin >> n ;
	cin >> a >> b ;
	cin >> c >> d ;
	
	for( int i=0 ; i<n ;i++ ) y[i] = i+1 ;
	
	for( int i=0 ; i<n ; i++ ){
		distance[0] = abs( (a-1)%y[i] - (b-1)%y[i] ) + abs( (a-1)/y[i] - (b-1)/y[i] ) ;
		distance[1] = abs( (c-1)%y[i] - (d-1)%y[i] ) + abs( (c-1)/y[i] - (d-1)/y[i] ) ;
		if( min > distance[0] + distance[1] )
			min = distance[0] + distance[1] ;
	}
	
	cout << min << endl ;
	
return 0;
}

Measured memory_bytes: 1164
#include <stdio.h>
#include<iostream>
#include<string>
#include <string.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <climits>
#include <map>
using namespace std;
int main() {
    int a,b,c;
    cin>>a>>b>>c;
    if(b*c>=a) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3644
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanLines)
	total := 0
	sc.Scan()
	in := sc.Text()
	a := strings.Split(in, " ")
	for _, v := range a {
		n, _ := strconv.Atoi(v)
		total += n
	}

	fmt.Println(total)

}



Measured memory_bytes: 1092
n,m=map(int,input().split())
A=[int(input()) for i in range(m)]

ai=0
n1,n2=0,1
for i in range(1,n+1):
      if ai<m and i==A[ai]:
            ai+=1
            n1=n2
            n2=0
      else:
            tmp=n2
            n2=(n1+n2)%1000000007
            n1=tmp
print(n2)


Measured memory_bytes: 7080
import re
import numpy as np
import math

#a = int(input())
#b, c = map(int, input().split())
#l = list(map(int, input().split()))

a, b, c = map(int, input().split())
if a==b:
  if a==c:
    print('No')
  else:
    print('Yes')
else:
  if a==c:
    print('Yes')
  else:
    if b==c:
      print('Yes')
    else:
      print('No')

Measured memory_bytes: 21280
N = int(input())
import math


def solve(num):
        count = 0
        for i in range(1, int(math.sqrt(num)) + 1):
                if num % i == 0:
                        if (num // i) != i:
                                count += 2
                        else:
                                count += 1
        if count == 8:
                return 1
        else:
                return 0

count = 0
for i in range(1, N+1):
        if i % 2 == 1:
                if solve(i):
                        count += 1
print(count)


Measured memory_bytes: 38256
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<bits/stdc++.h>

using namespace std;

int main() {
  long long int a, b, x, y, jum=0;
  scanf("%lld %lld", &a, &b);
  for(long long int i=0; i<a; i++){
  	scanf("%lld %lld", &x, &y);
  	if((x*x)+(y*y)<=b*b){
  		jum++;
	  }
  }
  
  printf("%lld\n", jum);
  return 0;
}

//middle = 3, 3

Measured memory_bytes: 3784
def main():
    N = int(input())
    H = list(map(int, input().split()))

    for i in range(N-1):
        if H[i] < H[i+1]:
            H[i+1] -= 1
            continue

    for i in range(N-1):
        if H[i] > H[i+1]:
            print('No')
            exit()
    
    print('Yes')

main()

Measured memory_bytes: 63856
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    int N;
    cin >> N;
    vector<pair<ll,ll>> W(N);
    ll a, b;
    for ( int i = 0; i < N; i++ ) {
        cin >> a >> b;
        W[i] = make_pair(b,a);
    }
    sort(W.begin(), W.end());
    string ans = "Yes";
    ll t = 0;
    for ( int i = 0; i < N; i++ ) {
        t += W[i].second;
        if ( W[i].first < t ) {
            ans = "No";
            break;
        }
    }

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

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

int main() {
    int k, s;
    cin >> k >> s;
    int ans = 0;
    for(int x = 0; x <= k; x++) {
        for(int y = 0; y <= k; y++) {
            int z = s - x - y;
            if(0 <= z and z <= k) {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;
#define DIV 1000000007

ll power(ll m, int n)
{
    if (n == 0) return 1;
    if (n % 2 == 1) {
        return power(m * m % DIV, n / 2) % DIV * m % DIV;
    } else {
        return power(m * m % DIV, n / 2);
    }
}

int main()
{
    int m, n;
    cin >> m >> n;
    ll surplus = power(m, n) % DIV;

    cout << surplus << endl;
    return 0;
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int Max=0x3f3f3f3f;
int a[100005];
int main()
{
    int p,n;
    while(~scanf("%d%d",&p,&n))
    {
        int x;
        bool f=0;
        int sum=0;
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
            sum+=a[i];
        }
    
        if(sum>=p)printf("Yes\n");
        else printf("No\n");
    }
}


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

namespace Algorithm
{
    class Program
    {
        const int NumberOfCities = 6;
        const int NumberOfVehicle = 5;

        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            var citiesPeople = new long[NumberOfCities];
            var vehicles = new long[NumberOfVehicle];

            for (var i = 0; i < NumberOfVehicle; i++)
            {
                vehicles[i] = long.Parse(Console.ReadLine());
            }

            var min = vehicles.Min();

            var answer = n / min + NumberOfVehicle;
            if (n % min == 0) answer -= 1;

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13268
#include <stdio.h>

int M,N;
char hata[1000][1001],niko[2][3],tmp[4] = "JOI";
	
int check(int y,int x){
	int i,j;
	
	if(x < 0 || y < 0 || y+1 >= M || x+1 >= N) return 0;
	
	for(i = 0;i < 2;i++){
		for(j = 0;j < 2;j++){
			if(hata[y+i][x+j] != niko[i][j]){
				return 0;
			}
		}
	}
	
	return 1;
}

int main(void) {
	int i,j,k,cnt,max,tmpn,tmpc;
	
	scanf("%d %d",&M,&N);
	for(i = 0;i < M;i++){
		scanf("%s",hata[i]);
	}
	
	for(i = 0;i < 2;i++){
		scanf("%s",niko[i]);
	}
	
	cnt = 0;
	for(i = 0;i < M-1;i++){
		for(j = 0;j < N-1;j++){
			if(hata[i][j] == niko[0][0]){
				if(check(i,j)){
					cnt++;
				}
			}
		}
	}
	
	max = 0;
	for(i = 0;i < M;i++){
		for(j = 0;j < N;j++){
			for(k = 0;k < 3;k++){
				if(hata[i][j] != tmp[k]){
					tmpc = hata[i][j];
					hata[i][j] = tmp[k];
					tmpn = check(i,j)+check(i-1,j)+check(i,j-1)+check(i-1,j-1);
					if(tmpn > max){
						max = tmpn;
					}
					hata[i][j] = tmpc;
				}
			}
		}
	}
	
	printf("%d\n",max+cnt);
	
	return 0;
}

Measured memory_bytes: 1576
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    int N;cin >> N;
    vector<pll> XL(N);
    rep(i,N)cin >> XL[i].F >> XL[i].S;

    vector<pair<int,int>> rl(N);

    rep(i,N){
        rl[i].F = XL[i].F + XL[i].S;
        rl[i].S = XL[i].F - XL[i].S;
    }
    sort(all(rl));

    LL ans = 0;
    int cur = 0;
    rep(i,N){
        if(i == 0)continue;
        LL a = rl[cur].F;
        LL b = rl[i].S;
        if(a > b){
            ans++;
        }
        else cur = i;
    }
    cout << N - ans << endl;




}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

// http://noshi91.hatenablog.com/entry/2019/03/31/174006
template <uint_fast64_t Mod>
struct modint {
  using u64 = uint_fast64_t;

  u64 n;

  modint(const u64 x = 0) : n(x % Mod) {}
  modint operator+(const modint r) const {
    return modint(*this) += r;
  }
  modint operator-(const modint r) const {
    return modint(*this) -= r;
  }
  modint operator*(const modint r) const {
    return modint(*this) *= r;
  }
  modint operator/(const modint r) const {
    return modint(*this) /= r;
  }
  modint &operator+=(const modint r) {
    n += r.n;
    if (n >= Mod) {
      n -= Mod;
    }
    return *this;
  }
  modint &operator-=(const modint r) {
    if (n < r.n) {
      n += Mod;
    }
    n -= r.n;
    return *this;
  }
  modint &operator*=(const modint r) {
    n = n * r.n % Mod;
    return *this;
  }
  modint &operator/=(const modint r) {
    n = n * r.n % Mod;
    return *this;
  }
  modint pow(u64 x) {
    modint<Mod> ret = 1;
    while (x) {
      if (x%2) {
        ret *= *this;
      }
      *this *= *this;
      x /= 2;
    }
    return *this = ret;
  }
};

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

  constexpr ll mod = 1e9+7;
  modint<mod> m, n;
  cin >> m.n >> n.n;
  cout << m.pow(n.n).n << endl;
}



Measured memory_bytes: 3212
// Template {{{
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;

#ifdef LOCAL
#include "contest.h"
#else
#define dump(x) 
#endif

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }

void iostream_init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(12);
}
//}}}

int main(){
    iostream_init();
    int N, K;
    while(cin >> N >> K) {
        bool b[10] = {};
        REP(i, K) {
            int x;
            cin >> x;
            b[x] = true;
        }
        while(true) {
            int M = N;
            bool ng = false;
            while(M > 0) {
                int x = M % 10;
                M /= 10;
                if(b[x]) {
                    ng = true;
                    break;
                }
            }
            if(!ng) break;
            N++;
        }
        cout << N << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define pb push_back
#define MAX 1000000000
#define MOD 1000000007
int main(){
  int n;cin>>n;
  string a[3];
  rep(i,3){
    cin >> a[i];
  }
  int kekka = 0;
  rep(i,n){
    if(a[0][i] == a[1][i] && a[1][i] == a[2][i]){
      //0
    }else if(a[0][i] == a[1][i] || a[1][i] == a[2][i] || a[0][i] == a[2][i]){
      kekka+=1;
    }else {
      kekka+=2;
    }
  }
  cout << kekka << endl;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <unordered_map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, double> pid;
typedef pair<double, int> pdi;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;

const double EPS = 1e-9;

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

	int N, K, Q;
	cin >> N >> K >> Q;

	vector<int> A(N);
	rep(i, 0, N)cin >> A[i];

	int ans = INF;

	rep(i, 0, N)
	{
		priority_queue<int, vector<int>, greater<int>> mas;
		multiset<int> mis;
		int l = 0;
		rep(r, 0, N)
		{
			if (A[r] < A[i])
			{
				mis.clear();
				l = r + 1;
			}
			else
			{
				mis.insert(A[r]);
				if (r - l + 1 >= K)
				{
					int v = *mis.begin();
					mas.push(v);
					mis.erase(mis.find(v));
				}
			}
		}
		if (SZ(mas) < Q)continue;
		int ma = 0, mi = INF;
		rep(j, 0, Q)
		{
			chmax(ma, mas.top());
			chmin(mi, mas.top());
			mas.pop();
		}
		chmin(ans, ma - mi);
	}

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

Measured memory_bytes: 3724
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

const int mod = (int) 1e9 + 7;

void add(int &x, int y) {
  if ((x += y) >= mod) {
    x -= mod;
  }
}

int mult(int x, int y) {
  return (long long) x * y % mod;
}

int myPower(int x, int pw) {
  int res = 1;
  for (; pw; pw >>= 1) {
    if (pw & 1) {
      res = mult(res, x);
    }
    x = mult(x, x);
  }
  return res;
}

map<vector<int>, int> mem;
int get(vector<int> a) {
  sort(a.begin(), a.end());
  int pos = 0;
  while (pos < sz(a) && a[pos] == 0) {
    ++pos;
  }
  rotate(a.begin(), a.begin() + pos, a.end());
  a.resize(sz(a) - pos);
  if (!sz(a)) {
    return 1;
  }
  if (mem.count(a)) {
    return mem[a];
  }
  int &res = mem[a];
  res = 0;

  int last = a.back();
  a.pop_back();
  if (!get(a)) {
    return res = 1;
  }
  a.pb(last);
  for (int i = 0; i < sz(a); ++i) {
    --a[i];
  }

  return res = !get(a);
}

int mget(vector<int> a) {
  {
    sort(a.begin(), a.end());
    int pos = 0;
    while (pos < sz(a) && a[pos] == 0) {
      ++pos;
    }
    rotate(a.begin(), a.begin() + pos, a.end());
    a.resize(sz(a) - pos);
    reverse(a.begin(), a.end());
  }

  if (!sz(a)) {
    return 1;
  }

  int pos = 0;
  while (pos < sz(a) && a[pos] >= pos + 1) {
    ++pos;
  }
  --pos;

  if ((a[pos] - pos - 1) & 1) {
    return 1;
  }

  int res = 0;
  for (int j = pos + 1; j < sz(a) && a[j] == pos + 1; ++j) {
    res ^= 1;
  }
  return res;
}

void precalc() {
  if (0) {
  const int n = 10;
  for (int x = 1; x <= n; ++x) {
    eprintf("x = %d\n", x);
    for (int y = 1; y <= n; ++y) {
      for (int z = 1; z <= n; ++z) {
        for (int w = 1; w <= n; ++w) {
          vector<int> cur = {x, y, z, w};
          bool fail = 0;
          for (int i = 0; i < sz(cur) - 1; ++i) {
            if (cur[i] > cur[i + 1]) {
              fail = 1;
              break;
            }
          }
          int got = !fail ? get(cur) : 7;
          //eprintf("%d%c", got, " \n"[w == n]);
          if (1) {
            eprintf("(%d,%d,%d,%d)\n", x, y, z, w);
          }
          assert(get(cur) == mget(cur));
        }
      }
      eprintf("\n");
    }
    eprintf("\n");
    eprintf("\n");
  }
  }
}


vector<int> a;
int n;

int read() {
  if (scanf("%d", &n) < 1) {
    return 0;
  }
  a.resize(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  return 1;
}

void solve() {
  printf(mget(a) ? "First\n" : "Second\n");
}

int main() {
  precalc();
#ifdef LOCAL
  freopen(TASK ".out", "w", stdout);
  assert(freopen(TASK ".in", "r", stdin));
#endif

  while (1) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 1024