akhauriyash/Code-Regression huggingface dataset:
def is_passcode_exist(S,passcode):
    passcode_idx = 0
    passcode_is_exist = False
    for c in S:
        if passcode_idx == 3:
            passcode_is_exist = True
            break
        if passcode[passcode_idx] == c:
            passcode_idx += 1
    if passcode_idx == 3:
        passcode_is_exist = True
    return passcode_is_exist

if __name__ == "__main__":
    N = int(input())
    S = input()
    count = 0
    for i in range(0,1000):
        if is_passcode_exist(S,str(i).zfill(3)):
            count += 1
    print(count)

Measured memory_bytes: 9272
import Foundation

var mintotal = Int.max
var memo: [[Int]: [Int]] = [:]

func calc(indexes: [Int]) -> [Int] {

    if let r = memo[indexes] {
        return r
    }

    var values:[Int] = [Int](repeating: 0, count: M + 1)
    for i in indexes {
        let book = books[i]
        for v in 0..<(M + 1) {
            values[v] += book[v]
        }
    }

    memo[indexes] = values
    return values
}

// indexes: 選ぶ参考書, threshold: 目標の値
func check(indexes: [Int]) {
    var values = calc(indexes:indexes)

    let total = values.first!
    values.removeFirst()
    if values.filter({$0 < X}).count > 0 {
        return
    }

    //print(total)
    mintotal = min(mintotal, total)
}

func search(indexes: [Int], current: inout [Int]) {
    if indexes.isEmpty { return }

    var copyIndexrs = indexes
    let first = copyIndexrs.first!
    copyIndexrs.removeFirst()

    //print("\(first), \(current)")
    check(indexes: current + [first])

    search(indexes: copyIndexrs, current: &current)
    current.append(first)
    search(indexes: copyIndexrs, current: &current)
    current.removeLast()
}

// main...

var values = readLine()!.components(separatedBy: " ")
let N = Int(values[0])! // 参考書の数
let M = Int(values[1])! // アルゴリズムの数
let X = Int(values[2])! // 目標の理解度

var books:[[Int]] = []
for _ in 0..<N {
    let book = readLine()!.components(separatedBy: " ").map{Int($0)!}
    books.append(book)
}

// 全部の組み合わせを検査する
let indexes = Array(0..<N)

var current:[Int] = []
search(indexes: indexes, current: &current)

if mintotal != Int.max {
    print(mintotal)
} else {
    print(-1)
}



Measured memory_bytes: 15660
#include<stdio.h>
#include<string.h>
  
#define N 3
#define LIM 32
#define HN 362897
  
struct dep{
    int depth,key;
};
  
int ans[N][N]={
    {1,2,3},
    {4,5,6},
    {7,8,0}};
  
int min = LIM;
struct dep h[HN];
  
int hash1(int k)
{
    return k % HN;
}
int hash2(int k)
{
    return 1 + k%(HN-1);
}
int hash(int k, int i)
{
    return (hash1(k) + i*hash2(k))%HN;
}
  
  
void dfs(int p[N][N], int n)
{
    int i,j,i1,j1,a=0,b=1;
    int f=0;
    int tmp[N][N];
    //printf("A\n");
    for(i=0;i<N;i++)
    {
        for(j=0;j<N;j++)
        {
            if(ans[i][j]!=p[i][j])f++;
            if(p[i][j]==0)
            {
                i1=i;
                j1=j;
            }
            a+=p[i][j]*b;
            b*=10;
        }
    }
      
    if(f==0)
    {
        if(min>=n)
        {
            min=n;
        }
        return;
    }
    if(n>min) return;
    i=0;
    while(1)
    {
        b=hash(a, i);
        if(h[b].key == 0)
        {
            h[b].key=a;
            h[b].depth=n;
            break;
        }
        else if(h[b].key == a)
        {
            if(h[b].depth>n)
            {
                h[b].depth=n;
                break;
            }
            else return;
        }
        i++;
    }
      
    if(i1>0 && i1<N)
    {
        memcpy(tmp,p,sizeof(int)*N*N);
        f=tmp[i1][j1];
        tmp[i1][j1]=tmp[i1-1][j1];
        tmp[i1-1][j1]=f;
        dfs(tmp, n+1);
    }
    if(j1>0 && j1<N)
    {
        memcpy(tmp,p,sizeof(int)*N*N);
        f=tmp[i1][j1];
        tmp[i1][j1]=tmp[i1][j1-1];
        tmp[i1][j1-1]=f;
        dfs(tmp, n+1);
    }
      
    if(i1>=0 && i1<N-1)
    {
        memcpy(tmp,p,sizeof(int)*N*N);
        f=tmp[i1][j1];
        tmp[i1][j1]=tmp[i1+1][j1];
        tmp[i1+1][j1]=f;
        dfs(tmp, n+1);
    }
    if(j1>=0 && j1<N-1)
    {
        memcpy(tmp,p,sizeof(int)*N*N);
        f=tmp[i1][j1];
        tmp[i1][j1]=tmp[i1][j1+1];
        tmp[i1][j1+1]=f;
        dfs(tmp, n+1);
    }
      
}
  
int main()
{
    int i,j;
    int p[N][N];
      
    for(i=0;i<N;i++)
    {
        for(j=0;j<N;j++)
        {
            scanf("%d",&p[i][j]);
        }
    }
    dfs(p,0);
      
    printf("%d\n",min);
      
    return 0;
}


Measured memory_bytes: 4684
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
    bool done_something = false;
    stringstream res;
    res << "[";
    for (; begin_iter != end_iter and counter; ++begin_iter) {
        done_something = true;
        counter--;
        res << *begin_iter << ", ";
    }
    string str = res.str();
    if (done_something) {
        str.pop_back();
        str.pop_back();
    }
    str += "]";
    return str;
}

vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
    vector<int> ord(size);
    for (int i = 0; i < size; i++) ord[i] = i;
    sort(ord.begin(), ord.end(), compare);
    return ord;
}

template <typename T>
bool MinPlace(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool MaxPlace(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename Container>
int SZ(const Container& S) { return S.size(); }

template <typename S, typename T>
ostream& operator <<(ostream& out, const pair<S, T>& p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

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

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file

    #define dbg_var(x) clog << #x  << ": " << x << endl;
    #define dbg_array(x, len) clog << #x << ": " << print_iterable(x, x+len, -1) << endl;
#else
    #define dbg_var(x)
    #define dbg_array(x, len)
#endif

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////

const int MAXN = 350;
const int zero = MAXN;

bool is_ok[2*MAXN];
char mat[MAXN][MAXN];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Remove in problems with online queries!

    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) cin >> mat[i][j];
    }
    for (int l = -(N-1); l <= N-1; l++) {
        bool works = true;
        for (int i = 0; i < N and works; i++) for (int j = 0; j < N; j++) {
            if (mat[i][j] != mat[(j+l+N)%N][(i-l+N)%N]) {
                works = false;
                break;
            }
        }
        if (works) is_ok[zero+l] = true;
    }
    int res = 0;
    for (int A = 0; A <= N-1; A++) for (int B = 0; B <= N-1; B++) {
        if (is_ok[A-B+zero]) res++;
    }
    cout << res << "\n";
}



Measured memory_bytes: 892
#include<stdio.h>
#include<algorithm>
using namespace std;
long long mod=100000007;
char str[110000];
long long dp1[110000];
long long dp2[110000];
int main(){
	dp1[0]=dp2[0]=1;
	for(int i=0;i<101000;i++){
		for(int j=1;j<=5;j++)dp1[i+j]=(dp1[i+j]+dp1[i])%mod;
		for(int j=1;j<=3;j++)dp2[i+j]=(dp2[i+j]+dp2[i])%mod;
	}
	for(int i=4;i<101000;i++){
		if(i-5>0)dp1[i]=(dp1[i]+dp1[i-5])%mod;
		dp2[i]=(dp2[i]+dp2[i-3])%mod;
	}
	while(1){
		scanf("%s",str);
		if(str[0]=='#')return 0;
		long long ret=1;
		int val=0;
		int now=str[0]-'0';
		for(int i=0;str[i];i++){
			if(now!=str[i]-'0'){
				if(now==8||now==0)ret=ret*dp2[val]%mod;
				else ret=ret*dp1[val]%mod;
				now=str[i]-'0';
				val=1;
			}else val++;
		}
		if(now==8||now==0)ret=ret*dp2[val]%mod;
		else ret=ret*dp1[val]%mod;
		printf("%lld\n",ret);
	}
}

Measured memory_bytes: 2644
N = int(input())
ans_count = 0
for i in range(1,N+1,2):
    divisor_count = 0
    for j in range(1,i+1):
        if i%j==0:
            divisor_count += 1
    if divisor_count == 8:
        ans_count += 1
print(ans_count)

Measured memory_bytes: 2940
#include <iostream>
using namespace std;
int main(void){
    int H;
    int W;
     while(1){
    cin>>H;
    cin>>W;
   
        if(W==0&&H==0)  break;
        else{
            for ( int i = 0; i < H; i++ ){
                for ( int j = 0; j < W; j++ ){
                    cout << "#";
                }
                cout << endl;
            
        }
        cout<<endl;
        
    }}
    
}



Measured memory_bytes: 3092
<?php
    $input_line = trim(fgets(STDIN));
    list($bns_day,$bns_week,$target) = explode(" ",$input_line);
    $cnt = 0;
    $day = 0;
    while ($target > $cnt) {
        $cnt += $bns_day;
        $day++;
        if ($day % 7 == 0) {
            $cnt += $bns_week;
        }
    }
    echo $day;
?>



Measured memory_bytes: 9220
#include<bits/stdc++.h>
#include <math.h>
#include <map>
#include <unordered_map>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
ll N;
  ll M;
  cin >>N>>M;
  
  vl vec(N+1);
  rep(i,M) {
    ll a;
    cin >>a;
    vec.at(a)=1;
  }
  
  
  ll dp[N+1];
  dp[0]=1;
  if(vec.at(1)==1) {
    dp[1]=0;
  }
  else if(vec.at(1)!=1){
    dp[1]=1;
  }
  repl(i,2, N+1) {
    if(vec.at(i)) {
      dp[i]=0;
      continue;
    }
    else {
      dp[i]=(dp[i-1]+dp[i-2])%MOD;
    }
    
  }
  cout<<dp[N]<<endl;
}
  
  


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <set>
#include <cstdio>
#include <utility>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#define llint long long
#define inf 1e9+7

using namespace std;
typedef pair<int, int> P;

int n;
set<P> S;
priority_queue<P, vector<P>, greater<P> > Q;
map<int, vector<P> > mp;

int main(void)
{
	while(1){
		cin >> n;
		if(n == 0) break;
		
		S.clear(), mp.clear();
		while(Q.size()) Q.pop();
		
		S.insert(P(0, -1));
		Q.push(P(0, inf));
		
		char c;
		llint id, len, pos;
		for(int i = 1; i <= n; i++){
			cin >> c;
			//cout << c << endl;
			if(c == 'W'){
				cin >> id >> len;
				while(len > 0){
					llint l = Q.top().first, r = Q.top().second;
					Q.pop();
					S.erase(P(l, -1));
					S.insert(P(l, id));
					if(r-l+1 > len){
						S.insert(P(l+len, -1));
						mp[id].push_back(P(l, l+len-1));
						Q.push(P(l+len, r));
						len = 0;
					}
					else{
						len -= r-l+1;
						mp[id].push_back(P(l, r));
					}
				}
			}
			else if(c == 'D'){
				cin >> id;
				vector<P> &vec = mp[id];
				for(int i = 0; i < vec.size(); i++){
					S.erase(P(vec[i].first, id));
					S.insert(P(vec[i].first, -1));
					Q.push(vec[i]);
				}
			}
			else{
				cin >> pos;
				auto it = S.upper_bound(P(pos, 2*inf));
				it--;
				cout << it->second << endl;
			}
			
			/*for(auto it = S.begin(); it != S.end(); it++){
				cout << "[" << it->first << " " << it->second << "]"<< endl;
			}*/
		}
		cout << endl;
	}
	
	return 0;
}


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

namespace ConsoleApp1
{
    static class CCitySavers
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            var aList = Console.ReadLine().Split(' ').Select(y => long.Parse(y)).ToList();
            var bList = Console.ReadLine().Split(' ').Select(y => long.Parse(y)).ToList();

            long enemySum = aList.Sum();

            for (int i = 0; i < n; i++)
            {
                long attack = bList[i];
                if (aList[i] < attack)
                {
                    attack -= aList[i];
                    aList[i] = 0;                    
                    if (aList[i + 1] < attack)
                    {
                        aList[i + 1] = 0;
                    }
                    else
                    {
                        aList[i + 1] -= attack;
                    }
                }
                else
                {
                    aList[i] -= attack;
                }
            }

            Console.WriteLine(enemySum - aList.Sum());
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 39108
#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define yokuwaruprime (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  string s;
  cin>>s;
  int l=s.length(),ans=100;
  for(char moji='a';moji<='z';moji++){
    int count=0;
    rep(i,l){
      if(s[i]==moji){
        count++;
      }
    }
    if(count!=0){
      vector<int> v;
      rep(i,l){
        if(s[i]==moji){
          v.push_back(i);
        }
      }
      int maxwidth=max(v[0],l-1-v[count-1]);
      rep(i,count-1){
        maxwidth=max(maxwidth,v[i+1]-v[i]-1);
      }
      ans=min(ans,maxwidth);
    }
  }
  cout<<ans;
}

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

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

    char grid[H][W];

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> grid[i][j];
        }
    }

    long dp[H][W];
    int mod = 1e9 + 7;
    dp[0][0] = 1;

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (i == 0 && j == 0) {
                continue;
            }
            dp[i][j] = 0;

            if (i > 0 && grid[i - 1][j] == '.') {
                dp[i][j] = (dp[i][j] + dp[i - 1][j]) % mod;
            } 

            if (j > 0 && grid[i][j - 1] == '.') {
                dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
            }
        }
    }

    cout << dp[H - 1][W - 1] << endl;
}

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

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#define NMAX (int )1e5+5
using namespace std;
int N,ans = 0,M = -1;
char animal[NMAX],truth[NMAX];
char S[NMAX];
string dx[4] = {"SS","SW","WS","WW"};
bool check(int b){
	if(truth[b] == 'o'){
		if(animal[b-1] == animal[b+1]){
			return true;
		}else{
			return false;
		}
	}else{
		if(animal[b-1] != animal[b+1]){
			return true;
		}else{
			return false;
		}
	}
}
void made(int b){
	if(truth[b] == 'o'){
		animal[b+1] = animal[b-1];
	}else{
		if(animal[b-1] == 'S'){
			animal[b+1] = 'W';
		}else{
			animal[b+1] = 'S';
		}
	}
}

int solve(int a){
	animal[0] = dx[a][0];
	animal[1] = dx[a][1];
	animal[N] = animal[0];
	for (int i = 0; i < N; ++i)
	{
		if(animal[i] == 'S'){
			truth[i] = S[i];
		}else{
			if(S[i] == 'o'){
				truth[i] = 'x';
			}else{
				truth[i] = 'o';
			}
		}
		
		if(i == N-1){
			if(!check(i)){
				return -1;
			}else if((truth[0] == 'o' && animal[N-1] != animal[1]) 
				|| (truth[0] == 'x' && animal[N-1] == animal[1])){
				return -1;
			}
		}

		if(i != 0) made(i);
	}
	for (int j = 0; j < N; ++j) cout << animal[j];
		cout << "\n";

	return 0;
}
int main(){
	ios::sync_with_stdio(false);
	cin >> N;
	for (int i = 0; i < N; ++i) 
	{
		cin >> S[i];
	}

	for (int i = 0; i < 4; ++i)
	{
		M = solve(i);
		if(M == 0){
			return 0;
		}
	}

	if(M == -1) cout << M << endl;
	return 0;
}

Measured memory_bytes: 640
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,m = map(int, input().split())
    res = [0]*m
    for _ in range(n):
        a = list(map(int, input().split()))
        for i in range(a[0]):
            res[a[i+1]-1] += 1
    ans = 0
    for i in res:
        if i==n:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
/*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog ender-zzm.enbar.cn
*/
#include <bits/stdc++.h>
using namespace std;

inline int read(){
    register int x = 0, flag = 1;
    register char ch;
    while (!isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), isdigit(ch = getchar()));
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10); 
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define For(i, x, y) for (int i = (x); i <= (y); i++) 
#define Rep(i, x, y) for (int i = (x); i >= (y); i--) 

#define int long long
const int Mod = 1e9 + 7;
const int maxn = 5e5 + 30;
#define int long long
int n, m;
int fac[maxn], inv[maxn];
int Pow(int x, int y) {
	int ans = 1;
	while (y) {
		if (y & 1) ans = 1ll * ans * x % Mod;
		x = 1ll * x * x % Mod;
		y >>= 1;
	}
	return ans;
}
int Do(int n, int m) {
	return 1ll * fac[m] * inv[m - n] % Mod;
}
int C(int n, int m) {
	int tmp = 1ll * fac[m] * fac[n - m] % Mod;
	tmp = Pow(tmp, Mod - 2);
	return 1ll * fac[n] * tmp % Mod;
}
signed main() {
	n = read(), m = read();
	fac[0] = 1;
	for (int i = 1; i <= m; i++) {
		fac[i] = 1ll * fac[i - 1] * i % Mod;
	}
	inv[m] = Pow(fac[m], Mod - 2);
	for (int i = m - 1; i >= 0; i--) inv[i] = 1ll * inv[i + 1] * (i + 1) % Mod;
	int ans = 1ll * fac[m] * inv[m - n] % Mod;
	ans = 1ll * ans * ans % Mod;
	int opt = -1;
	for (int i = 1; i <= n; i++) {
		int tmp = 1ll * C(n, i) * Do(n - i, m - i) % Mod * Do(n - i, m - i) % Mod % Mod;
		tmp = 1ll * tmp * Do(i, m) % Mod;
		ans = (ans + opt * tmp + Mod) % Mod;
		opt *= -1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 11392
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007

int main(){
    int n;
    cin >> n;
    if(n%2==0) cout << n/2 << endl;
    else cout << n/2 +1;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int g = sc.nextInt();
        int b = sc.nextInt();
 
       if((r*100+g*10+b)%4==0){
         System.out.print("YES");
       }else{
         System.out.print("NO");
       }
 
    }
}

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

int main()
{
  int n, a, b, x, y, z, ans;
  x = y = z = 0;
  cin >> n >> a >> b;
  for (auto i = 0; i < n; i++) {
    int p;
    cin >> p;
    if (p <= a) x++;
    else if (p <= b) y++;
    else z++;
  }
  if (x < y) {
    if (x < z) {
      ans = x;
    } else {
      ans = z;
    }
  } else {
    if (y < z) {
      ans = y;
    } else {
      ans = z;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
    VEC(int,v,3);
    int k;cin>>k;
    sort(ALL(v),greater<int>());
    cout<<v[0]*pow(2,k)+v[1]+v[2];
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s,t;
    cin>>n;
    cin>>s>>t;
    ll ans,a[n];
    a[0]=0;
    for(int i=1;i<n;i++){
        if(s[i]==s[i-1]){
            a[i-1]=1;
            a[i]=2;
        }
        else{
            a[i]=0;
        }
    }
    ans=(a[0]==0)?3:6;
    for(int i=1;i<n;i++){
        if(a[i]==0){
            if(a[i-1]==0){
                ans*=2;
            }
        }
        else if(a[i]==1){
            if(a[i-1]==0){
                ans*=2;
            }
            else{
                ans*=3;
            }
        }
        ans%=mod;
    }
    cout << ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

//Rock Man
public class Main{

	int n, COUNT, INF = 1<<29, res;
	
	List<E>[] edge, rev;
	Map<String, Integer> ref;
	int get(String s){
		if(ref.containsKey(s))return ref.get(s);
		ref.put(s, COUNT);
		return COUNT++;
	}
	
	class E{
		int t, c;
		public E(int t, int c) {
			this.t = t;
			this.c = c;
		}
	}
	
	boolean[] visited;
	List<Integer> list;
	void dfs(int k){
		if(visited[k])return;
		visited[k] = true;
		for(E e:edge[k])dfs(e.t);
		list.add(k);
	}
	int[] scc;
	void rdfs(int k, int ID){
		if(visited[k])return;
		visited[k] = true;
		scc[k] = ID;
		for(E e:rev[k])rdfs(e.t, ID);
	}
	
	int cycle(int k, int start, boolean f){
		if(k==start&&f||rev[k].isEmpty())return 0;
		E e = rev[k].get(0);
		return e.c+cycle(e.t, start, true);
	}
	void make(int k){
		for(E e:edge[k]){
			if(visited[e.t])continue;
			res += e.c; visited[e.t] = true; make(e.t);
		}
	}
	
	@SuppressWarnings("unchecked")
	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			n = sc.nextInt();
			if(n==0)break;
			edge = new List[n]; rev = new List[n];
			ref = new HashMap<String, Integer>();
			COUNT = 0;
			for(int i=0;i<n;i++){
				edge[i] = new ArrayList<E>();
				rev[i] = new ArrayList<E>();
			}
			int[] cost = new int[n];
			for(int i=0;i<n;i++){
				int x = get(sc.next());
				cost[x] = sc.nextInt();
				int y = get(sc.next()), c = sc.nextInt();
				if(x==y)continue;
				edge[y].add(new E(x, c)); rev[x].add(new E(y, c));
			}
			visited = new boolean[n];
			list = new ArrayList<Integer>();
			for(int i=0;i<n;i++)if(!visited[i])dfs(i);
			int ID = 0;
			scc = new int[n];
			visited = new boolean[n];
			for(int i=list.size()-1;i>=0;i--){
				int v = list.get(i);
				if(visited[v])continue;
				rdfs(v, ID); ID++;
			}
			int[] deg = new int[ID];
			for(int i=0;i<n;i++)for(E e:edge[i]){
				if(scc[i]!=scc[e.t])deg[scc[e.t]]++;
			}
			res = 0;
			visited = new boolean[n];
			for(int i=0;i<n;i++){
				if(deg[scc[i]]>0||visited[i])continue;
				int p = -1;
				if(rev[i].isEmpty()){
					p = i;
				}
				else{
					int c = cycle(i, i, false);
					p = i;
					int min = c-rev[i].get(0).c+cost[i];
					for(int j=0;j<n;j++){
						if(scc[i]!=scc[j])continue;
						int v = c-rev[j].get(0).c+cost[j];
						if(v<min){
							min = v; p = j;
						}
					}
				}
				visited[p] = true; res+=cost[p];
				make(p);
			}
			System.out.println(res);
		}
	}
	
	void debug(Object...o){
		System.out.println(Arrays.deepToString(o));
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 16000
#include "bits/stdc++.h"
using namespace std;

using ll = long long;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using val = valarray<T>;

using pi = pair<int,int>;

#define rep(a,b) for(int a=0; a<b; ++a)
#define Rep(a,b,c) for(int a=b; a<c; ++a)
#define ran(a,b) for(auto &a:b)
#define all(v) v.begin(),v.end()

struct S {
	int y, m, d;
};

int main(){
	S s1, s2;
	cin >> s1.y >> s1.m >> s1.d;
	cin >> s2.y >> s2.m >> s2.d;
	
	if(s1.y == s2.y) {
		if(s1.m == s2.m && s1.d == s2.d) cout << 0 << endl;
		else cout << 1 << endl;
		return 0;
	} else if(s1.y > s2.y) swap(s1, s2);
	
	if(s1.m == s2.m && s1.d == s2.d) cout << 0 << endl;
	else if(s1.m < s2.m || (s1.m == s2.m && s1.d < s2.d)) cout << s2.y - s1.y + 1 << endl;
	else cout << s2.y - s1.y << endl;
}


Measured memory_bytes: 3072
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

def resolve():
    return 

N,W = map(int,input().split())
wv = [list(map(int,input().split())) for _ in range (N)]
INF = 10**10
VMAX = N * 10**3 + 10
dp = [[INF]*(VMAX) for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
    for j in range(VMAX):
        if j>=wv[i][1]:
            dp[i+1][j] = min(dp[i][j], dp[i][j-wv[i][1]] + wv[i][0])
        else:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j])

ans = 0
for i in range(VMAX):
    if dp[N][i]<=W:
        ans = max(ans, i)

print(ans)



Measured memory_bytes: 119276
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define dump(a) (cerr << (#a) << " = " << (a) << endl)
#define FOR(it,c) for(__typeof((c).begin())it=(c).begin(); it!=(c).end();++it)
#define RFOR(it,c) for(__typeof((c).rbegin())it=(c).rbegin(); it!=(c).rend();++it)
#define exist(c, v) (find((c).begin(), (c).end(), (v)) != (c).end())

template<class T> inline void chmax(T& a, const T& b) { if(b > a) a = b; }
template<class T> inline void chmin(T& a, const T& b) { if(b < a) a = b; }

template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << '(' << p.first << ", " << p.second << ')';
	return os;
}

template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	copy(v.begin(), v.end(), ostream_iterator<T>(os, " "));
	return os;
}

const int MAX_LEN = 6;
const int MAX_N = 40;
const int LIMIT = MAX_LEN * MAX_N;
const string INF(LIMIT, 'z');

struct edge {
	int to;
	string cost;
	edge(int t, const string& c):to(t), cost(c){}
};

bool to_goal[MAX_N];
vector<vector<edge> > es;

string dijkstra(int s, int g) {
	typedef pair<string, int> P;
	const int n = es.size();
	vector<vector<string> > dist(n, vector<string>(LIMIT + MAX_LEN + 1, INF));
	dist[s][0] = "";
	priority_queue<P, vector<P>, greater<P> > que;
	que.push(make_pair("", s));

	while(!que.empty()) {
		const string spell = que.top().first;
		const int v = que.top().second, len = spell.size();
		que.pop();

		if(len > LIMIT) {
			if(to_goal[v])
				return "NO";
			else
				continue;
		}

		if(dist[v][len] != spell)
			continue;

		if(v == g)
			return spell;

		for(int i = 0; i < es[v].size(); ++i) {
			const edge& e = es[v][i];
			const string next_spell = spell + e.cost;
			const int next_len = next_spell.size();
			if(dist[e.to][next_len] > next_spell) {
				dist[e.to][next_len] = next_spell;
				que.push(make_pair(next_spell, e.to));
			}
		}
	}

	return "NO";
}

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

	for(int n, a, s, g; cin >> n >> a >> s >> g, n;) {
		es.clear();
		es.resize(n);
		for(int i = 0; i < a; ++i) {
			int x, y;
			string lab;
			cin >> x >> y >> lab;
			es[x].push_back(edge(y, lab));
		}

		memset(to_goal, false, sizeof(to_goal));
		to_goal[g] = true;
		for(int i = 0; i < n; ++i)
			for(int j = 0; j < n; ++j)
				for(int k = 0; k < (int)es[j].size(); ++k)
					if(to_goal[es[j][k].to])
						to_goal[j] = true;

		cout << dijkstra(s, g) << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 5416
import sys
sys.setrecursionlimit(10 ** 5)

# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

readline = sys.stdin.readline

def process():
    temp_list = readline().rstrip().split(',')
    return ' '.join(temp_list)

# for _ in range(int(readline().rstrip())):
#    print(process())

print(process())

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

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

    int div4 = 0;
    int odd = 0;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
        if(a[i] % 4 == 0) div4 += 1;
        if(a[i] % 2 != 0) odd  += 1;
    }
    if(div4 < n/2 && odd > div4) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner s=new Scanner(System.in);
		int A=s.nextInt(),B=s.nextInt(),C=s.nextInt(),x=0,y=0,z=0;
		if(A==B)x++;
		if(B==C)y++;
		if(C==A)z++;
		System.out.println(x+y+z==1?"Yes":"No");
	}
}

Measured memory_bytes: 35892
#include <stdio.h>

int main(void) {
	int a,b;
	int x,y,t;
	int steps;
	while(1) {
		scanf("%d %d",&a,&b);
		if(a==0 && b==0)break;
		if(a>=b) {
			x=a;
			y=b;
		} else {
			x=b;
			y=a;
		}
		for(steps=0;y>0;steps++) {
			x=x%y;
			t=x;
			x=y;
			y=t;
		}
		printf("%d %d\n",x,steps);
	}
	return 0;
}

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

int main()
{
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  for(int i = 1; i < s.size(); ++i)
  {
    if(s[i - 1] == s[i])
    {
      cout << "no" << endl;
      return 0;
    }
  }
  cout << "yes" << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int x = Integer.parseInt(sa[1]);
		int y = Integer.parseInt(sa[2]);
		br.close();

		int[] ans = new int[n];
		for (int i = 1; i < n; i++) {
			Queue<Integer> que = new ArrayDeque<>();
			que.add(i);
			int[] d = new int[n + 1];
			Arrays.fill(d, 10000);
			d[i] = 0;
			while (!que.isEmpty()) {
				int cur = que.poll();
				int alt = d[cur] + 1;
				if (cur == x && alt < d[y]) {
					que.add(y);
					d[y] = alt;
				}
				if (cur < n && alt < d[cur + 1]) {
					que.add(cur + 1);
					d[cur + 1] = alt;
				}
				if (cur > 0 && alt < d[cur - 1]) {
					que.add(cur - 1);
					d[cur - 1] = alt;
				}
			}
			for (int j = i + 1; j <= n; j++) {
				ans[d[j]]++;
			}
		}
		for (int i = 1; i < n; i++) {
			System.out.println(ans[i]);
		}
	}

	static void dfs(int c) {
		
	}
}


Measured memory_bytes: 46224
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#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 pi acos(-1.0)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


int main(){
	int n, q;
	while (cin >> n >> q && n){
		vector<string> s(n);
		VI a(n), b(n);
		REP(i,n) cin >> s[i] >> a[i] >> b[i];
		while (q--){
			int x;
			cin >> x;
			bool f = 1;
			REP(i,n){
				if (x > b[i] - a[i] && x <= b[i]) {
					cout << s[i] << " " << x - b[i] + a[i] << endl;
					f = 0;
					break;
				}
			}
			if (f) cout << "Unknown" << endl;
		}
	}
    return 0;
}

Measured memory_bytes: 3012
#include<bits/stdc++.h>
#define MIN -1000000
using namespace std;
typedef long long ll;
typedef pair <ll,ll> pll;
bool visited[100005];
const int max_N=1e5+10;
ll N, M;
ll A,B;
vector<pll> shops;
int main(void)
{
  cin >> N >> M;
  for(int i=0; i<N; i++){
    cin >> A >> B;
    shops.push_back(pll(A,B));
  }
  //vector ex vector<int> A;
  sort(shops.begin(),shops.end());
  ll sum=0; 
  for(int i=0; i<N; i++){
    ll buy=min(shops[i].second, M);
    M = M - buy;
    sum = sum + shops[i].first * buy;
    if(M==0)break;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int N; cin >> N;
	vector<ll>A(N);
	rep(i, 0, N)cin >> A[i];
	ll ans = 1000;
	rep(i, 0, N - 1) {
		if (A[i] < A[i + 1]) {
			ll stock = ans / A[i];
			ans += (A[i + 1] - A[i]) * stock;
		}
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
 
using namespace std;
 
const int MAXN = 2e3 + 10;
const int MOD = 1e9 + 7;
 
long long dp[MAXN][MAXN];
long long fac[MAXN * MAXN];
int n, k;
 
// asdjgfsadjkgfjksdgjfka
// sadjkgfasjdgfjasdgfjgasdgfaskjdf
// asdjgfajsdgfjasgdfgasdkjfgsadgfkjasdgfkjasdgfksadgf
#define fsgdfjasgdfgsadkjfg asdkjgfkjsagdfsgadjfgasdkjfaksjdf
#define hdgfhadfhasdhfgasjdgfjadgsjfkgsajdfgsadhjgfjksgadfj jsdgfjkasdgjfksgadkjfa
#define hafsdhfashfh ashdfshgadfadsjhgfashgdfshgadfshadfjshgadfj
int fsdgasdjkfjajksadgfkjags = 213213123;
long long fdashf = 13243543;

long long po(long long v, long long u)
{
	return u ? (po(v * v % MOD, u >> 1) * (u & 1 ? v : 1) % MOD) : 1;
}
 
long long ente(int i, int j)
{
	long long res = po(fac[i], MOD - 2) * po(fac[j - i], MOD - 2);
	res %= MOD;
	res *= fac[j];
	return res % MOD;
}
 
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> k;
	fac[0] = 1;
	for (int i = 1; i < MAXN * MAXN; i++)
		fac[i] = (fac[i - 1] * i) % MOD;
	if (k == 1)
		return cout << 1 << '\n', 0;
	dp[0][0] = 1;
	for (int i = 0; i <= n; i++)
	{
		for (int j = i; j <= n; j++)
		{
			if (i)
				dp[i][j] = dp[i - 1][j];
			if (j)
				dp[i][j] += dp[i][j - 1] * ente(k - 2, i + j * (k - 1) - 1);
			dp[i][j] %= MOD;
		}
	}
	dp[n][n] = (dp[n][n] * fac[n]) % MOD;
	cout << dp[n][n] << '\n';
	return 0;
}

Measured memory_bytes: 62208
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  long long H;
  scanf("%lld", &H);
  long long W;
  scanf("%lld", &W);
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);

  int x = 0, y = 1;
  for (int i = 0; i < H; ++i)
  {
    if (i >= B)
      x = 1, y = 0;
    for (int j = 0; j < W; ++j)
    {
      int n;
      if (j < A)
        n = x;
      else
        n = y;
      cout << n;
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>
#include<bitset>
#include<tuple>
#include<time.h>
#include<list>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;

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



string s;
int n;
int dp[1010101], dp2[1010101];

int toi(char c){
	return c - '0';
}

void solve(){
	cin >> s;
	n = s.size();
	
	fill(dp,dp+1010101, INF);
	fill(dp2,dp2+1010101, INF);
	dp[n] = 0, dp2[n] = 2;
	int cnt = 0;
	for(int i = n-1; i >= 0; i--){
		chmin(dp[i], min(dp[i+1]+toi(s[i]), dp2[i+1]+toi(s[i])));
		chmin(dp2[i], min(dp[i+1]+10-toi(s[i])+1, dp2[i+1]+9-toi(s[i])));
	}
	
	cout << min(dp[0],dp2[0]) << endl;
}

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

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

int N;
vector<int> p, q;

int main() {
    cin >> N;
    vector<int> p(N), q(N);
    for (int i = 0; i < N; ++i) cin >> p[i], --p[i];
    for (int i = 0; i < N; ++i) cin >> q[i], --q[i];

    // 各順列が何番目かを求める
    map<vector<int>, int> ord;
    int iter = 0;

    // スタートとなる順列
    vector<int> v(N);
    for (int i = 0; i < N; ++i) v[i] = i;

    // 順番に
    do {
        ord[v] = iter++;
    } while (next_permutation(v.begin(), v.end()));

    cout << abs(ord[p] - ord[q]) << endl;
}



Measured memory_bytes: 5248
import sys
N = int(input())
A_list = list(map(int ,input().split()))

s = 1

A_list.sort()
if A_list[0]==0:
    print("0")
    sys.exit()
for i in range(len(A_list)):
        s = s*A_list[i]
        if s>pow(10,18):
            print("-1")
            sys.exit()

print(s)

Measured memory_bytes: 21452
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];


int main()
{
    ll n,k,i,j,cc=0;cin>>n>>k;
    j=n*500;cout<<(j>=k ? "Yes" : "No")<<endl;
return 0;
}


Measured memory_bytes: 4992
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
int main()
{
    int n;
    cin >> n;
    if(n>=30) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3620
#include<stdio.h>

int main()
{
    int a,b,c;
    
    //do{
        scanf("%d %d %d",&a,&b,&c);
    //}while(!(1<=a && a<=10000 && 1<=b && b<=10000 && 1<=c && c<=10000));
    
    int max;
    max = a;
    if(b > max) max = b;
    if(c > max) max = c;
        
    printf("%d\n",a+b+c-max);
    return 0;
}




Measured memory_bytes: 128
import math
a,b,x = map(int,input().split())
if a**2*b>x> (a**2)*b/2:
  tan=2*((a**2)*b-x)/(a**3)
elif x<=a*a*b/2:
  tan=a*b*b/(2*x)
elif x==a*a*b:
  tan=0
  

print(math.degrees(math.atan(tan)))


Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
# A

import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
input = sys.stdin.readline

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

n, x, t = map(int, input().split())

print(math.ceil(n / x)*t)



Measured memory_bytes: 65096
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;

int main() {
    char S[100000];
    scanf("%s", S);

    int change = 0;
    char c = S[0];
    for (int i = 1; i < strlen(S); i++)
    {
        if (c != S[i]) change++;
        c = S[i];
    }

    printf("%d\n", change);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()) {
            String line = sc.nextLine();
            int plusPos = line.indexOf('+');
            int equalPos = line.indexOf('=');
            String leftOp = line.substring(0, plusPos);
            String rightOp = line.substring(plusPos + 1, equalPos);
            String answerOp = line.substring(equalPos + 1);
            int res = -1;
            int start = 0;
            if((leftOp.length() > 1 && leftOp.charAt(0) == 'X') || (rightOp.length() > 1 && rightOp.charAt(0) == 'X') || (answerOp.length() > 1 && answerOp.charAt(0) == 'X'))
                start = 1;
            for(int i = start; i <= 9; i++) {
                BigInteger l = new BigInteger(leftOp.replace("X", Integer.toString(i)));
                BigInteger r = new BigInteger(rightOp.replace("X", Integer.toString(i)));
                BigInteger a = new BigInteger(answerOp.replace("X", Integer.toString(i)));
                if(a.equals(l.add(r))) res = i;
            }
            if(res == -1) System.out.println("NA");
            else System.out.println(res);
        }
    }
}

Measured memory_bytes: 25848
#include <bits/stdc++.h>
using namespace std;
#define go(i, a, n) for (ll i = a; i < n; i++)
#define gor(i, a, n) for (int i = n - 1; i >= a; i--)
#define show(x) cout << x << '\n'
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vpair vector<pair<ll, ll>>
#define vtuple vector<tuple<ll, ll, ll>>
#define ff first
#define ss second
#define mod 1000000007
#define memset(a, k) memset(a, k, sizeof(a))
#define answer(z, k) cout << "Case #" << z << ": " << k << endl;
auto t1 = chrono::high_resolution_clock::now();
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s, t;
	cin >> s >> t;
	if (s == t.substr(0, t.size() - 1))
		show("Yes");
	else
		show("No");
	auto t2 = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(t2 - t1).count();
	clog << "Time taken = " << duration * 1.0 / 1000 << " seconds" << endl;
	return 0;
}


Measured memory_bytes: 3812
n, q = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(lambda x:int(x)-1, input().split())
    G[a].append(b)
    G[b].append(a)

counter = [0] * n
for _ in range(q):
    p, x = map(int, input().split())
    counter[p-1] += x

from collections import deque
que = deque([[0, counter[0]]])
visited = [0] * n
visited[0] = 1
while que:
    node, point = que.pop()
    for nn in G[node]:
        if visited[nn] == 1:
            continue
        visited[nn] = 1
        counter[nn] += point
        que.append([nn, counter[nn]]) 

print(*counter)


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

int main()
{
    ll n;
    cin>>n;
    map<ll,ll>mp;
    ll a[n+1];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];;
        mp[a[i]]++;
    }
    ll sum=0;
    for(auto it:mp)
    {
        ll p = it.second;
        sum+=p*(p-1)/2;
    }
    for(int i=0;i<n;i++)
    {
        cout<<sum-(mp[a[i]]-1)<<endl;
    }
}


Measured memory_bytes: 11008
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
using Graph = vector<vector<int>>;
int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    char c[3][3];
    rep(i,3){
        rep(j,3){
            cin>>c[i][j];
        }
    }
    rep(i,3)cout<<c[i][i];
    cout<<endl;

    return 0;
}

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

int main() 
{
    int n;
    cin >> n;
    vector<int> c(n);
    vector<int> s(n);
    vector<int> f(n);
    for (int i=0; i<n-1; i++)
        cin >> c[i] >> s[i] >> f[i];
    vector<int> res;
    for (int i=0; i<n; i++)
    {
        int t = 0;
        for (int j=i; j<n-1; j++)
        {
            if (t<s[j]) 
                t = s[j];
            else if (t%f[j]!=0)
                t = t+f[j]-t%f[j];
            t += c[j];
        }
        res.push_back(t);
    }
    for (int i=0; i<n-1; i++)
        cout << res[i] << endl;
    cout << 0;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,pink,white,green,yellow;
    string S;
    cin >> N;
    
    pink = 0;
    white = 0;
    green = 0;
    yellow = 0;
    int cnt = 0;
    for (int i=0 ; i<N ; i++) {
        cin >> S;
        if (S == "P") {
            if (pink == 0) {
                cnt ++;
            }
            pink ++;
        } else if (S == "W") {
            if (white == 0) {
                cnt ++;
            }
            white ++;
        } else if (S == "G") {
            if (green == 0) {
                cnt ++;
            }
            green ++;
        } else if (S == "Y") {
            if (yellow == 0) {
                cnt ++;
            }
            yellow ++;
        }
    }
    
    if (cnt == 3) {
        cout << "Three" << endl;
    } else if (cnt == 4) {
        cout << "Four" << endl;
    }
        
}

Measured memory_bytes: 256