akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        boolean a[] = new boolean[1000001];
        int tmp = sc.nextInt();
        
        for(int i = 1;i<1000000;i++){
            a[tmp] = true;

            if(tmp % 2 == 0){
                tmp = tmp/2;
            }else{
                tmp = tmp*3+1;
            }

            if(a[tmp] == true){
                tmp = i+1;
                break;
            }
        }

        System.out.println(tmp);
    }
}

Measured memory_bytes: 23892
#include<iostream>
#include<cctype>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
	string s,s1,s2;
	cin>>s>>s1>>s2;
	char x=toupper(s[0]);
	char y=toupper(s1[0]);
	char z=toupper(s2[0]);

	cout<<x<<y<<z;
}

Measured memory_bytes: 256
N, K, *A = map(int, open(0).read().split())

neg = sorted([-a for a in A if a < 0])
pos = sorted([a for a in A if a >= 0])

def _count_pair_neg(x):
    x = -x
    res = 0

    MAX = len(pos)
    i = 0
    for n in reversed(neg):
        while i < MAX and n * pos[i] < x:
            i += 1
            
        res += MAX - i
    return res


def _count_pair_pos(x):
    res = 0

    # Negative list
    i = 0
    MAX = len(neg)
    for n in reversed(neg):
        if n * n <= x:
            res -= 1
            
        while i < MAX and neg[i] * n <= x:
            i += 1
        res += i
        
    # Positive list
    i = 0
    MAX = len(pos)
    for n in reversed(pos):
        if n * n <= x:
            res -= 1
            
        while i < MAX and pos[i] * n <= x:
            i += 1
        res += i
        
    # Devide by 2 for counting the same pair twice
    res //= 2
    res += len(neg) * len(pos)
    return res


def count_pair(x):
    if x < 0:
        return _count_pair_neg(x)
    
    return _count_pair_pos(x)


# Bounds
lb = 0
ub = 2 * 10 ** 18 + 2

while ub - lb > 1:
    mid = (ub + lb) // 2
    if count_pair(mid - 10 ** 18 - 1) < K:
        lb = mid
    else:
        ub = mid

print(ub - 10 ** 18 - 1)


Measured memory_bytes: 97928
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<set>

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
 
#define sPRINT(str) printf(#str "\n")
#define yOUT sPRINT(Yes)
#define nOUT sPRINT(No)
#define YOUT sPRINT(YES)
#define NOUT sPRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
 
using namespace std;

int main(void)
{   
    long long n, m, min, ans;
    cin >> n >> m;
    vector<long long> a(n);
    vector<long long> b(n);
    vector<long long> c(m);
    vector<long long> d(m);

    REP(i, n){
        cin >> a[i] >> b[i];
    }
    REP(i, m){
        cin >> c[i] >> d[i];
    }

    REP(i, n){
        min = 100000000000;
        REP(j, m){
            long long dis = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if(dis < min){
                min = dis;
                ans = j+1;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

double bmi(double a, double b){
    return a / b / b;
}

int main(){
    int n, num;
    while(cin >> n, n){
        double m, kg;
        double ans = 2 << 24, ansmbi = 2 << 24;
        rep(i, n){
            cin >> num >> m >> kg;
            double re = fabs(bmi(kg, m / 100) - 22);
            if(ansmbi > re || (ansmbi == re && ans > num)){
                ansmbi = re;
                ans = num;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <iomanip>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <utility>
using namespace std;
int ky[8] = {-1,1,-2,2,-2,2,-1,1}; 
int kx[8] = {-2,-2,-1,-1,1,1,2,2};
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int ddy[8] = {-1,0,1,-1,1,-1,0,1};
int ddx[8] = {-1,-1,-1,0,0,1,1,1};
typedef long long ll;
#define pi pair
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define rep1(i,a,b) for(int i = a; i < b; i++)
#define rep2(i,a,b) for(int i = a; i <= b; i++) 
#define INF 999999999999
const double PI = acos(-1.0); 
int n;
ll h;
stack<ll> s;
ll ans;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin >> n;
    rep1(i,0,n){
        cin >> h;
        while(!s.empty() && s.top() < h) s.pop();
        if(!s.empty()) ans += abs(s.top() - h);
        if(!s.empty() && s.top() > h) continue;
        s.push(h);
    }
    cout << ans;
    
    return 0;  
}

Measured memory_bytes: 4744
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define f first
#define s second
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define debug(x) cout << #x << ":\t" << x << endl
#define _ << " " <<

using namespace std;
using namespace __gnu_pbds;

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

const ll N = 4e2 + 3;
const ll INF = 1e15 + 37;

ll n, a[N];
ll dp[N][N], cost[N][N];

int main() {
//	mt19937_64 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
//	freopen("in", "r", stdin)
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	cin >> n;
	for (ll i = 1; i <= n; ++i) cin >> a[i];
	for (ll i = 1; i <= n; ++i) dp[1][i] = a[i];
	
	for (ll i = 2; i <= n; ++i) {
		for (ll j = i; j <= n; ++j) {
			dp[i][j] = cost[i][j] = INF;
			for (ll h = 1, k = i - 1; h <= k; ++h, --k) {
				if (dp[i][j] >= dp[i-h][j] + dp[i-k][j - (i-h)]) {
					dp[i][j] = dp[i-h][j] + dp[i-k][j - (i-h)];
					if (cost[i][j] > cost[i-h][j] + cost[i-k][j - (i-h)] + dp[i][j]) {
						cost[i][j] = cost[i-h][j] + cost[i-k][j - (i-h)] + dp[i][j];
					}
				}
				if (dp[i][j] >= dp[i-k][j] + dp[i-h][j - (i-k)]) {
					dp[i][j] = dp[i-k][j] + dp[i-h][j - (i-k)];
					if (cost[i][j] > cost[i-k][j] + cost[i-h][j - (i-k)] + dp[i][j]) {
						cost[i][j] = cost[i-k][j] + cost[i-h][j - (i-k)] + dp[i][j];
					}
				}
			}
		}
	}
	cout << cost[n][n];
	
	return 0;
}


Measured memory_bytes: 2816
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <vector>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
#define x first
#define y second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ll long long
#define ld long double
#define ii pair<int,int>
#define heap priority_queue
#define all(k) k.begin(),k.end()
#define rall(k) k.rbegin(),k.rend()
#define len(v) ((int)v.size())
#define fa(a,c) for(auto &a:c)
#define endl '\n'





int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0);
  
   string  s;
   cin>>s;
   for(int i=0;i<s.size();i++){
      if((~i&1 and s[i]=='L') or (i&1 and s[i]=='R')){
        cout<<"No"<<endl;
        return 0;
      }
   }

    cout<<"Yes"<<endl;


}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	int t, c0 = 0, c1 = 0, c2 = 0, c3  = 0;
	cin>>t;
	string test;
	while(t--){
		cin>>test;
		if(test == "AC")
		   c0++;
		else if(test == "WA")
		   c1++;
		else if(test == "TLE")
		   c2++;
		else if(test == "RE")
		   c3++;
	}
	cout<<"AC"<<" x "<<c0<<endl;
	cout<<"WA"<<" x "<<c1<<endl;
	cout<<"TLE"<<" x "<<c2<<endl;
	cout<<"RE"<<" x "<<c3<<endl;
	
	
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

// #define DEBUG_MODE
#ifdef DEBUG_MODE
#define dump(x) cout << #x << " : " << x << endl
#define LINE cout << "line : " << __LINE__ << endl
#define dumpV(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << endl
#define STOP assert(false)
#else
#define dump(x) ;
#define LINE     ;
#define dumpV(v);
#define STOP     ;
#endif
#define mp make_pair

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fi<<", "<<a.se<<')';
    return out;
  }
}


int main(){
    string s;
    cin >> s;
    int n = s.size();
    if(s[0] != '1' || s.back() != '0') {
        LINE;
        cout << -1 << endl;
        return 0;
    }
    REP(i, 1, n) {
        int j = n - i;
        if(s[i-1] != s[j-1]) {
            LINE;
            cout << -1 << endl;
            return 0;
        }
    }
    {
        int hub = n-1;
        rep(i, s.size()-1) {
            cout << hub+1 << " " << i+1 << endl;
            if(s[i] == '1') {
                hub = i;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
int main()
{/*
	string s,tmp;
	vector<string> str;
	getline(cin, s);
	stringstream ssm{ s };
	while (getline(ssm, tmp, ' '))
	{
		str.push_back(tmp);
		if (tmp == "\n") break;
	}
	for (int i = str.size()-1; i >= 0; i--)
	{
		cout << str[i] <<",";
	}
	cout<<flush;
	string s;
	char b=0;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		if (b == s[i])
		{
			cout << "Bad" << endl;
			return 0;
		}
		b = s[i];
	}
	cout << "Good" << endl;*/
	int n, l,min,sum=0,r=0;
	cin >> n >> l;
	vector<int> ap(n);
	vector<int> pie;
	min = 100 + 200 - 1;//299
	for (int i = 0; i < n; i++)
	{
		static int fl = 0;
		ap[i] = l + i;
		//cout << "ap:" << ap[i]<<endl;
		if (abs(ap[i]) < abs(min))
		{
			if(fl==1)pie.push_back(r);
			min = abs(ap[i]);
			r = ap[i];
			fl = 1;
		}

		else
		{
			pie.push_back(ap[i]);
		}
	}
	for (auto x : pie)
	{
		sum += x;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
const int mo=1e9+7;
const int maxn=1e5+10;
int n,k;
long long dp[maxn],ans;
long long po(long long a,long long b)
{
	if (b==0) return 1;
	if (b==1) return a%mo;
	long long c=po(a,b/2);
	if (b&1) return c*c%mo*a%mo;else return c*c%mo;
}
int main()
{
	scanf("%d%d",&n,&k);
	for (int i=1;i<=k;i++) dp[i]=po(k/i,n);
	for (int i=k;i>=1;i--)
	 for (int j=2*i;j<=k;j+=i) dp[i]=(dp[i]-dp[j]+mo)%mo;
	for (int i=1;i<=k;i++) ans=(ans+dp[i]*i)%mo;
	printf("%lld\n",ans);
return 0;
}

Measured memory_bytes: 4536
import java.util.*;
public class Main {
        public static void main(String args[]){
          
        Scanner sc = new Scanner(System.in);
          
          //入力
          int L = sc.nextInt();
          
          double M = (double) L/3;
          
          //直方体の体積(最大)
          System.out.println(Math.pow(M,3));
        }
}

Measured memory_bytes: 35952
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  ll n,m;
  cin>>n>>m;
  vector<pair<ll,ll>> v(n);
  rep(i,0,n){
    cin>>v[i].f>>v[i].s;
  }
  sort(all(v));
  ll ans=0;
  rep(i,0,n){
    if(v[i].s>=m){
      ans+= m*v[i].f;
      m=0;
      break;
    }
    else{
      ans+= v[i].s*v[i].f;
      m-= v[i].s;
    }
  }
  cout<<ans<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 4784
#include<bits/stdc++.h>
using namespace std;
const int nax = 1e6 + 10;
string s[nax];
int nxt[nax][26];
int val[nax][26];
int ct[nax];
int top = 0;
int n;

void add_to_trie (string s) {
    int v = 0;
    vector <int> hist;
    for (char c : s) {
        hist.push_back(v);
        int x = c - 'a';
        if (nxt[v][x]) {
            v = nxt[v][x];
        } else {
            nxt[v][x] = ++ top;
            v = top;
        }
        ++ ct[v];
    }
    bool has_alpha[26];
    memset(has_alpha, false, sizeof(has_alpha));
    reverse(hist.begin(), hist.end());
    reverse(s.begin(), s.end());
    int t = 0;
    for (int h : hist) {
        has_alpha[s[t ++] - 'a'] = true;
        for (int i = 0 ; i < 26 ; ++ i) {
            val[h][i] += has_alpha[i];
        }
    }

}

int main () {
    cin.tie(0)->sync_with_stdio(false);
    cin >> n;

    for (int i = 1 ; i <= n ; ++ i) {
        cin >> s[i];
        reverse(s[i].begin(), s[i].end());
    }


    for (int i = 1 ; i <= n ; ++ i) {
        add_to_trie(s[i]);
    }


    long long ans = 0;

    for (int i = 1 ; i <= n ; ++ i) {
        int v = 0;
        string &t = s[i];

        for (int i = 0 ; i < int(t.size()) - 1 ; ++ i) {
            v = nxt[v][t[i] - 'a'];
        }
        int alpha = t.back() - 'a';
        ans += val[v][alpha] - 1;
    }

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


Measured memory_bytes: 243376
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    int w,a,b;
    cin>>w>>a>>b;
    if(a+w<b){
        cout<<b-w-a;
    }else if(b+w<a){
        cout<<a-b-w;
    }else{
        cout<<0;
    }
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;

struct edge { LL from, to, cost; };
vector<edge>es;
LL d[2525];
int N, M;
const LL INF = 1234567890123456;
void shortest_path(int s) {
	for (int i = 0; i < N; ++i)d[i] = INF;
	d[s] = 0;
	for (int i = 0; i < N + N; ++i) {
		bool update = false;
		for (int i = 0; i < M; ++i) {
			edge e = es[i];
			if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				update = true;
			}
		}
		if (!update)break;
	}
}
void find_negative_loop(int s) {
	for (int i = 0; i < N; ++i)d[i] = INF;
	d[s] = 0;
	for (int i = 0; i < N + N + N; ++i) {
		bool update = false;
		for (int j = 0; j < M; ++j) {
			edge &e = es[j];
			if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				update = true;
				if (i >= N - 1) {
					e.cost = -INF;
				}
			}
		}
		if (!update)break;
	}
}

LL P;

int main() {
	cin >> N >> M >> P;
	for (int i = 0; i < M; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		--a; --b;
		es.push_back({ (LL)a,(LL)b,(LL)P - c });
	}
	find_negative_loop(0);
	LL dis = d[N - 1];
	if (dis < -INF / 2) {
		cout << -1 << endl;
	}
	else {
		shortest_path(0);
		cout << max(0LL, -dis) << endl;
	}
}

Measured memory_bytes: 576
# https://atcoder.jp/contests/abc129/submissions/5841482 を参考 
N,M = map(int, input().split())
A = [int(input()) for _ in range(M)]
MOD = 10**9 + 7
F = [1]*(N+1)
for j in A:
    F[j-1] = 0
 
a = 1; b = 0
for i in range(N):
    if not F[i]:    #F[i] == 0
        a, b = 0, a
    else:
        a, b = ((a+b) % MOD), a
print(a)

Measured memory_bytes: 7848
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>

using namespace std;

int main() {
  long n,x,a[200],sum = 0;
  cin >> n >> x;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }

  if(sum == x) {
    cout << n << endl;
    return 0;
  }
  else if(sum < x) {
    cout << n-1 << endl;
    return 0;
  }

  sort(a,a+n);
  
  for(int i = 0; i < n; i++) {
    if(x >= a[i]) x -= a[i];
    else {
      cout << i << endl;
      break;
    }
  }
}


Measured memory_bytes: 3588
c = [1, 2, 3, 5, 8, 13, 21, 34, 55]

def count(n):
    if n < 0:
        return 1
    else:
        return c[n]
    
h, w, k = [int(i) for i in input().split(" ")]

p = [[0 for i in range(0, w)] for j in range(0, h + 1)]
p[0][0] = 1

def ul(i, j):
    if j == 0:
        return 0
    else:
        return count(j - 2) * count(w - j - 2) * p[i - 1][j - 1]

def uu(i, j):
    return count(j - 1) * count(w - j - 2) * p[i - 1][j]

def ur(i, j):
    if j == w - 1:
        return 0
    else:
        return count(j - 1) * count(w - j - 3) * p[i - 1][j + 1]

for i in range(1, h + 1):
    for j in range(0, w):
        p[i][j] = ul(i, j) + uu(i, j) + ur(i, j)
    
print(p[-1][k - 1] % 1000000007)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>

using namespace std;

typedef long long ll;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep1(i,n) for(int i=1; i<=(int)(n); i++)
#define all(c) c.begin(),c.end()
#define psb push_back
#define ppb pop_back

const int INF = 1000000000;

int main() {
    int A, B, H, M;

    cin >> A >> B >> H >> M;

    double tm = (double)M/60 * 2*M_PI;
    double th = (double)(60*H+M)/720 * 2*M_PI;

    double xm = B*cos(tm);
    double ym = B*sin(tm);
    double xh = A*cos(th);
    double yh = A*sin(th);

    double dx = xh-xm;
    double dy = yh-ym;

    double ans = sqrt(dx*dx + dy*dy);

    printf("%.10f\n", ans);
}


Measured memory_bytes: 4088
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		sc.close();

		List<Long> list = new ArrayList<>();
		for (int i = 1; i <= 9; i++) {
			dfs(list, i);
		}
		Collections.sort(list);
		System.out.println(list.get(k - 1));
	}

	static void dfs(List<Long> list, long x) {
		if (x > 3234566667L) {
			return;
		}
		list.add(x);
		long s = Math.max(x % 10 - 1, 0);
		long e = Math.min(x % 10 + 1, 9);
		long y = x * 10;
		for (long i = s; i <= e; i++) {
			dfs(list, y + i);
		}
	}
}


Measured memory_bytes: 27212
#include <bits/stdc++.h>
using namespace std;
int sol[200001];
int main()
{
  int n;
  cin>>n;
  for(int t=1;t<=n;t++)
  cin>>sol[t];

  int tem1=1;
  for(int t=1;t<=n;t++)
  {
    if(sol[t]==tem1)
    {
      tem1++;
    }
  }
  if(tem1==1)
  cout<<-1;
  else
  cout<<n-(tem1-1);
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  int n,k;
  cin >> n >> k;
  vector<int> count(n);
  for(int i = 0;i < n;i++)count[i] = 0;
  for(int i = 0;i < k;i++){
    int kazu = 0;
    cin >> kazu;
    for(int j = 0;j < kazu;j++){
      int num = 0;
      cin >> num;
      num--;
      count[num]++;
    }
  }
  int res = 0;
  for(auto& i:count){
    if(i == 0)res++;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3628
N,K=list(map(int,input().strip().split(' ')))
A=list(map(int,input().strip().split(' ')))
def gcd(a,b):
    a,b=min(a,b),max(a,b)
    if b%a==0:
        return a
    else:
        return gcd(a,b%a)
#assume len(A)>1    
def findgcd(A):
    ans=gcd(A[0],A[-1])
    for i in range(len(A)):
        ans=gcd(ans,A[i])
        if ans==1:
            return 1
    return ans
ans=findgcd(A)
good=0
if N>1:
    for i in range(len(A)):
        if A[i]==K:
            good=1
            break
        elif A[i]>K:
            if (A[i]-K)%ans==0:
                good=1
                break
else:
    if A[0]==K:
        good=1
if good==1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
        
    
    

Measured memory_bytes: 59348
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int A = sc.nextInt();
   int B = sc.nextInt();
   
   if(A<=8&&B<=8) System.out.println("Yay!");
   else System.out.println(":(");
 }
}

Measured memory_bytes: 23252
package main

import "fmt"

func main() {
	s, t := input()
	if isEqual(s, t) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func isEqual(s, t string) bool {
	for i := range s {
		if s[i] != t[i] {
			return false
		}
	}
	return true
}

func input() (string, string) {
	var s, t string
	fmt.Scan(&s)
	fmt.Scan(&t)
	return s, t
}


Measured memory_bytes: 1752
use std::io::Read;

fn main() {
    let mut line = String::new();
    std::io::stdin().read_to_string(&mut line);
    let mut iter = line.split_whitespace();
    let k: i64 = iter.next().unwrap().parse().unwrap();
    let a: i64 = iter.next().unwrap().parse().unwrap();
    let b = iter.next().unwrap().parse().unwrap();
    for i in a..=b {
        if i % k == 0 {
            println!("OK");
            return;
        }
    }
    println!("NG");
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    for(int T = 0; T < t ; T++){
        ll h, w, k, r = 0;
        cin >> h >> w >> k;
        char a[h][w];
        for(int i = 0; i < h; i++){
            string s;
            cin >> s;
            for(int j = 0; j < s.size(); j++){
                a[i][j] = s[j];
            }
        }
        for(int i = 0; i < pow(2,h); i++){
            vector<ll> x;
            for(int j = 0; j < h; j++){
                if(i&(1<<j)){
                    x.push_back(j);
                }
            }
            for(int q = 0; q < pow(2,w); q++){
                vector<ll> y;
                for(int e = 0; e < w; e++){
                    if(q&(1<<e)){
                        y.push_back(e);
                    }
                }
                ll ans = 0;
                for(int f = 0; f < h; f++){
                    for(int g = 0; g < w; g++){
                        if(binary_search(x.begin(), x.end(), f) == true ||
                                binary_search(y.begin(),y.end(),g) == true)
                        continue;
                        else if(a[f][g] == '#')
                            ans++;
                    }
                }
                if(ans == k)
                    r++;
            }
        }
        cout << r << endl;
    }
    return 0;
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP1(i, n) for (int i = 1; i < (n); i++)
#define CIN(A) int A; cin >> A;
#define CIN2(A, B) int A, B; cin >> A >> B;
#define CIN3(A, B, C) int A, B, C; cin >> A >> B >> C;
#define CINVEC(A, N) vector<int> A; REP(i, N) { int a; cin >> a; A.emplace_back(a); }
#define ANS(ans) cout << (ans) << endl
#define rsort(p, q) sort(p, q, greater<int>());

#define DEBUGV(V) REP(i, V.size() - 1) cout << V.at(i) << " "; cout << endl 

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

  bool flg = true;
  for (int i = 0; i < S.size() - 1 && flg; i++) {
    unsigned char c = S.at(i);
    for (int j = i + 1; j < S.size() && flg; j++) {
      if (S.at(j) == c) flg = false;
    }
  }

  if (flg) ANS("yes");
  else ANS("no");

  return 0;
}


Measured memory_bytes: 256
/**
 *      purpose : ABC 115 D
 *      author  : kyomukyomupurin
 *      created : 2018-12-08 21:21:22
**/

#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define fi first
#define se second

int64 a[55], p[55];

int64 rec(int64 n, int64 x){
    if (n == 0) return 1;
    if (x == 1) return 0;
    if (x > 1 && x <= 1 + a[n - 1]) return rec(n - 1, x - 1);
    else if (x == 2 + a[n - 1]) return p[n - 1] + 1;
    else if (x > 2 + a[n - 1] && x <= 2 + 2 * a[n - 1]) return p[n - 1] + 1 + rec(n - 1, x - a[n - 1] - 2);
    else if (x == 3 + 2 * a[n - 1]) return 2 * p[n - 1] + 1;
} 

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(__null);
    
    int64 n, x; cin >> n >> x;

    a[0] = 1; p[0] = 1;
    for (int i = 1; i < n; ++i){
        a[i] = 2 * a[i - 1] + 3;
        p[i] = 2 * p[i - 1] + 1;
    }

    print(rec(n, x));

    return 0;
}

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

using namespace std;

int main()
{
    int N, a, b, c, d;

    cin >> N;

    a = N / 1000;
    b = (N - a * 1000) / 100;
    c = (N - a * 1000 - b * 100) / 10;
    d = N - a * 1000 - b * 100 - c * 10;

    if ((a == b&&b == c) || (b == c&&c == d))
    {
        cout << "Yes\n" << endl;
    }
    else
    {
        cout << "No\n" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

struct UnionFind {
    vector<int> par;
    UnionFind(int n) :par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    bool connect(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    int size(int x) {
        return -par[root(x)];
    }
};

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    ll a[m], b[m];
    for(int i=0;i<m;i++){
    	cin >> a[i] >> b[i];
    	a[i]--;b[i]--;
    }
    UnionFind uf(n);
    vector<ll> v;
    ll ans = n * (n - 1) / 2;
    v.pb(ans);

    for(int i=m-1;i>=1;i--){
        ll c = uf.size(a[i]);
        ll d = uf.size(b[i]);
        if(uf.root(a[i]) != uf.root(b[i])) ans -= c * d;
        uf.connect(a[i], b[i]);
        v.pb(ans);
    }
    reverse(be(v));
    for(int i=0;i<m;i++){
    	cout << v[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 
#define int long long
#define double long double

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

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

signed main(){
  int a, b,c;cin>>a>>b>>c;
  if(a+b+c >= 22)cout << "bust" << endl;
  else cout << "win" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;


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

  int A, B, C;
  cin >> A >> B >> C;
  int ans = A + B + C;
  if(ans > 21) cout << "bust" << endl;
  else cout << "win" << endl;

}

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

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

using namespace std;

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

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

void solve() {
  int n, m, k; cin >> n >> m >> k;
  repc(x, n) repc(y, m) {
    if (x * m + y * n - 2 * x * y == k) yes();
  }
  no();
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] str = br.readLine().split(" ");
    int sTime = Integer.parseInt(str[0]);
    int num = Integer.parseInt(str[1]);
    int eTime = Integer.parseInt(str[2]);
    
    System.out.println((eTime / sTime) * num);
  }
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

template<typename F>
struct FixPoint : F{
  FixPoint(F&& f):F(forward<F>(f)){}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const{
    return F::operator()(*this,forward<Args>(args)...);
  }
};
template<typename F>
inline decltype(auto) MFP(F&& f){
  return FixPoint<F>{forward<F>(f)};
}


template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
signed main(){
  int n,w;
  cin>>n>>w;
  vector<int> ps(n);
  for(int i=0;i<n;i++) cin>>ps[i];

  struct edge{
    int to,cost;
    edge(int to,int cost):to(to),cost(cost){}
  };

  using ll = long long;
  ll ans=*max_element(ps.begin(),ps.end());
  vector< vector<edge> > G(n);
  for(int i=1;i<n;i++){
    int u,v,c;
    cin>>u>>v>>c;
    u--;v--;
    G[u].emplace_back(v,c);
    G[v].emplace_back(u,c);
    if(c<=w) chmax(ans,ps[u]+ps[v]);
  }

  vector<int> hs1,hs2;
  MFP([&](auto dfs,int v,int p,int d)->void{
        (d&1?hs1:hs2).emplace_back(v);
        for(auto e:G[v])
          if(e.to!=p) dfs(e.to,v,d+1);
      })(0,-1,0);
  if(hs1.size()>hs2.size()) swap(hs1,hs2);

  const ll INF = 1e18;
  auto dp=make_v<ll>(n+1,w+1);

  for(int rt:hs1){
    fill_v<ll>(dp,-INF);
    dp[rt][0]=ps[rt];

    MFP([&](auto dfs,int v,int p)->void{
          for(auto e:G[v]){
            if(e.to==p) continue;
            for(int j=0;j+e.cost<=w;j++)
              chmax(dp[e.to][j+e.cost],dp[v][j]+ps[e.to]);

            dfs(e.to,v);

            for(int j=0;j<=w;j++)
              chmax(dp[v][j],dp[e.to][j]);
          }
        })(rt,-1);

    for(int j=0;j<=w;j++)
      chmax(ans,dp[rt][j]);
  }

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



Measured memory_bytes: 82912
#include<stdio.h>
#include<map>
using namespace std;
int main()
{
	int n,i,sum,m;
	scanf("%d",&n);
	map<int,int>p;
	p.clear();
	sum=0;
	for(i=0;i<n;i++)
	{
		scanf("%d",&m);
		if(!p[m])
		{
			p[m]=1;
		}
		else
		{
			sum++;
		}
		
	}
	if(!sum) printf("YES\n");
	else printf("NO\n");
}

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

using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans = min(b,d) - max(a,c);
    if(ans < 0) ans = 0;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
ans=0
for i in range(n):
  if a[i]+a[i+1]-b[i]<0:
    ans+=a[i]+a[i+1]
    a[i+1]=0
  elif a[i]-b[i]>0:
    ans+=b[i]
  else:
    ans+=b[i]
    a[i+1]=a[i]+a[i+1]-b[i]
print(ans)

Measured memory_bytes: 18476
import core.stdc.stdio;

long gcd(long a,long b){
	return b?gcd(b,a%b):a;
}

long lcd(long a,long b){
	return a/gcd(a,b)*b;
}

void main(){
	while(1){
	
	int n;
	scanf("%d",&n);
	if(!n)
		break;
	auto p=new long[n],q=new long[n];
	auto r=new int[n],b=new int[n],ic=new int[n];
	foreach(i;0..n){
		scanf("%lld%lld%d%d",&p[i],&q[i],&r[i],&b[i]);
		if(--r[i]>=0)
			ic[r[i]]++;
		if(--b[i]>=0)
			ic[b[i]]++;
	}
	int root;
	foreach(int i,c;ic)
		if(!c)
			root=i;
	long dfs(int i){
		if(i<0)
			return 1;
		long s=dfs(r[i]),t=dfs(b[i]);
		//s*p[i]=t*q[i]
		long l=lcd(s*p[i],t*q[i]);
		s=l/p[i];
		t=l/q[i];
		return s+t;
	}
	printf("%lld\n",dfs(root));
	
	}
}

Measured memory_bytes: 2304
s = list(input())
n = len(s)
s_0 = s[:(n-1)//2]
s_1 = s[(n+1)//2:]
if s_0 == s_0[::-1] and s_1 == s_1[::-1] and s == s[::-1]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
	int a[200000];
	int b,i,sum=0,h=0;
	scanf("%d",&b);
	for(i=0;i<b;i++)
		scanf("%d",&a[i]);
	for(i=0;h<b-1;)
	{
		h++;
		if(a[i]>=a[h])
		{
			sum++;
			i=h;
		}
	}
	printf("%d",sum+1);
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
using namespace std;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
    string s;
    cin >> n >> s;

    // 答えのカウントを初期化する
    int cnt_ans = 0;
    for (int i = 1; i < n-1; i++){
        // 前半と後半が一致していたときのカウントを初期化
        int cnt_same = 0;
        // cが'a'から'z'までとする
        for (char c = 'a'; c <= 'z'; c++){
            // 左右にcがあることをブール型で表現する
            bool left = false, right = false;
            // 前半にcがあるときはleftをtrueにする
            for (int j = 0; j < i; j++) {
                if (s[j] == c) {
                    left = true;
                }
            }
            // 後半にcがあるときはrightをtrueにする
            for (int j = i; j < n; j++) {
                if (s[j] == c) {
                    right = true;
                }
            }
            // 左右にcがあるときのみcnt_sameを増やす
            if (right && left) {
                    cnt_same++;
                }
            }
        // iの位置ごとにこの作業を行い，最大値を更新したときは値を更新する
        if (cnt_ans < cnt_same) {
            cnt_ans = cnt_same;
        }
    }
    cout << cnt_ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007


int main() {
	int nen, mon, day;
	char buf1,buf2;
	cin >> nen >> buf1 >> mon >>buf2>> day;
	int jud = day + mon * 100 + nen * 10000;
	if (jud <= 20190430)cout << "Heisei" << endl;
	else cout << "TBD" << endl;






	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define DEBUG true
#define coutd if(DEBUG) cout
#define ff first
#define ss second
#define len(x) int(x.size())
using ll = long long;
class BITree {
        private:
                vector<long long> ts;
                size_t N;

                int LSB(int n) { return n&(-n); }

                void add(size_t i, ll x){
                        while (i <= N) {
                                ts[i] += x;
                                i += LSB(i);
                        }
                }
                long long RSQ(int i){
                        long long sum = 0;

                        while(i>=1){
                                sum+=ts[i];
                                i-=LSB(i);
                        }
                        return sum;
                }
        public:
                BITree(size_t n) : ts(n+1, 0), N(n) {};

                ll value_at(int i) { return RSQ(i); }

                void range_add(size_t i, size_t j, long long x){
                        add(i, x);
                        add(j+1, -x);
                }
};

int main(){
	ios_base::sync_with_stdio(0);
	int n, k;
	cin >> n >> k;
	BITree vs(n);
	for(int i=1; i<=k; i++){
		int l, r;
		cin >> l >> r;
		vs.range_add(l, r, 1);
	}
	ll ans = 0;
	for(int i=1; i<=n; i++){
		if(vs.value_at(i)==k) ans++;
	}
	cout << ans << endl;
}



Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	char c;
	in(c);
	outn((char)(c + 1));

	return 0;
}


Measured memory_bytes: 256
//AUTHOR - NAVEEN KUMAR(@naveen19991124)
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#inlcude<boost/multiprecision/cpp_dec_float.hpp>
#define ll long long
#define ld long double
#define F first
#define S second
#define mem(v) memset(v,0,sizeof(v))
#define all(v) v.begin(), v.end()
#define srt(v) sort(all(v))
#define rsrt(v) sort(v.rbegin(),v.rend())
#define pb push_back
#define f(a) for(ll i = 0;i<a;i++)
#define rep(i,a,b) for(ll i = a;i<b;i++)
#define rrep(i,a,b) for(ll i = a;i>b;i--)
#define vll vector<ll>
#define mp make_pair
#define fir first
#define sec second
#define dbg1(a) cout<<a<<"\n";
#define dbg2(a,b) cout<<a<<" "<<b<<"\n";
#define hell 1000000007
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
using namespace std:: chrono;
//using boost :: multiprecision :: cpp_int;
//using boost :: multiprecision :: cpp_dec_float_50;
//using boost :: multiprecision :: cpp_dec_float_100;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1;
a *= a; a %= mod;} return p % mod;}
ll modInverse(ll a, ll m) { ll m0 = m; ll y = 0, x = 1; 
if (m == 1) {return 0;} 
while (a > 1) { ll q = a / m; ll t = m;  m = a % m, a = t; t = y; y = x - q * y; x = t; } 
if (x < 0) {x += m0;} return x; } 
inline ll add(ll a, ll b) { return (((a >= hell) ? a % hell : a) + ((b >= hell) ? b % hell : b) + hell) % hell; }
inline ll subt(ll a, ll b) { return (a - b + hell) % hell; }
inline ll mult(ll a, ll b) { return (1ll * ((a >= hell) ? a % hell : a) * ((b >= hell) ? b % hell : b)) % hell; }
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
ll mylog(ll n,ll b)
{ll i = 1;ll ans = 0;
while(1)
{if(i>n/b){break;} i = i*b;ans++;}return ans;
}
bool compare(const pair<ll,ll> &a,const pair<ll,ll> &b){
if (a.first == b.first)
{return a.second<b.second;} 
return a.first<b.first;
}
bool comparerev(const pair<ll,ll> &a,const pair<ll,ll> &b){
if(a.first == b.first)
{return a.second>b.second;}
return a.first>b.first;
}
int main()
{
    fast
    ll t = 1;
  //  cin>>t;
    while(t--){
    ll n,m;
    ll sum = 0;
    cin>>n>>m;
    ll val;
    f(m)
    {
        cin>>val;
        sum += val;
    }
    if(sum>n)
    {
        cout<<-1<<"\n";
    }
    else
    {
        cout<<n-sum<<"\n";
    }
    
    } 
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int l, r;
  int sum = 0;
  for(int i = 0; i < N; i++) {
    cin >> l >> r;
    sum += r - l + 1;
  }
  
  cout << sum << endl;

  return 0;
}

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

#define MAXLEN 100010

int main()
{
	int n;
	
	while (cin >> n)
	{
		int num, localcount = 0, count = 0;
		
		for (int i = 0; i < n; i++)
		{
			cin >> num;
			
			if (i+1 == num)
				localcount++;
			else
			{
				count += (localcount + 1) / 2;
				localcount = 0;
			}	
		}
		
		count += (localcount + 1) / 2;
		
		cout << count << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

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

ll k, q;
vi d;
vi n, x, m;

int main()
{
    cin >> k >> q;
    d = vi(k);
    REP(i, k)
    {
        cin >> d[i];
    }
    n = x = m = vi(q);
    REP(i, q)
    {
        cin >> n[i] >> x[i] >> m[i];
    }
    REP(i, q)
    {
        ll s = 0;
        ll a = 0;
        ll z = 0;
        REP(j, k)
        {
            s += d[j] % m[i];
            if (s >= m[i])
            {
                ++a;
                s -= m[i];
            }
            if (d[j] % m[i] == 0)
            {
                ++a;
            }
        }
        ll p = ((n[i] - 1) / k);
        s = x[i] % m[i] + s * p;
        a = (a * p) + s / m[i];
        s %= m[i];
        REP(j, (n[i] - 1) % k)
        {
            s += d[j] % m[i];
            if (s >= m[i])
            {
                ++a;
                s -= m[i];
            }
            if (d[j] % m[i] == 0)
            {
                ++a;
            }
        }
        ll ans = (n[i] - 1) - a;
        OUT(ans);
    }
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int h[] = new int[n];

		for(int i = 0; i < n; i++){
			h[i] = sc.nextInt();
		}

		int count = 1;
		int maxH = h[0];
		for(int i = 1; i < n; i++){
			if(h[i] >= maxH){
				count++;
				maxH = h[i];
			}
		}

		System.out.println(count);
	}

}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

template<typename T> //最大公約数
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T> //最小公倍数
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_MAX; i++){
        fac[i] = fac[i-1]*i%MOD;
        inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}
long long COM(int n,int k){
    if(n < k || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}


struct UnionFind {
	vector<int> par, rank, cnt;
	UnionFind(int n) : par(n), rank(n, 0), cnt(n, 1){
		for(int i = 0; i < n; ++i) par[i] = i;
	}
 
	int find(int x) {
		if (x == par[x]) return x;
		return par[x] = find(par[x]);
	}
	
 
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;
 
		if (rank[x] < rank[y]) swap(x, y);
 
		par[y] = x;
		cnt[x] += cnt[y];
		if (rank[x] == rank[y]) rank[x]++;
	}
 
	bool same(int x, int y) {
		return find(x) == find(y);
	}
 
	int size(int x) {
		return cnt[find(x)];
	}
};

vector<int> dist;
int dfs(int pos, vector<vector<int> > &g){
	int maxDist = 0;
	for (int i = 0; i < g[pos].size(); i++){
		int to = g[pos][i];
		if (dist[to] != -1){
			maxDist = max(maxDist, dist[to]+1);
			continue;
		}
		int toDist = dfs(to, g);
		maxDist = max(maxDist, toDist + 1);
	}
	dist[pos] = maxDist;
	return maxDist;
}



int main(){
	int N, M; cin >> N >> M;
	vector<vector<int> > graph(N);
	dist.assign(N, -1);
	for (int i = 0; i < M; i++){
		int x, y; cin >> x >> y; x--; y--;
		graph[x].push_back(y);
	}
	int res = 0;
	for (int i = 0; i < N; i++){
		if (dist[i] == -1){
			dist[i] = dfs(i, graph);
		}
		res = max(res, dist[i]);
	}
	cout << res << endl;
}



Measured memory_bytes: 8192