akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

map<int,int>mm;

signed main()
{

ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    int n;
    cin>>n;
    int a[n+1];
    vector<int>s;
    int mx=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        mm[a[i]]++;
        if(mm[a[i]]==2)
        {
            s.push_back(a[i]);
        }
        if(mm[a[i]]>=4)
        {
            mx=max(mx,a[i]*a[i]);
        }
    }
    sort(s.begin(),s.end());
    if(s.size()>1)
    {
        int sz=s.size();
        mx=max(mx,s[sz-1]*s[sz-2]);
    }
    cout<<mx;

} 


Measured memory_bytes: 7296
arr = Array.new
until (line = gets) == "0 0\n"
  arr << line 
end
arr.each do |i|
  count = 0
  a = i.split(" ")
  n = a[0].to_i
  s = a[1].to_i
  (0..9).to_a.combination(n) do |a| 
    if s == a.inject{|result, item| result + item} 
      count += 1
    end
  end
  puts count
end

Measured memory_bytes: 6096
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappush, heappop


#read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())
a = N - M
if N - M > 0:
    ans = 'No'
else:
    ans = 'Yes'

print(ans)


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

int main(){
    int A,B,C;
    cin >> A >> B >> C;
    
    if ((A == B || A==C || B==C) && !(A==B && B==C))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvld;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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


//G:DAG
vi topological_sort(vvi& G)
{
    //各頂点の入次数を計算
    vi degin(G.size());

    rep(i, G.size())
    {
        for (auto v : G[i]) degin[v]++;
    }

    //トポロジカルソートを記録する配列
    vi sorted_vertices;

    //入次数が0の頂点が始点
    queue<int> q;
    rep(i, G.size()) if (degin[i] == 0) q.push(i);

    while (!q.empty())
    {
        int v = q.front(); q.pop();

        //その頂点と隣接している頂点の入次数を減らし、0になればキューに追加
        rep(i, G[v].size())
        {
            int u = G[v][i];
            degin[u] -= 1;
            if (degin[u] == 0) q.push(u);
        }

        //頂点vを配列の末尾に追加する 
        sorted_vertices.push_back(v);
    }

    return sorted_vertices;
}

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

    int N, M;
    cin >> N >> M;

    vvi G(N);
    rep(i, M)
    {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        G[x].push_back(y);
    }

    auto V = topological_sort(G);
    reverse(all(V));

    vll dp(N);

    for (auto v : V)
    {
        for (auto u : G[v])
        {
            chmax(dp[v], dp[u] + 1);
        }
    }

    ll ans = 0;

    rep(i, N)
    {
        chmax(ans, dp[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 7024
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7

import copy
B = copy.copy(A)
C = sum(B)
ans = 0

for i in range(N-1):
    C = (C - B[i]) % MOD
    ans += A[i] * C % MOD
    ans = ans % MOD
print(ans)

Measured memory_bytes: 31588
#include <iostream>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

struct UnionFind {
    vector<int> p;
    UnionFind(int n){
        p.resize(n, -1);
    }


    int find(int x) { //再起関数で親の添え字を返す
        if(p[x] < 0) return x;
        else return p[x] = find(p[x]);
    }

    void unite(int x, int y) { //くっつける
        x = find(x);
        y = find(y); //それぞれの親の添え字を召喚
        if(-p[x] >= -p[y]) { //サイズが大きいほうにくっつける
            p[x] += p[y];
            p[y] = x;
        } else {
            p[y] += p[x];
            p[x] = y;
        }
    }
    int size(int x) {
        return -p[find(x)];
    }
};

int main() {
    int n, m, k, a, b;
    cin >> n >> m >> k;
    UnionFind uf(n);
    vector<int> fri(n, 0);
    rep(i, m) {
        cin >> a >> b;
        fri[a-1]++; fri[b-1]++;
        if(uf.find(a-1) != uf.find(b-1)) uf.unite(a-1, b-1);
    }
    rep(i, k) {
        cin >> a >> b;
        if(uf.find(a-1) == uf.find(b-1)) {
            fri[a-1]++; fri[b-1]++;
        }
    }
    rep(i, n) {//親のサイズ-友達-ブロック-自分
        int x = uf.size(i);
        if(i != 0) cout << " ";
        cout << x - fri[i] -1;
    }
}

Measured memory_bytes: 1664
#include <cstdio>
#include <algorithm>
using namespace std;

const int Maxn = 5000;

int N, K;
char s[Maxn * 2 + 5], ans[Maxn * 2 + 5];
char mn, mx;

void check(char *str, int k) {
	char t[Maxn * 2 + 5];
	int now = N, len = 0;
	while(now >= 1 && str[now] == mn)
		now--, len++;
	while(k != 0 && len < N)
		len *= 2, k--;
	if(len >= N) {
		for(int i = 1; i <= N; i++)
			ans[i] = mn;
		puts(ans + 1);
		exit(0);
	}
	for(int i = 1; i <= len; i++)
		t[i] = mn;
	for(int i = len + 1; i <= N; i++)
		t[i] = str[now--];
	for(int i = 1; i <= N; i++)
		if(t[i] < ans[i]) {
			for(int j = 1; j <= N; j++)
				ans[j] = t[j];
			return;
		} else if(t[i] > ans[i]) return;
}

int main() {
#ifdef LOACL
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	scanf("%d %d %s", &N, &K, s + 1);
	mn = 'z', mx = 'a';
	for(int i = 1; i <= N; i++) {
		mn = min(mn, s[i]);
		mx = max(mx, s[i]);
		s[2 * N - i + 1] = s[i];
		ans[i] = 'z';
	}
	if(mn == mx) {
		puts(s + 1);
		return 0;
	}
	if(s[N] == mn)
		check(s, K);
	for(int i = N; i <= 2 * N; i++)
		if(s[i] == mn) check(s + i - N, K - 1);
	puts(ans + 1);
	return 0;
}

Measured memory_bytes: 128
program colon

 implicit none
 real::a,b,h,m
 real(8),parameter::pi=3.1415926535897932384626433D0
 real(8)::rad_h1,rad_h2,rad_m,cos_h,cos_m,sita1,sita2,sita,x
 read*,a,b,h,m

 rad_h1=30.0D0*pi/180.0D0
 rad_h2=0.50D0*pi/180.0D0
 rad_m=6.0D0*pi/180.0D0

 cos_h=rad_h1*h+rad_h2*m
 cos_m=rad_m*m

 sita1=abs(cos_h-cos_m)
 sita2=abs(360.0D0-abs(cos_h-cos_m))
 sita=min(sita1,sita2)
 
 x=sqrt(a**2+b**2-2*a*b*cos(sita))
 print*,x

end program colon
 


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

class Main{
    public static void main(String[] args){
	BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));
	try {
	    while(true){
		int n = Integer.valueOf(sc.readLine());
		if(n==0)
		    break;
		TreeMap<Integer,Integer> used = new TreeMap<Integer,Integer>();
		for(int i=0; i<n; i++){
		    String[] sp = sc.readLine().split(" ");
		    int m = Integer.valueOf(sp[0]);
		    int a = Integer.valueOf(sp[1]);
		    int b = Integer.valueOf(sp[2]);
		    if(used.containsKey(a)){
			int t = used.get(a);
			used.remove(a);
			used.put(a,t+m);
		    }else
			used.put(a,m);
		    if(used.containsKey(b)){
			int t = used.get(b);
			used.remove(b);
			used.put(b,t-m);
		    }else
			used.put(b,0-m);
		}
		int sum = 0;
		String out = "OK";
		for(int i:used.keySet()){
		    sum+=used.get(i);
		    if(sum>150){
			out = "NG";
			break;
		    }
		}
		System.out.println(out);
	    }
	}catch(Exception e){
	    System.out.println("Error");
	}
    }
}

Measured memory_bytes: 39944
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

//
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 main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin >> n;

  vector<lint> a(n + 2), b(n + 1);
  rep(i, n + 1) cin >> a[i];
  rep(i, n) cin >> b[i];

  lint ans = 0;
  rep(i, n) {
    if (a[i] <= b[i]) {
      ans += a[i];
      b[i] -= a[i];
      a[i] = 0;
    } else {
      ans += b[i];
      a[i] -= b[i];
      b[i] = 0;
    }

    if (0 < b[i]) {
      if (a[i + 1] <= b[i]) {
        ans += a[i + 1];
        b[i] -= a[i + 1];
        a[i + 1] = 0;
      } else {
        ans += b[i];
        a[i + 1] -= b[i];
        b[i] = 0;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int n,i,j,ans,now,a[200001];
map<int,int>g;
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",&a[i]),g[a[i]]++;
	sort(a+1,a+n+1);
	for(i=n;i;i--)if(g[a[i]]){
		for(j=31;j>=0;j--){
			//printf("%d %d\n",i,j);
			now=1<<j;
			if(now<a[i])continue;
			now-=a[i];
			if(now!=a[i]&&g[now]||now==a[i]&&g[a[i]]>1){
				g[a[i]]--;g[now]--;ans++;break;
			}
		}
	}
	printf("%d",ans);
}

Measured memory_bytes: 29824
#include <bits/stdc++.h>
using namespace std;
int N;
map<int,int>mp;
vector<int>v;
int main(){
  cin>>N;
  while(N--){
    int x;
    cin>>x;
    mp[x]++;
    if(mp[x]==2)v.push_back(x);
    if(mp[x]==4)v.push_back(x);
  }
  sort(v.begin(),v.end(),greater<>());
  if(v.size()<2)cout<<0;
  else cout<<1LL*v[0]*v[1];
}


Measured memory_bytes: 4992
#include <cstdio>
using namespace std;

int N, M;
int rel[410][410];

int main() {
    scanf("%d%d", &N, &M);
    for(int i=0; i<M; i++) {
        int x, y; scanf("%d%d", &x, &y);
        x--; y--;

        for(int z=0; z<N; z++) {
            if(rel[x][z]) rel[y][z] = true;
            if(rel[y][z]) rel[x][z] = true;
            if(rel[z][x]) rel[z][y] = true;
            if(rel[z][y]) rel[z][x] = true;
        }
        if(rel[y][y]) rel[x][x] = true;
        if(rel[x][x]) rel[y][y] = true;
        rel[x][y] = rel[y][x] = true;
    }

    int ans = 0;
    for(int i=0; i<N; i++) {
        for(int j=i+1; j<N; j++) {
            if(rel[i][i] || rel[j][j]) continue;
            if(!rel[i][j] && !rel[j][i]) {
                ans++;
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 768
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;

char s[50][50];
int n;
int cnt[50][50];
int h[50];
int main()
{
	scanf("%d",&n);
	for(int i = 1; i <= n;i++){
		scanf("%s", &s[i]);
	    int len = strlen(s[i]);
	    for(int j = 0; j < len; j++){
	 	   cnt[s[i][j] - 96][i]++;
	 	   if(i == 1)
	 	   h[s[i][j] - 96]++;
		}
		for(int k = 1; k <= 26; k++){
		   h[k] = min(h[k], cnt[k][i]);
	    }
	}
	int ok = 0;
	 for(int i = 1 ; i <= 26; i++){
	 	 if(h[i] != 0){
	 	 	 for(int j = 1; j <= h[i]; j++){
	 	 	 	 printf("%c",i + 96);
			 }
		 }
		 else ok++;
		 if(ok == 26)
		 	 printf("                                                                                                         ");
	 }
	 printf("\n");
	 return 0;
	}






Measured memory_bytes: 128
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
## libs ##
from itertools import accumulate as acc, combinations as combi, product, combinations_with_replacement as combi_dup
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left
#======================================================#

def main():
    n = II()
    aa = MII()
    l = set()
    cnt = 0
    for i, a in enumerate(aa):
        if (i+1,a) in l:
            cnt += 1
        else:
            l.add((i+1,a))
            l.add((a,i+1))
    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 37336
N = [int(_) for _ in input().split()]

def solve(a, b, c):
    
    # if c < a or c < b:
    #     return "No"

    # if a + 2*sqrt(a*b) + b - c < 0.0:
    #     return "Yes"
    # else:
    #     return "No"
    
    d = c-a-b
    if  0 < d and 4*a*b < d * d:
        return "Yes"
    else:
        return "No"

print(solve(N[0], N[1], N[2]))

Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<ll>
#define vvint vector<vint>
#define P pair<ll,ll>
#define INT_MAX 2147483647
#define MOD 998244353
#define PI 3.14159265358979323846
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;

#define MAX 1000000000000


int main(void) {
	ll n, m, k; cin >> n >> m >> k;
	vint a(n+m+3);
	for (int i = 1; i <= n + m;i++) {
		cin >> a[i];
		if (i == n) {
			reverse(a.begin() + 1, a.begin() + n+1);
		}
	}
	int l = 0, r = 0, ans = 0;
	ll sum = 0;
	while (l<=n) {

		if (r+1!=n+m+1&&sum + a[r+1] <= k) {
			r++;
			sum += a[r];
		}
		else {
			l++;
			sum -= a[l];
		}

		if (l == r) {
			l++; r++;
		}
		if (l <= n&& n <= r) {
			ans = max(r - l, ans);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6428
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>

using namespace std;

#define INF 10000000
#define _for(j,N) for(int i = (j); i < (N);++i)

struct Edge{
    int w;
    int to;
    Edge(int wi,int toi):w(wi),to(toi){;}
};

struct Compare{
    inline bool operator()(const Edge& e1,const Edge& e2){
        return e1.w < e2.w;
    }
};

int n;

typedef vector<int> Vec;
typedef pair<int,int> Pii;
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

Vec pre;
Graph G;

Vec dijkstra(int v){

    Vec ret_val(n,INF);
    ret_val[v] = 0;
    priority_queue<Edge,Edges,Compare> pq;
    pq.push(Edge(0,v));

    while(!pq.empty()){
        Edge e = pq.top();
        pq.pop();
        int to = e.to;
        int w = e.w;

        if(ret_val[to] < w) continue;

        for(auto a = G[to].begin();a != G[to].end();++a){
            if(w + a->w < ret_val[a->to]){
                ret_val[a->to] = w + a->w;
                pq.push(Edge(w + a->w,a->to));
            }
        }
    }

    return ret_val;
}

int find_father(int v){
    Vec di = dijkstra(v);
    int mv = 0;
    int weight = 0;
    _for(0,n){
        if(weight < di[i]){
            weight = di[i];
            mv = i;
        }
    }
    return mv;
}



int main()
{
    int s,t,w;
    scanf("%d",&n);
    G.resize(n);
    pre.resize(n);

    _for(0,n-1){
        scanf("%d %d %d",&s,&t,&w);
        G[s].push_back(Edge(w,t));
        G[t].push_back(Edge(w,s));
    }

    int v1 = find_father(0);
    int v2 = find_father(v1);

    Vec di1 = dijkstra(v1);
    Vec di2 = dijkstra(v2);

    _for(0,n){
        printf("%d\n",max(di1[i],di2[i]));
    }

    return 0;
}


Measured memory_bytes: 3868
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
ll dp[101][100001];
int main(){
	int N,W;
	cin>>N>>W;
	ll inf = 1e18;
	int V = 100000;
	rep(i,N+1) rep(j,V+1) dp[i][j] = inf;
	dp[0][0] = 0;

	rep(i,N){
		int w,v;
		cin>>w>>v;
		rep(j,V+1) if(dp[i][j] != inf){
			chmin(dp[i+1][j],dp[i][j]);
			chmin(dp[i+1][j+v],dp[i][j]+w);
		}
	}
	int ans = 0;
	rep(j,V+1) if(dp[N][j]<=W) chmax(ans,j);
	cout<<ans<<endl;
}

Measured memory_bytes: 79104
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main(){
	FIO
	
	char c;
	cin >> c;
	if(c == 'a' || c == 'e' || c == 'i'|| c == 'o' || c == 'u')puts("vowel");
	else puts("consonant");
	return 0;
}


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

using namespace std;

#define N_CONTEST   (26)
#define N_DAY       (365)

static void get_input (int &D, vector<int> &c, vector<vector<int>> &s) {
    cin >> D;
    assert(D == N_DAY);
    for ( int i = 0; i < N_CONTEST; i++ ) {
        cin >> c.at(i);
    }
    for ( int i = 0; i < N_DAY; i++ ) {
        for ( int j = 0; j < N_CONTEST; j++ ) {
            cin >> s.at(i).at(j);
        }
    }
}

int main (void) {
    int D;
    vector<int> c(N_CONTEST);
    vector<vector<int>> s(N_DAY, vector<int>(N_CONTEST));

    get_input(D, c, s);

    for ( int i = 0; i < N_DAY; i++ ) {
        cout << i % 26 + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 3680
#include<cstdio>

int main() {
  //入力
  int a,b;
  std::scanf("%d%d",&a,&b);
  
  if(a < b) {
    std::printf("a < b");
  }
  else if(a > b) {
    std::printf("a > b");
  }
  else {
    std::printf("a == b");
  }
  std::printf("\n");
  
  return 0;
}


Measured memory_bytes: 2740
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;

using namespace std;

vector<int> fac, finv, inv;

void comb_init(int n) {
  fac  = vector<int>(n);
  finv = vector<int>(n);
  inv  = vector<int>(n);
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < n; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
 
int comb(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main() {
  comb_init(1e5+10);

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

  vector<int> A(N);
  REP(i, N) cin >> A[i];
  sort(ALL(A));

  int ans = 0;
  REP(i, N){
    ans -= A[i]*comb(N-i-1, K-1);
    ans += A[i]*comb(i, K-1);
    ans %= MOD;
  }
  ans = (ans%MOD+MOD)%MOD;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];

int main(){
  cin >> n;
  vi vec;
  map<ll,ll> test;
  rep(i,0,n)cin >> d[i];
  rep(i,0,n){
    test[d[i]]++;
    test[d[n-1-i]]--;
    if(test[d[i]] == 0)test.erase(d[i]);
    //cout << "i:" << test.size() << endl;
    if(test[d[n-1-i]] == 0)test.erase(d[n-1-i]);
    //cout << "j:" << test.size() << endl << endl;
    if(test.empty())vec.pb(i);
  }
  sort(all(vec));
  rep(i,0,vec.sz){
    cout << vec[i] + 1;
    if(i == vec.sz-1)break;
    cout <<" ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 5216
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);

int main() {
  int cnt = 0;
rep(i,4){
  char x;
  cin >> x;
  if(x=='2')cnt++;
}
cout << cnt << endl;
}


Measured memory_bytes: 3576
local n = io.read("*n")
local a = {}
for i = 1, n do
  local tmp = {i, io.read("*n")}
  a[i] = tmp
end
table.sort(a, function(x, y) return x[2] < y[2] end)
local cnt = 0
for i = 1, n do
  if (i + a[i][1]) % 2 == 1 then
    cnt = cnt + 1
  end
end
print(cnt / 2)


Measured memory_bytes: 7552
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

def main():
	n=II()
	A=[0]+LI()
	B=[0]*(n+1)

	for i in range(n,0,-1):
		a=A[i]
		if n//i>=2:
			for j in range(2,n//i+1):
				#print(i,j)
				a^=B[i*j]
		B[i]=a

	ans=[]
	for i,v in enumerate(B):
		if v:
			ans.append(i)

	print(len(ans))
	print(*ans)













if __name__ == "__main__":
	main()


Measured memory_bytes: 17796
#include <stdio.h>
int main() {
  int N, i, ans;
  scanf("%d", &N);
  ans = N;
  char S[N];
  scanf("%s", S);
  for(i = 0; i < N - 1; ++i){
    if(S[i] == S[i+1]) {
      --ans;
    }
  }
  printf("%d\n", ans);
  return 0;
}

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

using std::cin;
using std::cout;
using std::endl;

int main(void) {
	int N;
	int M;
	int px_R,py_R;
	int all_gem;
	int ope;
	std::string move;

	cin >> N;
	
	while (N != 0) {
		all_gem = 1;
		px_R = 10;
		py_R = 10;
		int *gem_x = new int[ N ];
		int *gem_y = new int[ N ];
		int *gem = new int[ N ];

		int px_G,py_G;
		for (int i = 0; i < N; i++) {
			cin >> gem_x[i];
			cin >> gem_y[i];
			gem[i] = 1;
		}

		cin >> M;
		for (int i = 0; i < M; i++) {
			cin >> move;
			cin >> ope;

			if (move == "N") {
				for (int j = 0; j < N; j++) {
					if (gem[j]) {
						if (gem_x[j] == px_R) {
							if (gem_y[j] >= py_R && gem_y[j] <= (py_R+ope)) {
								gem[j] = 0;
							}
						}
					}
				}
				py_R += ope;
			}
			if (move == "S") {
				for (int j = 0; j < N; j++) {
					if (gem[j]) {
						if (gem_x[j] == px_R) {
							if (gem_y[j] <= py_R && gem_y[j] >= (py_R-ope)) {
								gem[j] = 0;
							}
						}
					}
				}
				py_R -= ope;
			}
			if (move == "E") {
				for (int j = 0; j < N; j++) {
					if (gem[j]) {
						if (gem_y[j] == py_R) {
							if (gem_x[j] >= px_R && gem_x[j] <= (px_R+ope)) {
								gem[j] = 0;
							}
						}
					}
				}
				px_R += ope;
			}
			if (move == "W") {
				for (int j = 0; j < N; j++) {
					if (gem[j]) {
						if (gem_y[j] == py_R) {
							if (gem_x[j] <= px_R && gem_x[j] >= (px_R-ope)) {
								gem[j] = 0;
							}
						}
					}
				}
				px_R -= ope;
			}
		}
		for (int i = 0; i < N; i++) {
			if (gem[i] == 1){
				all_gem = 0;
				break;
			}
		}
		if (all_gem) {
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
		
		cin >> N;
		delete[] gem_x;
		delete[] gem_y;
		delete[] gem;
	}
	return 0;
}

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

vector<int>E[200000];
int par[200000],d[200000],sub[200000];
int chain[200000];

void dfs(int v,int p,int dep){
	par[v]=p;d[v]=dep;
	sub[v]=1;
	for(int u:E[v]){
		if(u==p)continue;
		dfs(u,v,dep+1);
		sub[v]+=sub[u];
	}
}
void hld(int v,int k){
	chain[v]=k;
	if(E[v].empty())return;
	int Max=0,id=-1;
	for(int u:E[v]){
		if(Max<sub[u]){
			Max=sub[u];
			id=u;
		}
	}
	for(int u:E[v]){
		if(u==id)hld(u,chain[v]);
		else hld(u,u);
	}
}
int lca(int u,int v){
	while(chain[u]!=chain[v]){
		if(d[chain[u]]>d[chain[v]])swap(u,v);
		v=par[chain[v]];
	}
	return d[u]<d[v]?u:v;
}

int main(){
	int n;scanf("%d",&n);
	rep(i,n){
		int k;scanf("%d",&k);
		rep(j,k){
			int c;scanf("%d",&c);
			E[i].push_back(c);
		}
	}
	dfs(0,-1,0);
	hld(0,0);
	int q;scanf("%d",&q);
	rep(i,q){
		int u,v;scanf("%d%d",&u,&v);
		printf("%d\n",lca(u,v));
	}
}


Measured memory_bytes: 20432
#pragma GCC optimize("O3")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

#define DEBUG
#ifdef DEBUG
    #define IFD(...) __VA_ARGS__
    #define IFN(...)
    #define L cout<<__LINE__<<"\n";
    #define PRINT(...) __VA_ARGS__ cout<<__LINE__<" : "<<#__VA_ARGS__<<"\n"
    #define PRT(x) cout<<__LINE__<<" : "<<#x<<" = "<<x<<"\n"
#else // DEBUG
    #define IFD(...)
    #define IFN(...) __VA_ARGS__
    #define L
    #define PRINT(...) __VA_ARGS__
    #define PRT(x)
#endif // DEBUG

#define it iterator
#define rit reverse_iterator
#define mp make_pair
#define mems(a,b) memset(a,b,sizeof(a))
#define mem0(a) mems(a,0)
#define mem1(a) mems(a,1)
#define mem255(a) mems(a,255)
#define halt exit(0)
#define all(c) (c).begin() , (c).end()
#define sz(c) ((long long)((c).size()))
#define phb push_back
#define ppb pop_back
#define phf push_front
#define ppf pop_front
#define fort0(i,a,b) for(ll i=a,i##_TO=b;i<i##_TO;i++)
#define for0(i,n) fort0(i,0,n)
#define fort1(i,a,b) for(ll i=a,i##_TO=b;i<=i##_TO;i++)
#define for1(i,n) fort1(i,1,n)
#define ford(i,a,b) for(ll i=a,i##_TO=b;i>=i##_TO;i--)

using namespace __gnu_pbds;
using namespace std;

#define int ll

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

template
<
    class key,
    class val=null_type,
    class comp=less<key>
>
using ord_set=tree
<
    key,
    val,
    comp,
    rb_tree_tag,
    tree_order_statistics_node_update
>;

const int N=2e3;

int n,m;
int x[N],y[N],z[N],s[N];

int solve(int dx,int dy,int dz)
{
    for(int i=0;i<n;i++)
        s[i]=x[i]*dx+y[i]*dy+z[i]*dz;
    sort(s,s+n,greater<int>());
    return accumulate(s,s+m,0ll);
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m;
    for(int i=0;i<n;i++)
        cin>>x[i]>>y[i]>>z[i];
    int ans=0;
    for(int dx=-1;dx<=1;dx+=2)
        for(int dy=-1;dy<=1;dy+=2)
            for(int dz=-1;dz<=1;dz+=2)
                ans=max(ans,solve(dx,dy,dz));
    cout<<ans;
}


Measured memory_bytes: 256
n = int(input())
nlen = len(str(n))
nlist = list(str(n))
if nlen == 3:
    a = int(nlist[2])
elif nlen == 2:
    a = int(nlist[1])
else:
    a = int(nlist[0])
if a == 1:
    print("pon")
elif a == 2:
    print("hon")
elif a == 3:
    print("bon")
elif a == 4:
    print("hon")
elif a == 5:
    print("hon")
elif a == 6:
    print("pon")
elif a == 7:
    print("hon")
elif a == 8:
    print("pon")
elif a == 9:
    print("hon")
elif a == 0:
    print("pon")



Measured memory_bytes: 61724
#include <iostream>
#include <string>
#include <algorithm>
#include<vector>

using namespace std;

int main() {
	int n;
	cin >> n;
	int answer;
	vector<int> a(n);
	vector<int> ans(n);
	for (int i = 0; i < n; i++) {
		cin >> a.at(i);
		ans.at(i) = 0;
		bool f = true;
		while (f == true) {
			if (a.at(i) % 2 == 0) {
				a.at(i) = a.at(i) / 2;
				ans.at(i)++;
			}
			else {
				f = false;
			}
		}
		if (i == 0) {
			answer = ans.at(i);
		}
		else {
			if (ans.at(i) < answer) {
				answer = ans.at(i);
			}
		}
	}
	cout << answer << endl;
	return 0;
}


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




typedef long long ll;
#define PI 3.14159265359
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define mp make_pair
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBAC
#include <functional>
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

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

int sort_greater(int m, int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(), greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
	return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t, sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const ll mod = 1000000007;

map<string, int> memo;

using P=pair<ll,ll>;

/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/
ll findIndex(int value, vector<ll> a)
{

	for (ll i = 0; i < (ll)a.size(); i++) {
		if (a[i] == value) {
			return i;
		}
	}
	return -1;
}

ll nCr(ll n, ll r) {
	ll a = 1;
	for (ll i = n; i > n - r; --i) {
		a = a * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		a = a / i;
	}
	return a;
}



const int INF = 1001001001;



int main() {
	char s;
	cin >> s;
	if (s >= 'A'&&s<='Z') {
		cout << "A";
	}
	else {
		cout << "a";
	}
	return 0;
}













Measured memory_bytes: 3628
N,M = [int(_) for _ in input().split()]
K = []
c = 0
for i in range(1,N+1):
    I = [int(_) for _ in input().split()]
    K = K + I[1:]
for j in range(1,M+1):
    if K.count(j)==N:
        c +=1
print(c)


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

using namespace std;
typedef long long ll;


int main(void){

    int n;
    cin >> n;

    vector<int> ar(2*n,0);

    for(int i=0;i<2*n;i++){
        cin >> ar[i];
    }

    sort(ar.begin(),ar.end());

    ll sum = 0;

    for(int i=0;i<2*n-1;i+=2){
        sum += min(ar[i],ar[i+1]);
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3636
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
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>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
vector<ll>r;
void rec(ll x,ll y,int d){
  if(d==10)return;
  for(int i=max(x-1,0LL);i<=min(x+1,9LL);i++){
    ll z=y;
    z*=10;
    z+=i;
    r.pb(z);
    rec(i,z,d+1);
  }
}
inline void solve(void){
  ll K;in(K);
  up(i,1,9){
    r.pb(i);
    rec((ll)i,(ll)i,0);
  }
  sort(all(r));
  out(r[K-1]);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 10604
#include <bits/stdc++.h>
#include <regex>
#ifdef _DEBUG
#include "debug.h"
#endif
#define int ll
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define all(v) (v).begin(),(v).end()
#define mkpr make_pair
#define mktp make_tuple
#define tv(tp, i) get<(i)>(tp)
#define CLEAR(obj) obj = decltype(obj)()
#define var auto
#define OUT(type) type &
#define IN(type) const type &
#define self (*this)
#define in :
#define True true
#define False false
using namespace std; using int32 = int32_t; using str = string; using cstr = const str;
using ll = long long; using ull = unsigned long long; using cint = const int; using cll = const ll;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>;
using vc = vector<char>; using vvc = vector<vc>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using psl = pair<string, ll>;
using tiii = tuple<int, int, int>; using tlll = tuple<ll, ll, ll>;
static const int MGN = 10; static const int ARYSZ_MAX = (int)1e7;
static const ll LINF = LLONG_MAX/2;
#ifdef int
static const int INF = LINF;
#else
static const int INF = INT_MAX/2;
#endif
static double EPS = 1e-9;
#define FASTCIN() cin.tie(0);ios::sync_with_stdio(false);
#ifdef IMPORT_SAMPLE
#define DEBUG_IMPORT(file) vs args(argv, argv+argc);str sample = make_sample(args, file);ifstream ifs(sample); cin.rdbuf(ifs.rdbuf());
#else
#define DEBUG_IMPORT(file)
#endif
static inline bool DBLEQ(double a, double b) {return abs(a - b) < EPS;}
static inline void EPR(str msg) {cerr << msg << endl;}
static inline void AST(bool exp, str msg) {if(!exp){EPR(msg);} assert(exp);}
static inline void TAST(bool exp, str msg) {if(!exp){EPR(msg);} while(!exp){}}


int32 main(int32 argc, char* argv[]) {
    FASTCIN();
    DEBUG_IMPORT("sample-1");


    int L,R; cin>>L>>R;
    int MOD = 2019;

    int ans = INF;
    if (R - L < 3000) {
        FOR(i, L, R) {
            FOR(j, i+1, R+1) {
                ans = min(ans, i*j%MOD);
            }
        }
    } else {
        ans = 0;
    }

    cout << ans << endl;


    return 0;
}


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

vector<ll> p(52), b(52), s(52);

ll find(ll n, ll x)
{
    if(n*x==0){
        if(x>=1)
            return 1;
        else
            return 0;
    }

    if (0 < x && x < s[n - 1] + 2)
    {
        return find(n - 1, x - 1);
    }
    else
    {
        return p[n - 1] + 1+find(n - 1, x - 2 - s[n - 1]);
    }
}

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

    ll n, x;
    cin >> n >> x;

    p[0] = 1;
    s[0] = 1;
    b[0] = 0;
    rep(i, 50)
    {
        b[i + 1] = 2 + 2 * b[i];
        p[i + 1] = 1 + 2 * p[i];
        s[i + 1] = b[i + 1] + p[i + 1];
    }

    cout << find(n, x) << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())

cnt_list = []

for i in range(N):
    cnt_list.append(input())

C0 = 0
C1 = 0
C2 = 0
C3 = 0


for s in cnt_list:
    if s == "AC":
        C0 += 1
    elif s == "WA":
        C1 += 1
    elif s == "TLE":
        C2 += 1
    elif s == "RE":
        C3 += 1

print("AC x " + str(C0))
print("WA x " + str(C1))
print("TLE x " + str(C2))
print("RE x " + str(C3))

Measured memory_bytes: 16088
sx, sy, tx, ty = list(map(int, input().split()))
dy = abs(ty-sy)
dx = abs(tx-sx)
# 1巡目
ans = ''
ans += 'U'*(dy)
ans += 'R'*(dx)
ans += 'D'*(dy)
ans += 'L'*(dx)
# 2巡目
ans += 'L'
ans += 'U'*(dy+1)
ans += 'R'*(dx+1)
ans += 'D'
ans += 'R'
ans += 'D'*(dy+1)
ans += 'L'*(dx+1)
ans += 'U'

print(ans)


Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define rep(index,num) for(int index=0;index<num;index++)
#define eps 1e-15
typedef long long ll;
int main(){
	int N,A,Amax=0,Amin=2e+9;
	scanf("%d",&N);
	rep(i,N){
		scanf("%d",&A);
		if(A>Amax) Amax=A;
		if(A<Amin) Amin=A;
	}
	printf("%d\n",Amax-Amin);
	return 0;
}

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

int main() {
	int a, b, k;
	cin >> a >> b >> k;

	int count = 0;

	for(int i = a; i > 0; i--) {
		if (a % i == 0 && b % i == 0)
			count++;
		if (count == k) {
			cout << i << endl;
			break;
		}
	}

	return 0;
}

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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define MOD 1000000007
typedef pair<li, li> PI;

int main(void)
{
	li a, b;
	cin >> a >> b;
	cout << (max(a, b) >= 10 ? -1 : a * b) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;


int dp[34];
int main(){
int N,x;

  cin >> x;
  dp[0] = 1;
  for(int i = 0; i < 31; i++){

	  dp[i+1] += dp[i];
	  dp[i+2] += dp[i];
	  dp[i+3] += dp[i];

  }

  while(x != 0){

	  cout << dp[x]/3650 + 1 << endl;;

	  cin >> x;
  }


    


	return 0;
}

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

int main() {
    long long x, count, sub_count;
    cin >> x;
    count = x / 11;
    sub_count = count * 2;
    if (count * 11 < x) {
        if (x % 11 <= 6) sub_count++;
        else sub_count += 2;
    }
    cout << sub_count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int main() {

	string s; cin >> s;
	int ans = -1e9;

	REP(i,(1 << 3)) {
		int sum = (s[0] - '0');
		REP(j,3) sum += ((i >> j) & 1) ? (s[j + 1] - '0') * -1 : (s[j + 1] - '0');
		if (sum == 7) {
			REP(j,s.size()) {
				if (j == 0) cout << s[j];
				else cout << (((i >> (j - 1)) & 1) ? "-" : "+") <<  s[j]; 
			}
			cout << "=7" << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256
n=int(input())
s=input()
alpha=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]

out=[]
for i in range(len(s)):
    out.append(alpha[(alpha.index(s[i])+n)%26])

print("".join(out))

Measured memory_bytes: 3064
import math
import itertools
import statistics
#import numpy as np
import collections

#n = int(input())
#n, m = list(map(int, input().split()))
o = input()
e = input()
if len(o)!=len(e):
    e += " "
for i in range(len(o)):
    print(o[i], end="")
    print(e[i], end="")

Measured memory_bytes: 5276
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] g = buildGraph(sc, n, m);
        int s = sc.nextInt()-1;
        int t = sc.nextInt()-1;
        int[][] a = new int[n][3];
        for (int i = 0; i < n; i++) {
            Arrays.fill(a[i], -1);
        }
        ArrayDeque<int[]> ad = new ArrayDeque<>();
        ad.add(new int[]{s, 0});
        while(!ad.isEmpty()){
            int v = ad.peek()[0];
            int l = ad.peek()[1];
            int nl =( l + 1) % 3;
            ad.poll();
            for(int next : g[v]){
                if(a[next][nl] != -1) continue;
                a[next][nl] = l + 1;
                ad.add(new int[]{next, l+1});
            }
        }
        System.out.println(a[t][0] == -1 ? -1 : a[t][0] / 3);
        sc.close();

    }

    public static int[][] buildGraph(Scanner sc, int n, int m){
        int[][] graph = new int[n][];
        int[][] edges = new int[m][2];
        int[] deg = new int[n];
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt() -1;
            int b = sc.nextInt() -1;
            edges[i][0] = a;
            edges[i][1] = b;
            deg[a]++;
        }
        for (int i = 0; i < n; i++) {
            graph[i] = new int[deg[i]];
        }
        for (int i = 0; i < m; i++) {
            int a = edges[i][0];
            int b = edges[i][1];
            graph[a][--deg[a]] = b;
        }

        return graph;
    }

}



Measured memory_bytes: 98664
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
const ll MOD = 1e9+7; int INF=INT_MAX; ll LLINF = 1LL << 60;
const vector<int> d8x = {1, 0, -1, 0, 1, -1, -1, 1}; vector<int> d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vector<int> d4x = {1, 0, -1, 0}; vector<int> d4y = {0, 1, 0, -1};

//
int main(){
    int n; cin>>n;
    vector<int> p(n);
    int error=0;
    rep(i,n) cin>>p[i];
    rep(i,n){
        if(p[i]!=i+1) error++;
    }
    if (error<=2) cout << "YES" << endl;
    else cout << "NO" << endl;
    

}

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

int main(){
  int n,k;
  cin>>n>>k;
  int ans=1;
  for (int i=0;i<n;i++){
    if (ans<k){
      ans*=2;
    }else{
      ans+=k;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <unordered_map>

typedef long long ll;

using namespace std;

int main() {

	int x, n, num;
	cin >> x >> n;
	vector<int> nums;
	int ans = -1;

	unordered_map<int, int> mp;

	while (n--) {
		cin >> num;
		nums.push_back(num);
	}

	for (int i = 0; i < nums.size(); i++) {
		mp[nums[i]]++;
	}

	vector<int> direction;
	direction.push_back(-1);
	direction.push_back(1);

	for (int i = 0; i < x + 1; i++) {
		for (int j = 0; j < direction.size(); j++) {
			int a = x + direction[j] * i;
			if (mp[a] != 1) {
				ans = a;
				break;
			}	
		}
		if (ans > 0) break;
	}

	cout << to_string(ans) << endl;
	return 0;
}


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

int main() {
	int n[100], inv_n[100], x;

	cin >> x;

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

	for (int i = 0; i < x; i++) {
		inv_n[i] = n[x - 1 - i];
	}

	for (int i = 0; i < x; i++) {
		if (i == x - 1) cout << inv_n[i];
		else cout << inv_n[i] << " ";
	}

	cout << endl;
	
	return 0;
}

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

int main(){
  int s,s100,s10,s1,s0;
  cin >> s;
  
  s1 = s - s / 10 * 10;
  s10 = (s - s / 100 * 100 - s1) /10;
  s100 = (s - s / 1000 * 1000 - s1 - s10) / 100;
  cout << s1 + s10 + s100 << endl;
}

Measured memory_bytes: 256