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

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k = sc.nextInt();
    System.out.println(a[k - 1]);
  }
}

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


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll n;
	cin >> n;
	string s = "";
	while (n > 0) {
		n--;
		ll val = n%26;
		//if (val == 0) val = 26;
		s = (char) (val + 'a') + s;
		n /= 26;
	}
	cout << s;
	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)

#include <iostream>
#include <vector>
using namespace std;

//重複順列
vector<ll> buf;
void permutation(ll i, const ll size, const ll range_start, const ll range_end)
{
    if (i == size) {
      // ここで所望の作業を行う
      for(ll itr:buf){
        cout << itr;
      }
    }
    else{
        for(ll j = range_start; j <= range_end; ++j){
            buf[i] = j;
            permutation(i + 1, size, range_start, range_end);
        }
    }
}

int main(void)
{
  ll n, l, ans=0;
  cin >> n;
  map<ll, ll> count;
  vector<ll> L;
  RAP(i, n){
    cin >> l;
    if(count[l]==0){
      count[l]++;
      L.push_back(l);
    }else{
      count[l]++;
    }
  }
  sort(L.begin(),L.end());
  if(L.size()<3){
    cout << 0 << endl;
    return 0;
  }
  for(ll i=0;i<L.size()-2;i++){
    for(ll j=i+1;j<L.size()-1;j++){
      for(ll k=j+1;k<L.size();k++){
        if((L[i]+L[j])>L[k]){
          ans += count[L[k]]*count[L[j]]*count[L[i]];
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
unittest
{
	assert( [ "4", "3 3 3 3" ].parse.expand.solve == 0 );
	assert( [ "3", "1 0 3" ].parse.expand.solve == 1 );
	assert( [ "2", "2 2" ].parse.expand.solve == 2 );
	assert( [ "7", "27 0 0 0 0 0 0" ].parse.expand.solve == 3 );
	assert( [ "10", "1000 193 256 777 0 1 1192 1234567891011 48 425" ].parse.expand.solve == 1234567894848 );
	
	assert( [ "50", ( 10L ^^ 16 + 1000 ).to!string.repeat( 50 ).join( " " ) ].array.parse.expand.solve == 500000000000047550 );		// 追加ケース
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( n, as );
}

auto solve( long n, long[] as )
{
	auto ans = 0L;
	while( n <= as.reduce!max )
	{
		// n引く
		auto t = 0L;
		foreach( ref a; as )
		{
			auto c = ( a + t ) / n;		// ceil( ( ( a + t ) - ( n - 1 ) ) / n )
			a -= c * ( n + 1 );			// 余分に1引いておくことで、後ろの足す処理を簡単にする
			t += c;
		}
		
		// n引いた回数だけ全体に1足す
		as[] += t;
		ans += t;
	}
	return ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x,i##end=y;i<=i##end;++i)
#define _rep(i,x,y) for(int i=x,i##end=y;i>=i##end;--i)
#define ll long long 
#define N 1000005
typedef std::pair<int,int> pii;
int n,a[N],c[N],cpy[N],cnt,sum[N],up;
struct tree{
	void clear(){memset(c,0,sizeof(c));}
	inline void upd(int x,int v){for(;x<=up;x+=x&-x) c[x]+=v;}
	inline int qry(int x,int ret=0){for(;x;x-=x&-x) ret+=c[x]; return ret;}
} T;
/*bool check(int mid){
	T.clear();
	int ret=0; up=0;
	rep(i,1,n) sum[i]=a[i]>=mid?1:-1;
	rep(i,1,n) sum[i]+=sum[i-1],ret+=sum[i]>=0;
	rep(i,1,n) up=std::max(up,sum[i]+=n+1);
	rep(i,1,n) ret+=T.qry(sum[i]),T.upd(sum[i],1);
	return 1ll*n*(n-1)/2+n-ret<(1ll*n*(n-1)/2+n)/2+1;
}*/
inline int check(int mid) {
    memset(c,0,sizeof(c)),up=0;
    for (int i=1;i<=n;++i) {
        if (a[i]<mid) sum[i]=-1;
        else sum[i]=1;
    }
    ll res=0;
    for (int i=1;i<=n;++i) sum[i]+=sum[i-1],res+=(sum[i]>=0);
    for (int i=1;i<=n;++i) sum[i]+=n+1,up=std::max(up,sum[i]);
    for (int i=1;i<=n;++i) res+=T.qry(sum[i]),T.upd(sum[i],1);
    ll cnt=1ll*n*(n-1)/2+n;
    return cnt-res<cnt/2+1;
}
int main(){
	std::ios::sync_with_stdio(0);
	std::cin.tie(0),std::cout.tie(0);
	std::cin>>n;
	rep(i,1,n) std::cin>>a[i],cpy[i]=a[i];
	std::sort(cpy+1,cpy+n+1);
	cnt=std::unique(cpy+1,cpy+n+1)-cpy-1;
	rep(i,1,n) a[i]=std::lower_bound(cpy+1,cpy+cnt+1,a[i])-cpy;
	int l=1,r=cnt,ans=-1;
	while(l<=r){
		int mid=l+r>>1;
		if(check(mid)) l=mid+1,ans=mid;
		else r=mid-1;
		
	}
	std::cout<<cpy[ans]<<'\n';
	return 0;
}

Measured memory_bytes: 8716
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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

int N;

int main(){
    cin>>N;
    out(N*N*N);
    
    
}


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

const int NMAX = 1e5 + 5;

int n, m, k;
vector <int> G[NMAX], H[NMAX];
int nrComp, comp[NMAX], cnt[NMAX];
int ans[NMAX];

void dfs(int nod) {
    comp[nod] = nrComp;
    cnt[nrComp]++;

    for (auto v: G[nod])
        if (!comp[v])
            dfs(v);
}

int main()
{
    cin >> n >> m >> k;
    for (int i = 1; i <= m; i++) {
        int u, v;
        cin >> u >> v;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    for (int i = 1; i <= k; i++) {
        int u, v;
        cin >> u >> v;
        H[u].push_back(v);
        H[v].push_back(u);
    }

    for (int i = 1; i <= n; i++)
        if (!comp[i]) {
            nrComp++;
            dfs(i);
        }

    for (int i = 1; i <= n; i++)
        ans[i] = cnt[comp[i]] - 1;

    for (int i = 1; i <= n; i++) {
        for (auto v: G[i])
            ans[i]--;
        for (auto v: H[i]) {
            if (comp[v] == comp[i])
                ans[i]--;
        }
    }

    for (int i = 1; i <= n; i++)
        cout << ans[i] << " ";


    return 0;
}


Measured memory_bytes: 12672
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <list>
#include <iomanip>
#include <queue>
#include <cmath>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;
typedef pair<ll, ll> p;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
const long long mod = 1e9 + 7;
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);

int main() {

    ll N;
    cin >> N;

    vector<ll> a(N);

    rep(i, N) {
        cin >> a[i];
    }

    sort(a.begin(), a.end(), greater<>());
    ll ans1, ans2, d;

    ans1 = a[0];
    d = a[0];

    rep(i, N) {
        if (abs(a[0] / 2 - a[i]) < d) {
            ans2 = a[i];
            d = abs(a[0] / 2 - a[i]);
        }
    }

    if (N == 2) {
        ans1 = max(a[0], a[1]);
        ans2 = min(a[0], a[1]);
    }

    cout << ans1 << " " << ans2;
    
    return 0;
}


ll gcd(ll a, ll b) {
    if (a % b == 0)return(b);
    else return(gcd(b, a % b));
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

Measured memory_bytes: 4060
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n)           for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b)        for (int i = (int)(a); i < (int)(b); i++)
#define FOR(i, a)           for (auto &i : a)
#define ALL(obj)            begin(obj), end(obj)
#define MAX(x)              *max_element(ALL(x))
#define MIN(x)              *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))
#define Endl                endl

using namespace std;
const int MOD   = (int)(1e9 + 7);
const int INF   = (int)(1e13 + 7);
const double PI = acos(-1);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int pow(int x, int y) {                                                             //return x^y in order(log(y))
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template <class T>
void cumulative_sum(T &container) {
  for (int i = 0; i < container.size() - 1; i++) container[i + 1] += container[i];
}

class DMegalomania {
public:
  static void solve(istream &cin, ostream &cout) {
    int N;
    cin >> N;
    vector<pair<int, int>> AB(N);
    rep(i, N) {
      cin >> AB[i].second >> AB[i].first;
    }
    sort(ALL(AB));
    int now = 0;
    rep(i, N) {
      now += AB[i].second;
      if (now > AB[i].first) {
        cout << "No" << endl;
        return;
      }
    }
    cout << "Yes" << endl;
  }
};


signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  DMegalomania solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if ((A+B) > (C+D)) {
    cout << "Left" << endl;
  }
  else if ((A+B) < (C+D)) {
    cout << "Right" << endl;
  }
  else 
    cout << "Balanced" << endl;
}


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

int main(){
  int N;
  cin >> N ;
  vector<int> a(N+2,0);
  vector<int> b(N+1,0);
  
  for(int i=1; i<N+2 ; i++){
  	cin >> a.at(i);  
  }
  for(int i=1; i<N+1 ; i++){
  	cin >> b.at(i);  
  }
  
  vector<long long int> c(N+2,0);
  
  for(int i=1 ; i<N+1; i++){
    if(b.at(i)-a.at(i) >= 0){
      c.at(i) += a.at(i) ;
      if(a.at(i+1) - b.at(i) + a.at(i) >= 0){
        a.at(i+1) -= (b.at(i) - a.at(i));
        c.at(i+1) += b.at(i) - a.at(i);
      }else{
        c.at(i+1) += a.at(i+1);
        a.at(i+1) = 0;
      }  
        
    }else{
      c.at(i) += b.at(i)  ;
    }
  }
  
  long long int sum = 0 ;
  for(int i=0; i<N+2 ; i++){
    sum += c.at(i);
  }
  cout << sum;  
}


Measured memory_bytes: 1792
n, m = map(int, input().split())
adj = [[] for _ in range(n)]
for _ in range(m):
  x, y, z = map(int, input().split())
  adj[x-1].append(y-1)
  adj[y-1].append(x-1)
opn = [True] * n
count = 0
for i in range(n):
  if opn[i]:
    count += 1
    opn[i] = False
    stack = [i]
    while stack:
      u = stack.pop()
      for v in adj[u]:
        if opn[v]:
          stack.append(v)
          opn[v] = False
print(count)

Measured memory_bytes: 23624
H, W = map(int, input().split())
grid = [0]*H
for i in range(H):
    grid[i] = input()

ans = 1
for h in range(H):
    for w in range(W):
        if ans == 0:
            break
        if grid[h][w] == "#":
            if h == 0:
                if w == 0:
                    if grid[h + 1][w] == "." and grid[h][w+1] == ".":
                        ans = 0
                elif w == W - 1:
                    if grid[h + 1][w] == "." and grid[h][w-1] == ".":
                        ans = 0
                else:
                    if grid[h + 1][w] == "." and grid[h][w - 1] == "." and grid[h][w + 1] == ".":
                        ans = 0

            elif h == H - 1:
                if w == 0:
                    if grid[h - 1][w] == "." and grid[h][w+1] == ".":
                        ans = 0
                elif w == W - 1:
                    if grid[h - 1][w] == "." and grid[h][w-1] == ".":
                        ans = 0
                else:
                    if grid[h - 1][w] == "." and grid[h][w - 1] == "." and grid[h][w + 1] == ".":
                        ans = 0

            else:
                if w == 0:
                    if grid[h - 1][w] == "." and grid[h][w+1] == "."and grid[h + 1][w] == ".":
                        ans = 0
                elif w == W - 1:
                    if grid[h - 1][w] == "." and grid[h][w-1] == "."and grid[h + 1][w] == ".":
                        ans = 0
                else:
                    if grid[h - 1][w] == "." and grid[h][w - 1] == "." and grid[h][w + 1] == "." and grid[h + 1][w] == ".":
                        ans = 0

if ans == 1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3192
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define ed "\n"
void YN(bool flg){cout<<(flg?"YES":"NO")<<endl;}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<endl;}
void yn(bool flg){cout<<(flg?"yes":"no")<<endl;}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << endl;
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int64_t, int >prime_factor(int64_t n){map< int64_t, int > ret;for(int64_t i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

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

    int n; cin >> n;
    auto fn = getDivisor(n);
    int now = 1 , now2;
    for(auto x:fn){
        if(now*x==n){now2 = x; break;}
        else if(x*x==n){now = x; now2 = x; break;}
        now = x;
    }
    cout << now+now2-2 << endl;

    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	int count = 0;

	for (int i = 1; i <= n; i++)
	{
		string s = to_string(i);
		if (s.size() % 2 == 1)
		{
			count++;
		}
	}

	cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
using namespace std;
using ll = long long;

struct UnionFind {
  vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
  vector<int> sizes; // size[i]:iの属する木の要素数

  UnionFind(int N) : par(N), sizes(N,1) { //最初は全てが根であるとして初期化
    for(int i = 0; i < N; i++) par[i] = i;
  }

  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (par[x] == x){
      return x;
    }
    return par[x] = root(par[x]);
  }

  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); //xの根をrx
    int ry = root(y); //yの根をry
    if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
    if(sizes[rx]>sizes[ry]){ // 小さい方を大き方にくっつける
      par[ry]=rx;
      sizes[rx]+=sizes[ry];
    }
    else{
      par[rx]=ry;
      sizes[ry]+=sizes[rx];
    }
  }

  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    return root(x) == root(y);
  }

  int size(int x){
    return sizes[x]=sizes[root(x)];
  }
};

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> P(N);
  for(int i=0;i<N;i++){
    cin >> P[i];
    P[i]--;
  }
  UnionFind uni(N);
  for(int i=0;i<M;i++){
    int x,y;
    cin >> x >> y;
    x--;
    y--;
    uni.unite(x,y);
  }
  bool flag=true;
  while(flag){
    flag=false;
    for(int i=0;i<N;i++){
      if(i==P[i]){
        continue;
      }
      if(uni.same(i,P[i])){
        swap(P[i],P[P[i]]);
        flag=true;
      }
    }
  }
  int ans=0;
  for(int i=0;i<N;i++){
    if(i==P[i]){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4196
n = int(raw_input())
pts = [complex(*[float(_) for _ in raw_input().split()]) for i in xrange(n)]


def cross(a, b):
    return (a.conjugate() * b).imag


pts.sort(key=lambda p: (p.imag, p.real))

right = []
for p in pts:
    while len(right) >= 2 and cross(right[-1] - right[-2], p - right[-1]) < 0:
        right.pop()
    right.append(p)

left = []
for p in reversed(pts):
    while len(left) >= 2 and cross(left[-1] - left[-2], p - left[-1]) < 0:
        left.pop()
    left.append(p)

ans = right[:-1] + left[:-1]
print len(ans)
for p in ans:
    print int(p.real), int(p.imag)


Measured memory_bytes: 24020
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	N := ReadInt()
	a := ReadInts(N)
	b := make([]int, 0)
	c := make(map[int]int)
	for i := 0; i < N; i++ {
		if c[a[i]] == 0 {
			b = append(b, a[i])
		}
		c[a[i]]++
	}

	sort.Ints(b)

	if len(b) == 1 {
		if b[0] == 0 {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
		return
	}

	if len(b) == 2 {
		if b[0] == 0 && c[b[0]]*3 == N {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
		return
	}

	if len(b) >= 4 {
		fmt.Println("No")
		return
	}

	s := 0
	for i := 0; i < len(b); i++ {
		s ^= b[i]
	}
	ok := true
	first := c[b[0]]
	for i := 1; i < len(b); i++ {
		if first != c[b[i]] {
			ok = false
		}
	}

	if s == 0 && ok {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define int long long
#define PI (acos(-1))

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  int a,b;
  cin>>a>>b;
  int ans=a-b*2;
  if(ans<0)ans=0;
  cout(ans);
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    scanVecLLInt(A, N * 3);
    vector<ll> former_sum; former_sum.reserve(N + 1);
    vector<ll> latter_sum; latter_sum.reserve(N + 1);
    {
        ll former_sum_temp = 0;
        ll latter_sum_temp = 0;
        loop(i, N){
            former_sum_temp += A[i];
            latter_sum_temp += A[N * 2 + i];
        }
        former_sum.emplace_back(former_sum_temp);
        latter_sum.emplace_back(latter_sum_temp);
    }
    priority_queue<ll, vector<ll>, greater<ll>> former_queue(A.begin(), A.begin() + N, greater<ll>());
    priority_queue<ll> latter_queue(A.begin() + N * 2, A.end());
    loop(i, N){
        auto& ai = A[N + i];
        auto& qn = former_queue.top();
        if (qn < ai){
            former_sum.emplace_back(former_sum.back() + (ai - qn));
            former_queue.pop(); // qn
            former_queue.emplace(ai);
        }else{
            former_sum.emplace_back(former_sum.back());
        }
    }
    loop(i, N){
        auto& ai = A[N * 2 - 1 - i];
        auto& qn = latter_queue.top();
        if (ai < qn){
            latter_sum.emplace_back(latter_sum.back() + (ai - qn));
            latter_queue.pop(); // qn
            latter_queue.emplace(ai);
        }else{
            latter_sum.emplace_back(latter_sum.back());
        }
    }
    // loop(i, N + 1) printf("%lld ", former_sum[i]); puts("");
    // loop(i, N + 1) printf("%lld ", latter_sum[i]); puts("");
    ll result = LLONG_MIN;
    loop(i, N + 1){
        result = max(result, former_sum[i] - latter_sum[N + 1 - 1 - i]);
    }
    printf("%lld\n", result);
}


Measured memory_bytes: 5760
import java.util.Scanner;

/**
 * 鈴木くんのプログラムを元（参考）に作成 クラス内の変数を直接読み込ませないようにカプセル化（？）をしてみたが、
 * 果たしてこれがカプセル化なのかがわからない…
 * 
 * @author U633758
 *
 */
public class Main{

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		Dice2 dc = new Dice2();
		dc.dice(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());

		int q = sc.nextInt();
		int top, front;
		int[] r = new int[q];
		for (int i = 0; i < q; i++) {
			top = sc.nextInt();
			front = sc.nextInt();
			r[i] = dc.getRight(top, front);
		}

		for (int i = 0; i < q; i++) {
			System.out.println(r[i]);
		}
		sc.close();// Scannerを閉じる
	}

}

/**
 * Dice2クラス ダイスの面に数字をインプットする。回転させたりする。
 * 
 * @author U633758
 *
 */
class Dice2 {
	private int T, S, E, W, N, U;

	Dice2() {
		this.T = 0; // Top
		this.S = 0;
		this.E = 0;
		this.W = 0;
		this.N = 0;
		this.U = 0; // Under
	}

	void dice(int T_1, int S_2, int E_3, int W_4, int N_5, int U_6) {
		this.T = T_1; // Top
		this.S = S_2;
		this.E = E_3;
		this.W = W_4;
		this.N = N_5;
		this.U = U_6; // Under
		// TODO 自動生成されたコンストラクター・スタブ
	}

	/**
	 * 南方向にサイコロを傾ける
	 */
	void MoveSouth() {
		int a = T;
		T = N;
		N = U;
		U = S;
		S = a;
	}

	void MoveEast() {
		int a = T;
		T = W;
		W = U;
		U = E;
		E = a;
	}

	void MoveNorth() {
		int a = T;
		T = S;
		S = U;
		U = N;
		N = a;
	}

	void MoveWest() {
		int a = T;
		T = E;
		E = U;
		U = W;
		W = a;
	}

	void right() {// 時計周りの回転
		int a = S;
		S = E;
		E = N;
		N = W;
		W = a;
	}

	int getRight(int t, int f) {
		for (int i = 0; i < 3; i++) {
			if (t == T) {
				break;
			}
			MoveNorth();
			if (t == T) {
				break;
			}
			MoveWest();
		}
		for (int i = 0; i < 3; i++) {
			if (f == S) {
				break;
			}
			right();
		}
		return E;
	}

}


Measured memory_bytes: 25960
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int q = sc.nextInt();
        Queue<Process> queue = new ArrayDeque<Process>();
        for(int i=0; i<n; i++) {
            Process p = new Process(sc.next(),sc.nextInt());
            queue.add(p);
        }
        int pTime = 0;
        int b = 0;
        String[] result = new String[n];
        while(queue.size()>0) {
            Process pro = queue.poll();
            if(pro.time>q) {
                pro.time -= q;
                queue.add(pro);
                pTime += q;
            } else {
                pTime += pro.time;
                result[b] = pro.name+" "+Integer.toString(pTime);
                b++;
            }
        }
        for(String s:result) {
            System.out.println(s);
        }
    }
}
class Process{
    String name;
    int time;
    Process(String name, int time) {
        this.name=name;
        this.time=time;
    }
}



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

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

    sort(l.begin(), l.end());
    long long ans = 0;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            auto itr = lower_bound(l.begin(), l.end(), l[i] + l[j]);
            ans += (n - j - 1) - (l.end() - itr);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main ()
{
        char ch[5];
        scanf("%s",ch);
        for(int i=0;i<3;i++)
        {
                if(ch[i] == '9')
                        cout<<1;
                else
                        cout<<9;
        }
        cout<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}


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

  //まずは結果を考える。
  //abab, aba
  string str;

  cin >> str;
  string ans;
  if(str.size()%2 == 1 ){
    if(str[0] == str[str.size()-1])ans = "Second"; //aba
    else ans = "First";                            //abc
  }
  else{
    if(str[0] == str[str.size()-1]) ans = "First" ;//abca
    else ans = "Second";                           //abab
  }

  cout << ans << endl;
  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 512
import java.io.*;
import java.util.*;

class Main {

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        
        int a = sc.nextInt();
        int b = sc.nextInt();

        int ans=0;
        
        for(ans=1; ans<=20000; ans++){
            if(b <= (a-1)*(ans-1) + a){
                break;
            }
        }

        if(b==1){
            ans = 0;
        }

        System.out.println(ans);

    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;
    
        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }
    
        int nextInt() {
            return Integer.parseInt(next());
        }
    
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }
 
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
 
inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}
 
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n; cin>>n;
  vector<string> s(n);
  vi t(n);
  rep(i,n) cin>>s[i]>>t[i];
  string x; cin>>x;
  
  int tmp=0;
  rep(i,n){
    tmp+=t[i];
    if(x==s[i]) break;
  } 
  int ans=0;
  rep(i,n){
    ans+=t[i];
  }
  cout<<ans-tmp<<endl;
}

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

int main() {
    int N, mi = 1 << 30;
    string S;
    cin >> N >> S;
    int W_sum[N] = {0}, E_sum[N] = {0};
    // W_sumは左，E_sumは右から累積和を取る
    for (int i = 0; i < N; i++) {
        if (S[i] == 'W') {
            if (i == 0) W_sum[i] = 1;
            else W_sum[i] = W_sum[i - 1] + 1;
        } else {
            if (i == 0) W_sum[i] = 0;
            else W_sum[i] = W_sum[i - 1];
        }
    }
    for (int i = 0; i < N; i++) {
        if (S[N - i - 1] == 'E') {
            if (i == 0) E_sum[N - 1] = 1;
            else E_sum[N - i - 1] = E_sum[N - i] + 1;
        } else {
            if (i == 0) E_sum[N - 1] = 0;
            else E_sum[N - i - 1] = E_sum[N - i];
        }
    }

    for (int i = 0; i < N; i++) {
        if (i == 0) {
            mi = min(mi, E_sum[1]);
        } else if (i == N - 1) {
            mi = min(mi, W_sum[N - 2]);
        } else {
            mi = min(mi, W_sum[i - 1] + E_sum[i + 1]);
        }
    }

    // cout << "---" << endl;
    // for (int i = 0; i < N; i++) cout << W_sum[i] << ' ';
    // cout << endl;
    // for (int i = 0; i < N; i++) cout << E_sum[i] << ' ';
    // cout << endl;
    // cout << "---" << endl;
    cout << mi << endl;
}

Measured memory_bytes: 3076
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] inputs;
		inputs = br.readLine().split(" ");
		int n = Integer.parseInt(inputs[0]), m = Integer.parseInt(inputs[1]);

		N[] nodes = new N[n];
		for ( int i = 0; i < n; i++ ) {
			nodes[i] = new N();
		}

		for ( int i = 0; i < m; i++ ) {
			inputs = br.readLine().split(" ");
			int x = Integer.parseInt(inputs[0]) - 1, y = Integer.parseInt(inputs[1]) - 1;
			nodes[x].chldList.add(nodes[y]);
			nodes[y].prntCnt++;
		}

		ArrayDeque<N> toCheck = new ArrayDeque<>();
		for ( N node : nodes ) {
			if ( node.prntCnt == 0 ) toCheck.add(node);
		}

		int lenMax = 0;
		while ( toCheck.size() > 0 ) {
			N node = toCheck.pollFirst();
			for ( N chld : node.chldList ) {
				chld.prntCnt--;
				chld.len = Math.max(node.len + 1, chld.len);
				lenMax = Math.max(lenMax, chld.len);
				if(chld.prntCnt == 0) {
					toCheck.add(chld);
				}
			}			
		}
		System.out.println(lenMax);
	}
}

class N implements Comparable<N> {

	int				len			= 0;
	int				prntCnt		= 0;
	ArrayList<N>	chldList	= new ArrayList<>();

	@Override
	public int compareTo(N o) {
		return this.prntCnt - o.prntCnt;
	}
}

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

int main(){
  long long n;
  cin >> n;
  long long ret=1;
  function<long long(long long,long long)> gcd =
  [&](long long x,long long y){
    return y ? gcd(y,x%y):x;
  };
  function<long long(long long,long long)> lcm =
  [&](long long x,long long y){
    return x/gcd(x,y)*y;
  };
  for(int i=0;i<n;i++){
    long long x;
    cin >> x;
    ret=lcm(ret,x);
  }
  cout << ret << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N; cin >> N;
	ll Min = INF;
	ll ans = 0;
	for (int i = 0; i < N;i++) {
		ll A, B; cin >> A >> B;
		if (B < Min) {
			Min = B;
			ans = A + B;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
#include <cstdio>
#include<set>
using namespace std;
int main()
{
    // �����̓���
    string S;
    
    cin >> S;
    for (int i = 0; i < S.length(); ++i) { 
        if ((i % 2 == 0 && (S[i] == 'R' || S[i] == 'U' || S[i] == 'D')) ||
        (i % 2 == 1 && (S[i] == 'L' || S[i] == 'U' || S[i] == 'D'))){
                ;
        } else {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3,inline,unroll-loops")
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#define N 2000020
#define MOD 1000000007
using namespace std;

namespace Comb
{
    int f[N], g[N];

    int Power(int x, int y)
    {
        int o;

        for(o = 1; y; y >>= 1)
        {
            if(y & 1)
                o = (long long)o * x % MOD;
            x = (long long)x * x % MOD;
        }

        return o;
    }

    void InitComb(void)
    {
        int i;

        for(i = f[0] = 1; i < N; i ++)
            f[i] = (long long)f[i - 1] * i % MOD;
        g[N - 1] = Power(f[N - 1], MOD - 2);
        for(i = N - 2; i > -1; i --)
            g[i] = (long long)g[i + 1] * (i + 1) % MOD;

        return;
    }

    int C(int n, int m)
    {
        return m > n ? 0 : (long long)f[n] * g[m] % MOD * g[n - m] % MOD;
    }
}

char a[N];

int main(void)
{
    int n, m;
    int i, o;

    scanf("%d %s", &n, a);
    m = (int)strlen(a);
    n += m;

    Comb::InitComb();
    for(i = m, o = 0; i <= n; i ++)
        o = (o + (long long)Comb::Power(26, n - i) * Comb::Power(25, i - m) % MOD * Comb::C(i - 1, m - 1) % MOD) % MOD;
    printf("%d\n", o);

    return 0;
}


Measured memory_bytes: 20384
n = int(input())
h = list(map(int,input().split()))
c = 0

for i in range(n-1):
    if h[i] <= h[i+1]-1:
        h[i+1] = h[i+1]-1
    elif h[i] == h[i+1]:
        continue
    else:
        c = 1
if c == 1:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int q;
    scanf("%d",&q);
    while (q--){
        int a,b,c,d;
        scanf("%d%d%d%d",&a,&b,&c,&d);
        int k = (max(a,b)-1)/(min(a,b)+1)+1;
        //printf("k is %d\n",k);
        int lo = 0, hi = a+b;
        while (lo < hi){
            int m = (lo+hi+1)/2;
            int b1 = m/(k+1);
            int a1 = m-b1;
            int b2 = b-b1;
            int a2 = a-a1;
            if ((ll)b2 < (ll)(a2+1)*k){
                ///first part
                lo = m;
            }
            else{
                hi = m-1;
            }
        }
        for (int i = c; i <= d; i++){
            if (i <= lo){
                printf("%c",i%(k+1)==0?'B':'A');
            }
            else{
                printf("%c",(a+b-i+1)%(k+1)==0?'A':'B');
            }
        }
        printf("\n");
    }
}


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

using ll =long long;

//最大公約数
ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
//文字列→数列
//string S;int A=atoi(S.c_str());
//数列→文字列
//int A;string S=to_string(A);
//
//
//
int main(){
//cout<<fixed<<setprecision(10);
double T,X;cin>>T>>X;
  cout<<T/X<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// 標準入力からデータを読み込む準備
try (Scanner sc = new Scanner(System.in)) {
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// aとbを使ってvaluesを操作しよう
int tmp = values[a];
values[a] = values[b];
values[b] = tmp; 
}
// valuesを出力しよう
for (int i = 0; i < values.length; i++){
    System.out.println(values[i]);
}
}
}
}


Measured memory_bytes: 26428
N = int(input())
A = [int(i) for i in input().split()]
A.sort(reverse=True)

ans = 0

if N%2 == 0:
    ans = 2*sum(A[:N//2]) - A[0]
else:
    ans = 2*sum(A[:(N//2+1)]) - A[0] - A[N//2]
print(ans)

Measured memory_bytes: 31752
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;
int n;
struct edge
{
	int e, nxt;
};
edge a[200200]; int m;
int sp[100100];
int minv[100100], maxv[100100];
int dep[100100], par[100100];
const int inf = 1000000000;
int q[100100], hd, tl;
int val[100100];
int main()
{
	int i;
	scanf("%d", &n);
	for (int i = 1; i < n; i++)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		a[++m].e = v; a[m].nxt = sp[u]; sp[u] = m;
		a[++m].e = u; a[m].nxt = sp[v]; sp[v] = m;
	}
	for (int i = 1; i <= n; i++) {
		minv[i] = -inf; maxv[i] = inf;
	}
	par[1] = -1; dep[1] = 0;
	hd = 1; tl = 2;
	q[1] = 1;
	while (hd < tl)
	{
		int cur = q[hd++];
		for (int j = sp[cur]; j; j = a[j].nxt)
		{
			if (par[a[j].e]) continue;
			par[a[j].e] = cur;
			dep[a[j].e] = dep[cur] + 1;
			q[tl++] = a[j].e;
		}
	}
	scanf("%d", &m);
	bool parity_flags[2][2] = { {false, false}, {false, false} };
	for (int i = 1; i <= m; i++)
	{
		int v, p;
		scanf("%d%d", &v, &p);
		minv[v] = maxv[v] = p;
		parity_flags[dep[v] & 1][p & 1] = true;
	}
	// nodes at same depth must have same parity
	// nodes with different depth parity must have different value parity
	if ((parity_flags[0][0] && parity_flags[0][1])
		|| (parity_flags[1][0] && parity_flags[1][1])
		|| (parity_flags[0][0] && parity_flags[1][0])
		|| (parity_flags[0][1] && parity_flags[1][1]))
	{
		printf("No\n");
		return 0;
	}
	for (int i = n; i > 1; i--) // bottom up
	{
		int cur = q[i];
		if (minv[cur] > maxv[cur]) // unsatisfiable
		{
			printf("No\n");
			return 0;
		}
		if (minv[cur] != -inf)
			minv[par[cur]] = max(minv[par[cur]], minv[cur] - 1);
		if (maxv[cur] != inf)
			maxv[par[cur]] = min(maxv[par[cur]], maxv[cur] + 1);
	}
	for (int i = 1; i <= n; i++)
	{
		int cur = q[i];
		if (minv[cur] > maxv[cur]) // unsatisfiable
		{
			printf("No\n");
			return 0;
		}
		val[cur] = minv[cur]; // parity is guaranteed to be ok
		for (int j = sp[cur]; j; j = a[j].nxt)
		{
			if (a[j].e == par[cur]) continue;
			minv[a[j].e] = max(minv[a[j].e], val[cur] - 1);
			maxv[a[j].e] = min(maxv[a[j].e], val[cur] + 1);
		}
	}
	printf("Yes\n");
	for (int i = 1; i <= n; i++) printf("%d\n", val[i]);
	return 0;
}


Measured memory_bytes: 5248
#include<stdio.h>
int main()
{
	int tc;
	scanf("%d",&tc);
	int temp;
	int flag = 0;
	while(tc != 0)
	{
		temp = tc%10;
		tc /= 10;
		if(temp == 7){
			flag = 1;
			break;
		}
	}
	if(flag == 0) printf("No\n");
	else{
		printf("Yes\n");	
	}
}

Measured memory_bytes: 2048
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/compress.hpp"
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
#ifndef COMPRO_COMPRESS
#define COMPRO_COMPRESS

template <class T> class Compress {
public:
  explicit Compress(const std::vector<T> &argv) {
    isBuilt = false;
    add(argv);
  }

  Compress() { isBuilt = false; }

  void add(const std::vector<T> &argv) {
    for (const auto &x : argv) {
      add(x);
    }
  }
  void add(const T x) {
    assert(!isBuilt);
    v.emplace_back(x);
  }

  void build() {
    isBuilt = true;
    std::sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
  }

  int get(const T x) const {
    assert(isBuilt);
    return lower_bound(v.begin(), v.end(), x) - v.begin();
  }

  const T &operator[](const int k) const { return v[k]; }

  int size() const { return v.size(); }

private:
  std::vector<T> v;
  bool isBuilt;
};
#endif
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << endl; }

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

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


#line 3 "abc165_f.cpp"

void dfs(int cur, int par, vector<int> &lis, vector<int> &a, vector<int> &ans, vector<vector<int>> &g) {
  auto itr = lower_bound(ALL(lis), a[cur]);
  ans[cur] = itr - lis.begin() + 1;
  int prev = *itr;
  *itr = a[cur];
  if (par != -1)
    chmax(ans[cur], ans[par]);
  for (const auto e : g[cur]) {
    if (e == par)
      continue;
    dfs(e, cur, lis, a, ans, g);
  }
  *itr = prev;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vi a(n);
  REP(i, n) { cin >> a[i]; }
  Compress<int> ca;
  ca.add(a);
  ca.build();

  REP(i, n) { a[i] = ca.get(a[i]); }

  vector<vector<int>> g(n);
  REP(i, n - 1) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }

  vector<int> lis(n, 1e6), ans(n, 0);
  dfs(0, -1, lis, a, ans, g);
  REP(i, n) { cout << ans[i] << endl; }
}


Measured memory_bytes: 34424
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;

const int MAX = 1000;

int main(){
    int A,B;

    cin >> A >> B;
    cout << max(0,A - B * 2) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
 
int main() {
  int m,d;
  cin >> m >> d;
  
  int count=0;
  
  for(int i=1;i<=m;i++){
    for(int j=1;j<=d;j++){
      int d1,d10;
      d1=j%10;
      d10=j/10;
      if(d1<2||d10<2)continue;
  	  if(d1*d10==i)count+=1;
      }
  }
  cout << count << endl;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 1000000000000000000
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}

// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

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

#define S second
#define F first
#define int long long  

//////////

signed main()
{
    fastio;
    int n,m;
    cin>>n>>m;
    int f[m+1]={};
    for(int i=0;i<n;++i)
    {
        int d;
        cin>>d;
        while(d)
        {
            --d;
            int x;
            cin>>x;
            f[x]++;
        }
    }
    int ans=0;
    for(int i=0;i<=m;++i)
    {
        if(f[i]==n)
            ++ans;
    }
    cout<<ans;
}

Measured memory_bytes: 256
n, m = list(map(int, input().split()))
e = [[] for _ in range(n+1)]
for i in range(m):
  a, b = list(map(int, input().split()))
  e[a].append(b)
  e[b].append(a)
for i in range(1, n+1):
  print(len(e[i]))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
    freopen("a.in","r",stdin);
    #endif
    char c;
    cin>>c;
    char b=c+1;
    cout<<b;




}

Measured memory_bytes: 256
n = int(input())
t = [[0,0,0]] + [list(map(int,input().split())) for _ in range(n)]

for i in range(1,len(t)):
    dt = abs(t[i][0]-t[i-1][0])
    dx = abs(t[i][1]-t[i-1][1])
    dy = abs(t[i][2]-t[i-1][2])
    if not dx+dy<=dt or not (dx+dy)%2==dt%2:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 28068