akhauriyash/Code-Regression huggingface dataset:
from collections import defaultdict

# nCkを高速に求める
# https://drken1215.hatenablog.com/entry/2018/06/08/210000


class COM:
    def __init__(self, n, MOD):
        self.n = n
        self.MOD = MOD
        self.fac = [0] * (n+1)
        self.finv = [0] * (n+1)
        self.inv = [0] * (n+1)
        self.fac[0] = self.fac[1] = 1
        self.finv[0] = self.finv[1] = 1
        self.inv[1] = 1
        for i in range(2, n+1):
            self.fac[i] = self.fac[i-1] * i % MOD
            self.inv[i] = MOD - self.inv[MOD % i] * (MOD // i) % MOD
            self.finv[i] = self.finv[i-1] * self.inv[i] % MOD

    
    def calc(self, k):
        if k < 0:
            return 0
        return self.fac[self.n] * (self.finv[k] * self.finv[self.n-k] % self.MOD) % self.MOD


def main():
    MOD = 10**9+7
    X, Y = map(int,input().split())
    if (X+Y) % 3 == 0:
        z = (X+Y) // 3
        a_x = X-z
        a_y = Y-z
        if a_x >= 0 and a_y >= 0:
            com = COM(a_x+a_y, MOD)
            print(com.calc(a_x))
        else:
            print(0)
    else:
        print(0)

if __name__ == "__main__":
    main()





Measured memory_bytes: 82848
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
    private List<List<Integer>> g;
    private int[] a;
    private int[] ans;
    private boolean[] vis;

    private int bs(List<Integer> list, int t) {
        int left = 0, right = list.size() - 1;
        while (left <= right) {
            int mid = (left + right) / 2;
            if (list.get(mid) >= t) {
                right = mid - 1;
            } else {
                left = mid + 1;
            }
        }
        return right;
    }

    private void dfs2(int u, List<Integer> buf) {
        for (int v : g.get(u)) {
            if (!vis[v]) {
                dfs(v, buf);
            }
        }
    }

    private void dfs(int u, List<Integer> buf) {
        vis[u] = true;
        int t = bs(buf, a[u]);
        if (t == buf.size() - 1) {
            buf.add(a[u]);
            ans[u] = buf.size();
            dfs2(u, buf);
            buf.remove(buf.size() - 1);
        } else {
            int tmp = buf.get(t + 1);
            if (a[u] < tmp) {
                buf.set(t + 1, a[u]);
                ans[u] = buf.size();
                dfs2(u, buf);
                buf.set(t + 1, tmp);
            } else {
                ans[u] = buf.size();
                dfs2(u, buf);
            }
        }
    }

    private void solve() {
        int n = sc.nextInt();
        a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        g = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            g.add(new ArrayList<>());
        }

        for (int i = 1; i < n; i++) {
            int u = sc.nextInt() - 1;
            int v = sc.nextInt() - 1;
            g.get(u).add(v);
            g.get(v).add(u);
        }

        vis = new boolean[n];
        ans = new int[n];
        dfs(0, new ArrayList<>());

        Arrays.stream(ans).forEach(out::println);
    }

    private static PrintWriter out;
    private static MyScanner sc;

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        private MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    public static void main(String[] args) {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        sc = new MyScanner();
        new Main().solve();
        out.close();
    }
}


Measured memory_bytes: 156892
#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)

using namespace std;

int main() {
  long long int n, a, min, max, sum;
  min = 1000001;
  max = -1000001;
  sum = 0;
  cin >> n;
  REP(i, n) {
    cin >> a;
    if (a < min) min = a;
    if (a > max) max = a;
    sum += a;
  }
  cout << min << " " << max << " " << sum << endl;
  return 0;
}

Measured memory_bytes: 3104
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define trav(x,a) for (const auto& x: a)
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), x.end()
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int _i = 0; _i < (n); _i++) ni(a[_i])
#define nal(a, n) for (int _i = 0; _i < (n); _i++) nl(a[_i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define st first
#define nd second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
const int N = 705;
const double eps = 1e-9;
vi adj[N];
int deg[N], col[N];
bitset<N> dp;

void debug(vi& ind) {
  trav(x, ind) cerr << x << " ";
}

bool check(vi& ind) {
  if (!sz(ind)) return 1;
  int sm = 0, nod = 0;
  trav(x, ind) {
    nod++;
    trav(y, adj[x])
      sm += col[y] == col[x];
  }
  return sm == nod * (nod - 1);
}

void solve(vi& ind, int lo) {
  if (!sz(ind)) return;
  // debug(ind); cerr << lo << endl;
  int c = -1, d = inf;
  trav(x, ind)
    if (deg[x] < d)
      d = deg[x], c = x;
  if (d == sz(ind)-1) {
    for (int i = 1; i <= sz(ind); i++)
      dp[i] = 1;
    return;
  }
  col[c] = lo;
  vi lhs, rhs;
  lhs.pb(c);
  while (1) {
    bool ok = 1;
    trav(x, ind) if (!col[x]) {
      int l = 0, r = 0;
      trav(y, adj[x]) {
        l += col[y] == lo;
        r += col[y] == lo+1;
      }
      // debug(lhs);cerr << endl;
      // debug(rhs);cerr << endl;
      // cerr << l << " " << r << " " << x << endl;
      if (l != sz(lhs) && r != sz(rhs)) {
        printf("-1\n");
        exit(0);
      }
      if (l != sz(lhs)) {
        rhs.pb(x);
        col[x] = lo+1;
        ok = 0;
      } else if (r != sz(rhs)) {
        lhs.pb(x);
        col[x] = lo;
        ok = 0;
      }
    }
    if (ok) break;
  }
  if (!check(lhs) || !check(rhs)) {
    printf("-1\n");
    exit(0);
  }
  vi nx;
  trav(x, ind) if (!col[x])
    nx.pb(x);
  solve(nx, lo+2);
  dp = (dp << sz(lhs)) | (dp << sz(rhs));
}

int main() {
  int n, m; scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v; scanf("%d %d", &u, &v);
    adj[u].pb(v);
    adj[v].pb(u);
    deg[u]++, deg[v]++;
  }
  vi ind(n);
  iota(all(ind), 1);
  dp = 1;
  solve(ind, 1);
  int ans = inf;
  for (int i = 0; i <= n; i++) if (dp[i])
    ans = min(ans, i * (i-1) + (n-i) * (n-i-1));
  ans /= 2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}

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

   vector<tuple<int,int,int>> a;
   rep(i,n){
      int t,x,y;
      cin>>t>>x>>y;
      a.emplace_back(t,x,y);
   }
   sort(a.begin(),a.end());
   int xb=0;
   int yb=0;
   int tb=0;
   bool f=true;
   rep(i,n){
      int ta=get<0>(a[i]);
      int xa=get<1>(a[i]);
      int ya=get<2>(a[i]);

      if(abs(xa-xb)+abs(ya-yb)>(ta-tb)){
         f=false;
         break;
      }
      else{
         if(((abs(xa-xb)+abs(ya-yb))%2)!=abs((ta-tb)%2)){
            f=false;
            break;
         }
      }
      tb=ta;
      xb=xa;
      yb=ya;
   }

   f? cout<<"Yes":cout<<"No";

   return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w; cin>>h>>w;
    vector<string> s(h);
    rep(i,h) cin>>s[i];
    rep(i,h)rep(j,w){
        if (s[i][j]=='#') continue;
        int cnt=0;
        FOR(k,i-1,i+1)FOR(l,j-1,j+1){
            if (!(0<=k&&k<h&&0<=l&&l<w)) continue;
            if (s[k][l]=='#') cnt++;
        }
        s[i][j] = char(cnt+'0');
    }
    rep(i,h) cout<<s[i]<<"\n";
    return 0;
}


Measured memory_bytes: 256
from sys import stdin
input = stdin.readline

from itertools import accumulate
from bisect import bisect_left

N, K = map(int, input().split())

memo = [0] * 100010
for _ in range(N):
    a, b = map(int, input().split())
    memo[a] += b

print(bisect_left(list(accumulate(memo)), K))

Measured memory_bytes: 10636
#pragma GCC optimize(3)
#include <queue>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define ll long long
using namespace std;

template <typename T>
void read(T &x) {
    x = 0; bool f = 0;
    char c = getchar();
    for (;!isdigit(c);c=getchar()) if (c=='-') f=1;
    for (;isdigit(c);c=getchar()) x=x*10+(c^48);
    if (f) x=-x;
}

template <typename T>
void write(T x) {
    if (x < 0) putchar('-'), x = -x;
    if (x >= 10) write(x / 10);
    putchar('0' + x % 10);
}

const int N = 100500;
ll a[N], n;

int prime[N], e[N], tot;
void prework(void) {
	const int Maxn = 100050;
	for (int i = 2;i <= Maxn; i++) {
		if (!e[i]) e[i] = prime[++tot] = i;
		for (int j = 1;j <= tot && prime[j] * i <= Maxn; j++) {
			e[prime[j] * i] = prime[j];
			if (prime[j] >= e[i]) continue;
		}
	}
}

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

ll b[N];
bool check(int P) {
	if (a[0] % P) return false;
	for (register int i = 0;i <= n; i++) b[i] = a[i];
	for (register int i = n;i >= P - 1; i--) 
		(b[i-P+1] += b[i]) %= P, b[i] = 0;
	for (register int i = 0;i <= n; i++) 
		if (b[i] % P) return false;
	return true;
}

vector<int> res;

int main() {
	prework(); read(n); ll ans = 0;
	for (int i = n;i >= 0; i--) {
		read(a[i]); ans = gcd(a[i] > 0 ? a[i] : -a[i], ans);
	}
	
	for (int i = 2;i * i <= ans; i++) 
		while (ans % i == 0) ans /= i, res.push_back(i);
	if (ans != 1) res.push_back(ans); 
	
	for (int i = 1;i <= tot; i++) {
		if (prime[i] > n) break;
		if (check(prime[i])) res.push_back(prime[i]);
	}
	sort(res.begin(), res.end());
	res.erase(unique(res.begin(), res.end()), res.end());
	for (int i = 0;i < res.size(); i++) printf ("%d\n", res[i]);
	return 0;
}

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

int main() {
  int n,k; cin>>n>>k;
  int res=0;
  while (n>0) {
    res++;
    n/=k;
  }
  cout<<res<<endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;

public class Main {


    public static void main(String[] args) {
        try (CustomReader in = new CustomReader()) {
            new Main().execute(in);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    public void execute(CustomReader in) throws IOException {
        final String[] theNumbers = {"3", "5", "7"};
        final int N = in.readLineAsInt();

        int keta = 0;
        int n = N;
        while (n > 0) {
            keta++;
            n /= 10;
        }

        ArrayList<String> numbers = new ArrayList<>();
        ArrayList<String> prev = new ArrayList<>();
        prev.add("");

        for (int i = 0; i < keta; i++) {
            ArrayList<String> tmpNumbers = new ArrayList<>();
            for (String p : prev) {
                for (String num : theNumbers) {
                    tmpNumbers.add(num + p);
                }
            }
            numbers.addAll(tmpNumbers);
            prev = tmpNumbers;
        }

        int count = 0;
        for (String num : numbers) {
            if (Integer.parseInt(num) <= N && num.contains("3") && num.contains("5") && num.contains("7")) {
                count++;
            }
        }
        System.out.println(count);
    }


    static class CustomReader extends BufferedReader {
        public CustomReader() throws IOException {
            super(new InputStreamReader(System.in));
        }

        public int readLineAsInt() throws IOException {
            return Integer.parseInt(readLine());
        }

        public int[] readLineAsIntArray() throws IOException {
            String[] strArray = this.readLine().split(" ");
            int[] intArray = new int[strArray.length];
            for (int i = 0, n = strArray.length; i < n; i++) {
                intArray[i] = Integer.parseInt(strArray[i]);
            }
            return intArray;
        }

        public int[][] readAsIntMatrix(int rows, int columns) throws IOException {
            int[][] matrix = new int[rows][columns];
            for (int i = 0; i < rows; i++) {
                String[] r = this.readLine().split(" ");
                for (int j = 0; j < columns; j++) {
                    matrix[i][j] = Integer.parseInt(r[j]);
                }
            }
            return matrix;
        }

        public char[][] readAsCharMatrix(int rows) throws IOException {
            char[][] matrix = new char[rows][];
            for (int i = 0; i < rows; i++) {
                matrix[i] = this.readLine().toCharArray();
            }
            return matrix;
        }

    }

}

Measured memory_bytes: 26324
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void debug() { std::cerr << '\n'; }
template <class H, class... T> void debug(H &&head, T &&... args) {
    std::cerr << head;
    sizeof...(args) == 0 ? std::cerr << "" : std::cerr << ' ';
    debug(std::forward<T>(args)...);
}
template <class T> void debug(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cerr << v[i];
        i == v.size() - 1 ? std::cerr << '\n' : std::cerr << ' ';
    }
}
template <class T> void debug(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cerr << v[i][j];
            j == v[i].size() - 1 ? std::cerr << '\n' : std::cerr << ' ';
        }
    }
}

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

    string s;
    cin >> s;
    ll ans   = 0;
    int N    = s.size();
    auto dfs = [&](auto f, int now, ll sum, ll nxt) -> void {
        if (N <= now) {
            ans += sum + nxt;
            return;
        }
        int a = s[now] - '0';
        f(f, now + 1, sum, 10 * nxt + a);
        f(f, now + 1, sum + nxt, 0);
        return;
    };
    dfs(dfs, 0, 0, 0);
    print(ans);

    return 0;
}

Measured memory_bytes: 256
def gcd(a, b)
  gcd(b, a) if b > a
  return b if (r = a % b).zero?
  gcd(b, r)
end

N = STDIN.gets.strip.to_i
nums = STDIN.gets.strip.split(' ').map(&:to_i)
heads = Array.new(nums.length)
tails = Array.new(nums.length)

N.times do |idx|
  if idx == 0
    # head
    heads[idx] = 0
    # tail
    tails[N-1] = 0
  elsif idx == 1
    # head
    heads[idx] = nums[idx-1]
    # tail
    tails[N-2] = nums[N-1]
  elsif idx == 2
    # head
    heads[idx] = gcd(nums[idx-2], nums[idx-1])
    # tail
    tails[N-3] = gcd(nums[N-1], nums[N-2])
  else
    # head
    heads[idx] = gcd(heads[idx-1], nums[idx-1])
    # tail
    tails[N-idx-1] = gcd(tails[N-idx], nums[N-idx])
  end
end

max = 0
N.times do |idx|
  candidate = 0
  if idx == 0
    candidate = tails[idx]
  elsif idx == N-1
    candidate = heads[idx]
  else
    candidate = gcd(heads[idx], tails[idx])
  end

  max = candidate if candidate > max
end

puts max


Measured memory_bytes: 11516
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;


int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};



int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m, x;

	cin >> n >> m >> x;
	vector<int> data(m);
	vector<int> road(n + 1);
	rep(i, 0, m) {
		int a;
		cin >> a;
		road[a] = 1;
	}

	int leftans = 0;
	int rightans = 0;

	rep(i, x, n + 1) {
		rightans += road[i];
	}
	rep(i, 0, x+1) {
		leftans += road[i];
	}

	int ans = min(leftans, rightans);

	cout << ans << endl;

}
	

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <limits>

using namespace std;

int N;
vector<long long> v;
vector<vector<long long>> dp; 
long long LIM = std::numeric_limits<long long>::min();

long long deque(long long i, long long j)
{
  long long c = (N - (j-i)) % 2 == 0 ? 1 : -1; 

  if (i+1 == j) return v[i] * c;
  if (dp[i+1][j] == LIM) dp[i+1][j] = deque(i+1, j); 
  if (dp[i][j-1] == LIM) dp[i][j-1] = deque(i, j-1);

  long long a = v[i]*c + dp[i+1][j];
  long long b = v[j-1]*c + dp[i][j-1];

  return c < 0 ? min(a, b) : max(a, b); 
}

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

  std::cin >> N;
  v.resize(N);
  dp = vector<vector<long long>>(N+1, vector<long long>(N+1, LIM));

  for (int i = 0; i < N; ++i)
  {
    long long val;
    cin >> val;
    v[i] = val;
  }

  std::cout << deque(0, N); 

  return 0;
}

Measured memory_bytes: 70912
#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define y1 shinkle
#define fi first
#define se second
#define bg begin
cs int RLEN=1<<20|1;
inline char gc(){
    static char ibuf[RLEN],*ib,*ob;
    (ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
    return (ib==ob)?EOF:*ib++;
}
inline int read(){
    char ch=gc();
    int res=0;bool f=1;
    while(!isdigit(ch))f^=ch=='-',ch=gc();
    while(isdigit(ch))res=(res*10)+(ch^48),ch=gc();
    return f?res:-res;
}
inline ll readll(){
    char ch=gc();
    ll res=0;bool f=1;
    while(!isdigit(ch))f^=ch=='-',ch=gc();
    while(isdigit(ch))res=(res*10)+(ch^48),ch=gc();
    return f?res:-res;
}
inline char readchar(){
	char ch=gc();
	while(isspace(ch))ch=gc();
	return ch;
}
inline int readstring(char *s){
	int top=0;char ch=gc();
	while(isspace(ch))ch=gc();
	while(!isspace(ch)&&ch!=EOF)s[++top]=ch,ch=gc();
	s[top+1]='\0';return top;
}
template<typename tp>inline void chemx(tp &a,tp b){a=max(a,b);}
template<typename tp>inline void chemn(tp &a,tp b){a=min(a,b);}
typedef double db;
cs int N=350,M=(1<<7)|1;
db f[N][M];
int n,c,lim,l[10],tot;
int main(){
	#ifdef Stargazer
	freopen("lx.in","r",stdin);
	#endif
	n=read(),c=read(),lim=1<<(n-1),tot=n*c;
	for(int i=0;i<n;i++)l[i]=read();
	sort(l,l+n);db res=0;int cnt=0;
	do{
		memset(f,0,sizeof(f));
		f[n*l[n-1]][0]=1;
		for(int i=0;i<=tot;i++)if(i%n){
			int k=i%n-1;
			for(int j=i;j<=tot;j++)
			for(int s=0;s<lim;s++)if(!(s&(1<<k)))
			f[min(tot,max(j,i+l[k]*n))][s|(1<<k)]+=f[j][s];
		}
		res+=f[tot][lim-1],cnt++;
	}while(next_permutation(l,l+n-1));
	for(int i=1;i<=n-1;i++)res/=c;
	printf("%.15lf\n",res/cnt);return 0;
}

Measured memory_bytes: 768
using System;
using System.Collections.Generic;
using System.Linq;

namespace _20200802ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string input = Console.ReadLine();
            char[] stones = input.ToCharArray();

            int cnt = 0;

            int rcnt = 0;
            foreach(char c in stones)
            {
                if( c == 'R')
                {
                    rcnt++;
                }
            }
            for (var i = 0; i < rcnt; i++)
            {
                if (stones[i] == 'W')
                {
                    cnt++;
                }
            }
            /*
            for(var i = 0;i< rcnt; i++)
            {
                if(stones[i] == 'R')
                {
                    continue;
                }
                else
                {
                    char[] reverse = stones;
                    reverse.Reverse();
                    stones[i] = 'R';
                    for(var j = 0; j<wcnt; j++)
                    {
                        if(reverse[j] == 'R')
                        {
                            reverse[j] = 'W';
                            break;
                        }
                    }
                    cnt++;
                }
            }
            */
            Console.WriteLine(cnt); 
        }
    }
}


Measured memory_bytes: 28484
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int a,b,c;
  /*cin>>a>>b>>c;
  if(a>b) cout<<"NO"<<'\n';
  else if(a+b>=c) cout<<"YES"<<'\n';
  else cout<<"NO"<<'\n';*/
  string s,na="YAKI";
  cin>>s;
  if(s.size()<4) cout<<"No"<<'\n';
  else{
    for(int i=0;i<4;i++){
      if(s[i]!=na[i]){
	cout<<"No"<<'\n';
	return 0;
      }
    }
    cout<<"Yes"<<'\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>    
#include <cmath>
#include <map>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <set>
#include <functional>
#define int long long
#define mod(int)(1000000007)
using namespace std;
const int INF = 1000000000000;
int cnt[345678]; bool visit[345678];
vector<vector<int> > G(213456);
void dfs(int x) {
	visit[x] = true;
	for (int h = 0; h < G[x].size(); h++) {
		if (!visit[G[x][h]]) {
			cnt[G[x][h]] += cnt[x]; dfs(G[x][h]);
		}
	}
}
signed main() {
	int n, m, a, b, c, d, ans = 0; cin >> n >> m;
	for (int h = 1; h < n; h++) {
		cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	for (int h = 0; h < m; h++) {
		cin >> c >> d; cnt[c] += d;
	}
	dfs(1);
	for (int h = 1; h <= n; h++) {
		if (h == 1)cout << cnt[h];
		else cout << ' ' << cnt[h];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 21632
#include <bits/stdc++.h>
    using namespace std;
    
    int main() {

        long long N,A,B;
        long long kai,amari;

        long long kaitou=0;

        cin >> N >> A >> B;

        if (A !=0 ){
     
        kai = N/(A+B);

        amari = N%(A+B);

        if(amari< A){
            kaitou = kai*A+amari ;
        }else{
          kaitou = kai*A+A; 
        }
        

        }
            cout << kaitou << endl; 

        return 0;

    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	// your code goes here
	long long h, w;
	cin >> h >> w;
	if(h == 1 || w == 1){
		cout << 1 << endl;
		return 0;
	}
	long long ans = 0;
	ans = h / 2 * w;
	if(h%2 != 0){
		ans += (w+1)/2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;
  vector<int> d(n);
  re(i, n) cin >> d[i];

  sort(d.begin(), d.end());
  d.erase(unique(d.begin(), d.end()), d.end());
  
  cout << d.size() << endl;

  return 0;
}


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

int main() {
  ll n,ans=0,a[3005];
  cin>>n;
  for(int i=0; i<n; i++) {
    cin>>a[i];
    ans += a[i] - 1;
  }
  cout<<ans;
}

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

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

int main() {
    int n;
    cin >> n;
    int a[n], b[n], c[n];

    rep(i,n){
        cin >> a[i];
        cin >> b[i];
        cin >> c[i];
    }
    
    ll cost_a[n], cost_b[n], cost_c[n];
    cost_a[0]=a[0];
    cost_b[0]=b[0];
    cost_c[0]=c[0];
    
    rep1(i,n){
        cost_a[i]=max(cost_b[i-1],cost_c[i-1])+a[i];
        cost_b[i]=max(cost_a[i-1],cost_c[i-1])+b[i];
        cost_c[i]=max(cost_a[i-1],cost_b[i-1])+c[i];
    }

    cout << max(cost_a[n-1],max(cost_b[n-1],cost_c[n-1])) << endl;

}

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

using namespace std;

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

	int kuji[n];
	for (int i = 1; i <= w; i++) kuji[i] = i;

	for (int i = 0; i < n; ++i) {
		int a, b;
		scanf("%d, %d", &a, &b);
		int tmp = kuji[a];
		kuji[a] = kuji[b];
		kuji[b] = tmp;
	}

	for (int i = 1; i <= w; ++i) {
		cout << kuji[i] << endl;
	}
}

Measured memory_bytes: 1240
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  int N;
  cin >> N;
  vll A(N);
  rep(i, N) {
    cin >> A[i];
  }
  
  sort(all(A));
  
  vll acc(N + 1);
  rep(i, N) {
    acc[i+1] = acc[i] + A[i];
  }
  
  ll ct = 1;
  vi live(N);
  live[N - 1] = 1;
  
  for(int i=N-2; i>=0; i--) {
    if(live[i + 1]) {
      if(acc[i+1] * 2 >= A[i+1]) {
        ct++;
        live[i] = 1;
      }
    }
  }
  
  fin(ct);
}

Measured memory_bytes: 2176
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<cmath>

using namespace std;

int A[100009];

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

	A[0] = A[N + 1] = 0;
	for (int i = 1; i <= N; i++)
	{
		cin >> A[i];
	}

	long long total = abs(A[1]);
	for (int i = 2; i <= N; i++)
	{
		long long t = abs(A[i - 1] - A[i]);
		total += t;
	}
	total += abs(A[N]);

	for (int i = 1; i <= N; i++)
	{
		long long ans = total - abs(A[i] - A[i - 1]) - abs(A[i] - A[i + 1]) + abs(A[i - 1] - A[i + 1]);
		cout << ans << "\n";
	}

	return 0;
}

Measured memory_bytes: 1664
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>

auto& in = std::cin;
auto& out = std::cout;

int32_t N;
int32_t a[100000];
int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	in >> N;
	for (int32_t i = 0; i < N; ++i)
	{
		in >> a[i];
	}
	std::sort(a, a + N);

	if (a[0] + 1 < a[N - 1]) {
		std::cout << "No" << endl; return 0;
	}
	if (a[N-2] != a[N - 1]) {
		std::cout << "No" << endl; return 0;
	}
	if (a[0] == N - 1) {
		std::cout << "Yes" << endl; return 0;
	}

	auto iter = std::lower_bound(a, a + N, a[N - 1]);
	auto small_num = iter - a;
	auto big_num = (a + N) - iter;
	//if (a[0] <= (small_num - 1) + big_num / 2) {
	if (a[N-1] <= small_num + big_num / 2 && small_num+1 <= a[N - 1]) {
		std::cout << "Yes" << endl; return 0;
	}
	else{
		std::cout << "No" << endl; return 0;
	}
}
#endif


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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define fr(i,k) for(i=0;i<k;i++)
#define deb(x) cerr<<#x<<"  = "<<x<<endl;
#define deb2(x,y) cerr<<#x<<" ="<<x<<endl<<#y<<" ="<<y<<endl;
#define SZ(x) (x).size();
#define ll long long
#define mod 1000000007
#define ff first
#define ss second
#define pb push_back
#define em emplace_back
#define ulli unsigned long long int
#define inf 1e18
#define endl "\n"
typedef vector<vector<ll>> vvll;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
void solve();

int main() {
	fastio;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ll t;
	t = 1;

	//cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}

ll n;

vvll multiply(vvll a, vvll b)
{
	vvll c(n, vll(n, 0));
	ll i, j, k;

	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			for (k = 0; k < n; k++)
			{
				c[i][j] = ( c[i][j] + (a[i][k] % mod * b[k][j] % mod) % mod) % mod;
			}
		}
	}

	return c;
}

vvll pow(vvll v, ll k)
{
	vvll ans(n, vll(n, 0));

	for (ll i = 0; i < n; i++)
	{
		ans[i][i] = 1;
	}

	while (k)
	{
		if (k % 2 == 1)
		{
			ans = multiply(ans, v);
			k--;
		}
		else
		{
			v = multiply(v, v);
			k = k / 2;
		}
	}

	return ans;
}

inline void solve()
{
	ll k, i, j, ans = 0;
	cin >> n >> k;

	vvll v(n, vll(n));

	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
			cin >> v[i][j];
	}

	vvll m = pow(v, k);

	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			ans = (ans + m[i][j]) % mod;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 3764
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;

int main()
{
	int n, x;
	scanf("%d %d", &n, &x);
	if(x==1 || x==2*n-1){
		printf("%s\n", "No");
	}else if(n!=2){
		printf("%s\n", "Yes");
		if(x<=2*n-3){
		queue<int> que;
		for(int i=1; i<=2*n-1; i++){
			if(i!=x && i!=x-1 && i!=x+1 && i!=x+2) que.push(i);
		}
		for(int i=1; i<=2*n-1; i++){
			if(i!=n && i!=n-1 && i!=n+1 && i!=n-2){
				printf("%d\n", que.front());
				que.pop();
			}else if(i==n-2){
				printf("%d\n", x+1);
			}else if(i==n-1){
				printf("%d\n", x-1);
			}else if(i==n){
				printf("%d\n", x);
			}else if(i==n+1){
				printf("%d\n", x+2);
			}
		}
		}else{
			queue<int> que;
		for(int i=1; i<=2*n-1; i++){
			if(i!=x && i!=x-1 && i!=x+1 && i!=x-2) que.push(i);
		}
		for(int i=1; i<=2*n-1; i++){
			if(i!=n && i!=n-1 && i!=n+1 && i!=n-2){
				printf("%d\n", que.front());
				que.pop();
			}else if(i==n-2){
				printf("%d\n", x-1);
			}else if(i==n-1){
				printf("%d\n", x+1);
			}else if(i==n){
				printf("%d\n", x);
			}else if(i==n+1){
				printf("%d\n", x-2);
			}
		}
		}
	}else{
		printf("%s\n", "Yes");
		for(int i=1; i<=3; i++){
			printf("%d\n", i);
		}
	}
	return 0;
}

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


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

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

constexpr int64_t MOD = 1000000007ull;

int64_t inv_mod(int64_t a, int64_t iter = MOD - 2)
{
    if (iter == 1)
    {
        return a;
    }
    else if (iter == 0)
    {
        return 1;
    }
    else if (iter % 2 == 0)
    {
        auto sub = inv_mod(a, iter / 2);
        return (sub * sub) % MOD;
    }
    else
    {
        auto sub = inv_mod(a, iter - 1);
        return (sub * a) % MOD;
    }
}

int main()
{
    int64_t n, k;
    cin >> n >> k;

    vector<int64_t> as(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> as[i];
    }

    sort(as.begin() + 1, as.end());

    // i C k-1
    std::vector<int64_t> comb(n + 1, 0);
    comb[k - 1] = 1;

    for (int64_t i = k; i <= n; i++)
    {
        comb[i] = (comb[i - 1] * i) % MOD;
        comb[i] = (comb[i] * inv_mod(i - k + 1)) % MOD;
    }

    int64_t ans = 0;
    // 最大の数
    for (int i = k; i <= n; i++)
    {
        ans += as[i] * comb[i - 1];
        ans %= MOD;
    }

    // 最小の数
    for (int i = 1; i <= n - k + 1; i++)
    {
        ans += MOD - (as[i] * comb[n - i]) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}

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

int find_sum_of_digits(int n)
{
  int sum = 0;
  while(n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main()
{
  int N;
  cin >> N;
  int min = 100000010;
  for (int a = 1; a < N; a++){
    int b = N - a;
    int sum = find_sum_of_digits(a) + find_sum_of_digits(b);
    if (sum < min){
      min = sum;
    }
  }
  
  cout << min;
}

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

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

    vector<int> l(n);
    for (auto i = 0; i < n; i++) cin >> l[i];
    sort(l.begin(), l.end(), greater<>());

    int sum = 0;
    for (auto i = 0; i < k; i++) {
        sum += l[i];
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef pair <int,int> pr;
#define fr(i, n) for(int i = 0; i < n; i++)
#define sz(a) int((a).size())
#define pb push_back
#define all(c)(c).begin(), (c).end()
#define tr(c, i) for (typeof ((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c, x)((c).find(x) != (c).end())
#define cpresent(c, x)(find(all(c), x) != (c).end())
// for mod power a^b%m use power<lli> (a,b,m)
template < class mytype >
mytype power(mytype a, mytype b, mytype m){if (b == 1) return a % m;if (b == 0) return 1;
mytype root = power < lli > (a, b / 2, m);mytype ans = (root * root) % m;if (b % 2) ans = (ans * a) % m;
return ans;
}
// for gcd use gcd<int> (a,b)
template < class type >type gcd(type a, type b){if (a == 0) return b;else return gcd(b % a, a);}
template < class type >type mod_inv(type a, type p) {return power(a, p - 2, p);}
const lli MOD = 1e9 + 7;

int main()
{
   int n;
   cin >> n;
   bool a[n][n];
   for(int i = 0 ; i < n ; i++){
    for(int j = 0 ; j < n ; j++) cin >> a[i][j];
   }
   vector<lli> memo(1<<n, 0);memo[0] = 1;
   for(int i = 0 ; i < (1<<n) ; i++){
    int cnt = __builtin_popcount(i);
    for(int j = 0 ; j < n ; j++){
        if(a[cnt][j] && ((i&(1<<j)) == 0)) memo[i | (1<<j)]  = (memo[i | (1<<j)]+ memo[i])%MOD;
    }
   }
   cout << memo[(1<<n )- 1];
    return 0;
}











Measured memory_bytes: 16640
n,m=map(int,input().split())
l=[[0] for _ in range(n+1)]
for _ in range(m):
  j,k=map(int,input().split())
  l[j].append(k)
for i in l[1][1:]:
  if n in l[i]:break
  if i==l[1][-1]:print('IM',end='')
print('POSSIBLE')

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

int main()
{
    string s;
    cin>>s;
    int a,i,j,k,l,n=s.size();
    a=k=0;
    for(i=0;i<n;i++)
    {
        if(s[i]=='S') a++;
        else
        {
            if(a>0) k+=2,a--;
        }
    }

    cout<<n-k;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;

const int maxx = 100000 + 10;
struct task {
	// ??????????????????????´??????¶??´
	char name[100];
	int t;
};
queue<task> Queue;

int main() {
	int n, q;
	scanf("%d %d", &n, &q);
	for (int i = 0; i < n; i++) {
		task t;
		scanf("%s %d", t.name, &t.t);
		Queue.push(t);
	}
	// ????????¶??´
	int nowtime = 0;
	while (!Queue.empty()) {
		// ???????????´
		task u = Queue.front();
		Queue.pop();
		// ??§?????¶??´??? p ??? ???????????¶??´u.t
		int c = min(q, u.t);
		// ????????§?????? c ms
		u.t -= c;
		// ????????¶??´??????c ms
		nowtime += c;
		// ??????????????????????????\??°????°?
		if (u.t > 0) {
			Queue.push(u);
		}
		else { // ??????????????????????????°?????????
			printf("%s %d\n", u.name, nowtime);
		}

	}
	return 0;
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

struct query
{
  string name;
  int rest;
};

int n,t;
queue<query> q;

int main(){
	cin>>n>>t;
  rep(i,n){
    string a;
    int b;
    cin>>a>>b;
    q.push((query){a,b});
  }
  int nt=0;
  while(q.size()){
    query nq=q.front(); q.pop();
    if(nq.rest<=t){
      nt+=nq.rest;
      cout<<nq.name<<" "<<nt<<endl;
    }else{
      nq.rest-=t;
      nt+=t;
      q.push(nq);
    }
  }

	return 0;
}

Measured memory_bytes: 6212
#include <bits/stdc++.h>
#include <iostream>
#include <functional>
#include <vector>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define rep1(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define per1(i,a,n) for (int i=a;i>n;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define pi 3.14159265358979323846264338327950288419716939937510
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res, t;res=1;t=a%c;while(b){if(b & 1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
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;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
// head
const int maxn=2e5+5;
ll t,n,a[maxn];
signed main()
{
    //IOS;
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    cin>>n;
    if(n==1)
        cout<<0<<endl;
    else
        cout<<1<<endl;
    return 0;
}
/*

*/


Measured memory_bytes: 3596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atc_0035
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();

            var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            int result = 0;

            for (int i = 0; i < a.Length - 1; i++)
            {
                for (int j = i + 1; j < a.Length; j++)
                {
                    var t = Math.Abs(a[j] - a[i]);

                    if (result <= t)
                    {
                        result = t;
                    }
                }
            }

            Console.WriteLine(result);
        }
    }
}


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

int main() {
  int H, W;
  cin >> H >> W;

  char a[H][W];

  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      cin >> a[i][j];
    }
  }
  for(int i = 0; i < W + 2; i++) {cout << "#"; }
  cout << endl;
  for(int i = 0; i < H; i++) {
    cout << "#";
    for(int j = 0; j < W; j++) {
      cout << a[i][j];
    }
    cout << "#" << endl;
  }

  for(int i = 0; i < W + 2; i++) { cout << "#"; }
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  int a[100001];
  for (int i = 1; i <= N; i++) cin >> a[i];

  int j = 1, ans = 0, b[100001] = {};
  for (int i = 1; i <= N; i++) {
    ans++;
    b[j]++;
    j = a[j];
    if (j == 2) break;
  }

  for (int i = 1; i <= N; i++) if (b[i] >= 2) ans = -1;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<fstream>
using namespace std;
int main()
{
	char c;
	cin>>c;
	if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
	{
		cout<<"vowel"<<endl;
	}
	else
	{
		cout<<"consonant"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce
from operator import mul
import pprint



sys.setrecursionlimit(2147483647)
INF = 100
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


x, y = LI()
for i in range(x + 1):
    if (x - i) * 2 + i * 4 == y:
        print("Yes")
        break
else:
    print("No")
    
    

Measured memory_bytes: 76748
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney,chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun


#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")

int ctoi(char c) {
	switch (c)
	{
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default:
		cout << "ERR_ctoi" << endl;
		return -1;
	}
}
int main() {
	int a, p;
	cin >> a >> p;
	PRI((3 * a + p) / 2);
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main()
{
    int a,n1,n2,n3,x,j;
    cin>>a;
    n1=a%10;
    x=a/10;
    n2=x%10;
    n3=x/10;
    j=n1+n2+n3;
    cout<<j;







}



Measured memory_bytes: 256
str = gets.chomp
array = [0] * str.length
i = 0
while index = str.index(/L(R|$)/, i)
  sindex = str.index('RL', i)
  r = sindex - i + 1
  l = index - sindex
  array[sindex] = r / 2 + l / 2
  array[sindex] += 1 if r.odd?
  array[sindex + 1] = r / 2 + l / 2
  array[sindex + 1] += 1 if l.odd?
  i = index + 1
end

puts array.join(' ')

Measured memory_bytes: 3196