akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int main(){
  string S, T;
  cin >> S >> T;
  int count = 0;

  for(int i = 0; i < S.size(); i++)
    if(S[i] == T[i]) count++;

  cout << count << endl;
  return 0;
}

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

using namespace std;

int main() {
  int N;
  bool ans = false;
  
  cin >> N;
  
  for (int i = 0; i <= 25; i++) {
    for (int j = 0; j < 14; j++) {
      if (i * 4 + j * 7 == N) {
        ans = true;
      }
    }
  }
  
  cout << (ans ? "Yes" : "No") << endl;
  
  return 0;
}

Measured memory_bytes: 256
n,k=input().split()
n=int(n)
k=int(k)
#print(h,n)
arr=list(map(int,input("\r").strip().split()))[:n] 
arr.sort()
sum=0;
for i in range(0,n-k):
  #  print(arr[i])
    sum+=arr[i]
  
print(sum)
    
   

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int di2[] = {1, 1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1};
const int dj2[] = {1, -1, 1, -1, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

int main(){
  ll k, a, b;
  cin >> k >> a >> b;
  if(b-a <= 2 || k-a+1 <= 0) {
    cout << k+1 << endl;
    return 0;
  }
  ll ans = a + (b-a)*((k-(a-1))/2) + ((k-(a-1))%2);
  cout << ans << endl;
}

Measured memory_bytes: 3604
import java.util.*;
public class Main {

	public static void main(String[] args) {		
		Scanner scanner=new Scanner(System.in);
		String first=scanner.nextLine();
		String middle=String.valueOf(first.length()-2);
		System.out.println(first.charAt(0)+middle+first.charAt(first.length()-1));
	}

}

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

using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
// int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
// vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();

    int n, m;
    cin >> n >> m;
    vector<bool> red(n);
    vector<bool> sure(n);
    vi num(n, 1);
    red[0] = true;
    sure[0] = true;
    rep (i, m) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        num[u]--; num[v]++;
        if (red[u]) {
            red[v] = true;
            if (sure[u] and num[v] == 1) sure[v] = true;
            sure[u] = false;
            if (num[u] == 0) {
                red[u] = false;
            }
        }
        else {
            sure[v] = false;
        }
    }
    int ans = 0;
    rep (i, n) ans += red[i];
    cout << ans << endl;
}

Measured memory_bytes: 3972
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (a, b, c) = (v[0], v[1], v[2]);
    if a == b + c || b == a + c || c == a + b {
        println!("Yes");
    } else {
        println!("No");
    }
}

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

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


Measured memory_bytes: 4352
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		int d=scan.nextInt();
		int e=scan.nextInt();
		int f=scan.nextInt();
		int ab=Math.abs(a-b);
		int ac=Math.abs(a-c);
		int ad=Math.abs(a-d);
		int ae=Math.abs(a-e);
		int bc=Math.abs(b-c);
		int bd=Math.abs(b-d);
		int be=Math.abs(b-e);
		int cd=Math.abs(c-d);
		int ce=Math.abs(c-e);
		int de=Math.abs(d-e);
		if(ab<=f&&ac<=f&&ad<=f&&ae<=f&&bc<=f&&bd<=f&&be<=f&&cd<=f&&ce<=f&&de<=f) {
			System.out.println("Yay!");
		}
		else
		{
			System.out.println(":(");
		}
	}
}

Measured memory_bytes: 22608
let split str delim =
  let rec doit s acc =
    match
      try Some (String.rindex s delim) with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        doit s1 (String.sub s (i + 1) (String.length s - String.length s1 - 1) :: acc)
  in doit str []

let () =
  match List.map int_of_string (split (read_line ()) ' ') with
  | [n; k] -> begin
      let a = Array.init n (fun _ -> read_int ()) in
      let rec check p =
        let rec doit i j s =
          if i = n then n
          else if j >= k then i
          else
            let x = s + a.(i) in
            if x > p then doit i (j + 1) 0
            else doit (i + 1) j x
        in doit 0 0 0
      and bin_search l r =
        if r < l then l
        else
          let m = (l + r) / 2 in
          if check m >= n then bin_search l (m - 1)
          else bin_search (m + 1) r
      in Printf.printf "%d\n" (bin_search 0 (100000 * 10000))
    end
  | _ -> exit 1

Measured memory_bytes: 5288
S=input()
MOD=pow(10,9)+7
dp=[0]*4
dp[0]=1
for s in S:
  if s=='A':
    dp[1]+=dp[0]
  elif s=='B':
    dp[2]+=dp[1]
  elif s=='C':
    dp[3]+=dp[2]
  else:
    tmp3=dp[2]
    tmp2=dp[1]
    tmp1=dp[0]
    dp[3]*=3
    dp[3]+=tmp3
    dp[2]*=3
    dp[2]+=tmp2
    dp[1]*=3
    dp[1]+=tmp1
    dp[0]*=3
  dp[3]%=MOD
  dp[2]%=MOD
  dp[1]%=MOD
  dp[0]%=MOD
print(dp[3])

Measured memory_bytes: 9248
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>

using namespace std;

int main(){

string S;

cin >> S;

int flag = 0;

int size = S.size();

for(int i = 0;i < size -1;i++){
for(int j = i;j <size -1;j++){

if(S[i] == S[j + 1]){
flag =1;
}
}

}

if(flag == 0){
cout << "yes"<<endl;
}else{
cout << "no"<<endl;

}

}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main(int argc, char const *argv[])
{
    int n,m,a;
    int sum = 0;


    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        cin >> a;
        sum += a; 
    }
    
    if (n>=sum)
    {
        cout << n-sum;
    }
    else
    {
        cout << -1;
    }
    
    

    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);
    sort(a.begin(), a.end(), greater<int>());
    int alice=0;
    int bob=0;
    rep(i, n){
        if(i%2==0) alice+=a.at(i);
        else bob+=a.at(i);
    }
    cout << alice-bob << endl;
    return 0;
}

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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//Write From this Line

int N;

double dp[310][310][310];
double rec(int i, int j, int k){
	if(dp[i][j][k] >= 0) return dp[i][j][k];
	if(i + j + k == 0) return 0.0;

	double res = 0.0;
	if(i) res += rec(i-1, j, k) * i;
	if(j) res += rec(i+1, j-1, k) * j;
	if(k) res += rec(i, j+1, k-1) * k;

	res += N;
	res *= 1.0 / (i + j + k);

	return dp[i][j][k] = res;
}
int main()
{
	cin >> N;
	int one = 0, two = 0, three = 0;
	rep(i,N){
		int a;
		cin >> a;
		if(a == 1) ++ one;
		else if(a == 2) ++two;
		else ++three;
	}
	memset(dp, -1, sizeof(dp));
	cout << setprecision(10);
	cout << rec(one, two, three) << endl;
}


Measured memory_bytes: 233088
#include<bits/stdc++.h>
#define MAXN 1000000+10

using namespace std;

int n;
int a[MAXN];
long long Ans = 0;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		for(int j=i;j<=n;j+=i)
			a[j]++;
		Ans += a[i];
	}
	cout<<Ans;
	return 0;
}

Measured memory_bytes: 7668
N = int(input())
A = []
A.append(list(map(int,input().split(" "))))
A.append(list(map(int,input().split(" "))))
ans = 0
temp = 0
# temp2 = A[0][0] 
temp2 = 0
k = 0
for i in range(N):
    for j in range(N):
        temp2 += A[k][j]
        if j == temp:
            k = 1
            temp2 += A[k][j]
        # print("{0},{1}".format(k,j))
        # print(temp2)
    if ans <= temp2:
        ans = temp2
    temp += 1
    k = 0
    temp2 = 0

print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr int INF = 2e9;
constexpr int mod = 2019;
int main(){ 
  string s;
  cin >> s;
  int n = s.size();
  vector<int> cum(n + 1, 0);
  reverse(s.begin(), s.end());
  int now = 1;
  for (int i = 0; i < n; i++) {
    int d = s[i] - '0';
    cum[i + 1] = cum[i] + d * now;
    cum[i + 1] %= mod;
    now *= 10;
    now %= mod;
  }
  map<int, int> mp;
  int res = 0;
  for (int i = 0; i <= n; i++) {
    //cout << cum[i] << endl;
    res += mp[cum[i]];
    mp[cum[i]]++;
  }
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 4452
while True:
    H = int(input())
    if H==0:
        exit()
    board = [[0]*5 for _ in range(H+1)]
    for i in range(1,H+1):
        board[i] = list(map(int, input().split()))
    board = board[::-1]
    change = True
    score = 0
    while change==True:
        change = False
        for i in range(H-1,-1,-1):
            if len(set(board[i]))==1 and board[i][0]>0:
                score += sum(board[i])
                change = True
                for j in range(i,H):
                    board[j] = board[j+1]
            elif len(set(board[i][:4]))==1 and board[i][:4][0]>0:
                score += sum(board[i][:4])
                change = True
                for j in range(i,H):
                    board[j][:4] = board[j+1][:4]
            elif len(set(board[i][1:]))==1 and board[i][1:][0]>0:
                score += sum(board[i][1:])
                change = True
                for j in range(i,H):
                    board[j][1:] = board[j+1][1:]
            elif len(set(board[i][:3]))==1 and board[i][:3][0]>0:
                score += sum(board[i][:3])
                change = True
                for j in range(i,H):
                    board[j][:3] = board[j+1][:3]
            elif len(set(board[i][1:4]))==1 and board[i][1:4][0]>0:
                score += sum(board[i][1:4])
                change = True
                for j in range(i,H):
                    board[j][1:4] = board[j+1][1:4]
            elif len(set(board[i][2:]))==1 and board[i][2:][0]>0:
                score += sum(board[i][2:])
                change = True
                for j in range(i,H):
                    board[j][2:] = board[j+1][2:]
    print(score)


Measured memory_bytes: 5636
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n;
	scanf("%d", &n);
	REP(i, 1, 3501) REP(j, 1, 3501) {
		// 1/k = 4/n - 1/i - 1/j;
		// k = n*i*j / (4*i*j - n*j - n*i);
		ll bunsi = n*i*j, bunbo = 4*i*j - n*j - n*i;
		if(bunbo<=0) continue;
		if(bunsi%bunbo==0){
			printf("%ld %ld %ld\n", i, j, bunsi/bunbo);
			return 0;
		}
	}
	return 0;
}



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

namespace abc171_c
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = CIn.ReadLong();
            var list = new List<char>();        
            while(N > 0)
            {
                    list.Add((char)((N - 1) % 26 + 'a'));
                    N = (N - 1) / 26; 
            }  
            for(var i = list.Count - 1; i  >= 0; i--)
            {
                Console.Write(list[i]);
            }
        }
    }
    class CIn
    {
        private static readonly Queue<string> fieldBuffer = new Queue<string>();

        public static string Read()
        {
            if (fieldBuffer.Count == 0)
            {
                foreach (var field in Console.ReadLine().Split())
                {
                    fieldBuffer.Enqueue(field);
                }
            }

            return fieldBuffer.Dequeue();
        }

        public static int ReadInt() => int.Parse(Read());
        public static long ReadLong() => long.Parse(Read());
        public static double ReadDouble() => double.Parse(Read());

        public static string[] ReadStringArray(long n)
        {
            var array = new string[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = Read();
            }

            return array;
        }

        public static int[] ReadIntArray(long n)
        {
            var array = new int[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = ReadInt();
            }

            return array;
        }

        public static long[] ReadLongArray(long n)
        {
            var array = new long[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = ReadLong();
            }

            return array;
        }
        public static double[] ReadDoubleArray(long n)
        {
            var array = new double[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = ReadDouble();
            }

            return array;
        }
    }

}


Measured memory_bytes: 27796
#include <bits/stdc++.h>
#include <iomanip>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;

#define mem(a, b) memset(a, b, sizeof(a))
#define REP(i, a) for (int i = 0; i < a; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(a) a.begin(), a.end()

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
}

inline void print_vector(vector<int> &A){
    for (auto&& x : A){
        cout << x << " ";
    }
    cout << endl;
}

inline void print_array(const int A[], int n) {
    REP(i, n) {
        cout << A[i] << " ";
    }
    cout << endl;
}

bool is_prime(int n) {
    if (n == 2) return true;
    for (int i = 2; i < sqrt(n) + 1; ++i) {
        if (n % i == 0) {
            return false;
        }
    }

    return true;
}

inline void solve() {
    int n;
    cin >> n;

    n = (n - 400) / 200;

    cout << 8 - n << endl;
}


int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    int t;
    t = 1;
    // cin >> t;

    for (int _ = 0; _ < t; _++) {
        solve();
    }

    return 0;
}


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


int main() {
  vector<int> c(9);
  for(int i = 0; i < 9; ++i) {
    cin >> c[i];
  }
string ans = "No";

  for(int i = 0; i <= 100; ++i) {
    int a1 = i;
    int b1 = c[0] - a1;
    int b2 = c[1] - a1;
    int b3 = c[2] - a1;

    int a2 = c[3] - b1;
    int a3 = c[6] - b1;

    if(b1 >= 0 && b2 >= 0 && b3 >= 0 && a2 >= 0 && a3 >= 0) {
      if(c[4] == a2 + b2 && c[5] == a2 + b3 && c[7] == a3 + b2 && c[8] == a3 + b3) {
        ans = "Yes";
      }
    }
  }

  cout << ans << "\n";
}

Measured memory_bytes: 256
from collections import Counter

N = int(input())

numList = list(map(int, input().split()))

counter = Counter(numList)

ans = 0

for k, v in counter.items():
	if(k == v):
		continue
	elif(k < v):
		ans += v-k
	elif(k > v):
		ans += v

print(ans)


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

int fi(int n) {
    if (n == 0 || n == 1 )
        return 1;
    
//    return fi(n-2)+fi(n-1);
    int F[n+1];
    F[0] = 1;
    F[1] = 1;
    for (int i = 2; i <= n; i++)
        F[i] = F[i-1] + F[i-2];
    
    return F[n];
}

int main(int argc, char** argv) {
    int n;
    scanf("%d", &n);
    printf("%d\n", fi(n));
    return (EXIT_SUCCESS);
}




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

namespace ConsoleApplication
{
    class Program
    {
        static void Main()
        {
            new Solution().answer();
        }
    }

    class Solution
    {
        string N,M;
        string[] M_split;
        int N1;
        int T = 0;

        public Solution()
        {
            N = Console.ReadLine().ToString();
            N1 = Convert.ToInt32(N);
            int i;

            for (i = 1; i <= N1; i++)
            {
                M = Console.ReadLine();
                M_split = M.Split(' ');
                T = T + (Convert.ToInt32(M_split[1]) - Convert.ToInt32(M_split[0]) + 1);
            }
        }

        public void answer()
        {
            Console.WriteLine(T);
        }
    }
}

Measured memory_bytes: 11348
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse

int main() {
    int d;cin>>d;
    ll g;cin>>g;
    int p[12];
    ll c[12];
    rep(i,d) cin>>p[i]>>c[i];
    ll ans=100000;
    for(int bit = 0;bit<(1<<d);bit++) {
        ll grad_s=0,prob_s=0;
        int last=-1;
        rep(j,d) {
            if((bit>>j)&1) {
                grad_s+=p[j]*(100*(j+1))+c[j];
                prob_s+=p[j];
            } else {
                last = j;
            }
        }
        if(grad_s >= g) {
            ans = min(ans,prob_s);
        } else {
            int need = ((g-grad_s-1)/(100*(last+1)))+1;
            if (need <= p[last]) {
                ans = min(ans,prob_s+need);
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
const ull MOD = 1000000007;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
ll digitPoor(ll n)
{
    assert(INT_MAX == 2147483647);
    assert(n >= 0);

    if (n < 10)         return 1;
    if (n < 100)        return 2;
    if (n < 1000)       return 3;
    if (n < 10000)      return 4;
    if (n < 100000)     return 5;
    if (n < 1000000)    return 6;
    if (n < 10000000)   return 7;
    if (n < 100000000)  return 8;
    if (n < 1000000000) return 9;
    return 10;
}
struct p{
  ll x;
  bool end;
};

int main(){
    ll N,K;
    cin>>N>>K;
    
    cout<<N*K;
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define oset tree < int ,  null_type ,  less ,  rb_tree_tag ,  tree_order_statistics_node_update >
#define endl '\n'
#define int long long int
#define db long double
#define str string
#define mod 1000000007
#define ff first
#define ss second
#define PQi priority_queue<int>
#define Vi vector<int>
#define Si set<int>
#define Li list<int>
#define mk make_pair
#define pii pair<int,int>
#define all(x) (x.begin(),x.end())
#define pb(x) push_back(x)
#define For(i,n,s) for(int i=s;i<n;i++)
#define mat2D(T,r,c) vector<vector<int> > T(r,vector<int>(c))
#define vec2D vector<vector<int> >
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define getVal(x) {int val;cin>>val;x.pb(val);}
#define debug(x) {for(auto i :x) cout << i << " ";cout << endl;}

void solve() {
    int n, a, b;
    cin >> n >> a >> b;
    int A[n];
    map<int, int>mp;
    For(i, n, 0) {
        cin >> A[i];
        mp[A[i]]++;
    }
    sort(A, A + n, greater<int>());
    int sa = 0, c = 0;
    For(i, a, 0) {
        sa += A[i];
        if (A[a - 1] == A[i])c++;
    }
    cout << fixed << setprecision(6) << (db)sa / (db)a << endl;
    int C[51][51];
    For(i, 51, 0) {
        C[0][i] = 0;
        C[i][0] = 1;
    }
    For(i, 51, 1) {
        For(j, 51, 1) {
            C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
        }
    }
    int way = 0;
    if (c == a) {
        For(i, mp[A[a - 1]] + 1, a) {
            if (i <= b)
                way += C[mp[A[a - 1]]][i];
        }
    } else {
        way = C[mp[A[a - 1]]][c];
    }
    cout << way;
}

int32_t main() {
    fastIO;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
# endif
    solve();
    return 0;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  vector<int> hist(26);
  string s;
  cin>>s;
  rep(i,4) {
    hist[s[i]-'A']++;
  }
  vector<int> revhist(4);
  rep(i,26) {
    revhist[hist[i]]++;
  }
  if(revhist[2]==2) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

int main()
{
  int x;
  cin >> x;
  int y = x;
  int ax[9];
  int fx;
  for (int i = 0; i < 8; i++) {
    ax[i] = y % 10;
    fx += ax[i];
    y = (y-ax[i])/10;
  }
  if (x % fx == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using pq = priority_queue<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() { // 問題文はしっかり読め!!!
	double x, y, h, m;
	cin >> x >> y >> h >> m;
	double tans = 30.0 * h + 0.5 * m;
	double tyou = 6.0 * m;
	double dist = min(abs(tans - tyou), 360.0 - abs(tans - tyou));
	double Cos = cos(dist / 180.0 * pi);
	double X = pow(x, 2); double Y = pow(y, 2);
	double ans = X + Y - 2 * x * y * Cos;
	output(sqrt(ans), 20);
	return 0;
}

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

int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    if(a>b)swap(a,b);
    if(b>c)swap(b,c);
    if(a%2==0||b%2==0||c%2==0)cout<<0<<endl;
    else cout<<a*b<<endl;
    return 0;
}

Measured memory_bytes: 256
from itertools import combinations_with_replacement, permutations


def main():
    abcd = list(input())
    can_break = False
    for pp in combinations_with_replacement(["+", "-"], 3):
        if can_break:
            break
        for p in permutations(pp):
            now = [abcd[0]]
            for i in range(3):
                now.append(p[i])
                now.append(abcd[i + 1])
            now_f = "".join(now)
            if eval(now_f) == 7:
                print(now_f + "=7")
                can_break = True
                break


if __name__ == '__main__':
    main()



Measured memory_bytes: 3060
function Main(input) {
    input = input.trim();
    input = input.split("\n")
    input = input.map(e => e.split(" ").map(f => parseInt(f)))

    var tenbou = []

    input[1].forEach(e => {
        tenbou.push({
            h: e,
            childlen: [],
            parents: []
        })
    })

    var input2 = input.slice(2)

    input2.forEach(e => {
        var ten1 = tenbou[e[0] - 1]
        var ten2 = tenbou[e[1] - 1]

        if(ten1.h<ten2.h){
            tenbou[e[0] - 1].parents.push(ten2)
            tenbou[e[1] - 1].childlen.push(ten1)
        }else if(ten1.h==ten2.h){
            tenbou[e[0] - 1].parents.push(ten2)
            tenbou[e[1] - 1].parents.push(ten1)
        }else{
            tenbou[e[0] - 1].childlen.push(ten2)
            tenbou[e[1] - 1].parents.push(ten1)
        }

    })

    var count =0;

    tenbou.forEach(e=>{
        if(e.parents.length ==0)count++;
    })


    console.log(count)

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 103456
N,K = map(int,input().split())
H = list(map(int,input().split()))

INF = float('inf')
dp = [INF] * N
dp[0] = 0
for i in range(1,N):
    for j in range(K):
        if i-j-1 < 0: break
        dp[i] = min(dp[i], dp[i-j-1] + abs(H[i] - H[i-j-1]))
print(dp[-1])

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

using namespace std;

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

  vector<int> primeList;
  primeList.push_back(2);
  
  vector<bool> check(100001, false);

  for(int i = 3; i <= 100000; i += 2){
    if(!check[i]){
      primeList.push_back(i);
      check[i] = true;
      for(int j = i * i; j <= 100000; j += 2){
	check[j] = true;
      }
    }
  }

  for(int i = 0; i < N; i++){
    int temp = A[i];

    for(int prime: primeList){
      if(temp % prime == 0){
	temp /= prime;
      }
    }

    if(temp > 1){
      primeList.push_back(temp);
    }
  }

  long long ans = 0;
  for(int prime: primeList){
    long long tempSum = 0;
    for(int i = 0; i < N; i++){
      if(A[i] % prime == 0){
        tempSum += A[i];
      }
    }

    ans = max(ans, tempSum);
  }

  cout << ans << endl;
}



Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> PII;
typedef long long ll;

int main(void){
  int n,t;
  cin >> n >> t;
  int prev,now;
  ll res = 0;
  cin >> prev;
  for(int i = 0;i < n-1;++i){
    cin >> now;
    res += min(t,now - prev);
    prev = now;
  }
  res += t;
  cout << res << endl;
  return 0;
}


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

struct data {
  long long id, cost;
};
bool operator<(const data &l, const data &r) {
  if(l.cost != r.cost) return l.cost < r.cost;
  return l.id < r.id;
}

struct Unionfind {
  // tree number
  vector<int> par;
  // tree rank
  vector<int> treerank;
  // constructor
  Unionfind(int n = 1) { stree(n + 1); }
  // make and initialization
  void stree(int n = 1) {
    par.resize(n);
    treerank.resize(n);
    for(int i = 0; i < n; ++i) {
      par[i] = i;
      treerank[i] = 0;
    }
  }
  // search root
  int root(int x) {
    if(par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  // is same?
  bool issame(int x, int y) { return root(x) == root(y); }

  // add
  // already added, return 0
  bool uni(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return 0;
    if(treerank[x] < treerank[y])
      par[x] = y;
    else if(treerank[y] < treerank[x])
      par[y] = x;
    else {
      par[y] = x;
      ++treerank[x];
    }
    return 1;
  }
};

long long n, m, ans = -1;
bool ch[100005][2] = {0};
vector<data> v;
Unionfind uf;

void solve();

int main() {
  cin >> n >> m;
  uf = Unionfind(n + 1);
  v.resize(n);
  for(int i = 0; i < n; ++i) {
    cin >> v[i].cost;
    v[i].id = i;
  }
  sort(v.begin(), v.end());
  for(int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    uf.uni(x, y);
  }
  solve();
  if(ans == -1)
    cout << "Impossible" << endl;
  else
    cout << ans << endl;
  return 0;
}

void solve() {
   if((n - 1 - m)*2 > n) return;
  long long now = 0, cnt = 0;
  for(int i = 0; i < n; ++i)
    if(!ch[uf.root(v[i].id)][1]) {
      now += v[i].cost;
      ++cnt;
      ch[i][0] = 1;
      ch[uf.root(v[i].id)][1] = 1;
    }
  if(cnt == 1) now = 0;
 
  cnt = (cnt - 1) * 2 - cnt;
  for(int i = 0; i < n; ++i)
    if(!ch[i][0] && cnt > 0) {
      now += v[i].cost;
      if(--cnt == 0) break;
    }
  ans = now;
}


Measured memory_bytes: 2816
//============================================================================
// Name        : AOJ1179.cpp
// Author      : mizo0203
// Version     :
// Copyright   : Your copyright free
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <stdio.h>
using namespace std;

int remnant[999][10][20];
int n;
int Y, M, D;

int main() {
  int i, j, k;
  int cnt = 1;

  for (i = 999; i > 0; i--) {
    for (j = 10; j > 0; j--) {
      if (i % 3 != 0 && j % 2 == 0) {
        k = 19;
      } else {
        k = 20;
      }
      for (; k > 0; k--) {
        remnant[i - 1][j - 1][k - 1] = cnt;
        cnt++;
      }
    }
  }

  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d %d", &Y, &M, &D);
    printf("%d\n", remnant[Y - 1][M - 1][D - 1]);
  }

  return 0;
}

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

 int main(){
   int n;
   cin>>n;
   int a=n/1.08;
   int b=n/1.08 +1;
   if(a*1.08>=n && a*1.08<n+1){
     cout<<a<<endl;
   }else if(b*1.08>=n && b*1.08<n+1){
     cout<<b<<endl;
   }else{
     cout<<":("<<endl;
   }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
#define endl '\n'
using namespace std;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	LL x,y;
	cin>>x>>y;
	if(x==y||abs(x-y)==1)
		cout<<"Brown"<<endl;
	else cout<<"Alice"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b) {
	return b ? GCD(b, a%b) : a;
}
//sort(a, a + N, greater<int>())   // descend
//sort(a, a+N)                    //  ascend

using ll = long long;
using namespace std;


int main() {
	double w, h, x, y;
	cin >> w >> h >> x >> y;
	double ans1 = 0;

	if (x == w / 2 && y == h / 2) ans1 = 1;
	else if (x == w / 2 && y != h / 2) ans1 = 0;
	else if (x != w / 2 && y == h / 2) ans1 = 0;
	else ans1 = 0;


	printf("%.12lf ", (double)w*h / 2);
	cout << ans1;
}






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

#define ft first
#define sd second

using namespace std;

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

const int MAXN = 100 * 1000 + 123;


int n, m, p[MAXN], save, ans;
bool mark[MAXN];
vector<int> g[MAXN];
set<int> s[MAXN];
set<int> t[MAXN];

void dfs(int v);



int main() {
	{
		cin >> n >> m;
		for (int i = 1; i <= n; i++)
			cin >> p[i];
		int x, y;
		for (int i = 0; i < m; i++) {
			cin >> x >> y;
			g[x].push_back(y), g[y].push_back(x);
		}
	}
	for (int i = 1; i <= n; i++)
		if (!mark[i]) {
			dfs(i);
			save++;
		}
	for (int i = 0; i < save; i++)
		for (int j : t[i])
			if (s[i].find(j) != s[i].end())
				ans++;
	cout << ans;
	return 0;
}
void dfs(int v) {
	s[save].insert(p[v]);
	t[save].insert(v);
	mark[v] = true;
	for (int u : g[v])
		if (!mark[u])
			dfs(u);
}

Measured memory_bytes: 28032
n=int(raw_input())
a=[int(raw_input()) for _ in xrange(n)]
cnt=0
for i in xrange(n-1):
    if a[i]==0:continue
    if a[i]%2==1:
        if a[i+1]!=0:
            cnt+=a[i]/2
            a[i+1]+=1
        else:
            cnt+=a[i]/2
    else:
        cnt+=a[i]/2
if a[n-1]==0:
    print(cnt)
else:
    cnt+=a[n-1]/2
    print(cnt)

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

int main() {
  int n, k, x, y;
  cin >> n >> k >> x >> y;

  if (n > k) {
    cout << (k * x) + (n - k) * y << endl;
  } else {
    cout << n * x << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
	int a,b,c,d,ans;
int main(){
	scanf("%d%d%d%d",&a,&b,&c,&d);
	for (int i=0;i<=a;i++)
	  for (int j=0;j<=b;j++)
	    for (int k=0;k<=c;k++)
	    if ((i*500+j*100+k*50)==d)
	    {
	      ans++;
		}
		cout<<ans;
}

Measured memory_bytes: 256
S=input()

ans=0

if len(S)==1:
    ans=int(S)
else:
    for i in range(2**(len(S)-1)):
        tmp = S[0]
        for j in range(0,len(S)-1):
            if (i>>j&1==0):
                tmp+=S[j+1]
            else:
                ans+=int(tmp)
                tmp=S[j+1]
        ans+=int(tmp)

print(ans)

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

int n, m;
int a[100], b[100];
bool graph[10][10];
int ans = 0;

void dfs(int x, int mask) {
  bitset<10> h(mask);
  cerr << x << " " << h << endl;
  if (mask == (1<<n)-1) {
    ans++;
    return;
  }

  rep(i, n) {
    if (graph[x][i] == false) continue;
    if (mask & (1<<i)) continue;

    dfs(i, mask | (1<<i));
  }
}

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

  cin >> n >> m;
  rep(i, m) {
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
  }

  dfs(0, 1);

  cout << ans << endl;
}

Measured memory_bytes: 256
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0231
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

//??\???
#define MAX_N 100
#define W_LIM 150
int N;

int main() {
  ios::sync_with_stdio(false);


  while( cin >> N ) {

    if ( N== 0 ) break;

    map<int, int> imos;
    int m, a, b;
    for(int i = 0; i < N; i++) {
      cin >> m >> a >> b;
      imos[a] += m;
      imos[b] -= m;
    }

    int mx = 0, acc = 0;
    for(auto it : imos ) {
      acc += it.second;
      mx = max(mx, acc);
    }

    cout << ((mx <= W_LIM) ? "OK" : "NG") << "\n";
  }


}

Measured memory_bytes: 3036
#include<stdio.h>
#include<string.h>
int N,i,j,k,L;
char P[7],M[30],t,T[30];
int main()
{
	for(scanf("%d\n",&N);N--;)
	{
		gets(P);gets(M);
		L=strlen(M);
		for(i=strlen(P)-1;i>=0;i--)
		{
			switch(P[i])
			{
			case 'J':t=M[L-1];memmove(M+1,M,L-1);M[0]=t;break;
			case 'C':t=M[0];memmove(M,M+1,L-1);M[L-1]=t;break;
			case 'E':for(j=0;j<L/2;j++){t=M[j];M[j]=M[j+L/2+L%2];M[j+L/2+L%2]=t;}break;
			case 'A':for(j=0,k=L-1;j<k;j++,k--){t=M[j];M[j]=M[k];M[k]=t;}break;
			case 'P':for(j=0;j<L;j++)if(M[j]<58)M[j]=M[j]==48?57:M[j]-1;break;
			case 'M':for(j=0;j<L;j++) if(M[j]<58)M[j]=M[j]==57?48:M[j]+1;break;
			}
		}
		puts(M);
	}
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long a[100];
int main(){
	int n;
	cin>>n;
	a[0]=2;
	for(int i=0;i<=n;i++){
		a[i]=a[i-1]*2+2;
	}
	cout<<a[n];
	return 0;
}

Measured memory_bytes: 256
from collections import Counter
n,k,q = map(int, input().split())
a = [int(input()) for _ in range(q)]

if k > q: ans = ["Yes"] * n
else: ans = ["No"] * n

for key,val in Counter(a).items():
    if val + k - q > 0:
        ans[key-1] = "Yes"

[print(i) for i in ans];

Measured memory_bytes: 12672
import java.io.IOException;
import java.util.NoSuchElementException;

import java.io.InputStream;

@SuppressWarnings("unchecked")
public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner fs = new FastScanner();

        final int N = fs.nextInt();

        int ans = N;

        // 6円で払う金額 全探索
        for (int i = 0; i <= N; i++) {
            int tmp = i;

            // 払う回数
            int rem = 0;

            while (0 < tmp) {
                rem += tmp % 6;
                tmp /= 6;
            }

            // 9円で払う金額
            tmp = N - i;

            while (0 < tmp) {
                rem += tmp % 9;
                tmp /= 9;
            }

            ans = Math.min(ans, rem);
        }

        System.out.println(ans);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
        if (hasNextByte()) return buffer[ptr++];
        else return -1;
    }
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if(b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 21332
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <numeric>
#include <functional>
#include <cstdlib>
#include <regex>
#include <list>
int main() {
	int s, h, m, S;
	std::cin >> s;
	h = s / 3600;
	m = (s % 3600) / 60;
	S = (s % 3600) % 60;
	std::cout << h << ":" << m << ":" << S << std::endl;
	return 0;
}


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

int func(long long x,long long y)
{
	if (x<y) swap(x,y);
	long long t=x%y;
	while(t!=0){
		x=y;
		y=t;
		t=x%y;
	}
	return y;
}

int main()
{
	int n;
	cin>>n;
	long long a[n+1],x,d;
	cin>>x;
	for(int i=1;i<=n;i++) cin>>a[i];
	d=abs(x-a[1]);
	for(int i=2;i<=n;i++){
		int k=abs(x-a[i]);
		d=func(d,k);
	}
	cout<<d<<endl;
	return 0;
}

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


struct Edge{
    int to;
    long long w;
};

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

    int u[N], v[N];
    long long w[N];

    for(int i = 0; i < N-1; i++) {
        cin >> u[i] >> v[i] >> w[i];
        u[i]--;
        v[i]--;
    }

    vector<vector<Edge>> graph(N);
    for(int i = 0; i < N-1; i++) {
        graph[u[i]].push_back(Edge{v[i],w[i]});
        graph[v[i]].push_back(Edge{u[i],w[i]});
    }

    queue<int>q;
    int color[N];
    for(int i = 0; i < N; i++) {
        color[i] = -1;
    }
    color[0] = 0;
    q.push(0);
    
    do{
        int i = q.front();
        q.pop();
        for(int j = 0; j < graph[i].size(); j++){
            int to = graph[i][j].to;
            int w = graph[i][j].w;

            if(color[to] > -1)continue;

            // 経路発見
            if(w % 2 == 0){
                color[to] = color[i];
                q.push(to);
            }else{
                color[to] = 1 - color[i];
                q.push(to);
            }

            // cout << "to:" << to << endl;

        }
    }while(!q.empty());

    for(int i = 0; i < N; i++) {
        cout << color[i] << endl;
    }



    return 0;
}

Measured memory_bytes: 9856
#include <iostream>
#include <stdio.h>
#include <string>
#include <fstream>
#include <sstream>
using namespace std;

bool isPrime(int x){
  if(x==1||x==0){
    return false;
  }
  for(int i=2;i*i<=x;i++){
    if(x%i==0){
      return false;
    }
  }
  return true;
}

int main(){
  int N,tmp,count;
  count = 0;
  scanf("%d", &N);
  for(int i=0;i<N;i++){
    scanf("%d",&tmp);
    if(isPrime(tmp)){
      count++;
    }
  }
  printf("%d\n",count);
}


Measured memory_bytes: 3204
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<iomanip>
#include<set>
#include<random>
using namespace std ;

#define MOD 1000000007
#define MAXN 1000007

int n ;
long long dp[ MAXN ] ;

void input ( ) {
    scanf ( "%d" , &n ) ;
}

void solve ( ) {
    dp[ 0 ] = 1 ;
    long long ans = 0 ;
    long long pref = 0 ;
    for ( int i = 1 ; i <= n ; ++ i ) {
        dp[ i ] = pref ;
        dp[ i ] += dp[ i - 1 ] ;
        dp[ i ] %= MOD ;
        if ( i >= 2 ) {
            pref += dp[ i - 2 ] ;
            pref %= MOD ;
        }
    }
    for ( int i = 0 ; i < n - 1 ; ++ i ) {
        long long h = ( dp[ i ] * ( n - 1 ) ) % MOD ;
        h = ( h * ( n - 1 ) ) % MOD ;
        ans = ( ans + h ) % MOD ;
    }
    int coef = n ; 
    for ( int i = n - 1 ; i >= 0 ; -- i ) {
        ans = ( ans + dp[ i ] * coef ) % MOD ;
        if ( i != n - 2 ) { -- coef ; }
    }
    printf ( "%lld\n" , ans ) ;
}


int main ( ) {
    ios_base :: sync_with_stdio ( false ) ;
    cin.tie ( NULL ) ;
    input ( ) ;
    solve ( ) ;
    return 0 ;
}


Measured memory_bytes: 8064