akhauriyash/Code-Regression huggingface dataset:
package main

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

func main() {
	H, W := ReadInt(), ReadInt()
	fmt.Println(strings.Repeat("#", W+2))
	for i := 0; i < H; i++ {
		fmt.Println("#" + ReadString() + "#")
	}
	fmt.Println(strings.Repeat("#", W+2))
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1864
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <stack>
const int MAXN = 1e5 + 7;
using namespace std;
char a[MAXN];


int main() {
	scanf("%s", a);
	if (a[strlen(a) - 1] == 's') printf("%ses\n", a);
	else printf("%ss\n", a);
	return 0;
}

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

#define int long long

int N;
vector<int> A, B;

int calc(int b) {
  int ret = 0;
  for (int i = 1; i <= N; i++) {
    ret += abs(A[i-1] - (b + i));
  }
  return ret;
}

signed main() {
  cin >> N;
  A.resize(N);
  B.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    B[i] = A[i] - (i + 1);
  }

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

  cout << calc(B[N/2]) << endl;

  return 0;
}

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

int n,c,d[30][30],cnt[3][30],cl[3];

int main(){
    scanf("%d%d",&n,&c);
    for(int i=0;i<c;i++)
        for(int j=0;j<c;j++)scanf("%d",&d[i][j]);
    for(int i=0;i<3;i++)fill_n(cnt[i],c,0);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++){
            int x;
            scanf("%d",&x);
            cnt[(i+j)%3][x-1]++;
        }
    int ans=0x7fffffff;
    for(cl[0]=0;cl[0]<c;cl[0]++)
        for(cl[1]=0;cl[1]<c;cl[1]++)
            for(cl[2]=0;cl[2]<c;cl[2]++){
                int sm=0;
                if(cl[0]==cl[1]||cl[1]==cl[2]||cl[0]==cl[2])continue;
                for(int i=0;i<3;i++)
                    for(int j=0;j<c;j++)
                        sm+=cnt[i][j]*d[j][cl[i]];
                ans=min(sm,ans);
            }
    printf("%d\n",ans);
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(max(a,max(b,c))*2 ==a+b+c){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
// È¥°É£¡Æ¤¿¨Çð! °ÑAC´ø»ØÀ´£¡
//      ¤Ø¡¡¡¡¡¡¡¡¡¡£¯|
// ¡¡¡¡/£Ü7¡¡¡¡¡¡ ¡Ï£ß/
// ¡¡ /¡¡©¦¡¡¡¡ £¯¡¡£¯								AC		AC		AC		AC
//    ©¦¡¡Z £ß,£¼¡¡£¯¡¡¡¡ /`©c						AC		AC		AC		AC
//    ©¦¡¡¡¡¡¡¡¡¡¡©c¡¡¡¡ /¡¡¡¡¡µ					AC		AC		AC		AC
// ¡¡Y¡¡¡¡¡¡¡¡¡¡`¡¡ /¡¡¡¡/  /						AC		AC		AC		AC
// ¡¡Øé¡ñ¡¡.¡¡¡ñ¡¡¡¡¡´¡¡/¡¡/						AC		AC		AC		AC
// ¡¡()¡¡ ¤Ø¡¡¡¡¡¡¡¡|¡¡£Ü¡´							AC		AC		AC		AC
// ¡¡¡¡>- ._¡¡ ¥£¡¡ ©¦ £¯£¯							AC		AC		AC		AC
// ¡¡ / ¤Ø¡¡¡¡ /¡¡/£¼| £Ü£Ü							AC		AC		AC		AC
// ¡¡ ©c_/¡¡¡¡(_£¯¡¡ ©¦£¯£¯							AC		AC		AC		AC
// ¡¡¡¡ 7¡¡¡¡¡¡¡¡¡¡¡¡¡¡|£¯							AC		AC		AC		AC
// ¡¡¡¡ £¾¨Dr£þ£þ`-¨D£ß/							AC		AC		AC		AC
//**************************************Accepted*****************************************//

#include<bits/stdc++.h>

#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define Unique(x) x.erase(unique(all(x)),x.end());

#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"

#define Pig (OO)

using namespace std;

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

const int Days[]={-1,31,28,31,30,31,30,31,31,30,31,30,31};

inline int read()
{
	#define gc getchar
	int ans=0;
	bool f=1;
	char ch=gc();
	
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	
	return f?ans:-ans;
	
	#undef gc
}

typedef long long ll;

int n,m;
int cst[1010];
int bit[1010];
int DP[(1<<15)+100];

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int t;
		cin>>cst[i]>>t;
		
		while(t--)
		{
			int x;
			cin>>x;
			x--;
			
			bit[i]+=(1<<x);
		}
	}
	
	memset(DP,117901063,sizeof(DP));
	
	DP[0]=0;  
	
	for(int mask=0;mask<(1<<n);mask++)for(int j=0;j<m;j++)DP[mask|bit[j]]=min(DP[mask|bit[j]],DP[mask]+cst[j]);
	
	cout<<(DP[(1<<n)-1]==117901063 ? -1 : DP[(1<<n)-1]);
	
	//printf("Time used = %.12f",(double)(clock())/CLOCKS_PER_SEC);
	return 0;
}

/*  GOD BLESS  */


Measured memory_bytes: 384
from sys import stdin, setrecursionlimit
input = stdin.buffer.readline

MOD = 10 ** 9 + 7
N = int(input())

dp = [0 for _ in range(N + 1)]
dp[N] = 1

for i in range(N, -1, -1):
    for j in range(i - 3 + 1):
        dp[j] = (dp[j] + dp[i]) % MOD

print(dp[0])

Measured memory_bytes: 65692
#include<stdio.h>
int main(void){
  char str[6];
  int A=0;
  for(int i=0; i<6; i++){
    scanf("%1s",&str[i]);
  }
  if(str[0]==str[3]){
    A++;
  }
  if(str[1]==str[4]){
    A++;
  }
  if(str[2]==str[5]){
    A++;
  }
  printf("%d",A);
}

Measured memory_bytes: 128
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<queue>
#include<set>
#include<stack>
#include<vector>
using namespace std;

typedef long long lint;

int main(){
    int n;
    cin >> n;
    set<int> st;
    for(int i = 0 ; i < n ; i++){
        int a;
        cin >> a;
        if(st.count(a)){
            st.erase(a);
        }else{
            st.insert(a);
        }
    }
    cout << st.size() << endl;
    return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define INF (int) 2e9
#define MOD (int) 1e9 + 7
typedef pair<int, int> P;

int main(){
    int n;
    cin >> n;
    P p[n];
    rep(i, n){
        int a;
        cin >> a;
        p[i] = P(a, i+1);
    }

    sort(p, p+n);

    rep(i, n-1){
        cout << p[i].second << " ";
    }
    cout << p[n-1].second << endl;
    return 0;
}

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

int main() {
    int n, ans = INT_MAX, temp;
    cin >> n;
    vector<int> loc(n);
    rep(i, n) cin >> loc.at(i);
    for(int i = 1; i <= 100; i++) {
        int sum = 0;
        rep(j, n) sum += (i - loc.at(j)) * (i - loc.at(j));
        if(sum < ans) ans = sum;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N=int(input())
for h in range(N//4+1,3501):
    for w in range((N*h)//(4*h-N)+1,3501):
        if N*w*h%(4*h*w-N*h-N*w)==0:
            d=N*w*h//(4*h*w-N*h-N*w)
            print('{} {} {}'.format(h,w,d))
            break
    else:
        continue
    break

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	static Scanner sc=new Scanner(System.in);
    static int N;
    public static void main(String[] args) {
        N = sc.nextInt();
        double[] x=new double[3],y=new double[3];
        for(int i=0;i<N;i++) {
            for(int j=0;j<3;j++){
                x[j]=sc.nextDouble();
                y[j]=sc.nextDouble();
            }
            double a=Math.hypot(x[0]-x[1],y[0]-y[1]),
            	   b=Math.hypot(x[1]-x[2],y[1]-y[2]),
                   c=Math.hypot(x[2]-x[0],y[2]-y[0]),
                   R=a*b*c/(Math.sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c))),
            	   aA=Math.acos((b*b+c*c-a*a)/(2.0*b*c)),
            	   aB=Math.acos((c*c+a*a-b*b)/(2.0*c*a)),
            	   aC=Math.acos((a*a+b*b-c*c)/(2.0*a*b)),
            	   A=Math.sin(2.0*aA),
                   B=Math.sin(2.0*aB),
                   C=Math.sin(2.0*aC),
                   xp=((x[2]*A+x[0]*B+x[1]*C)/(A+B+C)),
                   yp=((y[2]*A+y[0]*B+y[1]*C)/(A+B+C));
            	   System.out.printf("%.3f %.3f %.3f\n",xp,yp,R);
        }
    }
}

Measured memory_bytes: 12000
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<cmath>
#include<string>
using namespace std;

int main(){
    long long int a,b,k,x;
    cin >> a >> b >> k;
    x = min(a,k);
    a -= x;
    k -= x;
    x = min(b,k);
    b -=x;
    k -=x;
    cout << a << " " << b << endl;

    return 0;
}




Measured memory_bytes: 256
import Control.Applicative
main = do
    [a,b,ang] <- map read . words <$> getLine
    let
        rad = (ang)*pi/180
    print $ a*b*(sin rad) / 2
    print $ a + b + sqrt (a^2 + b^2 - 2*a*b*(cos rad))
    print $ b * (sin rad)

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll h[n];
    for (int i = 0; i < n; ++i) cin >> h[i];

    ll prev = h[0];
    int res = 0;
    int cnt = 0;

    for (int i = 1; i < n; ++i){

        if(prev >= h[i]){
            cnt++;
            res = max(cnt, res);
        }
        else{
            cnt = 0;
        }
        prev = h[i];
    }
    cout << res << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
 
int main() {
  // input
    long n,a,b;cin >> n >> a >> b;
    long ans;

  // compute
    //nは1を別処理
    if(n == 1){
        if(a == b){
            cout << 1 << endl;
            return 0;
        }else{
            cout << 0 << endl;
            return 0;            
        }
    }    

    ans = (n -2) * b - (n - 2) * a + 1;
    if(ans < 0){	
    	ans = 0;
    }

  // output  
    cout << ans << endl;

}

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

#define INF INT_MAX
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,a,n) for(int i=0;i<n;i++)

using namespace std;

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

	int n,m;
	vector<pair<int,int>> v;
	cin >> n >> m;

	int t,tt;
	for(int i=0;i < n;i++){
		cin >> t >> tt;
		v.push_back(make_pair(t,tt));
	}

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


	ll ans = 0;
	ll cnt = 0;
	for(int i=0;i < n;i++){
		if(cnt + v[i].second > m){
			ans += (m - cnt)*v[i].first;
			break;
		}
		ans += (ll)v[i].first * v[i].second;
		cnt += (ll)v[i].second;
	}

	cout << ans << endl;
   
	return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define x first
#define y second
#define mod 1e9+7
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rof(i,a,b) for(ll i=a;i>b;i--)

//int a[1001][1001] //aise global me hi

ll lcm(ll a, ll b){
    return a / __gcd(a, b) * b;
}
//memset can initialize to 0 or -1 ONLY
// memset(a,0,sizeof(a[0][0])*n*n); //2D array
//memset(a, 0, sizeof(a));  //1D array
//memset(str, 't', sizeof(str)); // string
void solve()
{
    long long int n,k;cin>>n>>k;
    if(n==k) cout<<"0"<<endl;
    else if(k>n) {
	cout<<min(n,abs(n-k));
    }
    else
    {

    	cout<<min(n,  min(    (abs(n-(n/k)*k))    ,   abs(n-((n/k)+1)*k))          );
    }
    
}


int main()
{

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

    ll t=1;
  //  cin>>t;
    while(t--)
    {
    
    solve();
    
    }

}

Measured memory_bytes: 256
tList = []
for i in range(5):
  tList.append(list(str(input())))

dList = []
for i in range(len(tList)):
  tmp = 10 - int(tList[i][-1])
  if tmp == 10:
    dList.append(0)
  else: 
    dList.append(tmp)

result = 0
for i in range(len(tList)):
  result += int(''.join(tList[i]))+dList[i]

print(result - sorted(dList,reverse = True)[0])
 

Measured memory_bytes: 3316
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: u64 = sc.read();
    if n % 2 == 1 {
        println!("0");
        return;
    }

    let m = n / 2;
    let mut ans = 0;
    let mut cur = 5;
    while cur <= m {
        ans += m / cur;
        cur *= 5;
    }
    println!("{}", ans);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

using namespace std;
using ll = long long;

void init();
void solve();

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a
#define lcoutln(a) cout << a << endl
#define lcerr(a) cerr << a
#define lcerrln(a) cerr << a << endl
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif
#define MOD 1000000007
#define PI 3.141592653589793238462643383

signed main()
{
	init();
	solve();
}

int N;

void init()
{
	cin >> N;
}


void solve()
{
	ll res = 1;
	rep(i, N) res *= 3;
	ll minus = 1;
	rep(i, N) {
		int x;
		cin >> x;
		if (x % 2 == 0) minus *= 2;
	}
	cout << res - minus << endl;
}


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

bool judgement(int a, int b) {
	if (a + b == 4 && a * b == 3) return true;
	else if (a + b == 6 && a * b == 5) return true;
	else if (a + b == 8 && a * b == 7) return true;
	else if (a + b == 9 && a * b == 8) return true;
	else if (a + b == 11 && a * b == 10) return true;
	else if (a + b == 13 && a * b == 12) return true;
	else if (a + b == 8 && a * b == 15) return true;
	else if (a + b == 10 && a * b == 21) return true;
	else if (a + b == 11 && a * b == 24) return true;
	else if (a + b == 13 && a * b == 30) return true;
	else if (a + b == 15 && a * b == 36) return true;
	else if (a + b == 12 && a * b == 35) return true;
	else if (a + b == 13 && a * b == 40) return true;
	else if (a + b == 15 && a * b == 50) return true;
	else if (a + b == 17 && a * b == 60) return true;
	else if (a + b == 15 && a * b == 56) return true;
	else if (a + b == 17 && a * b == 70) return true;
	else if (a + b == 19 && a * b == 84) return true;
	else if (a + b == 18 && a * b == 80) return true;
	else if (a + b == 20 && a * b == 96) return true;
	else if (a + b == 22 && a * b == 120) return true;
	else if (a + b == 10 && a * b == 24) return true;
	else if (a + b == 13 && a * b == 36) return true;
	else if (a + b == 15 && a + b == 44) return true;
	else if (a + b == 15 && a * b == 54) return true;
	else if (a + b == 17 && a * b == 66) return true;
	else if (a + b == 20 && a * b == 99) return true;
	return false;
}

int main() {
	int a, b;
	cin >> a >> b;
	cout << (judgement(a, b) ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <math.h>
using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define INF 2000000000
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}


int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}



signed main() {
	int n, m,k,a,ans=0;
	cin >> n >> m;
	vector<vector<int>>vec(n, vector<int>(m));
	rep(i, n) {
		cin >> k;
		rep(j, k) {
			cin >> a;
			vec[i][a - 1] = 1;
		}
	}
	rep(i, m) {
		a = 0;
		rep(j, n) {
			a += vec[j][i];
		}
		if (a == n) {
			ans++;
		}
	}
	cout << ans << endl;
}



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

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

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

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

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

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

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

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

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

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

vmint f, finv, inv;

void finit(ll N) {
	f.assign(N + 1, 1);
	finv.assign(N + 1, 1);
	inv.assign(N + 1, 1);
	inv[1] = 1;

	repn(i, N) {
		f[i] = f[i - 1] * i;

		if(i>1)inv[i] = -inv[MOD % i] * (MOD / i);

		finv[i] = finv[i - 1] * inv[i];
	}

}

mint com(ll a, ll b) {
	if (a < 0 || b < 0 || a < b) { return 0; }
	return f[a] * finv[b] * finv[a - b];
}

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

	ll N = S.size();

	mint ans = 0;

	finit(N + K);
	for (ll i = N; i <= N + K; i++)ans += com(N + K, i) * pw(25, N + K - i);

	cout << ans << endl;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> TUP;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define mp(a,b) make_pair(a,b)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*y/gcd(x,y);
}

int main(){
    ll N; cin>>N;
  map<ll,ll> m;
  rep(i,N){
  	ll a; cin>>a;
    auto itr=m.find(a);
    if(itr!=m.end()){
    	(itr->second)++;
    }
    else{
    	m.insert(mp(a,1));
    }
  }
  ll cnt=0;
 for(auto itr=m.begin();itr!=m.end();++itr){
 	if((itr->second)%2==1){
    	cnt++;
    }
 }
  
     cout<<cnt<<endl;      
}

Measured memory_bytes: 6528
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;

const long long MOD = 1000000007;

void solve(long long N, std::vector<long long> A){
  vector<long long> B(60, 0);
  long long x, y;
  long long ret = 0;

  for (int i = 0; i < 60; i++) {
    x = 0; y = 0;
    for (int j = 0; j < N; j++) {
      if (((A[j]>>i)&1) == 1) {
        x++;
      } else {
        y++;
      }
    }
    B[i] = x*y % MOD;
    ret += (((1LL<<i)%MOD)*B[i])%MOD;
    ret %= MOD;
  }
  std::cout << ret << std::endl;

}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> A(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&A[i]);
  }
  solve(N, std::move(A));
  return 0;
}


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

int main()
{
	int k,a[3];
	cin>>a[0]>>a[1]>>a[2]>>k;
	sort(a,a+3);
	while(k--) a[2]*=2;
	cout<<a[0]+a[1]+a[2];
	
	return 0;
}

Measured memory_bytes: 256
N = int(input())
W = set([])

isok = True
w = input()
W.add(w)
back = w[-1]
for i in range(N-1):
    w = input()
    if w in W or w[0]!=back: isok=False
    W.add(w)
    back = w[-1]
    
if isok:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3316
import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
import std.random;
import std.math;
import std.container;
import std.numeric;
import std.bigint;

class UnionFind {

  int N;
  int[] table;

  this(int n) {
    N = n;
    table = new int[](N);
    foreach(i; 0..N) table[i] = -1;
  }

  int find(int x) {
    return table[x] < 0 ? x : (table[x] = find(table[x]));
  }

  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (table[x] < table[y]) swap(x, y);
    table[x] += table[y];
    table[y] = x;
  }

  void group(ref int[][] g) {
    auto group = new int[][](N);
    foreach (i; 0..N)
      g[find(i)] ~= i;
  }

}

void main() {
  auto input = readln.split.map!(to!int);
  auto N = input[0];
  auto M = input[1];

  auto lang = new int[][](M+1);
  foreach (i; 0..N) {
    input = readln.split.map!(to!int);
    if (input[0] == 0) { writeln("NO"); return;}
    foreach (j; 1..input[0]+1)
      lang[input[j]] ~= i;
  }

  auto uf = new UnionFind(N);
  foreach (i; 1..M+1)
    foreach (j; 1..lang[i].length)
      uf.unite(lang[i][0], lang[i][j]);
  writeln(uf.table.map!(x => x < 0).sum == 1 ? "YES" : "NO");
}


Measured memory_bytes: 9212
#include <stdio.h>
#include <vector>

int main() {
	int n;
	std::vector<int> d;

	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		int b;
		scanf("%d", &b);
		d.push_back(b);
	}
	
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		for (int j = n - 1; j > i; j--) {
			if (d[j] < d[j - 1]) {
				std::swap(d[j], d[j - 1]);
				cnt++;
			}
		}
	}

	for (auto v = d.begin(); v != d.end(); v++) {
		printf("%d%c", *v, (d.end() - v == 1) ? '\n' : ' ');
	}
	printf("%d\n", cnt);
}

Measured memory_bytes: 2780
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;


int main()
{
    int n;
    cin >>n;
    vector<ll>dp(n+1),a(n);
    int pre;
    rep(i,n)
    {
        
        cin >>a[i];
        if(!i)dp[i]=abs(a[i]);
        else dp[i]=abs(a[i]-pre)+dp[i-1];
      
        pre=a[i];
    }
    dp[n]=dp[n-1]+abs(pre);
 
    rep(i,n)
    {
        if(!i)cout<<abs(a[1])+dp[n]-dp[1]<<endl;
        else if(i==n-1)cout<<abs(a[n-2])+dp[n-2]<<endl;
        else
        {
            cout<<dp[n]-(dp[i+1]-dp[i-1])+abs(a[i+1]-a[i-1])<<endl;
        }
        
    }
    
    return 0;
}

Measured memory_bytes: 2816
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

class Main {
	
    public static void main(String[] args) {
		OriginScanner os = new OriginScanner();
		PrintWriter pw = new PrintWriter(System.out);
		
		int a = os.nextInt();
		int b = os.nextInt();
		int c = os.nextInt();
		
		int diff = a - b;
		
		int min = Math.min(diff, c);
		
		pw.println(c - min);
		pw.close();
	}
    
	static class OriginScanner {
		StringTokenizer token;
		BufferedReader br;
		
		public OriginScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		String nextLine() {
			String str = null;
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				System.out.println(e);
			}
			return str;
		}
		
		String next() {
			while (token == null || !token.hasMoreElements()) { 
				token = new StringTokenizer(nextLine());
			}
			return token.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  ll in;
  cin >> in;
  stack<char> ans;
  while(in != 0){
    in--;
    ans.push(in%26 + 'a');
    in /= 26;
  }
  while(!ans.empty()){
    cout << ans.top();
    ans.pop();
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
    int N, M;
    cin >> N >> M;
    cout << (1900 * M + 100 * (N - M)) * pow(2, M) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//string alp = "abcdefghijklmnopqrstuvwxyz";
using namespace std;
int main(){
  int n,k;
  vector<int> l;
  cin >> n >> k;
  REP(i,n){
    int a;
    cin >> a; 
    l.push_back(a);
  }
  sort(l.begin(),l.end(),greater<int>());
  cout << accumulate(l.begin(),l.begin()+k,0) << endl;
  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 lint=long long;

int main(){
	int n; scanf("%d",&n);
	vector<lint> x(n),a(n);
	rep(i,n) scanf("%lld%lld",&x[i],&a[i]);

	lint ans=a[n-1],mx=a[n-1];
	for(int i=n-1;i>0;i--){
		mx=max(mx+a[i-1]-(x[i]-x[i-1]),a[i-1]);
		ans=max(ans,mx);
	}
	printf("%lld\n",ans);

	return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); i++)
using P = std::pair<int, int>;
using ll = long long ;
template<class T> inline void chmax(T& a, T b) {if(a < b) a = b; }
template<class T> inline void chmin(T& a, T b) {if(a > b) a = b; }

int main(){

	int n;
	std::cin >> n;
	if(n >= 30){
		std::cout << "Yes" << std::endl;
	}else{
		std::cout << "No" << std::endl;
	}

	return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <cmath>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten53 300005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define mkpr(x1,x2) make_pair(x1,x2)
typedef long long int ll;

//stack<char> stk;
//set<ll> sll;
//set<pair<ll,ll>> spll;
//map<string,ll> mp;
//map<ll,ll> mp;
//deque<ll> deq;
vector<ll> vll,v1,v2,v3;
ll num[ten52],num2[ten52];
//priority_queue<pair<ll,ll>> pq;          //decreasing

int main(void)
{
    ll m,n,i,j,k=1,kk=1,ans=0;
    string s="";
    cin>>s;
    if(s[s.size()-1]=='s')
        cout<<s<<"es";
    else
        cout<<s<<'s';
    return 0;
}





Measured memory_bytes: 3624
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
    int N, K; cin >> N >> K;
    int trials[100000] = {};
    float sum = 0.0;

    for(int i = 1; i <= N; i++) {
        // i_bkは初期値
        int i_bk = i;
        while(true) {
            if(i_bk >= K) break;
            i_bk *= 2;
            trials[i-1]++;
        }
    }

    for(int i = 0; i < N; i++) {
        sum += powf(double(1.0/2.0), double(trials[i]));
    }

    cout << setprecision(10) << sum / double(N) << endl;
}


Measured memory_bytes: 640
import java.io.*
import java.util.*
import java.lang.*
import java.lang.Math.*


fun solve() {
    val (K, A, B) = rd.readLongArray()

    if (A >= B || K+1 < A) {
        println(K+1)
        return
    }

    val cnt = (K+1 - A)/2
    val rest = (K+1 - A)%2

    val ans = max(K+1, B*cnt - A*(cnt-1) + rest)
    println(ans)
}


//val rd = debug.Reader("etc", "yahoo-procon2019-qual", "c", "sample-2")
val rd = Reader()


fun main(args: Array<String>) {
    try {
        var exception: Throwable? = null
        val sth = Thread(null, SolveThread(), "solveThread", 128 * 1024 * 1024)
        sth.setUncaughtExceptionHandler { _, e -> exception = e }
        sth.start(); sth.join()
        if (exception != null) throw exception!! }
    catch (e: Exception) { throw e }
    finally { rd.close() }
}
const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
const val EPS = 1e-9; fun DBLEQ(a: Double, b: Double): Boolean {return abs(a - b) < EPS}
data class IntPair(val first: Int, val second: Int)
data class To(val idx: Int, val cost: Long)
typealias ALI = ArrayList<Int>
fun <T>edge(V: Int): Array<ArrayList<T>> { return Array(V){ArrayList<T>()} }
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
fun rAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("EAssert Error: $msg"); throw Error(msg) }
}
fun tAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("TAssert Error: $msg"); Thread.sleep(3000) }
}
class SolveThread : Runnable {
    override fun run() { solve() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
    val readListIntCol: (Int) -> List<Int> = { N -> (0 until N).map { readInt() } }
    val readListLongCol: (Int) -> List<Long> = { N -> (0 until N).map { readLong() } }
    val close: () -> Unit = { br.close() }
    protected fun finalize() { close() }
}


Measured memory_bytes: 36684
#include<bits/stdc++.h>
#define int long long int
#define pb push_back
#define ipair pair<int,int>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int arr[1000001][3],dp[1000001][3];
int n;
int vac(int pos,int j)
{
  if(dp[pos][j]!=-1)
  {
    return dp[pos][j];
  }
  if(pos<0)
  {
    return 0;
  }
  int a=arr[pos][j]+vac(pos-1,(j+1)%3);
  int b=arr[pos][j]+vac(pos-1,(j+2)%3);
  return dp[pos][j]=max(a,b);
}

int32_t main()
{
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
  }
  memset(dp,-1,sizeof(dp));
  int a,b,c;
  a=vac(n-1,0);
  b=vac(n-1,1);
  c=vac(n-1,2);
  cout<<max(a,max(b,c));
}


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

int main(){
	int abc[3], N;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> abc[0] >> abc[1] >> abc[2];
		while(!(((abc[0] >= 1)&&(abc[0] <= 1000))&&
				((abc[1] >= 1)&&(abc[1] <= 1000))&&
				((abc[2] >= 1)&&(abc[2] <= 1000)))){
			cout << "wrong value\n";
			cin >> abc[0] >> abc[1] >> abc[2];
		}
		sort(abc, abc+3);
		if((pow(abc[0], 2) + pow(abc[1], 2)) == pow(abc[2], 2)){
			cout << "YES\n";
		}else{
			cout << "NO\n";
		}
	}
    return 0;
}

Measured memory_bytes: 1136
#include <algorithm>
	#include <array>
	#include <bitset>
	#include <climits>
	#include <cmath>
	#include <cstdio>
	#include <cstdlib>
	#include <cstring>
	#include <ctime>
	#include <deque>
	#include <forward_list>
	#include <iomanip>
	#include <iostream>
	#include <iterator>
	#include <list>
	#include <map>
	#include <queue>
	#include <set>
	#include <sstream>
	#include <stack>
	#include <string>
	#include <tuple>
	#include <unordered_map>
	#include <unordered_set>
	#include <utility>
	#include <vector>

	const int N = 100;
	const long double EPS = 1e-9;

	using namespace std;

	template <class T>
	T gcd(T a, T b) {
		if (b == 0) return a;
		return gcd(b, a % b);
	}

	int arr[N];
	int main() {
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
		cout.tie(NULL);

		int n, m, total, nc;
		cin >> n >> m;
		total = 0;
		for (int i = 0; i < n; ++i) {
			cin >> arr[i];
			total += arr[i];
		}

		double lim = (double)total / (4 * m);
		nc = 0;
		for (int i = 0; i < n; ++i) {
			nc += (arr[i]-lim>=0);
		}

		if (nc >= m)
			cout << "Yes" << '\n';
		else
			cout << "No" << '\n';

	}

Measured memory_bytes: 3596
#include<iostream>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<math.h>
using namespace std;

typedef long long int ll;
typedef long double ld;
 
#define rep(i,a,b) for(ll i=a;i<=b;++i)
#define rev(i,a,b) for(ll i=a;i>=b;i--)
#define pll pair<ll,ll>
#define vll vector<ll>
#define sll set<ll>
#define vpll vector<pll>
#define F first
#define S second
#define pb push_back
#define mp make_pair

vector<int>* roads;
vector<int>* rails;
int loop_roads[200002];
int loop_rails[200002];
bool mark0[200002];
bool mark1[200002];

void calcLoopRoads( int cite, int id )
{
    mark0[cite] = 1;
    loop_roads[cite] = id;
    for( int k = 0; k < roads[cite].size(); ++k )
    {
        int connect = roads[cite][k];
        if( !mark0[connect] ) calcLoopRoads( connect, id );
    }
}

void calcLoopRails( int cite, int id )
{
    mark1[cite] = 1;
    loop_rails[cite] = id;
    for( int k = 0; k < rails[cite].size(); ++k )
    {
        int connect = rails[cite][k];
        if( !mark1[connect] ) calcLoopRails( connect, id );
    }
}


int main()
{
    int N, K, L;
    cin >> N >> K >> L;

    roads = new vector<int>[N];
    rails = new vector<int>[N];

    for( int i = 0; i < N; ++i )
    {
        /* roads[i].push_back( i ); */
        /* rails[i].push_back( i ); */
        mark0[i] = false;
        mark1[i] = false;
        loop_roads[i] = -1;
        loop_rails[i] = -1;
    }
    
    int p, q;
    int r, s;
    for( int i = 0; i < K; ++i )
    {
        cin >> p >> q ;
        p -= 1;
        q -= 1;
        roads[p].push_back( q );
        roads[q].push_back( p );
    }

    for( int i = 0; i < L; ++i )
    {
        cin >> r >> s ;
        r -= 1;
        s -= 1;
        rails[s].push_back( r );
        rails[r].push_back( s );
    }

    /* for( int i = 0; i < N; ++i ) */
    /* { */
    /*     int count = 0; */
    /*     set<int> link_roads; */
    /*     set<int> link_rails; */
    /*     findRoads( i, link_roads ); */
    /*     findRails( i, link_rails ); */

    /*     /1* cout << i << "," << link_roads.size() << "," << link_rails.size() << endl; *1/ */
    /*     for(auto&& ro = link_roads.begin(); ro != link_roads.end(); ++ro ) { */
    /*         for(auto&& ra = link_rails.begin(); ra != link_rails.end(); ++ra ) { */
    /*             /1* cout << "ra:" << i << "," << *ra << endl; *1/ */
    /*             if( *ro == *ra ) */
    /*                 count++; */
    /*         } */
    /*     } */

    /*     /1* cout << i << ":::" << count << " "; *1/ */
    /*     cout << count << " "; */
    /* } */

    int id = 0;
    for( int i = 0; i < N; ++i )
    {
        if( mark0[i] ) continue;
        calcLoopRoads( i, id++ );
    }
    id = 0;
    for( int i = 0; i < N; ++i )
    {
        if( mark1[i] ) continue;
        calcLoopRails( i, id++ );
    }

    map<pll,ll> co;
    for( int i = 0; i < N; ++i )
    {
        co[mp(loop_roads[i],loop_rails[i])]++;
    }
    for( int i = 0; i < N; ++i )
    {
        cout << co[mp(loop_roads[i],loop_rails[i])] << " ";
    }


    /* cout << input.find( "erasera", 5 ) << endl; */
}




Measured memory_bytes: 28288
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(int argc, char const *argv[]) {
  int n;
  scanf("%d", &n);
  int a[n];
  for (auto i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  ll ret = 0;
  int b[n];
  b[n - 1] = a[n - 1];
  for (auto i = n - 1; i >= 0; i--) {
    if (a[i] > i) {
      puts("-1");
      return 0;
    }
    if (i != n - 1) {
      b[i] = max(b[i + 1] - 1, a[i]);
    }
    if (i != n - 1 && a[i + 1] - 1 == a[i]) {
      continue;
    }
    if (b[i] > a[i]) {
      puts("-1");
      return 0;
    }
    ret += (ll)a[i];
  }
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 1792
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

n = inn()
sm = n*(n+1)*(n+2)//6
for i in range(n-1):
    u,v = inm()
    if u>v:
        u,v = v,u
    sm -= u*(n-v+1)
print(sm)


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

using namespace std;

int main()
{
	long long n, k, q, c;
	cin >> n >> k >> q;
	vector<int> e(n, k - q);

	for (long long i = 0; i < q; i++)
	{
		cin >> c;
		e[c - 1]++;
	}

	string d;
	for (long long i = 0; i < n; i++)
	{
		d = e[i] <= 0 ? "No" : "Yes";
		cout << d << endl;
	}
	//cin.ignore();
	//cin.get();

    return 0;
}

Measured memory_bytes: 1024
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
k = ni()

ans = 99999999999999999999999
for i in range(1<<n):
    v = 1
    for j in range(n):
        if i>>j&1:
            v *= 2
        else:
            v += k
    ans = min(ans, v)
print(ans)



Measured memory_bytes: 3060
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力]
		int N = sc.nextInt();
		int[] number = new int[N];
		boolean[] notpair = new boolean[N];
		int count = 0;
      
		for(int i=0; i<N; i++){
			number[i] = sc.nextInt();
        }
		for(int i=0; i<N; i++){
			if(i==number[number[i]-1]-1){
				count++;
            }
        }
      	count /= 2;
		System.out.println(count);
	}
}

Measured memory_bytes: 51764
h, w = list(map(int, input().split()))
s = [input() for _ in range(h)]
s_large = [''.join(['.']*(w+2))]\
          + ['.'+s[i]+'.' for i in range(h)]\
          + [''.join(['.']*(w+2))]
# for i in range(len(s)):
#     print(s[i])

for i in range(h):
    for j in range(w):
        n = 0
        if s[i][j] == '#':
            continue
        for ii in [i, i+1, i+2]:
            for jj in [j, j+1, j+2]:
                if s_large[ii][jj] == '#':
                    n += 1
        s[i] = s[i][:j]+str(n)+s[i][j+1:]

for i in range(h):
    print(s[i])


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

using namespace std;

int main(void)
{
    long long l, r;
    scanf("%lld%lld", &l, &r);
    if (r - l >= 2019) {
        printf("0\n");
        return 0;
    }
    long long ans = 2019;
    for (long long i = l; i <= r; ++i)
        for (long long j = i + 1; j <= r; ++j)
            ans = min(ans, i * j % 2019);
    printf("%lld\n", ans);
    return 0;
}

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


int main(void){
  int n,a,b,l,i;
  ll d,p;
  const int mod=1e9+7;
  
  cin >> n >> a >> b;
  
  d=2;
  p=1;
  l=n;
  while (l>0){
    if (l%2==1) p=p*d%mod;
    l >>= 1;
    d=d*d%mod;
  }
  
  ll inv[200005],finv[200005],afac=1,bfac=1;
  inv[1]=1;
  finv[0]=finv[1]=1;
  for (i=2;i<=max(a,b);i++){
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
  for (i=0;i<a;i++){
    afac=afac*(n-i)%mod;
  }
  for (i=0;i<b;i++){
    bfac=bfac*(n-i)%mod;
  }
  
  ll ao,bo;
  ao=mod-afac*finv[a]%mod;
  bo=mod-bfac*finv[b]%mod;
  
  cout << (p+ao+bo+mod-1)%mod << endl;
  
  return 0;
}

Measured memory_bytes: 3328
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    std::ios::sync_with_stdio(false);

    int X,A,B;
    while (cin >> X >> A >> B) {
        int C = X-A;
        cout << C%B << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<cstring>
#include <cstdio>
using namespace std;
int d[55556];
int x[56];
int n;
const int INF=100000;
int main()
{
    cin>>n;
    memset(d,0,sizeof(d));
    //把不是素数的数标记成INF
    for(int i=2;i<=55555/2;i++)
    {
        for(int j=2;i*j<=55555;j++)
        {
            if(d[i*j]==0)
            {
                d[i*j]=INF;
            }
        }
    }
    int t=0;
   for(int i=1;i*10+1<=55555;i++)
   {
       if(d[i*10+1]==INF)
        continue;
       cout<<i*10+1<<" ";
       t++;
       if(t==n)
        break;
       }
}


Measured memory_bytes: 512
// $%U%$
// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll power(ll x,ll y,ll m){if(y==0)return 1;ll p=power(x,y/2,m)%m;p=(p*p)%m;return (y%2==0)?p:(x*p)%m;}
ll nCr(ll n,ll r,ll m){if(r>n)return 0;ll a=1,b=1,i;for(i=0;i<r;i++){a=(a*n)%m;--n;}while(r){b=(b*r)%m;--r;}return (a*power(b,m-2,m))%m;}
#define Test int t;cin>>t;while(t--)
#define endl '\n'
void solve()
{
	int n;
	cin >> n;
	if(n>=30)
	cout << "Yes" << endl;
	else
	cout << "No" << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//Test
	solve();
	return 0;
}


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

int main(){
    int N; cin >> N;
    if(N <= 9){
        cout << N << endl;
    }else if(N <= 99){
        cout << 9 << endl;
    }else if(N <= 999){
        cout << 9 + (N-99) << endl;
    }else if(N <= 9999){
        cout << 9 + 900 << endl;
    }else if(N <= 99999){
        cout << 9 + 900 + (N - 9999) << endl;
    }else{
        cout << 9 + 900 + 90000 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8

# In[26]:


import sys


# In[106]:


A,B,K = map(int, input().split())


# In[107]:


def yakusuu(x):
    yakusuu_array = []

    for i in range(1, x+1):
        if x % i == 0:
            yakusuu_array.append(i)
    
    return yakusuu_array


# In[108]:


y_list = sorted(list(set(yakusuu(A)) & set(yakusuu(B))), reverse=True)


# In[109]:


print(y_list[K-1])



Measured memory_bytes: 2940
N = int(input())
nums = list(map(int, input().split()))
two = 0
four = 0
for num in nums:
  if num%4 == 0:
    four += 1
  elif num%2 == 0:
    two += 1
if four + two//2 >= N//2:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 14252
N = int(input())
def func(T_pre, A_pre, T, A):
  if T_pre <= T and A_pre <= A:
    return T, A
  else:
    t = -(-T_pre//T)
    a = -(-A_pre//A)
    x = max(t, a)
    return T*x, A*x
for i in range(N):
  T, A = map(int, input().split())
  if i == 0:
    T_pre = T
    A_pre = A
  else:
    T_pre, A_pre = func(T_pre, A_pre, T, A)
print(int(T_pre+A_pre))

Measured memory_bytes: 3064