akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct Edge{
  int u, v;
  ll w;
  Edge(){}
  Edge(int _u, int _v, ll _w) : u{_u}, v{_v}, w{_w}{}
  int other(int x){
    return x ^ u ^ v;
  }
};

const int N = 100001;
const int M = 200001;
const ll OO = 100000000000000000LL;
vector<int> adj[N];
Edge e[M];
ll waysS[N];
ll waysT[N];
ll distS[N];
ll distT[N];
const int MOD = 1e9 + 7;
void calc(int u, ll ways[], ll dist[]){
  for(int i = 0;i < N;i++)
    dist[i] = OO;
  dist[u] = 0;
  ways[u] = 1;
  priority_queue<pair<ll, int>> pr;
  pr.push({0, u});
  while(pr.size()){
    pair<ll, int> tp = pr.top();pr.pop();
    int cu = tp.second;
    ll cw = -tp.first;
    if(dist[cu] != cw)continue;
    for(auto el : adj[cu]){

      int v = e[el].other(cu);
      if(dist[cu] + e[el].w < dist[v]){
//        cout << v << endl;
        dist[v] = dist[cu] + e[el].w;
        ways[v] = ways[cu];
        pr.push({-dist[v], v});
      }else if(dist[cu] + e[el].w == dist[v]){
        ways[v] += ways[cu];
        ways[v] %= MOD;
      }
    }
  }
}
int main()
{
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
  int n, m;
  cin >> n >> m;
  int u, v, d;
  int s, t;
  cin >> s >> t;
  s--, t--;
  for(int i = 0;i < m;i++){
    cin >> u >> v >> d;
    u--, v--;
    e[i] = Edge(u, v, d);
    adj[u].push_back(i);
    adj[v].push_back(i);
  }
//  cout << distS[t] << endl;
//  return 0;
  calc(s, waysS, distS);
  calc(t, waysT, distT);
  ll res = waysS[t] * waysS[t] % MOD;
  ll D = distS[t];
//  cout << D << endl;
  for(int i = 0;i < n;i++){
    if(distS[i] == distT[i] && distS[i] + distT[i] == D)
      res -= waysS[i] * waysS[i] % MOD  * waysT[i] % MOD * waysT[i] % MOD;
    res %= MOD;
  }
  for(int i = 0;i < n;i++){
    for(auto el : adj[i]){
      Edge& ee = e[el];
      int u = i;
      int v = ee.other(u);
      int w = ee.w;
      if(distS[u] + w + distT[v] == D && 2 * distS[u] < D && 2 * distT[v] < D){
        res -= waysS[u] * waysS[u] % MOD * waysT[v] % MOD * waysT[v] % MOD;
        res %= MOD;
      }
    }
  }
  cout << (MOD + res) % MOD;
	return 0;
}


Measured memory_bytes: 16340
#include <iostream>
#include <algorithm>

using namespace std;

int main(void) {
    const int N = 100000;
    bool p[N];
    fill(p, p + N, true);
    for (int i = 2; i < N; i++) {
        if (!p[i]) continue;
        for (int j = i * 2; j < N; j += i) {
            p[j] = false;
        }
    }
    int n, a, b;
    while (true) {
        cin >> n;
        if (cin.eof()) break;
        for (a = n - 1; !p[a]; a--);
        for (b = n + 1; !p[b]; b++);
        cout << a << " " << b << endl;
    }
    return 0;
}

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

int main()
{
  ll n, ans = 0;
  cin >> n;
  vector<ll> a(n);
  map<ll, ll> b;
  for (ll i = 0; i < n; i++)
  {
    cin >> a.at(i);
    b[a.at(i)]++;
  }

  for (auto itr = b.begin(); itr != b.end(); itr++)
  {
    if (itr->first != itr->second)
    {
      if (itr->first > itr->second)
      {
        ans += itr->second;
      }
      else
      {
        ans += abs(itr->first - itr->second);
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 9968
// インクルード(GCC only)
#include <bits/stdc++.h>

// 長い型名
using namespace std;
typedef long long LL;

// 省略記法
#define INF 1e9
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i##_len=(n), i=(i##_len-1); i>=0; ++i)
#define FOR(i,m,n) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define all(x) (x).cbegin(),(x).cend()
#define sizei(x) ((int)(x).size())
#define fill(x,y) memset(x,y,sizeof(x))
#define printvector(x) rep(i,sizei(x)){cout << x[i] << endl;}
#define summation(x) (accumulate(all(x), 0LL))
#define product(x) (accumulate(all(x), 1LL, [](int acc, int i) { return acc * i;}))

// mod付き四則演算(mod関数のオーバーヘッドが重いかも)
// TODO: 二項係数、離散対数、平方剰余の実装
//#define MOD 1000000007LL
#define MOD 998244353LL
inline LL mod(LL const &a) { return (a % MOD + MOD) % MOD; }
inline LL madd(LL const &a, LL const &b) { return mod(mod(a) + mod(b)); }
inline LL msub(LL const &a, LL const &b) { return mod(mod(a) - mod(b)); }
inline LL mmul(LL const &a, LL const &b) { return mod(mod(a) * mod(b)); }
inline LL mpow(LL a, LL b) {
  LL r = 1;
  for (; b > 0; b >>= 1) {
    if (b & 1) (r *= a) %= MOD;
    (a *= a) %= MOD;
  }
  return r;
}
inline LL minv(LL const &a) { return mpow(a, MOD-2); }
inline LL mdiv(LL const &a, LL const &b) { return mod(mod(a) * minv(b)); }


// デバッグ用
#ifdef LOCAL
    #define TO_STRING(VariableName) # VariableName
    #define eprint(...) {fprintf(stderr, "DEBUG: "); fprintf(stderr, __VA_ARGS__);}
    #define eprintvector(x) rep(i,sizei(x)){fprintf(stderr, "DEBUG: %s[%d] = %lld\n", TO_STRING(x), i, x[i]);}
#else
    #define eprint(...) 42
    #define eprintvector(x) 42
#endif

/**************** 便利な関数 ****************/
vector<string> split_impl(string &&s, regex &&r) { return { sregex_token_iterator{s.begin(), s.end(), r, -1}, sregex_token_iterator{} }; }
auto split(string s, string pattern) { return split_impl(move(s), regex{pattern}); }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


/**************** ラムダ再帰用 ****************/
template<typename F>
class FixPoint : F
{
public:
  explicit constexpr FixPoint(F&& f) noexcept
    : F(std::forward<F>(f))
  {}
 
  template<typename... Args>
  constexpr decltype(auto)
  operator()(Args&&... args) const
  {
    return F::operator()(*this, std::forward<Args>(args)...);
  }
};
 
template<typename F>
static inline constexpr decltype(auto)
makeFixPoint(F&& f) noexcept
{
  return FixPoint<F>{std::forward<F>(f)};
}

/**************** main ****************/
 
int main()
{
  LL N;
  cin >> N;

  vector<LL> h(N+1);
  FOR(i, 1, N+1) {
    cin >> h[i];
  }

  vector<LL> dp(N+1);
  dp[1] = 0;
  dp[2] = abs(h[2] - h[1]);

  FOR(i, 3, N+1) {
    dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]), dp[i-2] + abs(h[i-2] - h[i]));
  }

  cout << dp[N] << endl;

  return 0;
}


Measured memory_bytes: 1792
O=input()
E=input()
p=""
if len(O)==len(E):
    for i in range(len(O)):
        p+=O[i]
        p+=E[i]
elif len(O)>len(E):
    for i in range(len(O)-1):
        p+=O[i]
        p+=E[i]
    p+=O[-1]
print(p)

Measured memory_bytes: 3060
import sys
from collections import deque
sys.setrecursionlimit(10 ** 6)


def dfs(v, step):
    global node0, node1
    if step & 1:
        color[v] = 1
        node1 += 1
    else:
        color[v] = 0
        node0 += 1
    for nv in edge[v]:
        if color[nv] is None:
            dfs(nv, step + 1)


N = int(input())
edge = [[] for _ in range(N)]
for s in sys.stdin.readlines():
    a, b = map(int, s.split())
    a -= 1; b -= 1
    edge[a].append(b)
    edge[b].append(a)
color = [None] * N
node0 = node1 = 0
dfs(0, 0)

ans = [None] * N
num0 = N // 3
num1 = N // 3 + (N % 3 >= 1)
num2 = N // 3 + (N % 3 == 2)
q0 = deque()
q1 = deque()
q = deque()
if node0 > num0 and node1 > num0:
    for i in range(1, num0 + 1):
        q.append(3 * i)
    for i in range(1, num1 + 1):
        q1.append(3 * i - 2)
    for i in range(1, num2 + 1):
        q0.append(3 * i - 1)
elif node0 <= num0:
    for i in range(1, node0 + 1):
        q0.append(3 * i)
    for i in range(node0 + 1, num0 + 1):
        q.append(3 * i)
    for i in range(1, num1 + 1):
        q1.append(3 * i - 2)
    for i in range(1, num2 + 1):
        q.append(3 * i - 1)
else:
    for i in range(1, node1 + 1):
        q1.append(3 * i)
    for i in range(node1 + 1, num0 + 1):
        q.append(3 * i)
    for i in range(1, num1 + 1):
        q.append(3 * i - 2)
    for i in range(1, num2 + 1):
        q0.append(3 * i - 1)

for i in range(N):
    if color[i] == 0:
        Q = q0 if q0 else q
        ans[i] = Q.pop()
    else:
        Q = q1 if q1 else q
        ans[i] = Q.pop()
print(*ans)


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

using namespace __gnu_pbds; 
using namespace std;

#define int           long long 
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define ub            upper_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (int)(4e18)
#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii>
#define ordered_set   tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){ cerr << name << " = " << arg1 << endl;}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args)
{ const char *name = strchr(names, ',');cerr.write(names, name-names) << " = " << arg1 << endl;_F(name+2, args...);}

template< typename T1, typename T2 > istream& operator>>(istream& in, pair<T1, T2> &q){ in >> q.F >> q.S; return in;}
template< typename T1, typename T2 > ostream& operator<<(ostream& out, pair<T1, T2> &q){ out << q.F << " " << q.S; return out;}
template< typename T1, typename T2 > pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F+p2.F, p1.S+p2.S};}
template< typename T1, typename T2 > pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F-p2.F, p1.S-p2.S};}
template< typename T1, typename T2 > bool operator<(pair<T1, T2> p1, pair<T1, T2> p2){ return p1 < p2 ;}

template<typename T> void Unique(vector<T> &v) {
    sort(all(v)), v.resize(distance(v.begin(), unique(all(v))));
}


void solve() {
	string s;
	cin >> s;

	if(s.back() == 's') {
		cout << s << "es" << endl;
	}
	else {
		cout << s << "s" << endl;
	}
}

signed main(){

    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);   
    start = clock(); 

  

    int test = 1;
    // cin >> test;
    
    cout << fixed << setprecision(2);
     
    for(int i = 1; i <= test; ++i){
    	solve();
    }

    cerr << time(start);
    return 0;
}


Measured memory_bytes: 3772
#include "bits/stdc++.h"
#define readInt(x) scanf("%d", &x)
#define readStr(x) scanf("%s", x)
#define rep(i, n) for(int i=0; i<(n); ++i)
#define write(x) cout << (x) << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1 << 28;

ll a, b, x;

int main()
{
    cin >> a >> b >> x;
    ll cnt = b / x - a / x + (a % x == 0);
    write(cnt);
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<list>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,x) unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;


struct edge
{
	long long to; long long len;
	bool operator<(const edge& rhs) const {
		return len > rhs.len;
	}
};


double f(ll n, double a, double d) {
	if (n == 0) {
		return 0;
	}
	else {
		double x = a + (n - 1)* d / 2;
		double b = ((2 * n + 2)*a + 3 * d) / 2 / n;
		double nex_d = d * (n + 2) / n;
		return x + f(n - 1, b, nex_d);
	}
}

int main() {
	cout.precision(16);
	ll n; double a, d;
	cin >> n >> a >> d;
	cout << f(n, a + d / 2, 2 * d) << endl;
}

Measured memory_bytes: 6528
#include <iostream>
#include <stdio.h>
using namespace std;

void solve()
{
	int a;
	while(cin >> a)
	{
		int b, c, d, e, f;
		cin >> b >> c >> d >> e >> f;
		double x = (c * e - b * f) / (double)(a * e - b * d);
		double y = (c * d - a * f) / (double)(b * d - a * e);
		if(x == -0)
		{
			x = 0;
		}
		if(y == -0)
		{
			y = 0;
		}
		printf("%.3f %.3f\n", x, y);
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int x, n;
    cin >> x >> n;
    set<int> s;
    rep(i, n){
        int p;
        cin >> p;
        s.insert(p);
    }
    int mn = 1001001;
    int ans;
    for(int i = 101; i >= -1; i--){
        if(s.find(i) != s.end())continue;
        int d = abs(x - i);
        if(d <= mn){
            mn = d;
            ans = i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <stdio.h>

void rotate_S(int minase_inori[6]) {
	int hayami_saori = minase_inori[0];
	minase_inori[0] = minase_inori[4];
	minase_inori[4] = minase_inori[5];
	minase_inori[5] = minase_inori[1];
	minase_inori[1] = hayami_saori;
}

void rotate_NES(int kugimiya_rie[6]) {
	int kitamura_eri = kugimiya_rie[1];
	kugimiya_rie[1] = kugimiya_rie[3];
	kugimiya_rie[3] = kugimiya_rie[4];
	kugimiya_rie[4] = kugimiya_rie[2];
	kugimiya_rie[2] = kitamura_eri;
}

int check(const int asumi_kana[6], const int iguti_yuka[6]) {
	int sakura_ayane;
	int satou_satomi[6];
	for (sakura_ayane = 0; sakura_ayane < 6; sakura_ayane++) {
		satou_satomi[sakura_ayane] = iguti_yuka[sakura_ayane];
	}
	for (sakura_ayane = 0; sakura_ayane < 4; sakura_ayane++) {
		int tateno_kanako;
		for (tateno_kanako = 0; tateno_kanako < 6; tateno_kanako++) {
			if (asumi_kana[tateno_kanako] != satou_satomi[tateno_kanako]) break;
		}
		if (tateno_kanako >= 6) {
			return 1;
		}
		rotate_NES(satou_satomi);
	}
	return 0;
}

int tokui_sora(const int utida_maaya[6], const int taneda_risa[6]) {
	int igarasi_hiromi[6];
	int horie_yui;
	for (horie_yui = 0; horie_yui < 6; horie_yui++) {
		igarasi_hiromi[horie_yui] = taneda_risa[horie_yui];
	}
	if (check(utida_maaya, igarasi_hiromi)) return 1;
	for (horie_yui = 0; horie_yui < 4; horie_yui++) {
		rotate_NES(igarasi_hiromi);
		rotate_S(igarasi_hiromi);
		if (check(utida_maaya, igarasi_hiromi)) return 1;
		rotate_S(igarasi_hiromi);
		rotate_S(igarasi_hiromi);
		rotate_S(igarasi_hiromi);
	}
	rotate_S(igarasi_hiromi);
	rotate_S(igarasi_hiromi);
	return check(utida_maaya, igarasi_hiromi);
}

int main(void) {
	int mizuhasi_kaori;
	int ootani_ikue[100][6];
	int uesaka_sumire, suzaki_aya;
	if (scanf("%d", &mizuhasi_kaori) != 1) return 1;
	for (uesaka_sumire = 0; uesaka_sumire < mizuhasi_kaori; uesaka_sumire++) {
		for (suzaki_aya = 0; suzaki_aya < 6; suzaki_aya++) {
			if (scanf("%d", &ootani_ikue[uesaka_sumire][suzaki_aya]) != 1) return 1;
		}
	}
	for (uesaka_sumire = 0; uesaka_sumire < mizuhasi_kaori; uesaka_sumire++) {
		for (suzaki_aya = uesaka_sumire + 1; suzaki_aya < mizuhasi_kaori; suzaki_aya++) {
			if (tokui_sora(ootani_ikue[uesaka_sumire], ootani_ikue[suzaki_aya])) {
				puts("No");
				return 0;
			}
		}
	}
	puts("Yes");
	return 0;
}



Measured memory_bytes: 2140
using System;

class Program
{
	static void Main(string[] args)
	{
		string[] nums = Console.ReadLine().Split(' ');
		int w = int.Parse(nums[0]);
		int h = int.Parse(nums[1]);
		int x = int.Parse(nums[2]);
		int y = int.Parse(nums[3]);
		int r = int.Parse(nums[4]);

		string value = "No";
		if ((0 <= x - r && x + r <= w) && (0 <= y - r && y + r <= h)) value = "Yes";
		Console.WriteLine(value);
	}
}

	

Measured memory_bytes: 8992
n, m = map(int, input().split())
a = [input() for i in range(n)]
b = [input() for i in range(m)]

res = "No"
c = n - m + 1
for i in range(c):
    for j in range(c):
        if list(map(lambda l: l[j:j+m], a[i:i+m])) == b:
            res = "Yes"
print(res)


Measured memory_bytes: 3064
def ex():print(-1);exit()

s=input()
N=len(s)
if not (s[0]=='1' and s[-1]=='0'):
    ex()
for i in range(N//2):
    if s[i]!=s[N-i-2]:
        ex()
ans=[]
m=1
for i in range(1,N//2+1):
    ans.append((m,i+1))
    if s[i-1]=='1':
        m=i+1
for i in range(N//2+2,N+1):
    ans.append((m,i))
for t in ans:
    print(*t)

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
bool graph[23][23]={};

int bfs_ans(int si,int sj){
    queue<tuple<int,int,int>> que;
    que.push(make_tuple(si,sj,0));
    bool clr[23][23] = {};
    clr[si][sj] = true;
    int ans=0;
    while (!que.empty())
    {
        tuple<int, int, int> q = que.front();
        if (graph[get<0>(q)+1][get<1>(q)] && !clr[get<0>(q) + 1][get<1>(q)])
        {
            clr[get<0>(q) + 1][get<1>(q)] = true;
            que.push(make_tuple(get<0>(q) + 1, get<1>(q), get<2>(q) + 1));
        }
        if (graph[get<0>(q) - 1][get<1>(q)] && !clr[get<0>(q) - 1][get<1>(q)])
        {
            clr[get<0>(q) - 1][get<1>(q)] = true;
            que.push(make_tuple(get<0>(q) - 1, get<1>(q), get<2>(q) + 1));
        }
        if (graph[get<0>(q)][1 + get<1>(q)] && !clr[get<0>(q)][1 + get<1>(q)])
        {
            clr[get<0>(q)][1 + get<1>(q)] = true;
            que.push(make_tuple(get<0>(q), get<1>(q) + 1, get<2>(q) + 1));
        }
        if (graph[get<0>(q)][get<1>(q) - 1] && !clr[get<0>(q)][get<1>(q) - 1])
        {
            clr[get<0>(q)][get<1>(q) - 1] = true;
            que.push(make_tuple(get<0>(q), get<1>(q) - 1, get<2>(q) + 1));
        }
        ans = get<2>(q);
        que.pop();
    }
    return ans;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h,w;
    cin >> h >> w;
    rep(i,1,h+1){
        rep(j,1,w+1){
            char pt;
            cin >> pt;
            if(pt == '.') graph[i][j] = true;
            else graph[i][j] = false;
        }
    }
    int ans=0;
    rep(i,1,h+1){
        rep(j,1,w+1){ //start point
            if(graph[i][j]) ans = max(ans,bfs_ans(i,j));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
fn main() {
    input! {//
        s:Chars,
    }

    let n = s.len();
    let mut l = 0;
    let mut r = n - 1;

    let mut ans = 0;
    while l < r {
        if s[l] == s[r] {
            l += 1;
            r -= 1;
        } else {
            if s[l] == 'x' {
                l += 1;
                ans += 1;
            } else if s[r] == 'x' {
                r -= 1;
                ans += 1;
            } else {
                println!("{}", -1);
                return;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2496
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int a[N];
int main() {
	int h,n;
	cin>>h>>n;
	int s=0;
	for(int i=1;i<=n;i++) {
		cin>>a[i];
		s+=a[i];
	}
	if(s>=h) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(){
  int ans = 0;
  int b[4];
  for(int i = 0 ; i < 3; i++){
    cin >> b[i];
    if(b[i]){
      ans += (1 << (2-i));
    }
  }
  cout << ((ans == 1 || ans == 6)?"Open":"Close") << endl;
}

Measured memory_bytes: 1160
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);--i)

#define ALL(c) (c).begin(),(c).end()
#define SIZE(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort(ALL(c))
#define LB(c,x) lower_bound(ALL(c),x)
#define UB(c,x) upper_bound(ALL(c),x)
#define COUNT(c,x) (int)(UB(c,x)-LB(c,x))

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

using namespace std;

typedef pair<int,int> P;
struct edge {
  int to, cost;
};

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

template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " ";
  }
  return s;
}


signed main()
{
  int N; cin >> N;
  vector<int> A(N), B(N), C(N);
  rep(i, 0, N) cin >> A[i];
  rep(i, 0, N) cin >> B[i];
  rep(i, 0, N) cin >> C[i];

  SORT(A);
  SORT(B);
  SORT(C);

  int ans = 0;
  rep(i, 0, N) {
    int b = B[i];
    ans += (LB(A, b) - A.begin()) * (C.end() - UB(C, b));
  }

  cout << ans << endl;

  return 0;
}


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

a_list = [int(a) for a in input().split()]

def calc_div2(n):
    return n//2

c = 0
f = 0
while(1):
    for a in a_list:
        if a%2 == 0:
            pass
        else:
            f = 1
            break
    if f == 1:
        break
    else:
        a_list = list(map(calc_div2, a_list))
        c += 1
print(c)

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

int main()
{
    int A,B;
    cin >> A >> B;
    int flag=0,a[5],count=0;
    for(int j=A;j<=B;j++){
        int num =j;
        for(int i=0;i<=5;i++){
            a[i] = num%10;
            num/=10;
        }
        for(int i=0;i<3;i++){
            if(a[i] != a[4-i])
                flag=1;
        }
        if(!flag)
            count++;
        flag=0;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10

int MOD = 1e9 + 7;

inline int mul(int a,int b,int mod=MOD){return ((a%mod)*(b%mod))%mod;}
inline int sum(int a,int b,int mod=MOD){return ((a%mod)+(b%mod))%mod;}
int power(int a,int n,int mod=MOD){int ans=1;while(n){if(n&1)ans=mul(ans,a,mod);a=mul(a,a,mod);n>>=1;}return ans;}
inline int sub(int a,int b,int mod=MOD){ return (((a) % mod)-((b) % mod) + mod) % mod; }
int inv[1000006];
void find_inverse(int m)  //m should be prime..
{
	inv[1] = 1;
	for(int i = 2; i < m; ++i)
    	inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;
	int n;
	cin>>n;

	vector<int>a(n);

	int sum1=0,cur=0;

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

	int ans=0;

	for(i=0;i<n;i++)
	{
		cur+=a[i];

		ans=sum(ans,mul(a[i],sum1-cur));
	}
	cout<<ans<<endl;



}

Measured memory_bytes: 4772
def main():
    n, *x = map(int, open(0).read().split())
    y = sorted(x)
    a, b = y[n // 2 - 1], y[n // 2]
    ans = ""
    for i in x:
        if i <= a:
            ans += str(b) + "\n"
        else:
            ans += str(a) + "\n"

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 25052
a, b, c, x, y = map(int, input().split())
if x <= y:
    d = x*c*2
    e = (y-x)*b
    abpizza = d+e
    sonomamapizza = a*x+b*y
    pizza = y*c*2
    print(min(abpizza,sonomamapizza,pizza))
else:
    d = y*c*2
    e = (x-y)*a
    abpizza = d+e
    sonomamapizza = a*x+b*y
    pizza = x*c*2
    print(min(abpizza,sonomamapizza,pizza))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


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

ll od(ll n, ll m) {
	if (m%n != 0) { return 0; }

	return od(n, m / n)+1;
}


int main() {
	ll N;
	ll g[2][3];

	cin >> N;

	rep(i, 2)rep(j, 3) cin >> g[i][j];

	vector<ll> dp1(N + 1);

	dp1[0] = 0;

	repn(i, N) {
		dp1[i] = i;

		rep(j, 3) {
			if (i >= g[0][j]) { dp1[i] = max(dp1[i], dp1[i - g[0][j]] + g[1][j]); }
		}
	}

	ll M = dp1[N];

	vector<ll> dp2(M + 1);
	dp2[0] = 0;

	repn(i, M) {
		dp2[i] = i;

		rep(j, 3) {
			if (i >= g[1][j]) { dp2[i] = max(dp2[i], dp2[i - g[1][j]] + g[0][j]); }
		}
	}

	cout << dp2[M];

	system("PAUSE");
}


Measured memory_bytes: 195832
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <fstream>
#include <set>
#include <cmath>
#include <array>
#include <iomanip>
#include <cassert>

using namespace std;

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

    int64_t x, y;
    cin >> x >> y;

    int64_t answer =4e9;

    auto check = [&](int64_t add, int64_t from, int64_t to) {
        if (to >= from) {
            answer = min(answer, to - from + add);
        }
        if (to >= -from) {
            answer = min(answer, to + from + 1 + add);
        }
    };

    check(0, x, y);
    check(abs(x - y), x + abs(x - y), y);
    check(abs(x + y), x + abs(x + y), y);
    check(abs(- x - y) + 1, -x + abs(- x - y), y);
    check(abs(- x + y) + 1, -x + abs(- x + y), y);
    assert(answer < 4e9);
    cout << answer << endl;
}


Measured memory_bytes: 256
//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

//#include "Union_Find.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <list>
#include <bitset>

using namespace std;
#define REP(i,a,n) for(int i = (a); i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
#define FLOAT setprecision(16)
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;

template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(begin(dest), end(dest), val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
//sum, 累積和
// 負のときの割り算に注意
#if 1
#include <array>
#include <unordered_set>
#include <unordered_map>
template<class T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

//#include "Union_Find.h"

int N;
int C[100000];
int main() {
	cin >> N;
	REP(i, 0, N) {
		int a;
		cin >> a;
		C[a - 1]++;
	}
	int ans = 0;
	int even = 0;
	REP(i, 0, 100000) {
		if (C[i] > 0) {
			ans++;
			if (C[i] % 2 == 0) even++;
		}
	}
	cout << ans - (even % 2 == 1 ? 1 : 0) << endl;
	return 0;
}

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

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

    int n, ans = 0;
    cin >> n;
    vector<int> l(n), r(n);
    rep(i, 0, n) {
        cin >> l[i] >> r[i];
    }
    int max_l = *max_element(l.begin(), l.end());
    int min_r = *min_element(r.begin(), r.end());

    vector<pair<int, int>> p(n);
    rep(i, 0, n) {
        p[i] = make_pair(min_r - l[i] + 1, r[i] - max_l + 1);
    }
    sort(p.begin(), p.end());
    int mx = 1.1e9;
    rep(i, 0, n) {
        int c = r[i] - l[i] + 1;
        c += max(0, min_r - max_l + 1);
        ans = max(ans, c);
    }
    rep(i, 0, n - 1) {
        mx = min(mx, p[i].second);
        ans = max(ans, mx + p[i + 1].first);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
inform = [[[0]*10 for i in range(3)] for j in range(4)]
N = int(input())
for loop in range(N):
    b, f, r, v = map(int, input().split())
    inform[b-1][f-1][r-1] += v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(end=" ")
            print(inform[i][j][k],end="")
        print()
    if i != 3:print("####################")



Measured memory_bytes: 5632
import java.util.Arrays;
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt();
    long[] t=new long[n];
    for(int i=0;i<n;i++)t[i]=sc.nextLong();
    Arrays.sort(t);
    if(n==1) {
    	System.out.println(t[0]);
    	System.exit(0);
    }
    long res=LCM(t[0],t[1]);
    for(int i=2;i<n;i++)res=LCM(res,t[i]);
    System.out.println(res);
  }
	/*min,maxの最大公約数を求める。引数の大小は気を付ける*/
	public static long GCD(long min,long max) {
		if(max==0)return min;
		return GCD(max,min%max);
	}
	/*min,maxの最小公倍数を求める。GCDとセットで使うように。引数の大小は気を付ける*/
	public static long LCM(long min,long max) {
		return min/GCD(min,max)*max;
	}
}


Measured memory_bytes: 23252
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> p;
const int inf=(1<<30);
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
	
	
int main(){
	ll a,b;
	cin>>a>>b;
	cout<<a*b<<endl;
}

Measured memory_bytes: 3560
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

using pqg = priority_queue<ll,vector<ll>, greater<ll> >; // 1,3,5..
using pql = priority_queue<ll,vector<ll> >; //5, 3, 1...

using pqg_p = priority_queue<P,vector<P>, greater<P> >; // 1,3,5..
using pql_p = priority_queue<P,vector<P> >; //5, 3, 1...

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)


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

  int A,B,C,X,Y;
  cin >> A >> B >> C >> X >> Y;

  if(A + B < C*2) {
    //not using C
    cout << A*X + B*Y << endl;;
    return 0 ; 
  }

  ll res = 0;
  if ( X > Y ) {
    res = C*2*Y;
    X -= Y;
    res += min(C*2*X, A*X);
  } else {
    res = C*2*X;
    Y -= X;
    res += min(C*2*Y, B*Y);
  }

  cout << res << endl;

    
  




}


Measured memory_bytes: 256
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math

#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
a,b = readInts()
print((a+b)//2 if (a+b)%2 == 0 else 'IMPOSSIBLE')


Measured memory_bytes: 10348
#include<bits/stdc++.h>
#include <ext/rope>

#define min3(a,b,c)   min(a,min(b,c))
#define max3(a,b,c)   max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

#define count_one(a) __builtin_popcount(a)  // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i)    __builtin_parity(i)  //even parity 0 and odd parity 1
#define blz(a)       __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a)       __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b)     __gcd(a,b)
#define lcm(a,b)     (a*(b/gcd(a,b)))

#define pb   push_back
#define PI   M_PI
#define endl "\n"
#define sc   scanf
#define pf   printf

#define ll  long long
#define ull unsigned long long

#define W(t)            while(t--)
#define rep1(i,n)       for(int i = 0; i < n; i++)
#define rep2(a,b)       for(int i = a; i <= b; i++)
#define rep3(a,b,c)     for(int i = a; i <= b; i+=c)
#define irep(a,b,c)     for(int i = b; i >=a; i-=c)
#define repit(it,type)  for(it = type.begin(); it != type.end(); it++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
using namespace __gnu_cxx;

int main()
{
     IOS
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll n;
    cin>>n;
    n--;
    n = n*(n+1)/2;
    cout<<n<<endl;

     return 0;
}



Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll ar[500005];
int main()
{
    ll a,b;
    cin >> a;
    for(int i=1; i<=a; i++)
    {
        cin >> b;
        ar[b]=i;
    }
    for(int i=1; i<=a; i++)
    {
        cout<<ar[i]<<" ";
    }
    return 0;
}

Measured memory_bytes: 1536
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<cmath>
#include<ctime>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<bitset>
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
map<int,int> mp;
int main()
{	int n,x; cin>>n; ll ans=0;
	for(rint i=1;i<=n;i++) scanf("%d",&x),mp[x]++;
	for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++)
	{	if(it->second>=it->first) ans+=it->second-it->first;
		else ans+=it->second;
	}
	cout<<ans<<endl;
 	return 0;
}


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

vector <vector<ll>> graph;
vector <ll> value;
vector <ll> ans;

void dfs(ll u = 0,ll p = -1,ll c = 0){
    c += value[u];
    ans[u] = c;
    for (int z=0;z<graph[u].size();z++){
        if (graph[u][z] == p) continue;
        dfs(graph[u][z],u,c);
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,q;
    cin >> n >> q;
    graph.resize(n);
    value.resize(n);
    ans.resize(n);
    for (int z=0;z<n-1;z++){
        ll a,b;
        cin >> a >> b;
        a--;b--;
        graph[a].push_back(b);
    }
    for (int z=0;z<q;z++){
        ll a,b;
        cin >> a >> b;
        a--;
        value[a] += b;
    }
    dfs();
    for (int z=0;z<n;z++){
        cout << ans[z] << " ";
    } cout << endl;
}

Measured memory_bytes: 25856
N, K = map(int, input().split())
A = list(map(int,input().split()))
b = [0]*N
next_town = 1
for i in range(N+1):
    if b[next_town-1] != 0:
        start = next_town
        cycle = i - b[next_town-1]
#        print("start: "+str(start))
#        print("cycle: "+str(cycle))
        break
    b[next_town-1] = i
    next_town = A[next_town-1]
    
next_town = 1
if b[start-1] >= K:
    for i in range(K):
        next_town = A[next_town-1]
    print(next_town)
else:
    next_town = start
    for i in range((K-b[start-1])%cycle):
        next_town = A[next_town-1]
    print(next_town)

Measured memory_bytes: 32344
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

const ll MAX = 1e9;

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

  // すべてあまり0
  int num = n / k;
  ll ans = pow(num, 3);

  // すべてあまりk/2
  if (k % 2 == 0) {
    int div = k / 2;
    int k2 = n / div - num;
    ans += pow(k2, 3);
  }
  cout << ans << endl;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
    ll x,y;cin >>x>>y;
    ll d=abs(y)-abs(x);
    ll ans=0;
    if(d>=0){
        ans+=abs(d);
        if(x<0)ans++;
        if(y<0)ans++;
    }
    else {
        ans+=abs(d);
        if(x>0)ans++;
        if(y>0)ans++;
    }
    cout <<ans <<endl;
    return 0;
}



Measured memory_bytes: 256
/*
        |___Arshit Mangukiya___|
        |___DA-IICT____|
        |___201801173____|
*/
        //__WRITE  YOUR  CODE  HERE___//
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;            
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppl;
typedef vector<pll> vpl;
#define ff first
#define ss second
#define pi acos(-1)
#define mr_ad_0501 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define all(a)      a.begin(),a.end()
#define f(i,a,n) for(ll i=a;i<n;i++)
#define MOD 1000000007
#define MAX 200007
#define LM LLONG_MAX
#define sz size()
#define p(x)        cout<< x << " ";
#define pe(x)       cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
const int N=1e5+5;
        /*  bool fun(pair<int,int>a , pair<int,int>b)
            {
                if(a.ff == b.ff)    return a.ss < b.ss;
                else            return a.ff < b.ff;
            }*/
 /*void bfs(ll x)
 {
    queue<ll> q;
    q.push(x);
    while(!q.empty())
    {
        ll k=q.front();
        q.pop();
        for(auto X:v[k])
        {
            if(!vis[X])
            {
                l[X]=l[k]+1;
                vis[X]=1;
                q.push(X);
            }
        }
    }
 }*/
//ll i,j;
/*void dfs(ll v) {
    visited[v] = true;
    for (auto u : adj[v]) {
        if (!visited[u])
            dfs(u);
    }
}*/

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll mod_pow(ll a,ll b,ll m)
{
    ll res = 1;
    while(b)
    {
        if(b&1)
        {
        	res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}
 
ll mod_inverse(ll a)
{
	return mod_pow(a , MOD-2 , MOD);
}

void solve()
{
	ll n;
	cin>>n;
	if(n>=30)cout<<"Yes";
	else cout<<"No";
}
    
int32_t main(){
    mr_ad_0501;
    ll t=1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    
}    	

Measured memory_bytes: 3636
def main():
    N, K = list(map(int, input().split(' ')))
    A = list(map(int, input().split(' ')))
    # Calculate divisors of sum(A)
    S = sum(A)
    divs = list()
    n = 1
    while n ** 2 <= S:
        if S % n == 0:
            m = S // n
            if n != m:
                divs.extend([n, m])
            else:
                divs.append(n)
        n += 1
    divs.sort(reverse=True)
    # calc answer
    ans = S
    for d in divs:
        B = [a % d for a in A]
        B.sort(reverse=True)
        t = sum(B) // d
        k = sum(B) - sum(B[:t])
        if d == 1:
            k = 0
        if k <= K:
            ans = d
            break
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 9200
#include<iostream>
using namespace std;
int main(){
  char b,ans;
  cin >> b;
  switch (b) {
    case 'A':
      ans = 'T';
      break;
    case 'T':
      ans = 'A';
      break;
    case 'G':
      ans = 'C';
      break;
    case 'C':
      ans = 'G';
      break;
  }
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long n,ans=0,cnt=0;
string s,t;
int main(){
	cin >> s;
	for(int i=0;i<4;i++){
		if(s[i]=='+'){
			ans++;
		}else{
			ans--;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>


//compare function (ascending order)
//qsort(array, n, size, cmp)
int cmp(const void *a,const void *b){ 
    if(*(int*)a < *(int*)b){
        return -1;
    }
    else if(*(int*)a == *(int*)b){
        return 0;
    }
    else return 1;
}


int main(void){
    int n;
    scanf("%d",&n);
    int l[n];
    int i, j, k;
    int s;
    int ans = 0;
    int temp;
    for(i=0;i<n;i++){
        scanf("%d",&l[i]);
    }
    qsort(l, n, sizeof(int), (int(*)(const void *, const void *))cmp);
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            for(k=j+1;k<n;k++){
                if(l[i]<l[j]+l[k] && l[j]<l[k]+l[i] && l[k]<l[i]+l[j])
                    ans++;
                else
                    break;
            }
        }
    }
    printf("%d",ans);
    return 0;
    
}


Measured memory_bytes: 128
N, M, X, Y = map(int, input().split())
maxNum = max(list(map(int, input().split())))
minNum = min(list(map(int, input().split())))

ans = "War"

if maxNum < minNum:
    for i in range(maxNum+1, minNum+1):
        if X < i and i <= Y:
            ans = "No War"
print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public boolean binarySearch(int[] s, int n, int key) {
        int left = 0;
        int right = n;
        int mid;
        while (left < right) {  // 表示搜索范围不为空
            mid = (left + right) / 2;
            if(key == s[mid]) return true;  // 发现 key
            else if(key > s[mid]) left = mid + 1;  // 搜索后半部分
            else right = mid;  // 搜索前半部分
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = in.nextInt();
        }

        int q = in.nextInt();

        Main test = new Main();
        int sum = 0;

        for (int i = 0; i < q; i++) {
            int key = in.nextInt();
            if (test.binarySearch(s, n, key)) sum++;
        }
        System.out.println(sum);
    }
}



Measured memory_bytes: 67848
n = int(input())
h = list(map(int,input().split()))

ans = 0
for i in range(1,101):
	res = 0
	flag = False
	for j in range(n):
		if h[j] >= i:
			flag = True
		if h[j] < i and flag:
			flag = False
			res += 1
	if flag:
		res += 1
	ans += res

print(ans)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int[] length=new int[10];
        int L,V,v1,v2,sum,A;
        while(sc.hasNextLine()){
            L=0;
            V=0;
            v1=0;
            v2=0;
            sum=0;
            A=0;
            String s=sc.nextLine();
            String[] l=s.split(",");
            for(int i=0;i<10;i++){
                length[i]=Integer.parseInt(l[i]);
                L+=length[i];
            }
            v1=Integer.parseInt(l[10]);
            v2=Integer.parseInt(l[11]);
            V=v1+v2;
            A=L*v1;
            for(int i=0;i<10;i++){
                sum+=length[i];
                if(A<=(v1+v2)*sum){
                    System.out.println(i+1);
                    break;
                }
            }
        }
        
    }
}

Measured memory_bytes: 17136
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int ctoi(char c) {return c-'0';}// char to int
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}//MAX
int lcm(ll a,ll b){return a*b/gcd(a,b);}//MIN
 
int  main(){
ll n;
cin >> n;
ll ans = 100000;
for(ll i=1;i*i<=n;i++){
    if(n%i!=0)continue;
ll z = n/i;
ll zketa = 0,iketa=0;ll nn = i;
while(z>0){
    zketa++;
    z/=10;
}
while(nn>0){
    iketa++;
    nn/=10;
}
ll chea = max(zketa,iketa);
 ans = min(chea,ans);
}
cout << ans << endl;
}
 


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, int> P;
#define MOD (1000000007ll)

ll sq(ll x){
	return x*x;
}

int main(void){
	int n,i,j;
	ll a[15],ans=0ll,tmp,p;
	string s;
	cin >> s;
	n = s.length();
	for(i=0; i<n; ++i){
		a[i] = s[i] - '0';
	}
	n--;
	for(i=((1<<n)-1); i>=0; i--){
		tmp = 0ll;
		p = a[0];
		for(j=0; j<n; ++j){
			if((i&(1<<j))){
				tmp += p;
				p = a[j+1];
			}else{
				p *= 10;
				p += a[j+1];
			}
		}
		tmp += p;
		ans += tmp;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int N, W;
vector<int> values;
vector<int> weights;
vector<vector<int>>* dp;

// i 番目以降の品物から重さの総和が w 以下となるように選んだときの価値の最大値
int napsack(const int i, const int w) {
    if ((*dp)[i][w] >= 0) {
        return (*dp)[i][w];
    }
    int res;
    if (i == N) {
        // もう品物は残っていない
        res = 0;
    }
    else if (w < weights[i]) {
        int wi = weights[i];
        // i 番目の品物は入らない
        res = napsack(i + 1, w);
    }
    else {
        int wi = weights[i];
        // 入れる場合と入れない場合を両方試す
        res = max(napsack(i + 1, w), napsack(i + 1, w - wi) + values[i]);
    }
    (*dp)[i][w] = res;
    return res;
}

int main() {

    cin >> N >> W;

    values = vector<int>(N, 0);
    weights = vector<int>(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> values[i];
        cin >> weights[i];
    }
    dp = new vector<vector<int>>(N + 1, vector<int>(W + 1, -1));

    //vector<vector<int>> dp(N, vector<int>(W, 0));
    cout << napsack(0, W) << endl;

    return 0;
}



Measured memory_bytes: 7068
n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))

import itertools

l = [i+1 for i in range(n)]

lst = list(itertools.permutations(l,n))

a = 0
b = 0

for i in range(len(lst)):
    if lst[i] == p:
        a = i
    if lst[i] == q:
        b = i

print(abs(a-b))

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

namespace ConsoleApp15
{
    class Class4
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            Dictionary<int, int> Table = new Dictionary<int, int>();
            int[] S = new int[N], T = new int[N];
            for(int i = 0; i < N; i++)
            {
                var XL = Console.ReadLine().Split().Select(int.Parse).ToArray();
                S[i] = XL[0] - XL[1];
                T[i] = XL[0] + XL[1];
            }
            Array.Sort(T, S);
            int j = 0;
            int now = int.MinValue;
            int count = 0;
            for (; j < N; j++)
            {
                if (S[j] >= now)
                {
                    count++;
                    now = T[j];
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 18144