akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int a, b, k;
signed main() {
	cin >> a >> b >> k;
	vector<int>v;
	for (int i = a; i <= min(b, a + k - 1); i++)
		v.push_back(i);
	for (int i = max(a, b - k + 1); i <= b; i++)
		v.push_back(i);
	sort(all(v));
	v.erase(unique(all(v)), v.end());
	for (int i = 0; i < v.size(); i++)
		cout << v[i] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  int tmp[31],tmp1;
  int i,w,n,a,b;
  for(i=1;i<=30;i++)tmp[i]=i;

  scanf("%d %d",&w,&n);
  for(i=0;i<n;i++){
    scanf("%d,%d",&a,&b);
    tmp1=tmp[a];
    tmp[a]=tmp[b];
    tmp[b]=tmp1;
  }
  for(i=1;i<=w;i++){
  printf("%d\n",tmp[i]);
  }
  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int P,Q,R;
  cin>>P>>Q>>R;
  cout<<min({P+Q, Q+R, R+P})<<endl;

  return 0;
}


Measured memory_bytes: 764
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int a, b, c;
	cin >> a >> b >> c;

	if(a==b){
		cout << c << endl;
	}else if(a==c){
		cout << b << endl;
	}else{
		cout << a << endl;
	}

	return 0;
}

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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/e.in", "r", stdin);
//  freopen("../IO/e.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}

constexpr int N = (int)2e5 + 455;
char s[N];
int mp[20000];

void solve(std::istream &in, std::ostream &out) {
  int n, p;
  in >> n >> p >> s;
  int64_t ans = 0;
  if (p != 2 && p != 5) {
    mp[0]++;
    int sm = 0;
    int p10 = 1;
    for (int i = n - 1; i >= 0; --i) {
      sm = (sm + (s[i] - '0') * p10) % p;
      ans += mp[sm]++;
      p10 = p10 * 10 % p;
    }
  } else {
    for (int i = 0; i < n; ++i) {
      if ((s[i] - '0') % p == 0) {
        ans += i + 1;
      }
    }
  }
  out << ans << '\n';
}



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

int main() {
	int n;
	cin >> n;
	int A[15];
	int x[15][15], y[15][15];
	for (int i = 0; i < n; i++) {
		cin >> A[i];
		for (int j = 0; j < A[i]; j++) {
			cin >> x[i][j] >> y[i][j];
			x[i][j]--;
		}
	}

	int ans = 0;
	for (int i = 0; i < (1<<n); i++) {
		bitset<15> t(i);
		int now = 0;
		for (int i = 0; i < n; i++) now += t[i];
		bool ok = true;
		for (int i = 0; i < n; i++) {
			if (t[i]) for (int j = 0; j < A[i]; j++) {
				if (y[i][j] == 0){
					if (t[x[i][j]] != 0) ok = false;
				} else {
					if (t[x[i][j]] != 1) ok = false;
				}

			}
		}
		if (ok) ans = max(ans, now);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
int Mod;
int dp[310][310];
int C[310][310];
int Dp[310][310];
int f(int,int);
int F(int n,int k)
{
	if(k<0)return 0;
	if(Dp[n][k]!=-1)return Dp[n][k];
	return Dp[n][k]=(F(n,k-1)+f(n,k))%Mod;
}
int f(int n,int k)
{
	if(k<0)return 0;
	if(n==0)return 1;
	if(dp[n][k]!=-1)return dp[n][k];
	dp[n][k]=0;
	for(int i=1;i<=n;i++)
		dp[n][k]=(dp[n][k]+(long long)F(i-1,k-1)*f(n-i,k)%Mod*C[n-1][i-1])%Mod;
	return dp[n][k];
}
int main()
{
	int n,k;
	scanf("%d %d %d",&n,&k,&Mod);
	for(int i=0;i<=n;i++)
	{
		C[i][0]=1;
		for(int j=1;j<=i;j++)
			C[i][j]=(C[i-1][j-1]+C[i-1][j])%Mod;
	}
	memset(dp,-1,sizeof(dp));
	memset(Dp,-1,sizeof(Dp));
	printf("%d\n",f(n,k));
	return 0;
}

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

int H;
const int maxn = 2000000;
int A[maxn + 1];

void maxHeapify(int i)
{
    int left = 2 * i;
    int right = 2 * i + 1;
    int largest;

    if (left <= H && A[left] > A[i])
        largest = left;
    else
        largest = i;
    if (right <= H && A[right] > A[largest])
        largest = right;
    if (largest != i)
    {
        swap(A[largest], A[i]);
        maxHeapify(largest);
    }
}

int main()
{
    cin >> H;
    for (int i = 1; i <= H; i++)
        cin >> A[i];

    for (int i = H / 2; i >= 1; i--)
    {
        maxHeapify(i);
    }

    for (int i = 1; i <= H; i++)
    {
        cout << " " << A[i];
    }
    cout << endl;
    return 0;
}




Measured memory_bytes: 4944
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)

typedef complex<double> P;

namespace std {
    bool operator < (const P& a, const P& b) {
        return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
    }
}

double cross(const P& a, const P& b) {
    return imag(conj(a) * b);
}

double dot(const P& a, const P& b) {
    return real(conj(a) * b);
}

int ccw(P a, P b, P c) {
    b -= a; c -= a;
    if(cross(b, c) > 0) return +1;
    if(cross(b, c) < 0) return -1;
    if(dot(b, c) < 0) return +2;
    if(norm(b) < norm(c)) return -2;
    return 0;
}

vector<P> convex_hull(vector<P> ps) {
    int n = ps.size(), k = 0;
    sort(ps.begin(), ps.end());
    vector<P> ch(n * 2);
    for(int i = 0; i < n; ch[k++] = ps[i++])
      while(k >= 2 && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k;
    for(int i = n - 2, t = k + 1; i >= 0; ch[k++] = ps[i--])
      while(k >= t && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k;
    ch.resize(k - 1);
    return ch;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    while(cin >> N && N) {
        double x_, y_; char gomi;
        vector<P> ps(N);
        rep(i, N) {
            cin >> x_ >> gomi >> y_;
            ps[i] = P(x_, y_);
        }

        cout << N - convex_hull(ps).size() << endl;
    }
    return 0;
}

Measured memory_bytes: 1260
fun main(args : Array<String>) {
    val (h, w) = readLine()!!.split(" ").map { it.toInt() }

    if (h == 1 || w == 1) {
        println(1)
        return
    }

    val oddL = ((h + 1) / 2).toLong()
    val evenL = (h - oddL)

    val oddLNum = ((w + 1) / 2).toLong()
    val evenLNum = (w / 2).toLong()

    println(oddL * oddLNum + evenL * evenLNum)
}

Measured memory_bytes: 37904
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
const ll mod=1000000007;
const ll mod2=998244353;
const ll inf=100000000000000000;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
const int MAX_N=1005;
const int MAX_V=MAX_N*(MAX_N-1)/2;
vector<int> to[MAX_V];
int id[MAX_N][MAX_N];
int toID(int i,int j){
   if(i>j)swap(i,j);
   return id[i][j];
}
bool visited[MAX_V];
bool calu[MAX_V];//ループ判定
int dp[MAX_V];//vからスタートした時の最長経路
int dfs(int v){
   if(visited[v]){
       if(!calu[v])return -1;
       return dp[v];
   }
   visited[v]=true;
   dp[v]=1;
   for(int u: to[v]){
       int res=dfs(u);
       if(res==-1)return -1;
       dp[v]=max(dp[v],res+1);
   }
   calu[v]=true;
   return dp[v];
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
cin>>n;
ll ma=n*(n-1)/2;
vector<vector<int>> a(n,vector<int>(n-1));
for(int i=0;i<n;i++){
     for(int j=0;j<n-1;j++){
        cin>>a.at(i).at(j);
        a.at(i).at(j)--;
     }
}
int v=0;
for(int i=0;i<n;i++){
 for(int j=0;j<n;j++){
     if(i<j)id[i][j]=v++;
 }
}
for(int i=0;i<n;i++){
    for(int j=0;j<n-1;j++){
       a[i][j]=toID(i,a[i][j]);//対戦相手
    }
    for(int j=0;j<n-2;j++){
        to[a[i][j+1]].push_back(a[i][j]);//グラフ作成
    }
}
int ans=0;
for(int i=0;i<v;i++){
    int res=dfs(i);
    if(res==-1){
        cout<<-1<<endl;
        return 0;
    }
   ans=max(ans,res);
}
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 38528
#include <iostream>
#include <string>
#include <algorithm>

#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

int
main(int argc, char* argv[]) {
	
	string s;
	cin >> s;
	rep(i, s.length()){
		if(i == 4){ 
			cout << ' ';
		}
		cout << s[i];
	}
	
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
using namespace std;
string s[200010];
vector<string> vec;
map<string, int> Map;
int main() {
    int n; scanf("%d", &n); int ans = 0;
    for(int i = 1; i <= n; i ++) {
        cin >> s[i];
        ans = max(ans, ++ Map[s[i]]);
    }
    for(int i = 1; i <= n; i ++) {
        if(Map[s[i]] == ans) {
            Map[s[i]] = 0;
            vec.push_back(s[i]);
        }
    }
    sort(vec.begin(), vec.end());
    for(auto s : vec) printf("%s\n", s.c_str());
    return 0;
} 

Measured memory_bytes: 28404
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#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 showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


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

    string tm =  t.substr(0, t.size()-1);
    if (tm == s){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}



Measured memory_bytes: 3628
s = gets.chomp.gsub('BC', 'D')
n = s.length
ans = 0
a_cnt = 0

n.times do |i|
  a_cnt += 1 if s[i] == 'A'
  a_cnt = 0 if s[i] == 'B' || s[i] == 'C'

  ans += a_cnt if s[i] == 'D'
end

puts ans

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

int main(){
  int N;
  cin >> N;
  vector<int64_t> a(N),b(N),c(N);
  for(int i=0;i<N;i++){
    cin >> a.at(i);
  }
  for(int i=0;i<N;i++){
    cin >> b.at(i);
    c.at(i)=b.at(i)-a.at(i);
  }
  while(1){
    sort(c.begin(),c.end());
    if(c.front()>=0){
      cout << "Yes" << endl;
      return 0;
    }else if(c.back()<=0){
      cout << "No" << endl;
      return 0;
    }
    int b=c.back();
    int f=c.front();
    if(c.back()>=-c.front()*2){
      c.back()+=c.front()*2;
      c.front()=0;
    }else{
      int64_t x=c.back()+c.front()*2;
      if(x%2==0){
        c.front()=x/2;
        c.back()=0;
      }else{
        c.front()=x/2-1;
        c.back()=1;
      }
    }
    if((c.back()==b)&&(c.front()==f)){
      cout << "No" << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3864
#include <bits/stdc++.h>
//#include <boost/range/algorithm/find_if.hpp>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;
const int INF = 999999999;

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> p(M);
    vector<string> S(M);
    vector<bool> choku(N, false);
    rep(i, M){
        cin >> p[i] >> S[i];
        p[i]--;
    }
    //int wac = 0, acc = 0;
    vector<int> wac(N, 0), acc(N, 0);
    rep(i, M){
        if(choku[p[i]] == false){
            if(S[i] == "AC"){
                acc[p[i]]++;
                choku[p[i]] = true;
            }else{
                wac[p[i]]++;
            }
        }else{

        }
    }
    int ans1 = 0, ans2 = 0;
    rep(i, N){
        if(choku[i] == true){
            ans1++;
            ans2 += wac[i];
        }
    }
    cout << ans1 << " " << ans2 << endl;
return 0;}
/**
 * g++ code.cpp
 * ./a.out
 * shift + ctrl + i
**/ 

Measured memory_bytes: 6912
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

import itertools

X,Y = map(int,readline().split())

for a in range(X+1):
    b = X-a
    if 2*a + 4*b == Y:
        print('Yes')
        exit()
print('No')


Measured memory_bytes: 9344
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int N,M;
    cin>>N>>M;
    vector<int> a(N),b(N),c(M),D(M);
    REP(i,N) cin>>a[i]>>b[i];
    REP(i,M) cin>>c[i]>>D[i];
    REP(i,N){
        int d=1e9,ans=0;
        REP(j,M){
            if(d>abs(a[i]-c[j])+abs(b[i]-D[j])){
                d=abs(a[i]-c[j])+abs(b[i]-D[j]);
                ans=j+1;
            }
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define elnd endl //* missspell check
const ll INF = 1LL << 60;

const long long MOD = 1000000007;

void solve(long long N, std::string S){
    map<char, ll> rec;
    REP(i, N){
        rec[S[i]]++;
    }
    ll ans = 1;
    for(auto x: rec){
        ans = (ans * (x.second+1))% MOD;
    }
    ans = (ans + MOD-1) %MOD;
    cout<<ans<<endl;
    return;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


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

using namespace std;
//using namespace __gnu_pbds;

#define ll    long long
#define PR    pair<ll, ll>

const int N = 3e5 + 5;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    vector<int> g[n + 1];
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int mx = 0;
        for (auto v : g[i]) {
            mx = max(mx, a[v]);
        }
        if (a[i] > mx) ans++;
    }
    cout << ans << '\n';
    return 0;
}


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

const int DIM = 1e5 + 5;

int arr[DIM];

int main(void) {
    ios::sync_with_stdio(false);
    
    int n, m;
    cin >> n >> m;
    
    cout << (n - 1) * (m - 1);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
		String b = sc.next();

		char[] ac = a.toCharArray();
		char[] bc = b.toCharArray();

		Arrays.sort(ac);
		Arrays.sort(bc);
		for (int i = 0; i < b.length() / 2; i++) {
			char tmp = bc[i];
			bc[i] = bc[b.length() - 1 - i];
			 bc[b.length() - 1 - i] = tmp;
		}

		String aa = new String(ac);
		String bb = new String(bc);

		int al = aa.length();
		int bl = bb.length();
		if (al < bl) {
			for (int i = 0; i < al; i++) {
				if (aa.charAt(i) < bb.charAt(i)) {
					System.out.println("Yes");
					return;
				} else if (aa.charAt(i) > bb.charAt(i)) {
					System.out.println("No");
					return;
				}
			}
			System.out.println("Yes");
		} else {
			for (int i = 0; i < bl; i++) {
				if (aa.charAt(i) < bb.charAt(i)) {
					System.out.println("Yes");
					return;
				}
			}
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23124
/*input
1 100
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define sz(_a) (ll)(_a.size())
#define FILL(n) memset(n,1,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
const ll maxn=505;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
int main(){
    int a,b;
    cin>>a>>b;
    for(int i=b-a+1;i<b+a;i++){
        cout<<i<<' ';
    }
}


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

using namespace std;

typedef long long LL;

LL n, s;

LL f(LL n, LL b){
    LL ret = 0;
    while(n > 0){
        ret += n % b;
        n /= b;
    }
    return ret;
}

int main(){
    cin >> n >> s;
    for(LL i = 2;i * i <= n;i++){
        if(f(n, i) == s){
            cout << i << endl;
            return 0;
        }
    }
    if(n < s){
        cout << -1 << endl;
        return 0;
    }
    if(n == s){
        cout << n + 1 << endl;
        return 0;
    }
    LL ans = 1e18;
    for(LL i = 1;i * i <= n - s;i++){
        if((n - s) % i == 0){
            LL b = (n - s) / i + 1;
            LL x1 = i;
            LL x0 = n - x1 * b;
//            cout << b << " " << x1 << " " << x0 << endl;
            if(x1 >= b or x0 >= b or x1 <= 0 or x0 < 0){
                continue;
            }else{
                if(x0 + x1 == s)
                    ans = min(ans, b);
            }
        }
    }
    if(ans == 1e18){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC omodtimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<long long ,long long> ii; 	
typedef complex<long double> com;
 
const ll mod = 998244353;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,s;
	cin >> n >> s;
	vector <ll> arr(n+1);
	for (int z=1;z<=n;z++){
		cin >> arr[z];
	}
	vector <vector<ll>> dp(n+1,vector<ll>(s+1));
	dp[0][0] = 1;
	for (int z=1;z<=n;z++){
		if (arr[z] <= s)
		dp[z][arr[z]] += z;
		for(int x=1;x<=s;x++){
			dp[z][x] += dp[z-1][x];
			dp[z][x] %= mod;
			if (x-arr[z] >= 1)
			dp[z][x] += dp[z-1][x-arr[z]];
			dp[z][x] %= mod;
		}
	}
	ll ans = 0;
	for (int z=1;z<=n;z++){
		ans += dp[z][s];
		ans %= mod;
	}
	cout << ans << endl;
}

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

typedef long long ll;

int n;
ll a, b, in, h[100000];

bool check(ll x){
    ll needA = 0;
    for(int i = 0; i < n; i++){
        ll residual = h[i] - b*x;
        if(residual > 0)    needA += (residual+a-b-1)/(a-b);
    }
    return needA <= x;
}

int main(){
    cin >> n >> a >> b;
    for(int i = 0; i < n; i++)  cin >> h[i];

    ll r = 0;
    for(int i = 0; i < n; i++)  r += (h[i]+a-1)/a;

    ll l = 1;
    while(l < r){
        ll mid = (l+r)/2;
        if(check(mid))  r = mid;
        else            l = mid;
        if((l+r)/2 == mid)  break;
    }

    cout << r << endl;
    /*
    if(check(l))    cout << l << endl;
    else            cout << r << endl;
    */
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#define MAXN 100001

int n, q, times[MAXN];
long long ans;
int main() {
	scanf("%d", &n);
	for (int i = 1, x; i <= n; ++i) {
		scanf("%d", &x);
		ans += x;
		++times[x];
	}
	scanf("%d", &q);
	for (int i = 1, b, c; i <= q; ++i) {
		scanf("%d %d", &b, &c);
		ans -= 1ll * times[b] * b;
		ans += 1ll * times[b] * c;
		printf("%lld\n", ans);
		times[c] += times[b];
		times[b] = 0;
	}
	return 0;
}

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

class Solution
{
    static void Main(string[] args)
    {
        var n = Console.ReadLine();
        var arr = Console.ReadLine().Split(" ").Select(x => int.Parse(x)).ToArray();


        var currentHeight = arr[0];
        var minTotalHeight = 0l;
        for (var i = 1; i < arr.Length; i++)
        {
            if (currentHeight > arr[i])
            {
                minTotalHeight += currentHeight - arr[i];
            }
            else
            {
                currentHeight = arr[i];
            }
        }

        Console.WriteLine(minTotalHeight);
    }
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int32 n = s.size() + 1;
    int64 ans = 0;
    int32 cntUp = 0;
    int32 cntDown = 0;
    char prev = '#';
    REP(i, n - 1){
        if(prev == '>' && s[i] == '<'){
            int32 x = max(cntUp, cntDown) + 1;
            int32 y = min(cntUp, cntDown);
            ans += (1 + x) * x / 2 + (1 + y) * y / 2 - 1;
            cntUp = 1;
            cntDown = 0;
        }else if(s[i] == '<'){
            cntUp++;
        }else{
            cntDown++;
        }
        prev = s[i];
    }
    if(cntDown == 0){
        ans += (2 + cntUp) * (cntUp + 1) / 2;
    }else{
        int32 x = max(cntUp, cntDown) + 1;
        int32 y = min(cntUp, cntDown);
        ans += (1 + x) * x / 2 + (1 + y) * y / 2;
    }
    ANS(ans - n);
    return 0;
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int         long long
#define mod         1000000007
#define FAST        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n)      for(int i=0;i<n;i++)
#define fp(i,k,n)   for(int i=k;i<=n;i++)
#define fr(i,k,n)   for(int i=k;i>=n;i--)
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define dbg(x)      cout << (#x) << " is " << (x) << '\n' 
#define F           first
#define S           second
#define sz(x)       (int)(x).size()
#define lb          lower_bound
#define ub          upper_bound
#define mems(x)     memset(x,0,sizeof(x))
#define all(a)      a.begin(),a.end()
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

/*---------------------------------------------------------------------------------------------------*/

void solve()
{
  int d,s,t;
  cin >> d >> t >> s;
  int d1=t*s;
  if(d1>=d)
    cout << "Yes\n";
  else
    cout << "No\n";
  return;
} 

signed main()
{
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  FAST
  int T=1;
  // cin >> T;
  while(T--)
  {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B, C;
	cin >> A >> B >> C;
	
	for (int i = 0; i < 10; i++) {
		C = C * A - B;
		cout << C << endl;
	}
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        System.out.println((arr[n - 1] - arr[0] + 1) / 2);
    }
}


Measured memory_bytes: 30124
fn main() {
    let _n = read::<usize>();
    let v = read_vec::<u32>();
    for i in v {
        if i % 2 == 0 {
            if i % 3 == 0 || i % 5 == 0 {
                continue;
            } else {
                println!("DENIED");
                return;
            }
        }
    }
    println!("APPROVED");
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
package main

import "fmt"

func main() {
	var k int
	var s string
	fmt.Scan(&k)
	fmt.Scan(&s)
	if len(s) <= k {
		fmt.Println(s)
	} else {
		for i, ss := range s {
			if i >= k {
				break
			}
			fmt.Printf("%s", string(ss))
		}
		fmt.Println("...")
	}
}


Measured memory_bytes: 1836
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#pragma comment(linker, "/STACK:16000000")
using namespace std;

const int Maxn = 100005;

int n;
vector <int> neigh[Maxn];
int cnt[Maxn], L[Maxn], P[Maxn];

void Traverse(int v)
{
	cnt[v] = 1;
	for (int i = 0; i < neigh[v].size(); i++) {
		int u = neigh[v][i];
		if (P[v] == u) continue;
		L[u] = L[v] + 1; P[u] = v;
		Traverse(u);
		cnt[v] += cnt[u];
	}
}

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n - 1; i++) {
		int a, b; scanf("%d %d", &a, &b);
		neigh[a].push_back(b);
		neigh[b].push_back(a);
	}
	Traverse(1);
	int up = (L[n] - 1) / 2;
	int v = n;
	while (up--) v = P[v];
	if (cnt[v] >= n - cnt[v]) printf("Snuke\n");
	else printf("Fennec\n");
	return 0;
}

Measured memory_bytes: 13184
def input_from_console():
    n, m = map(int, input().split())
    lr_list = []
    for i in range(m):
        l, r = map(int, input().split())
        lr_list.append((l,r))
    return n, m, lr_list

def solve(n, m, lr_list):
    lr_list.append((1,n))
    l_max = 0
    r_min = n
    for item in lr_list:
        l, r = item
        if l > l_max:
            l_max = l
        if r < r_min:
            r_min = r
    result = r_min - l_max + 1
    if result < 0:
        result = 0
    return result

def main():
    n, m, lr_list = input_from_console()
    print(solve(n, m, lr_list))


if __name__ == "__main__":
    main()

Measured memory_bytes: 16604
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define MP make_pair
#define PB push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;
	if (x >= r && y >= r && x <= w - r && y <= h - r)puts("Yes");
	else puts("No");
}


Measured memory_bytes: 3104
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

signed main() {
	IOS();
	ll n, q;
	string s;
	cin >> n >> q >> s;
	vector<pair<char, char>> a(q);
	for (int i = 0; i < q; i++) {
		cin >> a[i].first >> a[i].second;
	}
	ll left = -1, right = n;
	while (left < right - 1) {
		ll mid = (left + right) / 2;
		ll now = mid;
		//dump(mid);
		for (int i = 0; i < q; i++) {
			if (now == -1) {
				break;
			}
			if (s[now] == a[i].first) {
				if (a[i].second == 'R')
					now++;
				else
					now--;
			}
		}
		if (now == -1) {
			left = mid;
		} else {
			right = mid;
		}
	}
	left++;
	//dump(left);
	ll left2 = -1, right2 = n + 1;
	while (left2 < right2 - 1) {
		ll mid = (left2 + right2) / 2;
		ll now = mid;
		//dump(mid);
		for (int i = 0; i < q; i++) {
			if (now == -1) {
				break;
			}
			if (s[now] == a[i].first) {
				if (a[i].second == 'R')
					now++;
				else
					now--;
			}
		}
		if (now == n) {
			right2 = mid;
		} else {
			left2 = mid;
		}
	}
	//dump(right2);
	ll unko = n - right2;
	dump(max(0ll, n - left - unko));
	return 0;
}

Measured memory_bytes: 976
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long x,y;
	cin>>x>>y;
	if(x%y==0){
		cout<<"-1"<<endl;
		return 0;
	}
	/*if(x>y){
		cout<<x<<endl;
		return 0;
	} 
	else if(2*x!=y){
		cout<<2*x<<endl;
		}
	else if(3*x!=y){
		cout<<3*x<<endl; 
	}*/
	cout<<x<<endl;

	return 0;
}

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

int main(void){
    int n, l, r, ans = 0;
    cin >> n;
    for (int i=0; i<n; i++){
        cin >> l >> r;
        ans += r - l + 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define N (1005)
#define ll long long
#define debug(x) cerr<<#x<<" : "<<x<<endl
#define CM cerr<<(&MOP2-&MOP1)/1024.0/1024.0<<endl
using namespace std;
template <class T> inline T Min(T x, T y) {
	return x<y?x:y;
}
template <class T> inline T Max(T x, T y) {
	return x>y?x:y;
}
bool MOP1;
int n,A[N][N],p[N];
int read() {
	int v=0;
	char c;
	for(c=getchar(); c<48; c=getchar());
	for(; c>47; c=getchar())v=(v<<3)+(v<<1)+(c^48);
	return v;
}
int cnt=0;
int tot=0;
bool mark[N];
bool flag;
bool MOP2;
int q[2][N];
bool cur;
int main() {
	n=read();
	for(int i=1; i<=n; i++) {
		p[i]=1;
		for(int j=1; j<n; j++)A[i][j]=read();
	}
	cur=1;
	for(int i=1;i<=n;i++)q[cur][i]=A[i][1];
	q[cur][0]=n;
	while(tot<n*(n-1)/2) {
		flag=0;
		cur^=1;
		q[cur][0]=0;
		cnt++;
		memset(mark,0,sizeof mark);
		for(register int i=1; i<=q[cur^1][0]; i++) {
			int now=q[cur^1][i];
			int to=A[now][p[now]];
			if(p[now]==n||mark[now]||mark[to])continue;
			if(A[to][p[to]]==now){
				mark[now]=1,mark[to]=1,p[now]++,p[to]++,tot++,flag=1,q[cur][++q[cur][0]]=now,q[cur][++q[cur][0]]=to;
			}
		}
		if(!flag) {
			puts("-1");
			return 0;
		}
	}
	printf("%d\n",cnt);
	return 0;
}






Measured memory_bytes: 4224
import collections
n = int(input())
a = list(map(int,input().split()))
c = dict(collections.Counter(a))
c = dict(sorted(c.items(),key = lambda x:x[0]))

ans = 0
for i in range(1,10**5):
  cnt = 0
  try:
    cnt += c[i-1]
  except KeyError:
    pass
  
  try:
    cnt += c[i]
  except KeyError:
    pass
    
  try:
    cnt += c[i+1]
  except KeyError:
    pass
    
  ans = max(ans,cnt)  
  
print(ans)  

Measured memory_bytes: 21084
n=input()
l1=list(n)
l1=l1[::-1]
num=len(n)
ans=[0 for i in range(13)]
modlist=[1,10,9,12,3,4]
if l1[0]=="?":
  for i in range(0,10):
    ans[i]=1
else:
  ans[int(l1[0])]=1
for i in range(1,num):
  mod=modlist[i%6]
  dp=[ans[i] for i in range(13)]
  if l1[i]=="?":
    lmod=[(j*mod)%13 for j in range(10)]
    for j in range(13):
      ans1=0
      for k in lmod:
        if j-k>=0:
          mod2=j-k
        else:
          mod2=13+j-k
        ans1=(ans1+dp[mod2])%(10**9+7)
      ans[j]=ans1%(10**9+7)
  else:
    num1=int(l1[i])
    mod1=(num1*mod)%13
    for j in range(13):
      if j-mod1>=0:
        mod2=j-mod1
      else:
        mod2=13+j-mod1
      ans[j]=dp[mod2]
print(ans[5]%(10**9+7))


Measured memory_bytes: 50288
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <sstream>
using namespace std;

int main()
{
	int n, x;
	cin >> n >> x;

	vector<int> l(n);
	for (int i = 0; i < n; i++) {
		cin >> l[i];
	}

	int c = 1;
	int p = 0;
	for (int i = 0; i < n; i++) {
//		Di = Di−1 + Li−1(2 ≤ i ≤ N + 1) 
		p = p + l[i];
		if (p <= x) {
			c++;
		}
	}

  	cout << c << endl;

	return(0);
}





Measured memory_bytes: 256
#include<stdio.h>
main()
{
	register long long n,a,b,c,d;
	scanf("%lld%lld%lld",&n,&a,&b);
	c=n/(a+b);d=n%(a+b);
	if(d>=a)d=a;
	printf("%lld",a*c+d);
}

Measured memory_bytes: 128
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Stack;
//import java.util.EmptyStackException;

public class Main {
	static int m=0;
	public static void dfs(Node v,int n,Stack<Node> previsit) {
		//System.out.println(previsit);
		//if (v.visit && previsit.empty()) {
		//	v.end = n;
		//	m=n;
			//System.out.println(v);
			//System.out.println("oooooo");
		//	return;
		//}
		//System.out.println(previsit);
		if (v.visit) {
			//System.out.println(previsit);
			for (int i =0;i<v.adjecent.size();i++) {
				if (!v.adjecent.get(i).visit) {
					previsit.push(v);
					dfs(v.adjecent.get(i),n,previsit);
					return;
				}
			}
			v.end = n;
			//System.out.println(v);
			//previsit.pop();
			//if (previsit.size()<=1) {
			//	previsit.peek().end=n+1;
			//}
			//else {
			if (!previsit.empty()) {	
				dfs(previsit.pop(),n+1,previsit);
				return;
			}
			else {
				m=n;
				return;
			}
			//if (previsit.empty()) {
			//	System.out.println("oooooo");
			//	return;
			//}
			
		}
		else {
			previsit.push(v);
			v.start = n;
			v.visit=true;
			//System.out.println(previsit);
			if (v.adjecent.isEmpty()) {
				v.end=n+1;
				//System.out.println(v);
				previsit.pop();
				if (!previsit.empty()) {
				    dfs(previsit.pop(),n+2,previsit);
				    return;
				}
			}
			else {
				for (int i =0;i<v.adjecent.size();i++) {
					if (!(v.adjecent.get(i).visit)) {
						dfs(v.adjecent.get(i),n+1,previsit);
						return;
					}
				}
				v.end=n+1;
				//System.out.println(v);
				previsit.pop();
				if (!previsit.empty()) {
					dfs(previsit.pop(),n+2,previsit);
					return;
				}
			}
		}
		return;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Node[] nod = new Node[n];
		for (int i=0;i<n;i++) {
			nod[i] = new Node(i+1);
		}
		//for (Node node:nod) {
		//	System.out.println(node);
		//}
		//System.out.println(" ");
		for (int i=0;i<n;i++) {
			sc.nextInt();
			//System.out.println(a);
			int m = sc.nextInt();
			//System.out.println(m);
			for (int j=0;j<m;j++) {
				int k = sc.nextInt();
				//System.out.println(k);
				//System.out.println(nod[k-1]);
				nod[i].adjecent.add(nod[k-1]);
			}
			//for (Node node:nod) {
			//	System.out.println(node);
			//}
		}
		sc.close();
		//System.out.println("ok");
		Stack<Node> previs = new Stack<Node>();
		//previs.push(new Node(-1));
		//dfs(nod[0],1,previs);
		for (int i=0;i<nod.length;i++) {
			if (!nod[i].visit) {
				dfs(nod[i],m+1,previs);
			}
		}
		//System.out.println(1);
		for (Node node:nod) {
			//System.out.println(1);
			System.out.println(node.u+" "+node.start+" "+node.end);
		}
	}
	static class Node{
		public int u;
		public int start;
	    public int end;
	    public boolean visit;
	    public ArrayList<Node> adjecent;
	    public String toString() {
	    	return this.u+" "+this.start+" "+this.end+" "+this.visit;//+this.adjecent.toString();
	    }
	    public Node(int u) {
	    	this.u = u;
	        this.visit = false;
	        this.adjecent = new ArrayList<Node>();
	    }
	}
}


Measured memory_bytes: 28268
#include <bits/stdc++.h> 
#include <chrono>
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const int MAX_N=2e5+3;


const unsigned long long B=1e12+7;



int main(){
    string S;
    cin>>S;
    if(S=="ARC"){
        cout<<"ABC"<<endl;
    }else{
        cout<<"ARC"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a; 
  cin >> a;
  int ans = 0;
  int m = 0;
  for (int i = 0; i < a; i++) {
    int b;
    cin >> b;
    ans += b;
    if (m < b) m = b;
  }
  cout << ans - m / 2 << endl;
} 

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

using namespace std;

int a[100000];
int n;
int cnt = 1;

int botton(int x){
  if(cnt > n) {
    return -1;
  }
  if(a[x] == 2) {
    return cnt;
  } else {
    cnt++;
    return botton(a[x]);
  }
}


int main(){
  cin >> n;
  for(int i = 1; i < n+1; i++){
    cin >> a[i];
  }
  cout << botton(1) << endl;
  return 0;
}


Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)

template <typename T>
struct edge
{
    int src, to;
    T cost;
    edge(int to, T cost) : src(-1), to(to), cost(cost) {}
    edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
    edge &operator=(const int &x)
    {
        to = x;
        return *this;
    }
    operator int() const { return to; }
};

template <typename T>
using Edges = vector<edge<T>>;

template <typename T>
using WeightedGraph = vector<Edges<T>>;

template <typename T>
using UnweightedGraph = vector<vector<T>>;

template <typename T>
using Matrix = vector<vector<T>>;

int func(UnweightedGraph<int> &G, int v, vector<int> &dp)
{
    if (dp[v] != -1)
        return dp[v];
    if (G[v].size() == 0)
    {
        dp[v] = 0;
    }
    else
    {
        for (auto &u : G[v])
        {
            dp[v] = max(dp[v], func(G, u, dp) + 1);
        }
    }

    return dp[v];
}

int N, M;

int main()
{
    cin >> N >> M;
    UnweightedGraph<int> G(N);

    for (int i = 0; i < M; i++)
    {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].emplace_back(b);
    }

    vector<int> dp(N, -1);

    int ans = -2;

    for (int i = 0; i < N; i++)
    {
        ans = max(ans, func(G, i, dp));
    }

    cout << ans << endl;
}

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

int main() {
	// your code goes here
	int a,b,c;
	cin >> a >> b >> c;
	if(c>a && c<b)
	printf("Yes");
	else if(c>b && c<a)
		printf("Yes");
else
printf("No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repR(i, n) for(int i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(int i = n; i >= 0; ++i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define itn int
#define ednl endl
using namespace std;
typedef long long ll;
int main(){
  string s;cin>>s;
  int ans;
  for(int i;i<3;i++){
    if (s[i]=='1') ans++;
  }
  cout<<ans<<endl;
}
    

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 1100000;

void run_case()
{
    char c;
    cin >> c;
    if (c >= 'A' && c <= 'Z')
        cout << 'A' << "\n";
    else
        cout << 'a' << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 3620
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

#[allow(unused_imports)]
use std::{i32, i64, u32, u64, f64};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{VecDeque, HashMap, BTreeMap, HashSet, BTreeSet};
#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
#[allow(unused_imports)]
use std::iter::{Sum};
#[allow(unused_imports)]
use std::mem::{swap};
//#[allow(unused_imports)]
//use proconio::marker::{Isize1, Usize1, Bytes, Chars};

//#[proconio::fastout]
fn main() {
    input!{
        n: usize,
        a: [i64; n],
    }
    println!("{}", a.iter().map(|a| a.trailing_zeros()).sum::<u32>());
}



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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> lump(n);
    rep(i, m){
        int k; cin >> k;
        rep(j, k){
            int tmp; cin >> tmp; tmp --;
            lump[tmp] |= 1<<i;
        }
    }
    int p = 0;
    rep(i, m){
        int tmp; cin >> tmp;
        p |= tmp << i;
    }
    int success = 0;
    rep(bit, (1<<n)){
        int ok = 0;
        rep(i, n){
            if (bit >> i & 1){
                ok ^= lump[i];
            }
        }
        
        if (ok == p){
            success ++;  
        }
    }
    cout << success << endl;
}   


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


int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int N, K; cin >> N >> K;
  int ans;
  if (N % K == 0) ans = 0;
  else ans = 1;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256