akhauriyash/Code-Regression huggingface dataset:
s = input()
if s == 'SUN':
  print(7)
elif s == 'MON':
  print(6)
elif s == 'TUE':
  print(5)
elif s == 'WED':
  print(4)
elif s == 'THU':
  print(3)
elif s == 'FRI':
  print(2)
else:
  print(1)

Measured memory_bytes: 3060
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.bigint;

struct PriorityQueue(alias _fun, T) {
    import std.functional : binaryFun;
    import std.algorithm : swap;
    alias fun = binaryFun!_fun;

    ///
    this(T[] ts) {
        foreach (t; ts) enqueue(t);
    }

    ///
    PriorityQueue!(_fun, T) enqueue(T e) {
        if (this.tree.length == 0) this.tree.length = 1;
        if (this.tree.length == this.n) this.tree.length *= 2;
        this.tree[this.n] = e;
        auto i = this.n;
        this.n += 1;
        while (i) {
            auto j = (i-1)/2;
            if (fun(this.tree[i], this.tree[j])) {
                swap(this.tree[i], this.tree[j]);
                i = j;
            } else break;
        }
        return this;
    }

    alias insertFront = enqueue;
    alias insert = enqueue;

    ///
    T dequeue() {
        auto ret = this.tree[0];
        this.n -= 1;
        this.tree[0] = this.tree[this.n];
        this.tree = this.tree[0..$-1];
        size_t i;
        for (;;) {
            auto l = i*2+1;
            auto r = i*2+2;
            if (l >= this.n) break;
            size_t j;
            if (r >= this.n) {
                j = l;
            } else {
                j = fun(this.tree[r], this.tree[l]) ? r : l;
            }
            if (fun(this.tree[j], this.tree[i])) {
                swap(this.tree[i], this.tree[j]);
                i = j;
            } else break;
        }
        return ret;
    }

    ///
    @property
    T front() {
        return this.tree[0];
    }

    ///
    @property
    bool empty() {
        return this.n == 0;
    }

    ///
    void popFront() {
        this.dequeue();
    }

    alias removeFront = popFront;

    ///
    @property
    size_t length() {
        return this.n;
    }

private:
    size_t n;
    T[] tree;
}

///
PriorityQueue!(fun, T) priority_queue(alias fun, T)(T[] ts = []) {
    return PriorityQueue!(fun, T)(ts);
}

// alias P = Tuple!(int, "l", int, "r", long, "c");
alias P = Tuple!(int, "p", long, "c", long, "max_c");

void main()
{
    auto nm = readln.split.to!(int[]);
    auto N = nm[0];
    auto M = nm[1];
    auto ps = new P[](M);
    P[][] G;
    G.length = N;
    foreach (i; 1..N) G[i] ~= P(i-1, 0, long.max);
    foreach (i; 0..M) {
        auto lrc = readln.split.to!(int[]);
        auto l = lrc[0]-1;
        auto r = lrc[1]-1;
        long c = lrc[2];
        G[l] ~= P(r, c, long.max);
    }

    auto Q = priority_queue!("a.max_c < b.max_c", P)([P(0, 0, 0)]);
    long res = -1;
    while (!Q.empty) {
        auto p = Q.dequeue();
        foreach (ref r; G[p.p]) if (r.max_c > p.max_c + r.c) {
            r.max_c = p.max_c + r.c;
            if (r.p == N-1) {
                if (res == -1) {
                    res = r.max_c;
                } else {
                    res = min(res, r.max_c);
                }
            }
            Q.enqueue(r);
        }
    }
    writeln(res);
    return;
}

Measured memory_bytes: 33404
import queue

n = input()

def all_combination(length):
    q = queue.Queue()
    source = (0, )
    part_list = [source + (length, )]
    q.put(source)
    while not q.empty():
        parent = q.get()
        if parent[-1] < length-1:
            for m in range(parent[-1]+1, length):
                child = parent + (m, )
                part_list.append(child + (length, ))
                q.put(child)
        else:
            pass
            
    return part_list
        
length = len(n)
part_list = all_combination(length)

sum = 0
for t in part_list:
    for i, j in zip(t[:-1], t[1:]):
        sum += int(n[i:j])
        
print(sum)

Measured memory_bytes: 3952
#include <stdio.h>
#include <algorithm>
#include <vector>

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

using namespace std;

const int N=100010;
int n,x,y;
vector<int> vec[N];

int dfs(int x,int pa) {
    int tmp=0;
    for (int i=0;i<vec[x].size();i++) {
        if (vec[x][i]==pa) continue;
        tmp^=(dfs(vec[x][i],x)+1);
    }
    return tmp;
}

int main() {
    scanf("%d",&n);
    for (int i=0;i<n-1;i++) {
        scanf("%d%d",&x,&y);
        vec[x].pb(y);
        vec[y].pb(x);
    }
    int res=dfs(1,0);
    if (res==0) printf("Bob\n");
    else printf("Alice\n");
}

Measured memory_bytes: 11904
def bfs(s):  # たぶんstartのs
    global n, M, color, d, q

    q.append(s)
    d[s] = 0

    while len(q) != 0:
        u = q.pop(0)

        for v in range(n):
            if M[u][v] != 1:
                continue

            if color[v] == 'WHITE':
                q.append(v)
                color[v] = 'GRAY'
                d[v] = d[u] + 1

        color[u] = 'BLACK'


n = int(input())

M = [[0 for i in range(n)] for j in range(n)]
color = ['WHITE'] * n  # 各頂点の色を記録。ホワイト（未探索）、グレイ（探索中）、ブラック（探索ずみ）
d = [-1] * n  # 始点0からvまでの距離
q = []

for i in range(n):
    _ = list(map(int, input().split()))
    u = _[0] - 1  # 0オリジンに変換

    degree = _[1]
    for j in range(degree):
        v = _[j+2] - 1  # 0オリジンに変換
        M[u][v] = 1

# for row in M:
#     print(' '.join(map(str, row)))

bfs(0)

for i in range(n):
    print('{} {}'.format(i+1, d[i]))



Measured memory_bytes: 5696
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
using namespace std;

int main() {
	long long int ans = 0, R, G, B, N;
	cin >> R >> G >> B >> N;
	for (int r = 0; r < N / R + 1; r++)
	{
		for (int g = 0; g < N / G + 1; g++)
		{
			if (N>=r*R+g*G)
			{
				if ((N - (r*R + g*G)) % B == 0)
				{
					ans++;
				}
			}
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [1 if a == "B" else 0 for a in input()]
P = 10 ** 9 + 7
k = 0
ans = 1
for i in range(N):
    ans = (ans * (i+1)) % P
for i in range(N * 2):
    if k == 0:
        if A[i] == 0:
            ans = 0
            break
        else:
            k += 1
    elif (k + A[i]) % 2 == 0:
        ans = (ans * k) % P
        k -= 1
    else:
        k += 1
if k == 0:
    print(ans)
else:
    print(0)

Measured memory_bytes: 53232
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int N, K;
    cin >> N >> K;
    int h[N];
    for(int i = 0; i < N; i++) cin >> h[i];

    int cost[N];
    for(int i = 0; i < N; i++) cost[i] = inf;
    cost[0] = 0;
    for(int i = 0; i < N; i++) {
        for(int k = 1; k <= K && i + k < N; k++) cost[i + k] = min(cost[i + k], cost[i] + abs(h[i] - h[i + k]));
    }
    cout << cost[N - 1] << "\n";
    return 0;
}

Measured memory_bytes: 4360
#include <iostream>

using namespace std;

int combinations[51] = {};

int main() {
    for (int a = 0; a < 10; a++) {
        for (int b = 0; b < 10; b++) {
            for (int c = 0; c < 10; c++) {
                for (int d = 0; d < 10; d++) {
                    combinations[a + b + c + d] += 1;   
                }
            }
        }
    }

    int n;
    while (cin >> n) {
        cout << combinations[n] << endl;
    }

    return 0;
}

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

struct NODE{
  int id,k,p,depth,right,left;
  char *type;
};

struct NODE *root;
int n;
void makedepth(struct NODE);
int main(){
  int i,j,l,m,index,temp,om;
  scanf("%d",&n);
  root=(struct NODE *)malloc(sizeof(struct NODE)*n);
  for(i=0;i<n;i++){
    root[i].p=-1;
    root[i].depth=0;
    root[i].right=-1;
    root[i].left=-1;
  }
  for(i=0;i<n;i++){
    scanf("%d",&index);
    root[index].id=index;
    scanf("%d",&root[index].k);
      for(j=0;j<root[index].k;j++){
	scanf("%d",&m);
	root[m].p=index;
	if(j==0){
	  root[index].left=m;
	}
	else{
	  root[temp].right=m;
	}
	temp=m;
      }
  }
 

  for(i=0;i<n;i++){
    
    if(root[i].p==-1)makedepth(root[i]);
    
  }

  for(i=0;i<n;i++){
      if(root[i].p==-1)root[i].type="root";
      else if(root[i].p!=-1&&root[i].k!=0)root[i].type="internal node";
      else root[i].type="leaf";
      printf("node %d: parent = %d, depth = %d, %s, [",root[i].id,root[i].p,root[i].depth,root[i].type);
      	l=0;
	om=root[i].left;
	while(om!=-1){
	if(om==-1){
	  continue;
	}
	else{
	  if(l==0){
	    printf("%d",om);
	  }
	  else{
	    printf(", %d",om);
	  }
	}
	l++;
	om=root[om].right;
      }
      printf("]\n");
  }
  
  
  return 0;
}

void makedepth(struct NODE Root){
  int i;
  for(i=0;i<n;i++){
    if(Root.id==root[i].p){
      root[i].depth=Root.depth+1;
      if(root[i].k!=0)makedepth(root[i]);
    }
  }
}



Measured memory_bytes: 4860
# -*- coding: utf-8 -*-
import sys
# input
s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
# calc
op = ["+", "-"]
for i in range(2):
    ans = a
    if i == 0:
        ans += b
    else:
        ans -= b
    ans1 = ans
    for j in range(2):
        ans = ans1
        if j == 0:
            ans += c
        else:
            ans -= c
        ans2 = ans
        for k in range(2):
            ans = ans2
            if k == 0:
                ans += d
            else:
                ans -= d
            if ans == 7:
                print(str(a) + op[i] + str(b) + op[j] + str(c) + op[k] + str(d) + "=7")
                sys.exit()
# output
# 答えが存在しない入力は与えられない

Measured memory_bytes: 3064
n,a,b=map(int,input().split())
v=list(map(int,input().split()))
v.sort(reverse=True)
print(sum(v[:a])/a)
 
import math
def cmb(n,r):
    f = math.factorial
    return int(f(n) // f(r) // f(n-r))
x,y=v.count(v[a-1]),v[:a].count(v[a-1])
if v[0]==v[a-1]:
   ans=sum(cmb(x,i) for i in range(a,min(b,x)+1))
else:
    ans=cmb(x,y)
print(ans)    

Measured memory_bytes: 39024
string = input()
split = string.split(" ")
N = int(split[0])
L = split[1]

L = int(L)

taste = []

total = 0


for i in range(N):
  taste.append(L + i)
  total = total + taste[i]

mini = min(taste, key=lambda x: -x if x < 0 else x)
total = total - mini
print(total)

Measured memory_bytes: 3064
package main

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

func main() {
	L := nextInt64()
	R := nextInt64()
	if (R - L) > 2018 {
		fmt.Printf("%d", 0)
	} else {
		m := 2019
		r := make([]int, R-L+1)
		s := L % 2019
		for i := 0; i < len(r); i++ {
			r[i] = (int(s) + i) % 2019
		}
		for i := 0; i < len(r)-1; i++ {
			for j := i + 1; j < len(r); j++ {
				rem := (r[i] * r[j]) % 2019
				m = Min(m, rem)
			}
		}
		fmt.Println(m)
	}
}

func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}

func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}

func nextString() string {
	return nextReader()
}

func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}

func Min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}

func Max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func MinA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Min(s, v)
	}
	return s
}

func MaxA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Max(s, v)
	}
	return s
}

func Abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

int main() {
	ll n;
	cin>>n;
	if(n==0){
		cout << 0;
		return 0;
	}
	vector<ll> a;
	while(n!=0){
		a.push_back(abs(n)%2);
		if(n>0){n=n/(-2);}
		else{
			n=(abs(n)+2-1)/2;
		}
	}
	reverse(a.begin(),a.end());
	for(int i=0;i<a.size();i++){
		cout << a[i];
	}
	return 0;
}

Measured memory_bytes: 256
//#include<iostream>
//#include<algorithm>
//#include<string>
//#include <cmath>
//#include <vector>
#include <bits/stdc++.h>

using namespace std;

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

//vector//
#define vei vector<int> 
#define velli vector<long long int> 
#define pb(x) push_back(x) // 末尾にxを加える
#define pb2 pop_back() // 末尾削除
#define all(x) (x).begin(),(x).end() //イテレーター
#define be(x) (x).begin()
//auto  auto begin = v.begin()とか

typedef pair<int,int> P;  //q(p.first,p.second)

int main (){
    ll int x; cin >> x;
    ll int a = 0;
    int ans = 0;
    int i = 0;
    while(a < x){
        i++;
        a += i;
        ans++;
    }
    cout << ans;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  cout<<3*n*n<<endl;

  return 0;
}


Measured memory_bytes: 764
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll aa , bb;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)q) ->aa - ((fr*)p)->aa;}

int main(void){
    // char ;
    ll n,h,ans=0;
    scanf("%lld%lld",&n,&h);
    fr dam[2*n];
    rep(i,0,n){
        scanf("%lld%lld",&dam[i*2].aa,&dam[i*2+1].aa);
        dam[i*2+1].bb=1;
        dam[i*2].bb=0;
    }
    qsort(dam,2*n,sizeof(fr),cmp1);
    rep(i,0,2*n){
        if(dam[i].bb){
            h-=dam[i].aa;
            ans++;
            if(h<=0) break;
        }else{
            ans+=h/dam[i].aa;
            h-=dam[i].aa*(h/dam[i].aa);
            while(h>0){
                h-=dam[i].aa;
                ans++;
            }
            break;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 6396
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int P = 1e9 + 7;
inline int add(int a, int b) {if((a += b) >= P) a -= P; return a;}
inline int sub(int a, int b) {if((a -= b) < 0) a += P; return a;}
inline int mul(int a, int b) {return 1ll * a * b % P;}
inline int kpow(int a, int b) {int r=1;for(;b;b>>=1,a=mul(a,a)) {if(b&1)r=mul(r,a);}return r;}
//----
const int N = 202020;
vector<pii> ans;
char s[N];
int n;
bool check() {
	n = strlen(s);
	if(s[n - 1] == '1')
		return 0;
	if(s[0] != '1' || s[n - 2] != '1')
		return 0;
	int cnt = 0;
	for(int l = 0, r = n - 2; l <= r; l++, r--) {
		if(s[l] != s[r])
			return 0;
		cnt += s[l] == '1';
	}
	if(n & 1) {
		int p = 0;
		for(int i = 0; i < cnt; i++) {
			ans.pb({p, i * 2 + 1});
			p = i * 2 + 1;
		}
		p = 0;
		for(int i = 0; i < cnt; i++) {
			ans.pb({p, (i + 1) * 2});
			p = (i + 1) * 2;
		}
		int cur = cnt * 2 + 1;
		for(int l = cnt * 2, r = cnt * 2 - 1, i = 0, j = n - 2; i <= j; i++, j--) {
			if(s[i] == '1') {
				l -= 2;
				r -= 2;
				l = max(0, l);
				r = max(0, r);
			} else { 
				ans.pb({l, cur});
				ans.pb({r, cur + 1});
				cur += 2;
			}
		}
	} else {
		ans.pb({0, 1});
		rep(i, 0, cnt - 1)
			ans.pb({i * 2, (i + 1) * 2});
		rep(i, 0, cnt - 1)
			ans.pb({i * 2 + 1, (i + 1) * 2 + 1});
		int cur = cnt * 2;
		for(int l = (cnt - 1) * 2, r = (cnt - 1) * 2 + 1, i = 0, j = n - 2; i <= j; i++, j--) {
			if(s[i] == '1') {
				l -= 2;
				r -= 2;
				l = max(l, 0);
				r = max(r, 0);
			} else {
				ans.pb({l, cur});
				ans.pb({r, cur + 1});
				cur += 2;
			}
		}
	}
	return 1;
}
int main(){
	scanf("%s", s);
	if(!check()) puts("-1");
	else {
		for(auto & it : ans)
			printf("%d %d\n", it.fi + 1, it.se + 1);
	}
	return 0;
}


Measured memory_bytes: 2420
import fractions
a,b = map(int,input().split())
"""素因数分解"""
def factrize(n):
	b = 2
	fct = []
	while b*b <= n:
		while n % b == 0:
			n //= b
			#もし素因数を重複させたくないならここを加えてfct.append(b)を消す
			
			if not b in fct:
				fct.append(b)
			
			
		b = b+1
	if n > 1:
		fct.append(n)
	return fct #リストが帰る

gc = fractions.gcd(a,b)

ans = factrize(gc)
print(len(ans)+1)

Measured memory_bytes: 64620
#include <cstdio>
#include <algorithm>

#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define Rep0(i, n) for (int i = 0; i <= n; i ++)
#define RepG(i, x) for (int i = head[x]; i; i = edge[i].next)
#define v edge[i].to

using namespace std;

typedef long long LL;

const int N = 2010;
const int mod = 1e9 + 7;

LL f[N][N], p[N * N];

LL qpow(LL a, LL b)
{
	LL ret = 1, base = a;	
	while (b) {
		if (b & 1) ret = ret * base % mod;
		base = base * base % mod, b >>= 1;
	}
	return ret;
}

LL epb;

LL C(int a, int b) { return p[a] * epb % mod * qpow(p[a - b], mod - 2) % mod;}

int main()
{
	int n, k;
	scanf("%d%d", &n, &k);
	if (k == 1){ printf("%d\n", 1); return 0;}
	f[0][0] = p[0] = 1;
	Rep(i, n * k) p[i] = p[i - 1] * i % mod;
	epb = qpow(p[k - 2], mod - 2);
	Rep(i, n) Rep0(j, i) {
		f[i][j] = f[i - 1][j] * C(i * (k - 1) + j - 1, k - 2) % mod;
		f[i][j] = (f[i][j] + f[i][j - 1]) % mod;
		//printf("%d %d %lld\n", i, j, f[i][j]);
	}
	
	printf("%lld\n", f[n][n] * p[n] % mod);
	
	return 0;
}


Measured memory_bytes: 63104
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = 0;
		
		c = a*b-a-b+1;
		
		
		
		System.out.println(c);
		
		
		
		
	}

}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
ll ksm(int a,int b){
    if(b==0)return 1;
    if(b==1)return a;
    ll ans=ksm(a,b/2);
    ans*=ans;
    ans%=mod;
    if(b%2)ans*=a,ans%=mod;
    return ans;
}
int c(int n,int m){
    ll ans1=1,ans2=1;
    for(int i=n-m+1;i<=n;i++){
        ans1*=i;
        ans1%=mod;
    }
    for(int i=1;i<=m;i++){
        ans2*=i;
        ans2%=mod;
    }
    ans2=ksm(ans2,mod-2);
    ans1*=ans2;
    return ans1%mod;
}
int main(){
    int n,a,b;
    cin>>n>>a>>b;
    ll ans=ksm(2,n);
    ans-=c(n,a);
    ans+=mod;
    ans%=mod;
    ans-=c(n,b)+1;
    ans+=mod;
    ans%=mod;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){

    int time;
    int hour,min,sec;
    scanf("%d",&time);
    hour = time/3600;
    time = time - hour*3600;
    min = time/60;
    time = time - min*60;
    sec = time;
    
    
    printf("%d:%d:%d\n",hour,min,sec);
    return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

vector<string> dfs(string s, ll depth, vector<char> symbol)
{
    vector<string> ret;
    if (depth == 0)
    {
        ret.push_back(s);
        return ret;
    }

    for (ll i = 0; i < symbol.size(); i++)
    {
        auto vec = dfs(s + symbol[i], depth - 1, symbol);
        for (auto &&e : vec)
        {
            ret.push_back(e);
        }
    }
    return ret;
}

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

int main()
{
    string s;
    cin >> s;

    s[3] = '8';
    cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>
#include <math.h>
#include <deque>
#include <stack>

using namespace std;

typedef long long ll;

int main(void){
  ll n;
  cin >> n;
  vector<ll> h(n);
  for(ll i = 0;i < n;i++){
    cin >> h[i];
  }
  ll mn = 1145141919810;
  ll ans = 0;
  ll cnt = 0;
  for(ll i = 0;i < n - 1;i++){
    cnt++;
    mn = h[i];
    if(mn < h[i + 1]){
      cnt = 0;
      continue;
    }
    ans = ans < cnt ? cnt : ans;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
xp1,yp1,xp2,yp2=map(int,input().split())

q=int(input())

if xp1==xp2:
    for i in range(q):
        x0,y0=map(int,input().split())
        print('{:.10f}'.format(2*xp1-x0),'{:.10f}'.format(y0))
else:
    a=float((yp2-yp1)/(xp2-xp1))
    for i in range(q):
        x0,y0=map(int,input().split())
        x=a*((y0-yp1)-a*(x0-xp1))/(1+a**2)+x0
        y=(a*(a*y0+x0-xp1)+yp1)/(1+a**2)
        print('{:.10f}'.format(2*x-x0),'{:.10f}'.format(2*y-y0))



Measured memory_bytes: 5632
N = int(input())
A = map(int, input().split())

b2 = 0
b4 = 0
for a in A:
    if a % 2 == 0:
        b2 += 1

    if a % 4 == 0:
        b4 += 1

b2 -= b4

while b2 > 1:
    b2 -= 2
    # N -= 1
    b4 += 1

N -= b4*2+1

if N <= 0:
    print("Yes")
else:
    print("No")
    

Measured memory_bytes: 11096
#include <algorithm>
#include <array>
#include <climits> // INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX, ULLONG_MAX
#include <cmath>
#include <cstdint>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

#define ALL(x) (x).begin(), (x).end()
#define INF 1e9
#define LOG(x) cout << #x << " = " << (x) << endl
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using namespace std;

int main() {
    string S;
    cin >> S;

    if (S.find("AC") != string::npos)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n; cin >> n;
  vector<VI> dp(n + 1, VI(3));
  for (int i = 1; i <= n; i++) {
    for (int j: {0, 1, 2}) {
      int c; cin >> c;
      dp[i][j] = c + max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3]);
    }
  }
  cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;

  return 0;
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int arr[1000];
int main()
{
 	int n,cnt=0;
 	map<int,string>mp;
 	mp[2]="hon",mp[4]="hon";
 	mp[5]="hon",mp[7]="hon";
	mp[9]="hon",mp[0]="pon";
 	mp[1]="pon",mp[6]="pon";
 	mp[8]="pon",mp[3]="bon";
	cin>>n;
 	int k=n%10;
 	cout<<mp[k]<<endl;
/* 	while(n>0)
 	{
 		arr[cnt++]=n%10;
 		n/=10;
	}
	
	int flag=0;
	for(int i=0;i<cnt;i++)
	{
		if(arr[i]=='3')
		{
			flag=1;
			cout<<"bon"<<endl;
			break;
		}
		if((arr[i]==0)||(arr[i]==1)||(arr[i]==6)||(arr[i]==8))
		{
			flag=1;
			cout<<"pon"<<endl;
			break;
		}
	}
	//cout<<arr[0]<<" "<<arr[1]<<endl; 
	if(!flag)
	cout<<"hon"<<endl;*/
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int N,sum=0,x=1,P,a;
long long ans=0;
string S;
int main(){
    cin>>N>>P>>S;
    unordered_map<int,long long> mp;
    for(int i=0;i<N;i++){
        if(P==2 && (S.at(N-i-1)-'0')%2==0){ans+=N-i;}
        if(P==5 && (S.at(N-i-1)-'0')%5==0){ans+=N-i;}
        a=(S.at(N-1-i)-'0');
        sum+=a*x;
        sum%=P;
        mp[sum]++;
        x*=10;
        x%=P;
    }
    if(10%P==0){cout<<ans<<endl;}
    else{
        ans=mp[0];
        for(int i=0;i<P;i++){ans+=mp[i]*(mp[i]-1)/2;}
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3888
#include <iostream>
using namespace std; 
int main() {  
  int x;   
  while(1) { 
    int count=0;  
    cin >> x;
    if(x==0) break;  
    x = 1000-x; 
    count += x/500;  
    x = x%500;   
    count += x/100;  
    x = x%100;   
    count += x/50;  
    x = x%50;   
    count += x/10;  
    x = x%10;   
    count += x/5;
    x = x%5;  
    count += x/1;  
    cout << count << endl;
  } 
  return 0;
}


Measured memory_bytes: 1160
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let nmk: Vec<usize> = read_vec();
    let n = nmk[0];
    let m = nmk[1];
    let k = nmk[2] as u64;

    let a: Vec<u64> = read_vec();
    let b: Vec<u64> = read_vec();

    let mut total = 0;

    let mut ida = 0;
    while ida < n {
        if total + a[ida] > k {
            break;
        } else {
            total += a[ida];
            ida += 1;
        }
    }

    let mut idb = 0;
    while idb < m {
        if total + b[idb] > k {
            break;
        } else {
            total += b[idb];
            idb += 1;
        }
    }

    let mut ans = ida + idb;

    while ida > 0 {
        ida -= 1;
        total -= a[ida];
        while idb < m {
            if total + b[idb] > k {
                break;
            } else {
                total += b[idb];
                idb += 1;
            }
        }
        if ida + idb > ans {
            ans = ida + idb;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 7900
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int gcd(int a, int b){ //最大公約数
  if(!a) return b;
  if(!b) return a;
  if(a % b == 0) return b;
  return gcd(b, a % b);
}
int main(){
  int n;
  cin >> n;
  int mn = 1000000000;
  ll tot = 0;
  int cnt = 0;
  rep(i, n){
    int a;
    cin >> a;
    if(a < 0){
      cnt++;
      a = -a;
    }
    tot += a;
    mn = mn > a ? a : mn;
  }
  if(cnt & 1) cout << tot - mn * 2 << endl;
  else cout << tot << endl;
}

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

int main(void){
	int n;
	cin >> n;
	int p[n];
	for(int i = 0; i < n; i++){
		cin >> p[i];
	}
	sort(p, p+n, greater<int>());
	int count = 0;
	for(int i = 0; i < n; i++){
		if(i >= p[i]) break;
		count++;
	}
	cout << count << endl;

}



Measured memory_bytes: 3180
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll MOD = 1e9+7;
//LLONG_MIN

/*
ac
和がconst+順序になるような構成を考える．
*/

int main(void){
	ll n,p[20010],a[20010],b[20010];
	cin>>n;
	reg(i,1,n){
		cin>>p[i];
		a[p[i]]=30000*p[i];
		b[p[i]]=30000*(n-p[i])+i;
	}
	reg(i,1,n){
		printf("%lld",a[i]);
		if(i!=n)printf(" ");
	}
	printf("\n");
	reg(i,1,n){
		printf("%lld",b[i]);
		if(i!=n)printf(" ");
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <stdio.h>
#include <string>

int main(){
	int a, b, c;
	std::cin >> a >> b >> c;
	if( (a-c)*(b-c) < 0) std::cout << "Yes" << std::endl;
	else std::cout << "No" << std::endl;
	return 0;
}


Measured memory_bytes: 256
N,M = map(int, input().split())
Xs = list(map(int, input().split()))

if N >= M:
    print(0)
    exit()

Xs_sorted = sorted(Xs)

dists = [Xs_sorted[i+1]-Xs_sorted[i] for i in range(len(Xs_sorted)-1)]
dists_sorted = sorted(dists)

if N == 1:
    print(sum(dists_sorted))
else:
    print(sum(dists_sorted[:-(N-1)]))


Measured memory_bytes: 13960
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;
// Comment out below and program paste

// #include "UnionFind.hpp"
// #include "power.hpp"

signed main() {
    string S;
    cin >> S;
    int A = stoi(S.substr(0, 2));
    int B = stoi(S.substr(2, 2));
    if (A <= 12 && B <= 12 && A != 0 && B != 0) {
        cout << "AMBIGUOUS" << endl;
    } else if (A <= 12 && A != 0) {
        cout << "MMYY" << endl;
    } else if (B <= 12 && B != 0) {
        cout << "YYMM" << endl;
    } else {
        cout << "NA" << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

#include <string.h>

int main()

{

    char a[100];

    char b[50],c[50];

    int p,q,i,j,x;

    scanf("%s",a);

    p=strlen(a);

    q=p/2;

    for(i=0;i<q;i++)

    {

        b[i]=a[i];

    }

    b[i]='\0';

    for(i=0,j=q+1;i<q;i++,j++)

    {

        c[i]=a[j];

    }

    c[i]='\0';

    x=strcmp(b,c);

    if(x==0)

    {

        printf("Yes\n");

    }

    else{

        printf("No\n");

    }

    return 0;

}

Measured memory_bytes: 128
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;
typedef array<int,3> A;

const int L=1e5;
int rep[L];
int Find(int a){
	while(a!=rep[a]){
		a=rep[a]=rep[rep[a]];
	}
	return a;
}
void Union(int a,int b){
	a=Find(a);
	b=Find(b);
	rep[a]=b;
}
int x[L];
int y[L];
P X[L];
P Y[L];
int main() {
	int N;
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		scanf("%d%d",x+i,y+i);
		X[i]=P(x[i],i);
		Y[i]=P(y[i],i);
		rep[i]=i;
	}
	sort(X,X+N);
	sort(Y,Y+N);
	vector<A> ps;
	for(int i=1;i<N;i++){
		ps.push_back(A{{X[i].first-X[i-1].first,X[i].second,X[i-1].second}});
		ps.push_back(A{{Y[i].first-Y[i-1].first,Y[i].second,Y[i-1].second}});
	}
	sort(ps.begin(),ps.end());
	LL ret=0;
	for(auto a:ps){
		if(Find(a[1])!=Find(a[2])){
			ret+=a[0];
			Union(a[1],a[2]);
		}
	}
	printf("%lld\n",ret);
	

	return 0;
}



Measured memory_bytes: 7668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#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 n;cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	int ans = 0;
	rep(i,n){
		for(int j = i + 1; j < n; j++){
			ans += a.at(i) * a.at(j);
		}
	}
	cout << ans << endl;
}


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

using namespace std;

int main()
{
  int N, L, A[100000];

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

  for(int pos = 0; pos < N; pos++) {
    if(pos >= 1 && A[pos - 1] + A[pos] >= L) {
      vector< int > step;
      step.push_back(pos - 1);
      for(int i = pos - 2; i >= 0; i--)
        step.push_back(i);
      for(int i = pos; i < N - 1; i++)
        step.push_back(i);
      reverse(step.begin(), step.end());

      cout << "Possible" << endl;
      for(int k : step) {
        cout << k + 1 << endl;
      }
      exit(0);
    } else if(pos + 1 < N && A[pos] + A[pos + 1] >= L) {
      vector< int > step;
      step.push_back(pos);
      for(int i = pos - 1; i >= 0; i--)
        step.push_back(i);
      for(int i = pos + 1; i < N - 1; i++)
        step.push_back(i);
      reverse(step.begin(), step.end());

      cout << "Possible" << endl;
      for(int k : step) {
        cout << k + 1 << endl;
      }
      exit(0);
    }
  }
  cout << "Impossible" << endl;

}


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

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

signed main(){

  int h,n;
  cin>>h>>n;
  vector<int> a(n),b(n);
  rep(i,n)cin>>a[i]>>b[i];

  vector dp (h+1e5,1<<28);
  dp[0] = 0;
  rep(i,n)rep(j,h){
    auto& ai = a[i];
    auto& bi = b[i];
    dp[j+ai] = min(dp[j+ai],dp[j]+b[i]);
  }
  int ans = 1<<28;
  for(int i=h;i<h+1e5;++i)ans=min(ans,dp[i]);
  cout<<(ans)<<endl;

}

Measured memory_bytes: 3736
def calc(a1,c):
    As=[a1]
    Bs=[]
    Bs.append(c[0][0]-As[0])
    As.append(c[1][0]-Bs[0])
    As.append(c[2][0]-Bs[0])
    Bs.append(c[0][1]-As[0])
    Bs.append(c[0][2]-As[0])
    for a in range(3):
        for b in range(3):
            if As[a]+Bs[b]!=c[a][b]: return False
    return True

c=[]
for i in range(3):
    c.append(list(map(int,input().split())))

flag=False
if (calc(0,c)): 
    print('Yes')
else: print('No')

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

int main()
{
  long long a, b;
  cin >> a >> b;
  long long x;
  cin >> x;
  if (a == 0) {
	cout << b / x + 1 << endl;
  }
  else {
	long long s = (a -1) / x + 1, t = b / x + 1;
	cout << t - s << endl;
  }
  return 0;
}



Measured memory_bytes: 256
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let k: usize = itr.next().unwrap().parse().unwrap();
    let s: Vec<char> = itr.next().unwrap().chars().collect();
    let mut ans = 0;
    let mut cnt = 0;
    for i in 0..n - 1 {
        if s[i] == s[i + 1] {
            ans += 1;
        } else {
            cnt += 1;
        }
    }
    ans += min(cnt, k) * 2;
    ans = min(ans, n - 1);

    println!("{}", ans);
}


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

#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)

using int64 = uint64_t;
using namespace std;

vector<int64> prime_factor(int64 n) {
    vector<int64> primes;
    for (int64 i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            primes.push_back(i);
            if (n / i != i)
                primes.push_back(n / i);
        }
    }
    sort(primes.begin(), primes.end());
    return primes;
}

int digits(int64 n) {
    int cnt = 0;
    while (n > 0) {
        n /= 10;
        cnt++;
    }
    return cnt;
}

int main() {
    fastIO;
    int64 n;

    cin >> n;
    vector<int64> primes = prime_factor(n);

    int digit = 11;
    int l = 0, r = (int)primes.size() - 1;
    while (l <= r) {
        if (primes.at(l) * primes.at(r) == n) {
            int l_digit = digits(primes.at(l));
            int r_digit = digits(primes.at(r));
            digit = max(l_digit, r_digit);
            r--;
        } else {
            l++;
        }
    }
    cout << digit << endl;
}



Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main()
{
    char s[25];
    cin>>s;
    for(int i=0;i<=4;i++)cout<<s[i];
    cout<<" ";
    for(int i=6;i<=12;i++)cout<<s[i];
    cout<<" ";
    for(int i=14;i<=18;i++)cout<<s[i];

}


Measured memory_bytes: 256
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}


fn main() {
    let line: Vec<usize> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = line[0];
    let wmax = line[1];

    let mut memo = vec![vec![0u64; n*3 + 1]; n+1];
    let mut wv = Vec::with_capacity(n);

    for i in 0..n {
        let line: Vec<u64> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();

        wv.push((line[0], line[1]));
    }
    let w0 = wv[0].0 as usize;
    wv.sort_by(|a,b| b.1.cmp(&a.1));

    for i in 0..n {
        let w = (wv[i].0 as usize) - w0;
        let v = wv[i].1;

        for j in (0..n).rev() {
            for k in (0..3*n-w+1).rev() {
                memo[j+1][k+w] = cmp::max(memo[j+1][k+w], memo[j][k] + v);
            }
        }
    }

    let mut ans = 0;
    for i in 1..n+1 {
        if w0 * i > wmax {
            break;
        }
        ans = cmp::max(ans, memo[i][cmp::min(3*n, wmax - w0 * i)]);
    }

    println!("{}", ans);
}


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

using namespace std;

int main() {
  int N, Y;
  cin >> N >> Y;
  int a, b, c;
  bool ans = false;
  for(int x=0; x <= N; ++x) {
    for(int y=0; y <= N-x; ++y) {
      int sum = 10000*x + 5000*y + 1000*(N - x - y); // 三つ目の変数は定義しなくても表現できる
      if (sum == Y) {
          a = x;
          b = y;
          c = N - x - y;
          ans = true;
      }
    }
  }
  if (ans) {
    cout << a << " " << b << " " << c << endl;
  } else {
    cout << -1 << " " << -1 << " " << -1 << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
 
int main(){
 
  int f=0;
  string n;
 
  cin>>n;
  for(int i=0;i<n.size()/2;i++){
    if(n[i]!=n[n.size()-i-1]){
      f=1;
      break;
    }
  }
 
  if(f) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
 
  return 0;
}

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



int main() {
	int n;
	int k;
	cin >> n >> k;
	vector<int> d(k);
	for(int i = 0; i < k; i++){
		cin >> d.at(i);
	}
	int ans;
	for(int i = n; ; i++){
		bool flag = false;
		string i_str = to_string(i);
		for(int j = 0; j < i_str.size(); j++){
			for(int l = 0; l < k; l++){
				if(i_str[j] - '0' == d.at(l)){
					flag = true;
					break;
				}
			}
			if(flag){
				break;
			}
		}
		if(!flag){
			ans = i;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <bitset>
using namespace std;
#define N 5050
int n,K,a[N],f[N];
int g[N][N];
int main() {
	//freopen("Num.in","r",stdin);
	//freopen("Num.out","w",stdout);
	scanf("%d%d",&n,&K);
	int i,sum=0,j;
	for(i=1;i<=n;i++) {
		scanf("%d",&a[i]); a[i]=min(a[i],K); sum+=a[i];
	}
	if(sum<K) {
		printf("%d\n",n); return 0;
	}
	f[0]=1;
	for(i=1;i<=n;i++) {
		for(j=K;j>=a[i];j--) {
			f[j]=f[j]+f[j-a[i]];
		}
	}
	for(i=1;i<=n;i++) {
		for(j=0;j<a[i];j++) g[i][j]=f[j];
		for(j=a[i];j<=K;j++) g[i][j]=f[j]-g[i][j-a[i]];
	}
	int ans=n;
	for(i=1;i<=n;i++) {
		for(j=K-a[i];j<K;j++) {
			if(g[i][j]) {
				ans--; break;
			}
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 98816
#!/usr/bin/env python3
import sys
import numpy as np


def solve(K: int, X: int):
    start = X - K + 1
    end = X + K - 1
    for i in range(start, end + 1):
        if i == end:
            print(i)
        else:
            print(i, end=" ")

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    solve(K, X)


if __name__ == "__main__":
    main()


Measured memory_bytes: 12452
#include <iostream>

int main() {
  unsigned long long N,M;
  std::cin >> N >> M;
  unsigned long long l = 0;
  unsigned long long r = N;
  for(unsigned long long m=0;m<M;m++){
    unsigned long long L,R;
    std::cin >> L >> R;
    l = std::max(l,L);
    r = std::min(r,R);
  }
  if (l <= r)
    std::cout << r - l + 1 << std::endl;
  else
    std::cout << 0 << std::endl;
  return 0;
}


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

int main() {
	ll x, k, d, ans;
	cin >> x >> k >> d;
	if (abs(x) > k*d && 1000000000000000.0 / d > k) {
		if (x > 0) ans = x - k * d;
		else ans = x + k * d;
	}
	else {
		if ((k - abs(x) / d) % 2 == 0) ans = x % d;
		else {
			if (x > 0) ans = x % d - d;
			else ans = ans = x % d + d;
		}
	}
	cout << abs(ans) << endl;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

template<typename Monoid, typename OperatorMonoid=Monoid>
struct LazySegmentTree{
	using F=function<Monoid(Monoid, Monoid)>;
	using G=function<Monoid(Monoid, OperatorMonoid, int)>;
	using H=function<OperatorMonoid(OperatorMonoid, OperatorMonoid)>;
	int sz;
	vector<Monoid> data;
	vector<OperatorMonoid> lazy;
	const F f;
	const G g;
	const H h;
	const Monoid e1;
	const OperatorMonoid e0;

	LazySegmentTree(int n, const F f, const G g, const H h, const Monoid &e1, const OperatorMonoid &e0): f(f), g(g), h(h), e1(e1), e0(e0){
		sz=1;
		while(sz<n) sz<<=1;
		data.resize(2*sz-1, e1);
		lazy.resize(2*sz-1, e0);
	}

	void build(vector<Monoid> v){
		for(int i=0; i<v.size(); i++) data[i+sz-1]=v[i];
		for(int i=sz-2; i>=0; i--) data[i]=f(data[2*i+1], data[2*i+2]);
	}

	void eval(int k, int l, int r){
		if(lazy[k]!=e0){
			data[k]=g(data[k], lazy[k], r-l);
			if(k<sz-1){
				lazy[2*k+1]=h(lazy[2*k+1], lazy[k]);
				lazy[2*k+2]=h(lazy[2*k+2], lazy[k]);
			}
		}
		lazy[k]=e0;
	}

	void update(int a, int b, const OperatorMonoid &x, int k, int l, int r){
		eval(k, l, r);
		if(r<=a || b<=l) return;
		if(a<=l && r<=b){
			lazy[k]=h(lazy[k], x);
			eval(k, l, r);
		}else{
			update(a, b, x, 2*k+1, l, (l+r)/2);
			update(a, b, x, 2*k+2, (l+r)/2, r);
			data[k]=f(data[2*k+1], data[2*k+2]);
		}
	}
	void update(int a, int b, const OperatorMonoid &x){
		return update(a, b, x, 0, 0, sz);
	}

	Monoid find(int a, int b, int k, int l, int r){
		eval(k, l, r);
		if(b<=l || r<=a) return e1;
		if(a<=l && r<=b) return data[k];
		else return f(find(a, b, 2*k+1, l, (l+r)/2), find(a, b, 2*k+2, (l+r)/2, r));
	}
	Monoid find(int a, int b){
		return find(a, b, 0, 0, sz);
	}
};
const int INF=1e9+7;
int main()
{
	int n, q;
	scanf("%d %d", &n, &q);
	auto f=[](int a, int b){ return a+b;};
	auto g=[](int a, int x, int len){ return x*len;};
	auto h=[](int x, int y){ return y;};
	LazySegmentTree<int> seg(n, f, g, h, 0, INF);
	for(int z=0; z<q; z++){
		int p; scanf("%d", &p);
		if(p==0){
			int s, t, x;
			scanf("%d %d %d", &s, &t, &x);
			seg.update(s, t+1, x);
		}else{
			int s, t;
			scanf("%d %d", &s, &t);
			printf("%d\n", seg.find(s, t+1));
		}
	}
	return 0;
}


Measured memory_bytes: 4964
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i=0; i<n; i++)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define reprs(i, s, e) for(int i=e-1; i>=s; i--)


const ll MOD = 1e9+7; // modification needed.
const int MAX = 1e6; // modification needed.

ll fac[MAX], finv[MAX], inv[MAX];

void cominit(){

    fac[0]  = fac[1]  = 1;
    finv[0] = finv[1] = 1;
    inv[1]  = 1;

    for(int i=2; i<MAX; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

ll com(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}


int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll h, w, a, b; cin >> h >> w >> a >> b;

    cominit();

    ll ans = 0;
    rep(i, h - a){
        ans = (ans + (com(b-1+i, i) * com(h-1-i+w-b-1, w-b-1)) % MOD ) % MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 23680
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<vector>
#include<cctype>
using namespace std;

int main(){
int a,b;
cin>>a>>b;
double da=a,db=b;
printf("%d %d %f\n",a/b,a%b,da/db);
return 0;
}

Measured memory_bytes: 1184
H, W = [int(str) for str in input().strip().split()]
A = [[int(str) for str in input().strip().split()] for _ in range(H)]

N = 0
actions = []
for i in range(H):
    jd = 1 - (i % 2) * 2
    js = list(range(W))[::jd]
    for j in js:
        if A[i][j] % 2 and A[i][j] != 0:
            if j == js[-1]:
                if i != H - 1:
                    ti, tj = i + 1, j
                else:
                    break
            
            else:
                ti, tj = i, j + jd

            A[ti][tj] += 1
            actions.append('{0} {1} {2} {3}'.format(i + 1, j + 1, ti + 1, tj + 1))
            N += 1

print(N)
[print(action) for action in actions]

Measured memory_bytes: 17244
#include <stdio.h>
int main()
{
	int a, b;
	char op;
	while (1){
		scanf("%d %c %d", &a, &op, &b);
		if (op == '+'){
			printf("%d\n", a + b);
		}
		else if (op == '-'){
			printf("%d\n", a - b);
		}
		else if (op == '*'){
			printf("%d\n", a * b);
		}
		else if (op == '/'){
			printf("%d\n", a / b);
		}
		else{
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 2760