akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
const int mod = 1000000007;
double a;

int main(){ //srand((unsigned)time(NULL));
  cin >> a;
  cout << syo(12) << 2.0*a*M_PI << endl;
}


Measured memory_bytes: 3740
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n=II()
    x=800*n
    y=n//15*200
    print(x-y)

main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef pair<int,int> P;
typedef long long int ll;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

const int MAX_N = 1 << 18;

// セグメント木を持つグローバル配列
int nn, dat[2 * MAX_N - 1];

// 初期化
void init(int n_){
    // n_が小さいときの変な挙動を防ぐ
    if(n_ < 10)n_ = 10;
    // 簡単のため要素数を2のべき乗に
    nn = 1;
    while(nn < n_)nn *= 2;

    // 全ての値をINT_MAXに
    for(int i = 0; i < 2 * nn - 1; i++)dat[i] = INT_MAX;
}

// k番目の値(0-indexed)をaに変更
void update(int k, int a){
    // 葉の接点
    k += nn - 1;
    dat[k] = a;
    // 登りながら更新
    while(k > 0){
        k = (k - 1) / 2;
        dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
}

// [a,b)の最小値を求める
// 後ろのほうの引数は、計算の簡単のための引数。
// kは節点の番号、l, rはその節点が[l, r)に対応づいていることを表す。
// したがって、外からはquery(a, b, 0, 0, nn)として呼ぶ。
int query(int a, int b, int k, int l, int r){
    // [a, b)と[l, r)が交差しなければ、INT_MAX
    if (r <= a || b <= l)return INT_MAX;

    // [a, b)が[l, r)を完全に含んでいれば、この節点の値
    if (a <= l && r <= b)return dat[k];
    else {
        // そうでなければ、2つの子の最小値
        int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
        int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
        return min(vl, vr);
    }
}


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

    init(n);

    int x[q][3];
    rep(i,q){
        cin >> x[i][0] >> x[i][1] >> x[i][2];
    }

    rep(i,q){
        if(x[i][0]==0){
            update(x[i][1],x[i][2]);
        }else{
            int ans = query(x[i][1],x[i][2]+1,0,0,nn);
            cout << ans << endl;
        }
    }

    return 0;
}




Measured memory_bytes: 5276
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;

pair<int,int> stu[100005];

int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        int temp;
        scanf("%d",&temp);
        stu[i] = make_pair(temp,i+1);
    }
    sort(stu,stu+n);
    for(int i=0;i<n;i++)
        printf("%d ",stu[i].second);
    return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#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;
char c[1000000];
int main()
{	scanf("%s",c+1); int n=strlen(c+1),cur=0; ll ans=0;
	for(rint i=n;i>=1;i--)
	{	if(c[i]=='W') cur++;
		else ans+=cur;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<58);

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

ll calc(mat &s, vec &c, vec &ans){
    ll res = 0;
    vec last(26, 0);
    rep(day, N){
        last[ans[day]] = day + 1;
        rep(i, 26){
            if(i == ans[day]){
                res += s[day][i];
            }else{
                res -= c[i] * (day + 1 - last[i]);
            }
        }
    }
    return res;
}

void make_ans_another(vec &ans, mat &ans_another){
    rep(day, N){
        ans_another[ans[day]].push_back(day + 1);
    }
    rep(i, 26) ans_another[i].push_back(N + 1);
}

int main() {
    cin>>N;
    vec c(26), last(26, 0), ans(N);
    mat s(N, vec(26));
    rep(i,26) cin>>c[i];
    rep(i,N) rep(j, 26) cin>>s[i][j];
    ll score = 0;
    rep(day, N){
        vec temp(26, 0);
        rep(i, 26) temp[i] += s[day][i];
        rep(i, 26) temp[i] += c[i] * (day + 1 - last[i]);
        auto ite = max_element(ALL(temp));
        ans[day] = ite - temp.begin();
        last[ite - temp.begin()] = day + 1;
        rep(i, 26){
            if(i == ans[day]){
                score += s[day][i];
            }else{
                score -= c[i] * (day + 1 - last[i]);
            }
        }
    }

    ll total_num = 160000;
    while(total_num) {
        mat minus(N + 1, vec(26, 0)), ans_another(26, vec(1, 0));
        make_ans_another(ans, ans_another);
        priority_queue<P> pque;
        rep(i, 26) {
            vec &table = ans_another[i];
            int id = 0;
            reps(day, 1, N) {
                if (table[id + 1] == day) {
                    ++id;
                } else {
                    ll weight = s[day - 1][i], len = table[id + 1] - table[id] - 1;
                    ll wh = day - table[id];
                    weight += c[i] * ((len * (len + 1) / 2) - (wh * (wh - 1) / 2 + (len - wh) * (len - wh + 1) / 2));
                    pque.emplace(weight, day * 26 + i);
                }
            }
        }
        if((total_num -= 22) < 0) break;
        ll non_update = 0;
        rep(check, 10000) {
            P p = pque.top();
            pque.pop();
            ll day = p.se / 26, i = p.se % 26;
            --day;
            ll old = ans[day];
            ans[day] = i;
            if (!chmax(score, calc(s, c, ans))) {
                ans[day] = old;
                check += non_update * 3;
            }else{
                ++non_update;
            }
            if((--total_num) < 0) break;
        }
    }

    rep(i,N) cout<<ans[i] + 1<<'\n';
}


Measured memory_bytes: 4004
#include<bits/stdc++.h>
using namespace std;
const int N=200005;
const long long M=998244353;
const long long iv2=499122177;
int n,t,a,b,v,w;
char c[N];
int main()
{
	scanf("%s",c);
	printf("%c%c%c",c[0],c[1],c[2]);
}

Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
int s(int a){
	long double b = sqrt(a);
	for(int i = 2;i <= b;i++){
		if(a % i == 0){
			return 0;
		}
	}
	return 1;
}
int main(){
	int x;
  cin >> x;
	for(int i = x;;i++){
		if(s(i) == 1){
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
fn getline() -> String{
    let mut __ret = String::new();
    std::io::stdin().read_line(&mut __ret).ok();
    return __ret;
}

fn main() {
    let s = getline();
    let inp:Vec<_> = s.trim().split(' ').collect();
    let a = inp[0].chars().collect::<Vec<char>>();
    let b = inp[1].chars().collect::<Vec<char>>();
    let c = inp[2].chars().collect::<Vec<char>>();
    if a[a.len()-1] == b[0] && b[b.len()-1] == c[0] {
        println!("YES");
    }else{
        println!("NO");
    }
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main(){
  int a,b,c;cin>>a>>b>>c;
  int ans=3;
  if(a==b&&b==c)ans=1;
  else if(a==b||b==c||c==a)
    ans=2;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
//http://codeforces.com/blog/entry/5514
#include<queue>
#include<map>
#include <string>
#include<bits/stdc++.h>
#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);
//#define x real()
//#define y imag()
using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
//typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
ll ans;
string s,t,f;
 main()
{

//cout<<Pow((ll)1000000,(ll)110);
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
//    char input[15];
//    scanf("%s", &input);  array of char
//  gets(c+1);  array of char
//printf("%s, ",name[k[i]].c_str());  printf of string
input;

cin>>s;
int n=s.size();
ll c=0;
for(int i=0;i<n;)
{
    if(s[i]=='A')c++,i++;
    else if(i+1<n&&s[i]=='B'&&s[i+1]=='C')ans+=c,i+=2;
    else c=0,i++;
}

cout<<ans;

return 0;
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5+7;
const int maxm = 2e5+7;
const ll mod = 998244353;

int n,m,ar[maxn];
struct node{
    ll b,l,r;
    ll cmp;
    bool operator < (const node& n)const{
        return cmp>n.cmp;
    }
    void prin(){
        cout << b << " " << l << " " << r << "\n";
    }
}no[maxn];
bool che(ll x){
    int mark=0;
    ll a = x/m, b = x%m;
    ll all1=0, all2=0;
    for(int i=1;i<=n;i++){
        if(i<=a+1){
            all1 += (m-no[i].b)*no[i].r;
        }
        else{
            all1 -= no[i].b*no[i].l;
        }
        if(i<=a){
            all2 += (m-no[i].b)*no[i].r;
        }
        else{
            all2 -= no[i].b*no[i].l;
        }
    }
    for(int i=1;i<=n;i++){
        if(i<=a+1){
            ll now = all1 - (m-no[i].b)*no[i].r;
            now += max((b-no[i].b)*no[i].l, (b-no[i].b)*no[i].r);
            if(now>=0){
                //if(mark==x)cout<<"makr = "<< i<<" "<<now<<" "<<all1<<endl;
                return 1;
            }
        }
        else{
            ll now = all2 + no[i].b*no[i].l;
            now += max((b-no[i].b)*no[i].l, (b-no[i].b)*no[i].r);
            if(now>=0){
                //if(mark==x)cout<<"mark = "<< i<<" "<<now<<" "<<all1<<endl;
                return 1;
            }
        }
    }
    return 0;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
        scanf("%lld%lld%lld", &no[i].b, &no[i].l, &no[i].r);
        no[i].cmp = no[i].r*(m-no[i].b) + no[i].l*no[i].b;
    }
    sort(no+1, no+n+1);
    //for(int i=1;i<=n;i++)no[i].prin();
    ll l=0,r=1LL * m * n;
    while(l<r){
        ll mid = l+r>>1;
        if(che(mid))r=mid;
        else l=mid+1;
    }
    printf("%lld\n", l);
    return 0;
}


Measured memory_bytes: 4352
s = input()
s_len = len(s)
s_reversed = s[::-1]
s_before = s[0:(s_len - 1) // 2:]
s_before_reversed = s_before[::-1]
s_after = s[((s_len + 3) // 2 - 1) : s_len:]
s_after_reversed = s_after[::-1]
if s == s_reversed and s_before == s_before_reversed and s_after == s_after_reversed:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<cstdint>
#include<vector>
#include<map>
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;

ll nCr(ll n, ll r) {
	if (r > n) { return 0; }
	if (r * 2 > n) r = n - r;
	ll dividend = 1;
	ll divisor = 1;
	for (ll i = 1; i <= r; ++i) {
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}
ll sumdigit(ll n) {
	ll dig = 0, sum = 0;
	while (n) {
		dig = n % 10;
		sum = sum + dig;
		n = n / 10;
	}
	return sum;
}



int main() {
	int a, b;
	std::cin >> a >> b;
	if (a%b == 0) {
		std::cout << 0 << std::endl;
	}
	else {
		std::cout << 1 << std::endl;
	}
}

Measured memory_bytes: 256
def e_virus_tree_2(N, K, Edges, MOD=10**9 + 7):
    # 参考: https://atcoder.jp/contests/abc133/submissions/6306104
    import sys
    sys.setrecursionlimit(10**6)

    class Permutation(object):
        # 参考: https://harigami.net/contents?id=5f169f85-5707-4137-87a5-f0068749d9bb
        __slots__ = ["mod", "factorial", "inverse"]

        def __init__(self, max_n: int = 10**6, mod: int = 10**9 + 7):
            fac, inv = [1], []
            fac_append, inv_append = fac.append, inv.append

            for i in range(1, max_n + 1):
                fac_append(fac[-1] * i % mod)

            inv_append(pow(fac[-1], mod - 2, mod))

            for i in range(max_n, 0, -1):
                inv_append(inv[-1] * i % mod)

            self.mod, self.factorial, self.inverse = mod, fac, inv[::-1]

        def permutation(self, n, r):
            if r < 0 or n < r:
                return 0
            return self.factorial[n] * self.inverse[n - r] % self.mod

    tree = [[] for _ in range(N)]
    for a, b in Edges:
        tree[b - 1].append(a - 1)
        tree[a - 1].append(b - 1)
    perm = Permutation(K).permutation

    def dfs(current, parent):
        # currentが根なら、根自身とその子達にK色から選んで色を塗る
        # 違うなら、currentの子達に(currentとその親の色以外の)K-2色から選んで色を塗る
        # 式中で ±1 をするのは、無向木の根でないcurrentに対して
        # tree[current]の要素に必ずparentも含まれているため
        ret = (perm(K, len(tree[current]) + 1) if parent == -1
               else perm(K - 2, len(tree[current]) - 1))

        for child in tree[current]:
            if child == parent:
                continue
            ret *= dfs(child, current)
            ret %= MOD
        return ret
    return dfs(0, -1)

N, K = [int(i) for i in input().split()]
Edges = [[int(i) for i in input().split()] for j in range(N - 1)]
print(e_virus_tree_2(N, K, Edges))

Measured memory_bytes: 120660
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define PI 3.141592653589793238
#define int long long
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<int, int, hash<int>> ht; // while using, comment #define int long long  */

void __print(int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
using namespace std;
#define MAX 200000
multiset<int> kind[MAX+1]; // kind[i] has multiset representing kg i
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    	freopen("in2.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    #endif

	int T=1;
	//cin >> T;
	FOR1(tp, T)
	{
		//cout << "Case #" << tp << ": ";
		int s, w; cin >> s >> w;
		if(w >= s) cout << "unsafe";
		else cout << "safe";
		cout << '\n';
	}
	return 0;
}


Measured memory_bytes: 12964
N, K = map(int,input().split())

import math

p_k = 0


if N >= K:
    p_N = (N - (K-1))/ N

    for n in range(1, K):
        i = math.ceil(math.log(K/n, 2))
        p_n = (1/N) * ((1/2) ** i)
        p_k += p_n

else:
    p_N = 0

    for n in range(1, N+1):
        i = math.ceil(math.log(K/n, 2))
        p_n = (1/N) * ((1/2) ** i)
        p_k += p_n


p = p_k + p_N
print(p)


Measured memory_bytes: 3188
n, m, c = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for _ in range(n):
  b = list(map(int, input().split()))
  sum = 0
  for i in range(len(a)):
    sum += a[i] * b[i]
  if sum + c > 0:
    count += 1
print(count)

Measured memory_bytes: 3064
package main

import (
	"bufio"
	"os"
	"fmt"
	"strings"
	"strconv"
)

func sum(n []string) (c int) {
	c = 0
	for _, x := range(n) {
		y, _ := strconv.Atoi(x)
		c += y
	}
	return
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	for {
		scanner.Scan()
		s := scanner.Text()
		if s == "0" {
			break
		}
		fmt.Println(sum(strings.Split(s, "")))
	}
}



Measured memory_bytes: 1144
class UnionFind:
    __slots__ = ["N", "root", "rank"]

    def __init__(self, N):
        """
        N:要素数
        root:各要素の親要素の番号を格納するリスト.
             ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.
        rank:ランク
        """
        self.N = N
        self.root = [-1] * N

    def __repr__(self):
        return "\n".join("{}: {}".format(r, self.members(r)) for r in self.roots())

    def find(self, x):
        """頂点xの根を見つける"""
        while self.root[x] >= 0:
            x = self.root[x]
        return x

    def union(self, x, y):
        """x, yが属する木をunion"""
        # 根を比較する
        # すでに同じ木に属していた場合は何もしない.
        # 違う木に属していた場合はrankを見てくっつける方を決める.
        # rankが同じ時はrankを1増やす
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        elif self.root[y] < self.root[x]:
            x, y = y, x
        self.root[x] += self.root[y]
        self.root[y] = x

    def same(self, x, y):
        """xとyが同じグループに属するかどうか"""
        return self.find(x) == self.find(y)

    def count(self, x):
        """頂点xが属する木のサイズを返す"""
        return -self.root[self.find(x)]

    def members(self, x):
        """xが属する木の要素を列挙"""
        _root = self.find(x)
        return [i for i in range(self.N) if self.find == _root]

    def roots(self):
        """森の根を列挙"""
        return [i for i, x in enumerate(self.root) if x < 0]

    def group_count(self):
        """連結成分の数"""
        return len(self.roots())

    def all_group_members(self):
        """{ルート要素: [そのグループに含まれる要素のリスト], ...}の辞書を返す"""
        return {r: self.members(r) for r in self.roots()}


def main():
    import sys
    input = sys.stdin.readline

    n, q = map(int, input().split())
    uf = UnionFind(n)
    res = []
    for i in range(q):
        t, u, v = map(int, input().split())
        if t:
            res.append(int(uf.same(u, v)))
        else:
            uf.union(u, v)
    print("\n".join(map(str, res)))


if __name__ == "__main__":
    main()


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

int main() {
  int A, B, C, D;
  scanf("%d%d%d%d", &A, &B, &C, &D);

  const int lower = max(A, C);
  const int upper = min(B, D);

  printf("%d", max(0, upper - lower));
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

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

int main() {
    int N, X, x;
    cin >> N >> X;
    cin >> x;
    int ans = abs(X - x);
    REP(i, N - 1) {
        cin >> x;
        ans = gcd(ans, abs(X - x));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
	String a = sc.next();
	String b = sc.next();
	String c = sc.next();
	System.out.println("A" + b.charAt(0) + "C");
	}
}

Measured memory_bytes: 21588
use std::io;
use std::collections::HashMap;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).expect("");
    let iter = buf.split_whitespace();
    let mut v: Vec<T> = Vec::new();
    for i in iter {
        v.push(i.parse().ok().unwrap());
    }
    v
}

fn main() {
    let mut map:HashMap<u64, u64> = HashMap::new();
    let n:u64 = procon_read()[0];
    let a:Vec<u64> = procon_read();
    let mut sum:u64 = 0;
    for i in a {
        match map.insert(i, 1) {
            Some(n) => {
                map.insert(i, n+1);
            },
            _ => (),
        }
        sum += i;
    }
    let q:u64 = procon_read()[0];
    let mut s:Vec<u64> = Vec::new();
    
    for i in 0..q {
        let bc:Vec<u64> = procon_read();
        match map.insert(bc[0], 1) {
            Some(n) => {
                for j in 0..n {
                    sum = sum - bc[0] + bc[1];
                }
                map.remove(&bc[0]);
                let m = match map.insert(bc[1], n) {
                    Some(k) => k,
                    None => 0,
                };
                map.insert(bc[1], m+n);
            },
            None => {
                map.remove(&bc[0]);
                ()
            },
        }
        s.push(sum);
    }
    
    for i in s {
        println!("{}", i);
    }
}

Measured memory_bytes: 7260
/*
  AOJ 2321
  Title:Butterflies
  @kankichi573
*/
#include <stdio.h>
#include <string.h>

#define max(x,y) (((x)>(y))?(x):(y))

int N,M;
short schedule[100];
int sat[100];
int min_dat[100];


solve2(short schd,int guy)
{
  int i,ret1,ret2;

  if(guy==N)
    return(0);

  if(!(schd & schedule[guy]))
    {
       ret1=sat[guy]+solve2(schd|schedule[guy],guy+1);
    }
  else
    ret1=0;
  ret2=solve2(schd,guy+1);
  return(max(ret1,ret2));
}


int solve()
{
  int ret;
  short schd=0;
  
  ret=solve2(schd,0);
  return(ret);
}

main()
{
  int i,j,k,s,e,ret;
  while(scanf("%d",&N)  && (N   ))
    {
      memset(schedule,0,sizeof(schedule));
      for(i=0;i<N;i++)
	{
	  scanf("%d %d",&M,&sat[i]);
	  for(j=0;j<M;j++)
	    {
	      scanf("%d %d",&s,&e);
	      for(k=s-6;k<e-6;k++)
		schedule[i]|=(1<<k);
	    }
	}
      ret=solve();
      printf("%d\n",ret);
    }
  return(0);
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    int n;cin>>n;
    int cot=n;
    if(n==1){
        std::cout << 1 << std::endl;
    }else{
        n/=1.08;
        n--;
        bool ok=0;
        while(int(n*1.08)<=cot){
            if(int(n*1.08)==cot){
                ok=1;break;
            }
            n++;
        }
        if(ok){
            cout<<n<<endl;
        }else{
            cout<<":("<<endl;
        }
    }
    return 0;
}

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

int n,k;
int in[101];

int calc() {
    int ans = 0;
    for(int i=0; i+k<=n; ++i) {
        int tmp = 1;
        for(int j=0; j<k; ++j)
            tmp *= in[i+j];
        ans = max(ans,tmp);
    }
    return ans;
}

int main() {
    while(cin>>n>>k, n|k) {
        for(int i=0; i<n; ++i) cin>>in[i];
        int ck = calc(),ans = 0;
        for(int i=0; i<n; ++i) 
            for(int j=0; j<i; ++j) {
                swap(in[i],in[j]);
                int t = calc();
                if(t >= ck) ans = max(ans, t);
                swap(in[i],in[j]);
            }
        if(ans == 0) cout<<"NO GAME"<<endl;
        else cout<<ans-ck<<endl;
    }
}

Measured memory_bytes: 868
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef long double ld;
typedef vector<ll>VI;
typedef pair<int,int>P;
#define VV(T) vector<vector<T>>
#define sz(x) int(x.size())
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i,n) for (ll i=(ll)n-1;i>=0;i--)
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX6 1001001//6
#define MAX7 10010010//7
#define SENTINEL 2000000000//9
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define CLR(mat) memset(mat, 0, sizeof(mat))
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}//最大公約数
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}//最小公倍数
template<class T> bool contain(const std::string& s, const T& v) {
   return s.find(v) != std::string::npos;
}
const int MOD = 998244353;
inline ll mod_add(ll a,ll b){return (a+b)%MOD;}
inline ll mod_sub(ll a,ll b){return (a+MOD-b)%MOD;}
inline ll mod_mul(ll a,ll b){return ((a%MOD)*(b%MOD))%MOD;}
inline ll mod_pow(ll x,ll n,ll mod=(ll)MOD){ll res=1;while(n>0){
if(n&1)res=res*x%mod;
x=x*x%mod;n>>=1;}return res;}
inline ll mod_inv(ll x){return mod_pow(x,MOD-2);}
inline ll mod_div(ll a, ll b){return mod_mul(a,mod_inv(b));}
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17
//push_back -> emplace_back

int n;
int main(){
   cin>>n;
   int k=-1;
   for(int i=1;i*i<2*n;i++){
      if(i*(i+1)==2*n){
         k=i;
         break;
      }
   }
   if(k==-1){
      cout<<"No"<<endl;
      return 0;
   }
   cout<<"Yes"<<endl;
   cout<<k+1<<endl;
   vector<set<int> > ans(k+1);
   int num=1;
   rep(i,k+1){
      for(int j=0;j<k-i;j++)ans[i].insert(num),num++;
   }
   num=1;
   rep(i,k+1){
      for(int j=i+1;j<k+1;j++){
         ans[j].insert(num),num++;
      }
   }
   rep(i,k+1){
      cout<<k<<" ";
      for(auto v:ans[i])cout<<v<<" ";
      cout<<endl;
   }
}

Measured memory_bytes: 12884
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
#include <cstdio>
#include <complex>
#include <cstring>

using namespace std;

const int N = 500000 + 5;
const int C = 26;

int n, m;
int root, tot;
int ch[N][C];
char s[N];
int p[N + N];
int ans[N];
vector<pair<int, int>> vec[N];

int getp(int u)
{
    return p[u] == u ? u : p[u] = getp(p[u]);
}

void merge(int u, int v)
{
    int pv = getp(v + N);
    int pu = getp(u + N);
    p[pv] = pu;

    for(int i = 0; i < C; ++ i) {
        if (ch[v][i] == 0) continue;
        if (ch[u][i] == 0) {
            ch[u][i] = ch[v][i];
        } else {
            merge(ch[u][i], ch[v][i]);
        }
    }
}

void solve()
{
    scanf("%s", s);
    n = strlen(s);
    cin >> m;
    for(int i = 0; i < m; ++ i) {
        int l, r;
        scanf("%d%d", &l, &r);
        --l, --r;
        vec[r].push_back(make_pair(l, i));
    }

    tot = 1;
    root = tot ++;

    for(int i = 0; i < N + N; ++ i) {
        p[i] = i;
    }

    for(int i = 0; i < n; ++ i) {
        int c = s[i] - 'a';
        int nroot = tot ++;
        ch[nroot][c] = root;
        p[i] = root + N;

        for(int cur = c; cur < C; ++ cur) {
            int t = ch[ch[nroot][cur]][cur];
            if (t == 0) break;
            ch[ch[nroot][cur]][cur] = 0;

            if (cur == C - 1) {
                if (t) {
                    merge(nroot, t);
                }
            } else {
                if (t) {
                    ch[nroot][cur + 1] = t;
                }
            }
        }

        for(auto l: vec[i]) {
            int tmp = getp(l.first) - N;
            ans[l.second] = (tmp == nroot);
        }

        root = nroot;
    }

    for(int i = 0; i < m; ++ i) {
        if (ans[i]) puts("Yes");
        else puts("No");
    }
}

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


Measured memory_bytes: 72192
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<map>
#include<string>
#include<numeric>
#include<set>
using namespace std;

long long euclid(long long m, long long n){
  long long m1 = m, n1 = n, tmp = 0;

  while(n1 != 0){
    tmp = n1;
    n1 = m1 % n1;
    m1 = tmp;
  }

  return m1;
}

long long lcm(long long m, long long n){
  return (m / euclid(m, n)) * n;
}

int main(){
    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    long long mother = b - a + 1;
    long long common = lcm(c, d);

    long long dividable = (b/c - (a-1)/c) + (b/d - (a-1)/d) - (b/common - (a-1)/common);

    cout << mother - dividable << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
using namespace std;
int main(void){
  int a,b,c;
  cin >> a >> b >> c;
  int ans= 0;
  if(b < a*c){
    ans = b/a;
  }else{
    ans = c;
  }
  cout << ans << endl;
}


Measured memory_bytes: 764
import java.util.Arrays;
import java.util.Scanner;

//import java.io.*;
 
//class Main{
//    public static void main(String[] args) throws Exception{
//        int x, ans;
//     
//        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//        x = Integer.parseInt(br.readLine());
//         
//        ans = x*x*x;
//        System.out.println(ans);
//    }
//}

//class Main {
//    public static void main(String[] arg)throws IOException{
//        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//        String str = br.readLine();
//        String[] div = str.split(" ");
//        int s =  Integer.parseInt(div[0]);
//        int l =  Integer.parseInt(div[1]);
//        System.out.println(s*l + " "+ 2*(s+l));
//    }   
//}

//import java.io.BufferedReader;
//import java.io.InputStreamReader;
//   
//public class Main{
//    public static void main(String args[])throws java.lang.Exception{
//        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//        String line = br.readLine();
//        //変数に配列を代入
//        int s =Integer.parseInt(line);
//        int h = s / 3600;
//        int m = (s % 3600) / 60;
//        s = s % 60;
//        System.out.println(h+":"+m+":"+s);
//         
//    }
//}

//import java.io.*;
//
//public class Main
//{
//	public static void main(String[] args) throws Exception
//	{
//		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//		String str = br.readLine();
//		String[] div = str.split(" ");
//		int a = Integer.parseInt(div[0]);
//		int b = Integer.parseInt(div[1]);
//		if (a > b)
//		{
//			System.out.println("a > b");
//		} else if (a == b) {
//			System.out.println("a == b");
//		} else {
//			System.out.println("a < b");
//		}
//	}
//}

//public class Main
//{
//	public static void main(String[] args) throws IOException {
//		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//		String str = br.readLine();
//		String[] div = str.split(" ");
//		int a = Integer.parseInt(div[0]);
//		int b = Integer.parseInt(div[1]);
//		int c = Integer.parseInt(div[2]);
//		if (a < b && b < c)
//		{
//			System.out.println("Yes");
//		}else{
//			System.out.println("No");
//		}
//	}
//}

public class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int first = sc.nextInt();
		int second = sc.nextInt();
		int third = sc.nextInt();
		
		int[] sort = {first, second, third};
		
		Arrays.sort(sort);
		
		System.out.println(sort[0] + " " + sort[1] + " " + sort[2]);
	}
}

Measured memory_bytes: 26216
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if(n ==1 ||n ==2 ||n == 3||n ==5 ||n == 6||n ==9 ||n ==10 ||n == 13||n ==17){
  cout << "No" <<endl;
}
else{
  cout << "Yes" <<endl;
  
}
}

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

int main() {
	int a, b;
	int result[2]; //面積と周の長さ

	cin >> a >> b;

	result[0] = a * b;
	result[1] = 2 * a + 2 * b;

	cout << result[0] << " ";
	cout << result[1] << endl;


	return 0;

}


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

int main() {
  uint64_t N;
  cin>>N;
  vector<uint64_t> v(5);
  rep(i,5) cin>>v[i];
  sort(v.begin(),v.end());
  cout<<(N+v[0]-1)/v[0]+4<<endl;
  return 0;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "12" ].parse.expand.solve == "Yes" );
	assert( [ "57" ].parse.expand.solve == "No" );
	assert( [ "148" ].parse.expand.solve == "No" );
}



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

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

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.strip.to!( dchar[] );
	return tuple( n );
}

auto solve( dchar[] n )
{
	auto x = n.to!( long );
	auto f = n.map!( ( a ) => a - '0' ).sum;
	
	return ( x % f == 0 ) ? "Yes" : "No";
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int S,A,B;
  scanf("%d",&S);
  A=S/100;
  B=S-A*100;
  if(A>12){
    if(B>12){
      printf("NA");
    }
    if(B<=12 && B>0){
      printf("YYMM");
    }
    if(B==0){
      printf("NA");
    }
  }
  if(A<=12 && A>0){
    if(B>12){
      printf("MMYY");
    }
    if(B<=12 && B>0){
      printf("AMBIGUOUS");
    }
     if(B==0){
      printf("MMYY");
    }
  }
  if(A==0){
    if(B==0 || B>12){
      printf("NA");
    }
    if(B<=12 && B>0){
      printf("YYMM");
    }
  }
  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#define PB push_back
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
template <class T> inline void cmin(T &x,T y) { if(y<x) x=y; }
template <class T> inline void cmax(T &x,T y) { if(x<y) x=y; }
const ll inf=1e16;
int S,T,ncnt;
namespace Flow {
	const int N=410;
	int head[N],cur[N];
	ll dis[N];
	struct ed { int to,next,f; ll w; };
	vector<ed> e;
	void init() { memset(head,-1,sizeof(head)),e.clear(); }
	void ad(int x,int y,int f,ll w) {
		e.PB((ed){y,head[x],f,w}); head[x]=e.size()-1;
		e.PB((ed){x,head[y],0,-w}); head[y]=e.size()-1;
	}
	queue<int> que;
	int vis[N];
	bool bfs() {
		for(int i=1;i<=ncnt;++i) dis[i]=-inf,cur[i]=head[i];
		dis[S]=0,vis[S]=1,que.push(S);
		while(!que.empty()) {
			int u=que.front(); que.pop(),vis[u]=0;
			for(int k=head[u];~k;k=e[k].next) if(e[k].f) {
				int v=e[k].to;
				if(dis[v]<dis[u]+e[k].w) {
					dis[v]=dis[u]+e[k].w;
					if(!vis[v]) vis[v]=1,que.push(v);
				}
			}
		}
		return dis[T]>-inf;
	}
	int dfs(int u,int f) {
		if(u==T||!f) return f; int ret=0,tmp;
		vis[u]=1;
		for(int &k=cur[u];~k;k=e[k].next) if(e[k].f) {
			int v=e[k].to;
			if(!vis[v]&&dis[v]==dis[u]+e[k].w&&(tmp=dfs(v,min(f,e[k].f)))) {
				e[k].f-=tmp,e[k^1].f+=tmp;
				f-=tmp,ret+=tmp;
				if(!f) break;
			}
		}
		vis[u]=0;
		return ret;
	}
	ll work() { ll ans=0; while(bfs()) ans+=dfs(S,1e9)*dis[T]; return ans; }
}
const int N=110;
const int M=410;
char ss[M],str[10];
int a[M],b[M];
int xi[N],yi[N],n,m;
int lbx[N],rbx[N],lby[N],rby[N];
int idx[N],idy[N];
ll vi[N];
ll sol(int K) {
	for(int i=1;i<=K;++i)
		lbx[i]=lby[i]=1,
		rbx[i]=rby[i]=100;
	for(int i=1;i<=m;++i) {
		if(b[i]>K) continue;
		if(ss[i]=='L') cmax(lbx[b[i]+1],a[i]+1);
		else if(ss[i]=='R') cmin(rbx[K-b[i]],a[i]-1);
		else if(ss[i]=='D') cmax(lby[b[i]+1],a[i]+1);
		else cmin(rby[K-b[i]],a[i]-1);
	}
	for(int i=2;i<=K;++i)
		cmax(lbx[i],lbx[i-1]),
		cmax(lby[i],lby[i-1]);
	for(int i=K-1;i>=1;--i)
		cmin(rbx[i],rbx[i+1]),
		cmin(rby[i],rby[i+1]);
	
	for(int i=1;i<=K;++i) if(lbx[i]>rbx[i]||lby[i]>rby[i]) return 0;
//	for(int i=1;i<=K;++i) printf("%d %d %d %d\n",lbx[i],rbx[i],lby[i],rby[i]);
	ncnt=0; Flow::init();
	S=++ncnt,T=++ncnt;
	for(int i=1;i<=100;++i) idx[i]=++ncnt,idy[i]=++ncnt;
	for(int i=1;i<=K;++i) {
		int u=++ncnt;
		Flow::ad(S,u,1,0);
		for(int j=lbx[i];j<=rbx[i];++j)
			Flow::ad(u,idx[j],1,0);
	}
	for(int i=1;i<=K;++i) {
		int u=++ncnt;
		Flow::ad(u,T,1,0);
		for(int j=lby[i];j<=rby[i];++j)
			Flow::ad(idy[j],u,1,0);
	}
	for(int i=1;i<=n;++i)
		Flow::ad(idx[xi[i]],idy[yi[i]],1,vi[i]);
	return Flow::work();
}
	
	
int main() {
	rd(n);
	for(int i=1;i<=n;++i) rd(xi[i]),rd(yi[i]),rd(vi[i]);
	rd(m);
	for(int i=1;i<=m;++i) {
		scanf("%s",str);
		ss[i]=str[0];
		rd(a[i]),rd(b[i]);
	}
	ll ans=0;
	for(int i=1;i<=n;++i) ans=max(ans,sol(i));
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1276
/*
Program
Written by "Vaibhav" aka 'ZodiacBestro'
In 2017
*/

#include <bits/stdc++.h>

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define eps 1e-9
#define fast_cin ios_base::sync_with_stdio(false)

typedef long long ll;
typedef pair<int,int> pii;

const ll MOD = 1e9+7;
const ll MAXN = 1e6+5;

ll dp[MAXN],dp1[MAXN];

ll lucas(int n){

	ll a = 2, b = 1, c, i;
 
    if (n == 0)
        return a;

    for (i = 2; i <= n; i++)
    {
        c = a + b;
        a = b;
        b = c;
    }
    return b;
}

int main()
{
	fast_cin; cin.tie(NULL); cin.tie(NULL);
	int n;
	cin >> n;
	cout << lucas(n) << endl;
	return 0;
}


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

int main(void){
    int n;
	int x;
	cin >> n;
	for (int i = 1; i <= n ; i = i + 1)
	{
		if ( i % 3 == 0 )
		{
			cout << " " << i;
			//cout << "(" << i << ")";
		}
		else
		{
			if  ( i % 10 == 3 )
			{
				cout << " " << i;
				//cout << "[" << i << "]";
			}
			else
			{
				x = i;
				x = x / 10;
				while (x)
				{
					if ( x % 10 == 3 )
					{
						cout << " " << i;
						//cout << "<" << i << ">";
						x = 0;
					}
					x = x / 10;
				}
			}
			
		}
		
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 3072
import sys
s=input()
n=len(s)

for i in range(int((n-1)/2)):
    if s[i] != s[-(i+1)]:
        print("No")
        sys.exit()
        
tmps=s[:int((n-1)/2)]
for i in range(len(tmps)//2):
    if tmps[i] != tmps[-(i+1)]:
        print("No")
        sys.exit()
    

if s[:int((n-1)/2)] != s[int((n+3)/2-1):]:
    print("No")
    sys.exit()




print("Yes")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vd=vector<double>;
using vvd=vector<vd>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using vs=vector<string>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.141592653589793

template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	string s,t;
	vi x,y;
	map<int,int> a;
	cin>>s>>t;
	rep(i,s.size()){
	    if(a.find(s[i])==a.end()) a[s[i]]=a.size();
	    x.push_back(a[s[i]]);
	}
	a.clear();
	rep(i,t.size()){
	    if(a.find(t[i])==a.end()) a[t[i]]=a.size();
	    y.push_back(a[t[i]]);
	}
    if(x==y)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 2956
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>

using namespace std;

const ll N = 4e5+100;
const ll MOD = 1e9+7;
string s,t;
ll tree[N];

void build(ll node,ll l,ll r)
{
	if(l==r)
	{
		tree[node] = (s[l-1] == t[r-1]);
	}
	else
	{
		ll mid = (l + r) >> 1LL;
		build(node*2,l,mid);
		build(2*node+1,mid+1,r);
		tree[node] = tree[node*2] + tree[node*2+1];
	}
}

ll query(ll node,ll st,ll en,ll l,ll r)
{
	if(r < st || l> en) return 0;
	if(st >= l && en <= r) return tree[node];
	ll mid = (st + en)/2;
	ll p1 = query(node*2,st,mid,l,r);
	ll p2 = query(node*2+1,mid+1,en,l,r);
	return p1 + p2;
}

ll pre[N];
ll pr2[N];
int main()
{
	ll n,m;
	cin >> n >>m;
	ll a[n+1],b[m+1];

	for(int i =1;i<=n;i++) cin >>a[i-1];
	for(int i =1;i<=m;i++) cin >> b[i-1];

	ll co = 0,co2 = 0;

	for(int i =0;i<(n-1);i++)
	{
		ll x = i+1;
		co = co + ((a[i+1]- a[i]) * (x) * (n-x));
		if(co < MOD) co+=MOD;
		co%=MOD;
	}

	for(int i =0;i<(m-1);i++)
	{
		ll x = i+1;
		co2 = co2 + ((b[i+1]- b[i]) * (x) * (m-x));
		if(co2 < MOD) co2+=MOD;
		co2%=MOD;
	} 
	 		
	 cout << (co*co2) %MOD << endl;
	
	return 0;
}

Measured memory_bytes: 1792
n,k = STDIN.gets.split.map(&:to_i)
input = STDIN.gets.strip.split('')
candidates = []
input.each.with_index do |str, i|
  if i == 0 || input[i-1] != input[i]
    candidates.push [str, i]
  end
end

max = 0
0.upto(candidates.length - 1) do |i|
  len = candidates[i][0] == '0' ? k*2 : k*2+1
  from = candidates[i][1]
  to = (candidates[i+len] || [nil, n])[1]
  max = [max, to - from].max
end
puts max


Measured memory_bytes: 16124
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <functional>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
//#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#define dump(val)

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    vector<ll> t(N), d(N);
    REP(i, 0, N) {
        cin >> t[i] >> d[i];
        t[i]--;
    }

    vector<int> indices(N);
    REP(i, 0, N) {
        indices[i] = i;
    }

    sort(rbegin(indices), rend(indices), [&](int a, int b) -> bool {
        return d[a] < d[b];
    });

    priority_queue<ll, vector<ll>, greater<ll>> num;
    vector<int> usedType(N, 0);
    vector<bool> used(N, false);
    ll ans = 0;

    REP(i, 0, N) {
        int index = indices[i];
        if (usedType[t[index]]) continue;
        usedType[t[index]] = 1;
        used[index] = true;
        num.emplace(d[index]);
        ans += d[index];
        if (num.size() >= K) break;
    }

    const ll inf = 1 << 30;
    while (num.size() < K) {
        num.emplace(-inf);
    }

    ll T = K;
    dump(ans);
    REP(i, 0, N) {
        int index = indices[i];
        ll cnum = d[index];
        if (!usedType[t[index]]) {
            continue;
        }
        if (used[index]) continue;
        ll n = num.top();
        dump(cnum);
        if (n < cnum - 2 * T + 1) {
            num.emplace(cnum);
            T--;
            ans += cnum;
            if (n != -inf) {
                ans -= n;
            }
        }
        num.pop();
    }
    dump(ans);

    cout << ans + T * T << endl;

    return 0;
}


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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  ll n;cin>>n;
  if(n%2==1){
    cout<<0<<endl;
  }else{
    ll ans = 0;
    ll cnt=0;
    while(1){
      ll piv = pow(5, cnt) * 10;
      if(piv>n)break;
      ans += (n / piv);
      cnt++;
    }
    cout<<ans<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll unsigned long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int mod = 1e9 + 7;
int main()
{
	SPEED
	string s;
	cin >> s;

	if (s[0] == 'A' && s[1] == 'A' && s[2] == 'A')
	{
		cout << "No";
	}
	else if (s[0] == 'B' && s[1] == 'B' && s[2] == 'B')
	{
		cout << "No";
	}
	else
	{
		cout << "Yes";
	}
	
	return 0;
}

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

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

    int n, input;
    vector<int> vi1, vi2;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> input;
        vi1.push_back(input);
        vi2.push_back(input);
    }

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

    int count = 0;
    for (int i = 0; i < n; i++) {
        if (vi1[i] != vi2[i])
            count++;
    }

    if (count <= 2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 256
//#define NDEBUG
 
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <cassert>
#include <unistd.h>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <random>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
const int MN = 50500; 
const int MD = 1000003;

int n, m;
P g[MN];
vector<P> edge;
int calc(int l, int r) {
    ll res = 1;
    while (l <= r) {
        P p = g[l];
        l = p.first+1;
        res *= p.second; res %= MD;
    }
    return res;
}
int solve() {
    if (n % 2) return 0;
    edge.clear();
    for (int i = 0; i < n-1; i++) {
        g[i] = P(i+1, 1);
    }
    vector<T> buf;
    buf.push_back(T(n-1, 0, n-1));
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d %d", &a, &b); a--; b--;
        if (a > b) swap(a, b);
        if ((b-a) % 2 == 0) continue;
        buf.push_back(T(b-a, a, b));
    }
    sort(buf.begin(), buf.end());
    for (T &t: buf) {
        int a, b, c;
        tie(c, a, b) = t;
        int res = calc(a, b) + calc(a+1, b-1);
        res %= MD;
        g[a] = P(b, res);
    }
    return g[0].second;
}

int main() {
    while (true) {
        scanf("%d %d", &n, &m);
        if (!n) break;
        printf("%d\n", solve());
    }
}

Measured memory_bytes: 2040