akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define int long long
using namespace std;
using P=pair<int,int>;
using Graph=vector<vector<int>>;
using ll=long long;


ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
bool root(string s){
    int n=s.length();
    if(n==2){
        if(s[0]==s[1]){
            return true;
        }
        else return false;
    }
    if(n==3){
        if(s[0]==s[2]){
            return true;
        }
        else return false;
    }
 
    return false;
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

//深さ優先
vector<int> seen;
vector<ll> h;
 
//普通の深さ優先探索seenを返す感じ
void dfs(const Graph &G,int v){

    seen[v] = 0; //v探索済み
 
    P good=make_pair(v,h[v]);
    for(auto next_v :G[v]){
        if(seen[next_v]!=-1) continue;//もう探索していた
        if(h[next_v]>good.second){
            good=make_pair(next_v,h[next_v]);
        }
        dfs(G,next_v);
    }
 
    if(!(h[v]==good.second && v==good.first)){
        seen[good.first]=1;
    }
}


int n;

void dfs(string s, char mx){
    if(s.length()==n){
        cout<<s<<endl;
    }else{
        for(char c='a';c<=mx;c++){
            dfs(s+c,((c==mx) ? (char)(mx+1) : mx));
        }
    }
}


signed main(){ 
    string n; cin>>n;
    int len = n.length();

    if(n[len-1]=='3'){
        cout<<"bon"<<endl;
    }else if(n[len-1]=='0'||n[len-1]=='1'||n[len-1]=='6'||n[len-1]=='8'){
        cout<<"pon"<<endl;
    }else{
        cout<<"hon"<<endl;
    }
}  

Measured memory_bytes: 3724
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] a = new int[n];
		Set<Integer> set = new HashSet<>();
		boolean f  = true;
		for(int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
			if(set.contains(a[i])) {
				f = false;
				break;
			}
			set.add(a[i]);
		}
		if(f) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		

	}

}

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

using ll = long long;
#define REP(i,n) for(int i = 0;i < n;i++)

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

  int x;cin >> x;
  if(x >= 30)cout << "Yes" << '\n';
  else cout << "No" << '\n';

}


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

int main (){
  int n,x,s;
  cin >>n >>x;
  s=0;
  vector<int> m(n);
  for(int i=0;i<n;i++){
    cin >>m.at(i);
    s+=m.at(i);
  }
  sort(m.begin(),m.end());
  cout <<n+(x-s)/m.at(0) <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N;
	lint A, B;
	cin >> N >> A >> B;

	vector<lint> data(N);
	lint ans = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> data[i];
	}

	for (int i = 1; i < N; i++)
	{
		ans += min(A * (data[i] - data[i - 1]), B);
	}

	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10**6)

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

par = [i for i in range(N+1)]

# 木の根を求める
def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return par[x]

# xとyが同じ集合に属するか否か
def bool_same(x,y):
    return root(x) == root(y)

# xとyの属する集合を併合
def unite(x,y):
    x = root(x)
    y = root(y)
    if x != y:
        par[x] = y

AB = [list(map(int,input().split())) for i in range(M)]
CD = [list(map(int,input().split())) for i in range(K)]

for i in range(M):
    a,b = AB[i]
    unite(a,b)

member = [0 for i in range(N+1)]

for i in range(1,N+1):
    member[root(i)] += 1

ans = [member[par[i]]-1 for i in range(N+1)]

for i in range(M):
    a,b = AB[i]
    if bool_same(a,b):
        ans[a] -= 1
        ans[b] -= 1

for i in range(K):
    c,d = CD[i]
    if bool_same(c,d):
        ans[c] -= 1
        ans[d] -= 1

print(*ans[1:])


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) {}

    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};


typedef pair<int, int> P;
typedef pair<ll, P> Edge; // <cost, (x,y)座標>


int main() {
    int N;
    cin >> N;
    vector<ll> x(N), y(N);
    rep(i, N) cin >> x[i] >> y[i];

    vector<Edge> edges;

    // x 軸方向にソートして隣接している部分のみの辺を使用する
    vector<P> xi(N);
    rep(i, N) xi[i].first = x[i], xi[i].second = i;
    sort(xi.begin(), xi.end());
    rep(i, N - 1) {
        int u = xi[i].second, v = xi[i + 1].second;
        edges.push_back(Edge{xi[i + 1].first - xi[i].first, P(u, v)});
    }

    // y 軸方向にソートして隣接している部分のみの辺を使用する
    vector<P> yi(N);
    rep(i, N) yi[i].first = y[i], yi[i].second = i;
    sort(yi.begin(), yi.end());
    rep(i, N - 1) {
        int u = yi[i].second, v = yi[i + 1].second;
        edges.push_back(Edge{yi[i + 1].first - yi[i].first, P(u, v)});
    }

    // Kruskal 法
    sort(edges.begin(), edges.end());
    UnionFind uf(N);
    ll ans = 0;
    for (auto e: edges) {
        int u = e.second.first, v = e.second.second;
        ll cost = e.first;
        if (uf.issame(u, v)) continue;
        uf.merge(u, v);
        ans += cost;
    }
    cout << ans << endl;
}

Measured memory_bytes: 9456
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        int result = 0;
        for (int i = 0; i < n; i++) {
            String[] lr = scanner.nextLine().split(" ", 2);
            int l = Integer.parseInt(lr[0]);
            int r = Integer.parseInt(lr[1]);
            result += r - l + 1;
        }
        System.out.println(result);
    }
}


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

int main(){

    int n;
    int d[100];
    int res=1;
    cin >> n;
    for(int i=0; i<n; i++) cin >> d[i];

    sort(d, d+n);

    for(int i=0; i<n-1; i++){
        if(d[i] < d[i+1])
            res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 3576
#include <cstdio>
#include <iostream>
#include <string>
#include <queue>
using namespace std;

int K,T;
int a[105];

int main()
{
  cin >> K >> T;
  for (int i=0; i<T; ++i)
    cin >> a[i];
  a[T] = 0;
  int ans = 0;
  int last = -1;
  for (int i=0; i<K; ++i)
  {
    int mi = T;
    for (int i=0; i<T; ++i)
    {
      if (i==last)
        continue;
      if (a[i] > a[mi])
        mi = i;
    }
    if (mi == T)
      mi = last;
    if (mi==last)
      ++ans;
    a[mi]--;
    last = mi;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
package main

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

//=====I/O=====

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//=====main=====

func main() {
	sc.Split(bufio.ScanWords)

	n := scanInt()
	x := make([]int, n)
	y := make([]int, n)

	for i := 0; i < n; i++ {
		x[i], y[i] = scanInt(), scanInt()
	}

	ans := float64(0)

	c := 1

	for i := 0; i < n; i++ {
		c *= n-i
	}

	b := make([]int, n)
	for j := 0; j < n; j++ {
		b[j] = j
	}

	for i := 0; i < c; i++ {
		now := i
		a := make([]int, n)
		do := make([]int, n)
		done := make([]bool, n)

		for j := 0; j < n; j++ {
			do[n-1-j] = now%(j+1)
			now /= (j+1)
		}

		for j := 0; j < n; j++ {
			count := 0
			for k := 0; k < n; k++ {
				if done[k] {
					continue
				}
				if count == do[j] {
					a[j] = b[k]
					done[k] = true
					break
				} else {
					count++
				}
			}
		}

		// fmt.Println(a)

		for j := 0; j < n-1; j++ {
			ans += math.Sqrt(float64(dist(x[a[j]],y[a[j]],x[a[j+1]],y[a[j+1]])))
		}

	}

	fmt.Println(ans/float64(c))
}

func dist(x1,y1,x2,y2 int) int {
	return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)
}


Measured memory_bytes: 6016
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
 
int main() {
string A;
cin >> A;
int B;
B=A.size();
if(A.at(B-1)=='3'){cout << "bon" << endl;}else if(A.at(B-1)=='0' || A.at(B-1)=='1' || A.at(B-1)=='6' || A.at(B-1)=='8'){cout << "pon" << endl;}else{cout << "hon" << endl;}
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int 	
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("badhair.gir","r",stdin);freopen ("badhair.cik","w",stdout);
#define mod 1000000007
#define fs(x,y) for(ll i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(ll i=x;i<=y;i++)
#define INF 1000000000005
#define ull unsigned long long int
using namespace std;

ll n,m,ar[N],sum,t;

vector<int> ans;

int main()
{
	fast;
	cin>>m>>n;
	// cout<<endl;
	fs(ar,n);
	int flag=0;
	fo(i,1,n)
		if(ar[i]%2==1)
			flag++;
	if(flag>2)
		return cout<<"Impossible",0;
	if(ar[1]==1 && n==1)
	{
		cout<<1<<endl<<1<<endl<<1;
		return 0;
		// return cout<<1,0;
	}
	// sort(ar+1,ar+n+1);
	int k=1;
	fo(i,1,n)
	{
		if(ar[i]%2==1)
		{
			k=i+1;
			ans.pb(ar[i]);
			break;
		}
	}
	fo(i,1,n)
		if(ar[i]%2==0)
			ans.pb(ar[i]);
	fo(i,k,n)
		if(ar[i]%2==1)
			ans.pb(ar[i]);
	for(int i=0;i<ans.size();i++)
		cout<<ans[i]<<sp;

	cout<<endl;
	if(n==1)
		ans.pb(0);
	if(ans[0]-1<=0)
		t++;
	cout<<ans.size()-t<<endl;
	if(ans[0]-1>0)
	cout<<ans[0]-1<<sp;
	for(int i=1;i<ans.size()-1;i++)
		cout<<ans[i]<<sp;
	cout<<ans[ans.size()-1]+1;

}



/*     cd onedrive\desktop\kod
cls

Sinav:21-22 aralik
Aciklama: Muhtemelen 25 aralik
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF (1<<28)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long
/*
signed main(){
  int a,b;
  cin>>a>>b;
  if(a<=5) cout<<0<<endl;
  else if(a<=12) cout<<b/2<<endl;
  else cout<<b<<endl;
  return 0;
}
*/

signed main(){
  int r,d,x;
  cin>>r>>d>>x;
  lp(i,10){
    x=r*x-d;
    cout<<x<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<string>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#include<functional>
#include<cassert>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vint;
typedef vector<vint> vvint;

int main(void) {
	ll n;
	cin >> n;
	ll ans = n;
	int k=0;
	for (ll i = 1; i*i <= n;i++ ){
		if (n%i == 0) {
			ll a;
			a = n / i;
			if (a  + i - 2 < ans) {
				ans = a  + i - 2;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
	const int vmax=1e5+10;
	int n,a,b;
	int h[vmax];

bool check(int t){
		int num=0;
	for(int i=0;i<n;i++){
		if(h[i]<=t*b)continue;
		num+=(1+(h[i]-t*b-1)/(a-b));


//			if(num>t)return false;
	}
    return num<=t;
}


signed main(){
	cin>>n>>a>>b;

	for(int i=0;i<n;i++)cin>>h[i];
	int l=0ll,r=1e9;
	while(r-l>1){
	int m=(l+r)/2;
	if (check(m)){r=m;}
	else {l=m;}
	}
	cout<<r	<<endl;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, j, n) for (int i = j; i < (int)(n); i++)
#define brep(i, n) for (int i = n; i > 0; i--)
#define BREP(i, j, n) for(int i = n; i > j; i--)
#define TEST cout << "PASS" << endl
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 1e6 + 1e3 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793;

int main(){
    string s;
    cin >> s;
    int cnt = 0;
    for(int i = 0; i < int(s.size()); i++){
        int k = s[i] - 48;
        cnt += k;
        cnt %= 9;
    }
    if(cnt == 0) cout << "Yes" <<endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a, b; cin >> a >> b;
  string one, two;
  string t1 = to_string(a), t2 = to_string(b);
  for(int i=0; i<a; i++)
    one += t2;
  for(int i=0; i<b; i++)
    two += t1;
  if(one < two) cout << one;
  else		    cout << two;
  return 0;
}

Measured memory_bytes: 256
MOD = 10 ** 9 + 7
n = int(input())
a = list(map(lambda x: format(int(x), '060b')[::-1], input().split()))

ans = 0
onecount = [0 for i in range(60)]
zerocount = [0 for i in range(60)]
for i in range(n):
    for j in range(60):
        if a[i][j] == '1':
            onecount[j] += 1
        else:
            zerocount[j] += 1

for i in range(60):
    ans += ((2 ** i) * onecount[i] * zerocount[i] % MOD)
    ans %= MOD
print(ans)


Measured memory_bytes: 155372
from collections import deque

S = list(input())
Q = int(input())

S = deque(S)

Query = [list(input()) for i in range(Q)]

rev_cnt = 0

for i in range(Q):
    if Query[i][0] == "1":
        rev_cnt += 1
    else:
        if Query[i][2] == "1":
            if rev_cnt % 2 == 1:
                S.append(Query[i][4])
            else:
                S.appendleft(Query[i][4])
        else:
            if rev_cnt % 2 == 1:
                S.appendleft(Query[i][4])
            else:
                S.append(Query[i][4])

if rev_cnt % 2 == 1:
    while len(S) != 0:
        print(S.pop(), end="")
else:
    while len(S) != 0:
        print(S.popleft(), end="")


print()


Measured memory_bytes: 128540
#include<stdio.h>
int main(){
	int W,H,C;
	int w,h;
	scanf("%d %d %d",&W,&H,&C);
	w=W;
	h=H;
	
	for(;;){
		if(W<H){
			H=H-W;
		}else if(W>H){
			W=W-H;
		}else if(W==H){break;}
	}
	C=w/W*h/H*C;
	printf("%d\n",C);
	
	return 0;
}

Measured memory_bytes: 1860
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int N;
  cin >> N;
  vector<ll> T(N), A(N);
  ll tmpT = 1, tmpA = 1;
  rep(i, N) {
    cin >> T[i] >> A[i];
    ll tmp = max((tmpT + T[i] - 1) / T[i],
                 (tmpA + A[i] - 1) / A[i]);
    tmpT = tmp * T[i];
    tmpA = tmp * A[i];
  }
  cout << tmpT + tmpA << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <map>
#include<set>
#include <cmath>
#include <stack>
using namespace std;

const int LEN = 1000005;

struct pp {
	char s[100];
	int t;
};

struct pp Q[LEN+1];
int head, tail;

void enque(struct pp a) {
	Q[tail] = a;
	tail = (tail+1)%LEN;
}

struct pp a;
struct pp dequeue() {
	a = Q[head];
	head = (head +1)%LEN;
	return a;
}

int main() {
	int n, q;cin >> n >> q;
	for (int i = 1;i <= n;i++) {
		cin >> Q[i].s >> Q[i].t;
	}
	head = 1;tail = n + 1;
	int time=0;
	struct pp u;
	while (head != tail) {
		u = dequeue();
		time += min(q, u.t);
		u.t -= min(q, u.t);
		if (u.t <= 0)printf("%s %d\n",u.s, time);
		else enque(u);
	}
}


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

using namespace std;

int main()
{
  string A,B; cin>>A>>B;
  int N=A.size(), M=B.size();
  if (N>M){
    cout<<"GREATER"<<endl;
  }else if(N<M){
    cout<<"LESS\n"<<endl;
  }else if(A>B){
 	cout<<"GREATER"<<endl;
  }else if(A<B){
    cout<<"LESS"<<endl;
  }else{
    cout<<"EQUAL"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define forn(i, n) for (llong i = 0ll; i < (llong) n; ++i)
#define fornn(i, l, r) for (llong i = (llong) l; i < (llong) r; ++i)
#define size(x) ((int) (x.size()))
 
using namespace std;
 
typedef long long llong;
const llong inf = (llong) 1e+9 + 7ll;
const llong linf = (llong) 1e+18 + 7ll;
const long double eps = (long double) 1e-9;
const long double pi = acosl((long double) -1.0);
const int alph = 26;

mt19937 mrand(random_device{} ()); 

template<typename T, typename U> inline llong umin(const T& a, const U& b) { return a < b ? a : b; }
template<typename T, typename U> inline llong umax(const T& a, const U& b) { return a > b ? a : b; }
 
static char buff[(int) 2e6 + 17]; // reads std::string
const int maxn = (int) 3e5 + 17;

int n;
int a[maxn];

bool read()
{
	if (scanf("%d", &n) != 1)
		return false;

	forn (i, 3 * n)
		scanf("%d", a + i);

	return true;
}

void solve()
{
	set< pair<int, int> > left, right1, right2;
	llong lsum = 0, rsum = 0, ans = -linf;

	forn (i, n)
	{
		left.insert(make_pair(a[i], i));
		lsum += a[i];
	}

	for (int i = n; i < 3 * n; ++i)
		right2.insert(make_pair(a[i], i));

	for (; size(right2) > n; )
	{
		right1.insert(*right2.begin());
		rsum += right2.begin()->first;
		right2.erase(right2.begin());
	}

	for (int i = n; 3 * n - i >= n; ++i)
	{
		ans = max(ans, lsum - rsum);
		left.insert(make_pair(a[i], i));
		lsum += a[i];
		lsum -= left.begin()->first;
		left.erase(left.begin());

		if (i == 2 * n)
			break;

		right1.erase(make_pair(a[i], i));
		right2.erase(make_pair(a[i], i));

		if (size(right1) < n)
		{
			rsum -= a[i];
			rsum += right2.begin()->first;
			right1.insert(*right2.begin());
			right2.erase(right2.begin());
		}
	}

	printf("%lld\n", ans);
}

int main()
{
#if SEREZHKA
	freopen("file.in", "r", stdin);
#endif

	while (read())
		solve();

	return 0;
}


Measured memory_bytes: 15488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;cin >> a >> b;
	vector<int> c = {13,1,2,3,4,5,6,7,8,9,10,11,12};
	if(a == b) cout << "Draw" << endl;
	else if(c[a - 1] > c[b - 1]) cout << "Alice" << endl;
	else cout << "Bob" << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI acos(-1)
#define Mod (int)1000000007
#define INFTY (int)INT_MAX
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Part(vec, b, e) vec.begin() + b, vec.begin() + e
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define Find(vec, s) vec.find(s) != vec.end()
#define Set_union(A, B, res) set_union(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));
#define Set_intersection(A, B, res) set_intersection(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));
#define Set_difference(A, B, res) set_difference(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));
#define Set_symmetric_difference(A, B, res) set_symmetric_difference(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));

int main() {
	int N;
	cin >> N;
	vector<ll> A(N);
	Rep(i, N) cin >> A[i];
	vector<ll> op(N);
	for (int i = N - 2; i >= 0; i--) {
		op[i] = op[i + 1] + A[i + 1];
	}
	ll ans = 0;
	Rep(i, N - 1) {
		ans += op[i] % Mod * A[i] % Mod;
		ans %= Mod;
	}
	cout << ans << endl;
	return 0;
}

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

#define DB(x) cout<<#x<<"="<<x<<endl

int N;
vector<int>c;
//[i,j)???k???????????§?????????(false:0 true:1)
int memo[123][123][12];
int dp(int i,int j,int k){
	if(memo[i][j][k]>=0){
		return memo[i][j][k];
	}
	int res = 0;
	assert(i < j);
	if(j - i == 1){
		if(k == c[i])res = 1;
	}else{
		if(k){
			for(int m = i + 1;m < j;++m){
				if((dp(i,m,k)&&dp(m,j,k)) || (dp(i,m,k)&&dp(m,j,0)) || (dp(i,m,0)&&dp(m,j,k))){
					res = 1;
				}
			}
		}else{
			for(int kk = 0;kk <= 9;++kk){
				for(int m = i + 1;m < j;++m){
					if((dp(i,m,kk)&&dp(m,j,kk))){
						res = 1;
					}
				}
			}
		}
	}
	return memo[i][j][k]=res;
}

int main(){
	cin >> N;
	for(int i=0;i<N;++i){
		int cc;cin >> cc;
		c.push_back(cc);
	}
	memset(memo,0xff,sizeof(memo));
	cout << (dp(0,N,0) ? "yes" : "no") << endl;
	return 0;
}

Measured memory_bytes: 3820
#include<iostream>            
                              
using namespace std;          
int main(void){               
  int n;                      
  cin >> n;                   
  int a[n];                   
  int b = 0,count = 0;;       
  for(int i = 0 ;i < n;i++){  
    cin >> a[i];              
  }                           
  while(b == 0){              
    for(int i = 0;i < n;i++){ 
      b += a[i]%2;            
      a[i] /= 2;              
    }                         
    if(b == 0){               
      count++;                
    }                         
  }                           
  cout << count << endl;      
  return 0;                   
}                             

Measured memory_bytes: 256
// Aizu Vol0 0077: Run Length
// 2017.7.29

#include <stdio.h>
#include <stdlib.h>

char *gets(char *);

#define MAX 150

int main()
{
	char buf[MAX+5];
	char *p;
	int n;

	while (gets(buf) != NULL) {
		p = buf;
		while (*p) {
			if (*p == '@') {
				p++;
				n = *p++ - '0';
				while (n-- > 0) putchar(*p);
			} else putchar(*p);
			p++;
		}
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 524
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include<functional>
#include<queue>
#include<regex>
#include<time.h>

using namespace std;


#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl

#define Tof(x) (x) ? Yes : No
#define TOF(x) (x) ? YES : NO
#define tof(x) (x) ? yes : no

using ll = long long;

//constexpr ll MOD = 1000000007;
constexpr ll INF = 1050000000;


/*vectorの要素を全部確認するやつだよ。普通に拡張for文したほうがいいよ。

for (vector<int>::iterator itr = ans.begin(); itr != ans.end(); ++itr) {
	cout << *itr << " ";
}

*/


/*for文でx,yを上下左右確認するやつだよ。正直使いづらいよ。

int dy[] = { 0, 1, 0, -1 };
int dx[] = { 1, 0, -1, 0 };


for (int i = 0; i < 4; i++) {
	int ny = y + dy[i];
	int nx = x + dx[i];
}

*/


/*繰り返し二乗法だよ。modもとってくれるよ。n^kをmodで割った余りでやってくれるよ。

ll POW_MOD(ll n, ll k, ll mod) {
	ll r = 1;

	for (; k > 0; k >>= 1) {
		if (k & 1) {
			r = (r * n) % mod;
		}
		n = (n * n) % mod;
	}
	return r;
}

*/


/*実行開始からの経過時間を表すよ。

while (clock() < 1900000) {  }

*/


/*まだ使えないテクニックのメモだよ。

for (int bit = 0; bit < (1<<n); ++bit)//bit全探索用のfor文だよ

*/


/*2重for文書くのめんどくなった時用だよ。

for (int i = 0; i < h; ++i) {
	for (int j = 0; j < w; ++j) {

	}
}

*/


int main() {
	int n, k; cin >> n >> k;
	int ans[114514];
	int h[114514];
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	for (int i = 0; i < 114514; i++) {
		ans[i] = INF;
	}
	ans[0] = 0;
	ans[1] = abs(h[1] - h[0]);
	
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j<n && j<i + k + 1; j++) {
			ans[j] = min(ans[j], ans[i] + abs(h[j] - h[i]));
		}
	}

	cout << ans[n - 1] << endl;

}



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

using namespace std;

int n,a[101],k;

bool dp[100100];

int main(){
    cin >> n >> k;
    for(int i = 1; i <= n; i++){
    	cin >> a[i];
    }
    dp[0] = false;
    for(int stones = 0; stones <= k; stones++){
    	for(int i = 1; i <= n; i++){
    		int x = a[i];
    		if(stones >= x && !dp[stones - x]) dp[stones] = true;
    	}
    }
    cout << (dp[k] == true ? "First" : "Second");
	return 0;
}

Measured memory_bytes: 384
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 1e5 + 10;
int n , a[N] , b[N] , c[N] , has[N];
int s[N] , del[N] , maxup[N];

int main(){
  scanf("%d",&n);
  rep(i,0,n) scanf("%d%d",a+i,b+i);
  rep(i,0,n+1) scanf("%d",c+i);
  vi v(c,c+n+1);
  sort(all(v));
  v.erase(unique(all(v)),v.end());
#define rk(x) lower_bound(all(v),x)-v.begin()
  vi seg;
  rep(i,0,n) {
    a[i]=rk(a[i]);b[i]=rk(b[i]);
    s[a[i]]++;
    if(b[i]<a[i]) {
      has[i] = true;
      seg.pb(i);
    }
  }
  rep(i,0,n+1) {
    c[i]=rk(c[i]);
    s[c[i]]--;
  }
  int need = 0 , err = 0 , cur = 0 , dif = 0;
  sort(all(seg),[&](int x,int y){return a[x]>a[y];});
  rep(i,1,sz(v)) s[i]+=s[i-1];
  priority_queue<pii> Q;
  vi used;
  per(i,0,sz(v)) {
    dif += del[i];
    int t = s[i] + dif;
    while(cur<sz(seg)&&a[seg[cur]]>i) {
      Q.push(mp(-b[seg[cur]],seg[cur]));
      cur++;
    }
    while(t<-1&&sz(Q)) {
      int x = Q.top().se;Q.pop();
      if(b[x]>i) continue;
      used.pb(x);
      has[x] = false;
      need ++;
      dif ++;
      t ++;
      if(b[x]) del[b[x]-1] --;
    }
    if(t<-1) {
      err=1;
      break;
    }
  }
  if(!err) {
    memset(del , 0 , sizeof(del));
    for(auto e : used) del[b[e]]++ , del[a[e]]--;
    rep(i,1,sz(v)) del[i]+=del[i-1];
    rep(i,0,sz(v)) s[i]+=del[i];
    memset(maxup , -1 , sizeof(maxup));
    maxup[0] = n - need;
    vi seg;
    rep(i,0,n) if(has[i]) {
      seg.pb(i);
    }
    sort(all(seg),[&](int x,int y){return b[x]<b[y];});
    priority_queue<pii> Q;
    memset(del , 0 , sizeof(del));
    int cur = 0 , dif = 0;
    rep(i,0,sz(v)) {
      dif += del[i];
      int t = s[i] + dif;
      while(cur<sz(seg)&&b[seg[cur]]<=i){
        Q.push(mp(a[seg[cur]],seg[cur]));
        cur++;
      }
      while(t<0&&sz(Q)) {
        int x = Q.top().se;Q.pop();
        if(a[x]<=i) continue;
        need ++;
        dif ++;
        t ++;
        del[a[x]]--;
      }
      if(t<0) break;
      else maxup[i+1] = n - need;
    }
  } else memset(maxup , -1 , sizeof(maxup));
  int q;
  scanf("%d",&q);
  rep(i,0,q) {
    int d,e;
    scanf("%d%d",&d,&e);
    d=rk(d);e=rk(e);
    int ans=-1;
    if(maxup[d]!=-1) ans=max(ans,maxup[d]+1);
    if(maxup[e]!=-1) ans=max(ans,maxup[e]);
    printf("%d\n",ans);
  }
  return 0;
}


Measured memory_bytes: 6772
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;
int main(void){
	while(1){
		int n,sum,flag;
		string str;
		cin >> n;
		if(n==0)	break;
		vector<int> len(n);
		for(int i=0;i<n;i++){
				cin >> str;
				len[i] = str.size();
		}
		for(int i=0;i<n;i++){
			sum=0;
			flag=0;
			for(int j=i;(j<n&&sum<=7);j++){
				sum+=len[j];
				if(sum==5&&flag==0){
					flag=1;
					sum=0;
				}
				if(sum==7&&flag==1){
					flag=2;
					sum=0;
				}
				if(sum==5&&flag==2){
					flag=3;
					sum=0;
				}
				if(sum==7&&flag==3){
					flag=4;
					sum=0;
				}
				if(sum==7&&flag==4){
					cout << i+1 << endl;
					flag=5;
				}
			}
			if(flag==5)	break;
		}
	}
	return 0;
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define P pair<int,int>
int x;
vector<int>prime;
signed main(){
    cin>>x;
    prime.push_back(2);
    for(int i=2;;i++){
        bool p=true;
        for(int j=0;prime[j]<=sqrt(i);j++){
            if(i%prime[j]==0){
                p=false;
                break;
            }
        }
        if(p)prime.push_back(i);
        if(p&&i>=x){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}



Measured memory_bytes: 512
using System;
using System.Linq;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    string[] str=Console.ReadLine().Split(' ');
      string a=str[0];
      string b=str[1];
      string target=a+b;
     int n=int.Parse(target);
     int m=(int)Math.Sqrt(n);
      int flg=0;
      if(m*m==n){
        flg=1;
      }
      if(flg==1){
        Console.WriteLine("Yes");
      }else{
        Console.WriteLine("No");
      }
    }
    
  }

}


Measured memory_bytes: 27292
N=int(input())
A=list(map(int,input().split()))
count = 0
for i in range(N):
    if A[i]%2 == 0:
        if A[i]%5!=0 and A[i]%3!=0:
            count = count+1
        else:
            count = count
    else:
        count = count
if count==0:
    print('APPROVED')
else:
    print('DENIED')

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

int main() {
	long long n, m,mod,k;
	mod = pow(10, 9) + 7;
	cin >> n >> m;
	vector<long long> a(m),l,fib(100004);
	fib[0] = 0; fib[1] = 1; fib[2] = 1;
	for (long long i = 3; i < 100003; i++) fib[i] = (fib[i - 1] + fib[i - 2])%mod;
	for (long long &i:a) cin >> i;
	if (m != 0) {
		l.push_back(a[0]);
		for (long long i = 0; i < a.size()-1; i++) l.push_back(a[i + 1] - a[i] - 1);
		l.push_back(n - a[a.size() - 1]);
		k = 1;
		for (long long i : l)k = fib[i] * k%mod;
	}
	else k = fib[n + 1] % mod;
	cout << k << endl;
	return 0;
}

Measured memory_bytes: 2936
import math
a, b, C = map(int, input().split())
print('{0}'.format(0.5 * a * b * math.sin(C * math.pi / 180)))
print('{0}'.format(a + b + (a ** 2 + b ** 2 - 2 * a * b * math.cos(C * math.pi / 180)) ** 0.5))
print('{0}'.format(b * math.sin(C * math.pi / 180)))

Measured memory_bytes: 7840
import numpy as np

A, B, H, M = map(int, input().split())

Aw = 2 * np.pi / 12 / 60
Bw = 2 * np.pi / 60
thetaA = Aw * (H * 60 + M)
thetaB = Bw * M
# thetaA = 2 * np.pi * H / 12 + 2 * np.pi / 12 * M / 60
# thetaB = 2 * np.pi * M / 60

if thetaA > thetaB:
    ans = np.sqrt(A ** 2 + B ** 2 - 2 * A * B * np.cos(thetaA - thetaB))
elif thetaB > thetaA:
    ans = np.sqrt(A ** 2 + B ** 2 - 2 * A * B * np.cos(thetaB - thetaA))
else:
    ans = abs(A - B)

print(ans)

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

using namespace std;

int main(){
    int n;
    scanf("%d", &n);

    int mx = 0;
    int val;
    int sum = 0;

    for(int i = 0; i < n; i++){
        scanf("%d", &val);

        if(mx < val)
            mx = val;

        sum += val;
    }

    printf("%d", sum - mx / 2);
}


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

int main(){

	int H, W;
	
	while(1){
		cin >> H >> W;
		if( H == 0 && W == 0)break;
		
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				cout << "#";
				
			}
			cout << endl;
		}
		cout << endl;
	}
return 0;
}

Measured memory_bytes: 3100
H = int(input())
W = int(input())
N = int(input())

n_W = 0
n_H = 0

if H > W:
  for i in range(W):
    if H*(i+1) >= N:
      n_H=i+1
      break
  if i+1 == W and n_H == 0:
    n_H = i+1
    for j in range(H):
      if W*(j+1) + H*(n_H) >= N:
        n_W = j+1
        break
else:
  for i in range(H):
    if W*(i+1) >= N:
      n_W=i+1
      break
  if i+1 == H and n_W == 0:
    n_W = i+1
    for j in range(W):
      if H*(j+1) + W*(n_W) >= N:
        n_H = j+1
        break
  
        
print(n_W + n_H)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<climits>
#include<vector>
#include <sstream>
#include<algorithm>
#include<array>
#include<map>

using namespace std;

int main(void) {

	
	long long a, b, n;
	long long min=999999;
	long long sum;

	cin >> n;
	for (int a = 1;a < n ;++a) {
		b = n - a;
		if (b < a)break;
		sum = a / 100000 + b / 100000;
		sum += (a / 10000) % 10 + (b / 10000) % 10;
		sum += (a / 1000) % 10 + (b / 1000) % 10;
		sum += (a / 100) % 10 + (b / 100) % 10;
		sum += (a / 10) % 10 + (b / 10) % 10;
		sum += a % 10 + b % 10;
		if (min > sum)min = sum;
	}
	cout << min << endl;

	return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<int(n); i++)
#define ALL(a) (a).begin(), (a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;

int main(){
	string s; cin >> s;
	if(s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  double a;
  vector<double> vb;
  while(cin>>a)
    vb.push_back(a);
  sort(vb.begin(),vb.end());
  cout<<-vb[0]+vb[vb.size()-1]<<endl;
  return 0;
}

Measured memory_bytes: 3192
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
    int n,a;
    scanf("%d",&n);
    int sum = 0,ma = 0;
    for(int i = 0;i < n;i++)
    {
        scanf("%d",&a);
        ma = max(ma,a);
        sum += a;
    }
    sum -= ma/2;
    printf("%d\n",sum);
    return 0;
}



Measured memory_bytes: 128
#include<iostream>
using namespace std;
#include<vector>
int main()
{
	int n;
	int ans = 0;
	cin >> n;
	int a[20];
	int b[20];
	int c[20];
	//vector<int> a(n), b(n), c(n - 1);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		a[i]--;
	}
	for (int i = 0; i < n; i++)
	{
		cin >> b[i];
	}
		
		
	
	for (int i = 0; i < n - 1; i++)
	{
		cin >> c[i];
	}
	for (int i = 0; i < n; i++)
	{
		//int d = a[i];
		ans += b[a[i]];
		if (i > 0 &&   a[i] == a[i - 1]+1)
			ans += c[a[i-1]];


	}
	cout << ans;
	return 0;
}

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

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

  int left = a+k-1;
  int right = b-k+1;
  if (left >= right) {
    for(int i=a; i<=b; i++)
      cout << i << endl;
  }
  else {
    for(int i=a; i<=left; i++)
      cout << i << endl;
    for(int i=right; i<=b; i++)
      cout << i << endl;
  }
  return 0;
}

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

using namespace std;
long long MOD = 1000000007LL;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647

int main() {
	int bingo[3][3] = { 0 };
	map<int, pair<int, int>> mp;
	for (int i = 0; i < 3; ++i) {
		for (int j = 0; j < 3; ++j) {
			cin >> bingo[i][j];
			mp[bingo[i][j]] = make_pair(i + 1, j + 1);
		}
	}

	int N;
	cin >> N;
	for (int i = 0; i < N; ++i) {
		int k;
		cin >> k;
		if (mp[k] != make_pair(0, 0)) {
			int j = mp[k].second - 1;
			int i = mp[k].first - 1;
			bingo[i][j] = 0;
		}
	}

	for (int i = 0; i < 3; ++i) {
		int k = 0;
		int l = 0;
		for (int j = 0; j < 3; ++j) {
			k += bingo[i][j];
			l += bingo[j][i];
		}
		if (k == 0 || l == 0) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	if (bingo[0][0] + bingo[1][1] + bingo[2][2] == 0 || bingo[0][2] + bingo[1][1] + bingo[2][0] == 0) {
		cout << "Yes" << endl;
		return 0;
	}

	cout << "No" << endl;
	return 0;
}

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

int a[3] = {0};

int solve();

int main() {
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a + 3);
  cout << solve() << endl;
  return 0;
}

int solve() {
  int ans = 0;
  for(int i = 0; i < 3; ++i)
    if(a[i] % 2 != a[(i + 1) % 3] % 2 &&
       a[i] % 2 != a[(i + 2) % 3] % 2) {
      ans = 1;
      ++a[(i + 1) % 3];
      ++a[(i + 2) % 3];
    }
  ans += (a[1] - a[0]) / 2;
  ans += a[2] - a[1];
  return ans;
}

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

typedef long long ll;
using vi = vector<int>;
using vll = vector<ll>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

const int MAX = 100100;

int isPrime[MAX];
void Eratosthenes(int n) {
    for(int i = 0; i <= n; i++) isPrime[i] = 1;
    isPrime[0] = 0; isPrime[1] = 0;
    for(int i = 2; i <= n; i++) {
        if(isPrime[i]) {
            for(int j = 2 * i; j <= n; j += i) {
                isPrime[j] = 0;                
            }
        }
    }
}

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

    Eratosthenes(MAX);

    //2017likeか
    vector<int> a(MAX, 0);
    rep(i, MAX) {
        if(isPrime[i] && isPrime[(i+1)/2]) a[i] = 1; 
    }

    //累積和
    int s[MAX+1];
    s[0] = 0;
    rep(i, MAX) {
        s[i + 1] = s[i] + a[i]; 
    }

    int cnt[q];
    rep(i, q) {
        int l, r;
        cin >> l >> r;
        cnt[i] = s[r+1] - s[l];
    }

    for(int ans : cnt) {
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
 
int main(){
    string s;
    cin >> s;
    string output = "";
    for (int i = 0; i < s.length(); i++)
    {
        if(s[i] == '0'){
            output += "0";
        }else if(s[i] == '1'){
            output += "1";
        }else{
            if(output.size() != 0) output.erase(output.size()-1, 1);
        }
    }
    cout << output << endl;
}
      

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

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli > plli;
typedef vector<lli> vlli;
typedef vector<plli > vplli;

#define rep(i,a) for(i = 0 ; i < a ; i++)
#define repr(i,a) for(i = a ; i >= 0 ; i--)
#define REP(i,a,b) for(i = a ; i <= b ; i++)
#define REPR(i,a,b) for(i = a ; i >= b ; i--)

#define scan(N) scanf("%lld",&N)
#define print(N) printf("%lld",N)
#define scan2(N1,N2) scanf("%lld %lld",&N1,&N2)
#define print2(N1,N2) printf("%lld %lld",N1,N2)
#define scan3(N1,N2,N3) scanf("%lld %lld %lld",&N1,&N2,&N3)
#define print3(N1,N2,N3) printf("%lld %lld %lld",N1,N2,N3)

#define mem(a,b)memset(a,b,sizeof(a))
#define opt ios_base::sync_with_stdio(false);cin.tie(NULL);
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))
#define sqr(x) (x)*(x)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl

#define endl '\n'

const long long INF = 2000000000000;
const long long MOD = 1000000007;
const long long MAXN = 100005;

lli dx[]={0,0,-1,1,-1,-1,1,1};
lli dy[]={1,-1,0,0,1,-1,-1,1};

lli power(lli a,lli b)
{
    lli value;
    if(!b)
    	return 1;
    else if(b%2==0) {
        value = power(a,b/2)%MOD;
        return (value * value)%MOD;
    }
    else {
        value = power(a,b/2)%MOD;
        return ((a*value)%MOD*(value))%MOD;
    }
}

int main()
{
    opt;
    lli n,k,ans = 0,i,j,b;
    cin >> n >> k;
    if(k == 0)
    {
        cout << n*n << endl;
        return 0;
    }
    REP(b,k+1,n)
    {
        lli temp = n/b;
        lli sum = (b-k)*(temp);
        ans += sum;
        ans += max((n%b + 1)-k,0LL);
        //cout << ans << ' ';
    }
    cout << ans ;
    return 0;

}










Measured memory_bytes: 256
import std.stdio, std.string, std.array, std.conv, std.math;

void main() {
    double[] tmp = readln.chomp.split.to!(double[]);
    double a = tmp[0], b = tmp[1], c = tmp[2] * PI / 180;
    double s = 0.5 * a * b * sin(c);
    double l = a + b + sqrt(a ^^ 2 + b ^^ 2 - 2 * a * b * cos(c));
    double h = 2 * s / a;
    writefln("%0.8f", s);
    writefln("%0.8f", l);
    writefln("%0.8f", h);
}


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

const int N=1e5+1e3+7;

char s[N];

int n;

int main()
{
	scanf("%s",s);
	n=strlen(s);
	for(int i=0;i<=n-9;i++)
		cout<<s[i];
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)

n = int(input())
a = list(map(int, input().split()))
#n, m = map(int, input().split())
#s = input()
#s,t = input().split()
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

x2 = 0
for i in range(n):
    if i%2:
        x2 -= a[i]
    else:
        x2 += a[i]

ans = [0]*n
ans[0] = x2//2

for i in range(n-1):
    ans[i+1] = a[i] - ans[i]
    
for i in range(n):
    ans[i] *= 2
    
print(*ans)

Measured memory_bytes: 64996
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }
        static void Solve()
        {
            var NM = Sarray();
            var N = NM[0];
            var M = NM[1];
            var graph = Enumerable.Range(0, (int)N).Select(_ => new List<(long t, long c)>()).ToArray();

            for (var i = 0; i < M; ++i)
            {
                var abc = Sarray();
                var a = abc[0] - 1;
                var b = abc[1] - 1;
                var c = abc[2];
                graph[a].Add((b, c));
            }
            var INI = long.MinValue / 2;
            var dst = Enumerable.Repeat(INI, (int)N).ToArray();
            var isC = new bool[N];
            dst[0] = 0;
            for (var r = 0; r < N; ++r)
                for (var v = 0; v < N; ++v)
                    foreach (var g in graph[v])
                        if (dst[v] != INI && dst[g.t] < dst[v] + g.c)
                        {
                            dst[g.t] = dst[v] + g.c;
                            if (N - 1 == r)
                                isC[g.t] = true;
                        }
            var q = new Queue<long>();
            for (var i = 0; i < N; ++i)
                if (isC[i]) q.Enqueue(i);
            var used = new bool[N];
            while (q.Any())
            {
                var v = q.Dequeue();
                used[v] = true;
                foreach (var g in graph[v])
                    if (!used[g.t])
                    {
                        q.Enqueue(g.t);
                        isC[g.t] = true;
                    }
            }
            if (isC[N - 1])
                WriteLine("inf");
            else
                WriteLine(dst[N - 1]);
        }
    }
}

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

#define      ll      long long int

int main( )
{
    ll i, j, k, r, n, l;
    string s;
    cin >> n;
    if (n == 0) {
        s = "0";
    }
    while (n != 0) {
        r = n % -2;
        n = n / -2;
        if (r < 0) {
            r += 2;
            n += 1;
        }
        s.push_back(char(r + '0'));
    }
    reverse(s.begin(), s.end());
    cout << s << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define all(a) a.begin(), a.end()
     
signed main() {
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  int n; cin >> n;
  vector <int> a(n), b(n);
  
  for(int i = 0; i < n; i++) {
  	cin >> a[i] >> b[i];
  }

  int check = 0;

  for(int i = n - 1; i >= 0; i--) {
    a[i] += check;
    if(a[i] % b[i] == 0) continue;
    check += b[i] - (a[i] % b[i]);
  }
  
  cout << check << endl;
  
  return 0;
}

Measured memory_bytes: 4740
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define N 1000000007
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t1,t2,a1,a2,b1,b2,i,ans = 0,x;
    cin>>t1>>t2>>a1>>a2>>b1>>b2;
    a1 = a1*t1;
    a2 = a2*t2;
    b1 = b1*t1;
    b2 = b2*t2;
    if(a1 > b1)
    {
        swap(a1,b1);
        swap(a2,b2);
    }
    if(a1+a2 < b1+b2)
    {
        cout<<0;
        return 0;
    }
    if(a1+a2 == b1+b2)
    {
        cout<<"infinity";
        return 0;
    }
    ans++;
    x = a1+a2 - (b1+b2);
    ans += 2*((b1-a1)/x);
    if((b1-a1)%x == 0)
        ans--;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#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>;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}

int main() {
  int N;
  cin >> N;
  ll a=0,b=0;
  ll c=0;
  for(ll i=1; i<=N;i++){
    for(ll j = 1; j<=N;j++){
      for(ll k = 1;k<=N;k++){
        a = gcd(i,j);
        b = gcd(a,k);
        c += b;
      }
    }
  }
  cout << c << endl;
}

Measured memory_bytes: 3636
H,W=map(int,input().split())

import sys
N=1
if W==1 or H==1:
    print(1)
    sys.exit()
if (W-1)%2==0:
    N+=(W-1)//2
    N+=(W-1)//2
elif (W-1)%2==1:
    N+=(W-2)//2
    N+=W//2
if H%2==0:
    NN=N*(H//2)
elif H%2==1:
    if (W-1)%2==0:
        NN=N*((H-1)//2)+(W-1)//2+1
    elif (W-1)%2==1:
        NN=N*((H-1)//2)+(W-2)//2+1
print(NN)

Measured memory_bytes: 3064
S = input()
cnt = 0
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
for i in range(len(S)):
    if i %2==0:
        if S[i] in odd:
            cnt +=1
    elif i %2==1:
        if S[i] in even:
            cnt +=1

if cnt == len(S):
    print("Yes")
else:
    print('No')

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

#define INF 1e9+7
#define pf2 pop_front
#define pb2 pop_back
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define sz size
#define eps 1e-7
#define fod find_by_order
#define fastio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ofk order_of_key
#define val(x) cout << "Value dari "<< #x << " adalah " << x  << "\n"
#define tr tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
using namespace __gnu_pbds;
using namespace std;

int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,1,-1,1,-1};

void readf(string x){
	freopen((x+".in").c_str(),"r",stdin);
	freopen((x+".out").c_str(),"w",stdout);
}

void pr(string x){
	freopen((x+".in").c_str(),"w",stdout);
}


int read()
{
	bool min = 0;
	int  result = 0;
	char ch;
	ch = getchar();
	while(1)
	{
		if(ch == '-') break;
		if(ch >='0' && ch <= '9') break;
		ch = getchar();
	}
	if(ch == '-') min = 1;else result = ch-'0';
	while(1)
	{
		ch =getchar();
		if(ch< '0' || ch>'9') break;
		result = result * 10 + (ch-'0');
	}
	if(min) return -result;
	return result;
}
//Reynaldo's Template

int main(){
	ll N,A,B;
	cin >> N >> A >> B;
	if(A > B){
		cout  << 0 << "\n";
		return 0;
	}
	if(N == 1){
		if(A !=B ) cout << 0 << "\n";
		else cout << 1 << "\n";
		return 0;
	}
	N = N - 2;
	cout << N * (B-A) + 1 << "\n";
}



Measured memory_bytes: 256