akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
static const double pi = 3.141592653589793;




int main(){
    ll N;
    cin>>N;
    if(N==0){
        cout<<0<<endl;
        return 0;
    }
    if(N==1){
        cout<<1<<endl;
        return 0;
    }
    if(N>0){
        ll Num=0;
        ll Key=1;
      	ll Keta=-2;
        while(Num<N){
            Num+=Key;
            Key*=4;
          	Keta+=2;
        }
        ll Dif=Num-N;
        ll J=1;
        cout<<1;
        vector<ll> W(Keta, 0);
      	ll i=0;
        while(Dif>0){
            W[i]=Dif%2;
          	i++;
            Dif/=2;
        }
        
        rep(i, Keta){
            if(J+1){
				cout<<W[Keta-1-i];
            }else{
              	cout<<(1-W[Keta-1-i]);
            }
          
          	J*=-1;
        }
    }
  	if(N==-1){
      	cout<<11<<endl;
      return 0;
    }
  	if(N<0){
      	ll Num=0;
        ll Key=2;
      	ll Keta=-1;
        while(Num<N*-1){
            Num+=Key;
          	Keta+=2;
            Key*=4;
        }
        ll Dif=Num-N*-1;
      	cout<<1;
        vector<ll> W(Keta, 0);
      	ll i=0;
        while(Dif>0){
            W[i]=Dif%2;
          	i++;
            Dif/=2;
        }
      	ll J=1;
        rep(i, Keta){
            if(J+1){
				cout<<W[Keta-1-i];
            }else{
              	cout<<(1-W[Keta-1-i]);
            }
          
          	J*=-1;
        }
    }
}
    

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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/a.in", "r", stdin);
//  freopen("../IO/a.in", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}


constexpr int N = 3000;
double dp[N][N];


void solve(std::istream &in, std::ostream &out) {
  int n;
  in >> n;
  vector<double> p(n + 1);
  for (int i = 1; i <= n; ++i) {
    in >> p[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < i; ++j) {
      dp[i][j] += dp[i - 1][j] * (1 - p[i]);
      dp[i][j + 1] += dp[i - 1][j] * p[i];
    }
  }
  double ans = 0;
  for (int i = n - n / 2; i <= n; ++i) {
    ans += dp[n][i];
  }
  out << fixed << setprecision(15) << ans << '\n';
}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    ll h, w, k;
    cin >> h >> w >> k;
    string s[h];
    rep(i, h) { cin >> s[i]; }
    int ans = mod;
    rep(i, 1 << (h - 1)) {
        int ans_temp;
        int num = __builtin_popcount(i);
        ans_temp = num;
        vector<int> count(num + 1);
        vector<int> index(h);
        int index_last = 0;
        rep(j, h) {
            index[j] = index_last;
            if ((i >> j) & 1) {
                index_last++;
            }
        }
        rep(j, w) {
            vector<int> next(num + 1);
            rep(l, h) {
                if (s[l][j] == '1') {
                    next[index[l]]++;
                }
            }
            bool flag = false;
            rep(l, num + 1) {
                if (next[l] > k) {
                    ans = mod;
                }
            }
            rep(l, num + 1) {
                if (count[l] + next[l] > k) {
                    flag = true;
                    break;
                }
            }
            if (flag) {
                ans_temp++;
                count = next;
            } else {
                rep(l, num + 1) { count[l] += next[l]; }
            }
        }
        ans = min(ans, ans_temp);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000

using namespace std;

int main(){
    int n,a,b;
    cin >> n >> a >> b;
    int ans =0;
    for (int i=1;i<=n;i++){
        string s = to_string(i);
        int tmp=0;
        rep(j,s.length()){
            int t = (int)(s[j]-'0');
            tmp += t;
        }
        if ((a<= tmp) && (tmp <=b)) ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

template <class T>
inline bool chmax(T& a, T b) {
    return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
    return a = (a > b) ? b : a;
}

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;
    ll x, y;
    cin >> x >> y;

    if (abs(x) < abs(y)) {
        if (x > 0 && y > 0) {
            cout << y - x << endl;
        } else if (x > 0 && y < 0) {
            cout << abs(y) - abs(x) + 1 << endl;
        } else if (x < 0 && y > 0) {
            cout << abs(y) - abs(x) + 1 << endl;
        } else if (x < 0 && y < 0) {
            cout << abs(y) - abs(x) + 2 << endl;
        } else if (x == 0) {
            if (y > 0)
                cout << y << endl;
            else if (y < 0)
                cout << abs(y) + 1 << endl;
        }
    } else if (abs(x) > abs(y)) {
        if (x > 0 && y > 0) {
            cout << abs(x) - abs(y) + 2 << endl;
        } else if (x > 0 && y < 0) {
            cout << abs(x) - abs(y) + 1 << endl;
        } else if (x < 0 && y > 0) {
            cout << abs(x) - abs(y) + 1 << endl;
        } else if (x < 0 && y < 0) {
            cout << abs(x) - abs(y) << endl;
        } else if (y == 0) {
            if (x > 0) {
                cout << 1 + x << endl;
            } else if (x < 0) {
                cout << abs(x) << endl;
            }
        }
    } else if (abs(x) == abs(y)) {
        if ((x >= 0 && y >= 0) || (x < 0 && y < 0)) {
            cout << 0 << endl;
        } else {
            cout << 1 << endl;
        }
    }

    return 0;
}

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

int main(){
    int a[5];
    for(int i=0; i<5; i++)
        cin >> a[i];
    int ans = 0;
    for(int i=0; i<5; i++)
        ans += a[i];
    int b[5];
    for(int i=0; i<5; i++)
        b[i] = (10000 - a[i]) % 10;
    sort(b, b+5);
    for(int i=0; i<4; i++)
        ans += b[i];
    cout << ans << endl;
    return 0;
}

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

namespace ARC75_C
{
    class Program
    {
        static void Main(string[] args)
        {

            var n = int.Parse(Console.ReadLine());
            var s = new int[n];
            for (int i = 0; i < n; i++)
            {
                s[i] = int.Parse(Console.ReadLine());
            }
            Array.Sort(s);
            int sum = s.Sum();
            if (s.All(x=>x%10==0))
            {

                Console.WriteLine(0);
                return;
            }
            if (sum % 10 != 0)
            {
                Console.WriteLine(sum);
                return;
            }
            if (sum % 10 == 0)
            {
                for (int i = 0; i < n; i++)
                {
                    if (s[i] % 10 != 0)
                    {
                        sum -= s[i];
                        break;
                    }
                }
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 13268
H, W = map(int, input().split())
field = [input() for _ in range(H)]
hi, wi = set(), set()
for i in range(H):
    if not('#' in field[i]):
        hi.add(i)
for i in range(W):
    f = False
    for j in range(H):
        if field[j][i] == '#':
            f = True
    if not f:
        wi.add(i)
for i in range(H):
    if i in hi:
        continue
    for j in range(W):
        if j in wi:
            continue
        print(field[i][j], end="")
    print("")


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

int main(){
  int A, B, C, X;
  cin >> A >> B >> C >> X;

  int cnt=0;
  for (int i=0; i<A+1; i++){
    for (int j=0; j<B+1; j++){
      for (int k=0; k<C+1; k++){
        if (500*i+100*j+50*k==X){
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
}


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

typedef long long ll;

const ll N = 3e5 + 10, mod = 998244353;
ll fact[N], factRev[N];

ll sum(ll a, ll b) {
    return ((1LL * a + b) % mod + mod) % mod;
}

ll mul(ll a, ll b) {
    return ((1LL * a * b) % mod + mod) % mod;
}

ll pw(ll n, ll m) {
    ll res = 1, tmp = n;
    while (m) {
        if (m & 1)
            res = mul(res, tmp);
        tmp = mul(tmp, tmp);
        m >>= 1;
    }
    return res;
}

ll c(ll n, ll m) {
    if (m > n)
        return 0;
    return mul(fact[n], mul(factRev[m], factRev[n - m]));
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    ll n, a, b, k;
    cin >> n >> a >> b >> k;
    fact[0] = 1;
    for (ll i = 1; i <= n; i++)
        fact[i] = mul(fact[i - 1], i);
    factRev[n] = pw(fact[n], mod - 2);
    for (ll i = n - 1; ~i; i--)
        factRev[i] = mul(factRev[i + 1], i + 1);
    ll ans = 0;
    for (ll i = 0; i <= n; i++) {
        if (a * i <= k && (k - a * i) % b == 0 && (k - a * i) / b <= n) {
            int y = (k - a * i) / b;
            ans = sum(ans, mul(c(n, i), c(n, y)));
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4992
//#pragma GCC optimize("O3")

#include <bits/stdc++.h>

using namespace std;

int main() {
    //   freopen("in.txt", "rt", stdin);
    int n, k;
    scanf("%d %d", &n, &k);
    long long ans = 0, v;
    v = n / k;
    ans = (v * v * v);
    if (k % 2==0) {
        k /= 2;
        v = (n / k) - v;
        ans += (v * v * v);
    }
    printf("%lld", ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a=1,b=1,c=1,n,ans;
int gcd(int a,int b)
    {
        if(a==0)
        {
            return b;
        }else
        {
            return gcd(b % a,a);
        }
    }
int main(){
	cin>>n;
	for(a=1;a<=n;a++)for(b=1;b<=n;b++)for(c=1;c<=n;c++){
		ans+=gcd(a,gcd(b,c));
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3636
def num(card):
    return int(card[2:])

def partition(A, p, r):
    x = num(A[r])
    i = p - 1
    for j in range(p, r):
        if num(A[j]) <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i + 1], A[r] = A[r], A[i + 1]
    return i + 1

def quicksort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quicksort(A, p, q - 1)
        quicksort(A, q + 1, r)

def is_stable(A, B):
    C = B[:]
    for card in A:
        i = C.index(card)
        if i == 0:
            pass
        elif num(C[i - 1]) == num(card):
            return False
        del C[i]
    return True

n = int(input())
A = [input() for _ in range(n)]
B = A[:]
quicksort(B, 0, n - 1)

print("Stable" if is_stable(A, B) else "Not stable")
for card in B:
    print(card)

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

using ll = long long;
using pp = pair<ll,ll>;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end() //昇順
#define enb(a) a.rbegin(),a.rend() //降順
#define pb(a,b) a.push_back(b)
//fixed << setprecision(20)
int main(){
	string s;
	ll k;
	cin >> s >> k;
	for(int i = 0; i < s.size(); i++){
		if(s[i] - '0' != 1){
			cout << s[i] - '0' << endl;
			break;
		}
		if(i == k - 1){
			cout << 1 << endl;
			break;
		}
	}
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>

int main(void) {
    int N, Y;

    std::cin >> N >> Y;

    int m, g, s;
    int wa = 1;

    for(m = 0; m <= N; m++) {
        for(g = 0; g <= (N-m); g++) {
            s = N - m - g;
            if(m*10000 + g*5000 + s*1000 == Y) {
                std::cout << m << " " << g << " " << s << std::endl;
                return 0;
            }
        }
    }
    std::cout << "-1 -1 -1" << std::endl;

    return 0;
}


Measured memory_bytes: 256
n=input()
ans=0
for i in range(2**(len(n)-1)):
  a=0
  s=n[0]
  for j in range(1,len(n)):
    if i&1==1:
      a += int(s)
      s=n[j]
    else:
      s+=n[j]
    i = i >> 1
  else:
    a+=int(s)
    ans+=a
print(ans)

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

int main() {
    int cost = 700;
    string str;
    cin >> str;
    
    for(int i = 0; i < 3; i++){
        if(strncmp("o",&str[i],1)==0){
            cost += 100;
        }
    }
    
    cout << cost << endl;
    
    return 0;
}

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

using namespace std ;

const int MAXN = 1e3 + 10 , MAX = 1e4 + 10 ;

int a[MAX] , b[MAX] ;
int n,  h ;
int dp[MAXN][MAX] ;

int solve(int idx, int rem)
{
	if(rem <= 0)
		return 0ll ;
	if(idx == n)
		return 3e8 ;
	int &ret = dp[idx][rem] ;
	if(ret != -1)
		return ret ;
	ret = solve(idx+1 , rem) ;
	ret = min(ret , solve(idx , rem - a[idx]) + b[idx]) ;
	return ret ;
}

int main()
{
	memset(dp , -1 , sizeof(dp)) ;
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>h>>n ;
	for(int i = 0 ; i < n ; ++i)
		cin>>a[i]>>b[i] ;
	return cout<<solve(0 , h)<<"\n" , 0 ;
}		

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

int main() {
  int n; cin >> n;
  int odd = 0;
  rep(i,n){
    int x = 0;
    cin >> x;
    if(x % 2 == 1) odd++;
  }

  if(odd % 2 == 0){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
N = int(input())

data = []
for i in range(N):
  data.append(input())

dic = {}
for i in data:
  dic[i] = dic.get(i, 0) + 1

data = []
for i in dic.keys():
  data.append((-dic[i], i))

data.sort()

thresh = data[0][0]
for i in data:
  if i[0] == thresh:
    print(i[1])

Measured memory_bytes: 44520
use std::io::Read;
use std::collections::HashMap;

pub fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let mut ary: Vec<i64> = vec![0;n];
    for i in 0..n {
        ary[i] = iter.next().unwrap().parse().unwrap();
    }
    let mut csum: Vec<i64> = vec![0;n + 1];
    for i in 0..n {
        csum[i+1] = csum[i] + ary[i];
    }

    // println!("{:?}", csum);

    let mut ret: i64 = 0;
    let mut hmap: HashMap<i64, i64> = HashMap::new();
    for c in csum {
        let v = {hmap.get(&c).unwrap_or(&0) + 1};
        hmap.insert(c, v);
    }
    for (_, v) in hmap {
        if v >= 2 {
            ret += v * (v - 1) / 2;
        }
    }
    println!("{}", ret);
}


Measured memory_bytes: 21404
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef vector <int> vi;
typedef map <char,char> mapcc;
#define REP(i,n) for (int i=0; i<n; i++)
string A2Z="abcdefghijklmnopqrstuvwxyz";

string decode(mapcc &mp, string &msg){
	string s="";
	int i=0;
	while (msg[i]){
		char c = msg[i];
		if (islower(c)) c = mp[c];
		s += c;
		i++;
	}
	return s;
}

string affine(string &msg, int a=0, int b=0){
	
	mapcc mp;
	REP(i,26){
		int i1 = i*a+b;
		while (i1<0) i1 += 26;
		mp[A2Z[i]] = A2Z[i1 % 26];
	}
	return decode(mp, msg);
}

string rot(string &msg, int a){
	if (a==0) return msg;
	mapcc mp;
	while (a<0) a += 26;
	REP(i,26)
		mp[A2Z[i]] = A2Z[(i+a) % 26];
	return decode(mp, msg);
}

vi find(string &msg){
	char c0='t';
	vi key(2);
	int a,b;
	for (int i=1; i<26; i+=2){
		a = i;
		string x = affine(msg, a, 0);
		b = c0-x[0];
		if (b<0) b += 26;
		x = rot(x, b);
		if (x=="this" || x=="that"){
			key[0] = a;
			key[1] = b;
			return key;
		}
	}
	key[0] = -1;
	return key;
}

int main(void){
	int n;
	cin>>n;
	cin.ignore();
	REP(i,n){
		vi key;
		string msg, word;
		getline(cin, msg);
		istringstream is(msg);
		while(is>>word)
			if (word.size()==4){
				key = find(word);
				if (key[0] != -1) break;
			}
		cout<<affine(msg, key[0], key[1])<<endl;
	}
}

Measured memory_bytes: 1248
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef pair<int,int> pii;
typedef vector<pii> vp;
typedef vector<int> vi;
 
int main(){
  int n, t[55], c[55];
  pii s[55];
  while(scanf("%d",&n),n){
    rep(i,n)scanf("%d%d",&s[i].first,&s[i].second);
    sort(s,s+n);
    rep(i,n){
      t[i] = s[i].first;
      c[i] = s[i].second;
    }
    
    vi q[2];
    rep(i,n)q[0].push_back(i);
     
    int ans = 0;
    while(q[0].size() || q[1].size()){
      vi g[2];
      int nxt = 1000;
      rep(x,2){
	if(q[x].size())nxt = min(nxt, t[q[x].front()]);
      }
      ans += nxt;

      rep(x,2){
	rep(i,q[x].size()){
	  t[q[x][i]] -= nxt;
	  if(i>0 && t[q[x][i-1]] > t[q[x][i]])t[q[x][i]] = t[q[x][i-1]];
	}
	while(q[x].size()){
	  if(t[q[x][0]])break;
	  g[x].push_back(q[x][0]);
	  q[x].erase(q[x].begin());
	}
      }
       
      sort(all(g[0])); sort(all(g[1]));
      for(int id : g[0]){
	q[1].push_back(id);
	t[id] = s[id].first;
      }
      for(int id : g[1]){
	if(--c[id]){
	  q[0].push_back(id);
	  t[id] = s[id].first;
	}
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
using namespace std;
int main()
{
  int a,b;
  cin >> a >> b;
  bool flg=false;
  int c;
  rep2(i,1250){
    c = i*0.08;
    int d = i*0.1;
    if(a==c && b==d){
      flg = true;
      c=i;
      break;
    }
  }
  
  if(flg) cout << c;
  else cout << "-1";

}


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

int main() {
	int a, b;
	cin >> a >> b;
	int  ans = 0;
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		if (i == a) {
			if (s[i] != '-') {
				ans = 1;
				break;
			}
		}
		else {
			if ((s[i] != '0') && (s[i] != '1') && (s[i] != '2') && (s[i] != '3') && (s[i] != '4') &&(s[i] != '5') && (s[i] != '6') && (s[i] != '7') && (s[i] != '8') && (s[i] != '9')) {
				ans = 1;
				break;
			}
		}
	}
	if (ans == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

int n = 0, m = 0;

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

    if (n < m)
        cout << "a < b" << endl;
    if (n > m)
        cout << "a > b" << endl;
    if (n == m)
        cout << "a == b" << endl;

    return 0;
}

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

using namespace std;
#define IOS ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define pii pair<int,int>

int main()
{
    IOS;
    int n;
    cin>>n;
    vector<int> a(1<<n);
    for(int i=0;i<1<<n;i++)cin>>a[i];
    sort(all(a));
//    for(auto x:a)cout<<x<<" ";
//    cout<<endl;
    bool ok=1;
    vector<int> pre;
    int m=1<<n;
    if(a[m-1]>a[m-2]){
        pre.pb(a[m-1]);
        pre.pb(a[m-2]);
    }else {
        ok=0;
    }
    multiset<int> st;
    for(int i=0;i<m-2;i++)st.insert(a[i]);
    for(int i=1;i<n;i++){
        vector<int> now;
        for(int j=0;j<pre.size();j++){
            auto it=st.lower_bound(pre[j]);
            if(it==st.begin()){
//                cout<<i<<" "<<j<<" "<<pre[j]<<endl;
                ok=0;
                break;
            }
            --it;
            now.pb(*it);
            st.erase(it);
        }
        if(!ok)break;
        pre.insert(pre.end(),all(now));
    }
    if(ok)puts("Yes");
    else puts("No");
    return 0;
}


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

int main(){
  int D;
  cin >> D;
  vector<int> C(26);
  for(int i=0;i<26;i++){
    cin >> C.at(i);
  }
  vector<vector<int>> S(D,vector<int> (26));
  for(int i=0;i<D;i++){
    for(int j=0;j<26;j++){
      cin >> S.at(i).at(j);
    }
  }
  for(int i=0;i<14;i++){
    for(int j=0;j<26;j++){
      cout << j+1 << endl;
    }
  }
  cout << 1 << endl;
}


Measured memory_bytes: 3684
import std.functional,
       std.algorithm,
       std.container,
       std.typetuple,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv;

bool chmin(t)(ref t a, t b) {
  if (b < a) {
    a = b;
    return true;
  } else {
    return false;
  }
}

void main() {
  long N = readln.chomp.to!long;
  long ans = N;

  foreach (long i; 0..N+1) {
    long count, t;
    t = i;
    while (t > 0) {
      count += t % 6;
      t /= 6;
    }
    t = N - i;
    while (t > 0) {
      count += t % 9;
      t /= 9;
    }

    chmin(ans, count);
  }

  writeln(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_poizcy.hpp>
typedef long long  ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef long double lldb;
typedef pair<ll, ll>  ii;
typedef pair<lldb, lldb>  iidb;
typedef pair<ll, ii>  iii;
typedef vector<ll>     vi;
typedef vector<ll>      vll;
//typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9+7;
const lldb PI = acos(-1);
#define initseg ll new_nodo=(pnodo*2),mid=(iz+der)/2;
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define tam 320000
#define offset 200
#define ptr nodo*
const ll MOD=1e9+7;

int main()
{
	ll d,s,t;
	cin>>d>>t>>s;
	if (s*t>=d)
	{
		cout<<"Yes\n";
	}
	else
		cout<<"No\n";
}

Measured memory_bytes: 3676
#include<iostream>
using namespace std;
int main(){
	int t,s;
	cin>>t>>s;
	int ans=0;
	for(int i=0;i<=t;i++){
		for(int j=0;j<=t;j++){
			int k=s-i-j;
			if(k<=t&&k>=0) ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

MIN= min(A)
while 1:
  newA = []
  MIN0 = MIN
  for i in range(len(A)):
    a = A[i] % MIN
    if a == 0:
      newA.append(a)
    else:
      if a < MIN:
        MIN = a
      newA.append(a)
  if MIN==1:break
  if MIN0 == MIN:break

print(MIN)

Measured memory_bytes: 20096
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    s = S()
    ans = inf
    for i in range(len(s)-2):
        ans = min(ans, abs(int(s[i:i+3]) - 753))
    print(ans)


main()



Measured memory_bytes: 83564
import sys

def f(G, start, visited):
    cnt = 0
    n = len(G)
    visited_ = visited + [start]

    if len(visited_) == n:
        return 1

    next_node = set(G[start]) - set(visited_)
    if len(next_node) == 0:
        return 0

    for nn in next_node:
        cnt += f(G, nn, visited_)

    return cnt


def main():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    G = [[] for _ in range(N)]
    for _ in range(M):
        a, b = map(int, input().split())
        G[a-1].append(b-1)
        G[b-1].append(a-1)

    cnt = f(G, 0, [])

    return cnt


if __name__ == '__main__':
    print(main())


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

using namespace std;

const int max_n = 100111, mod = 1000000007;

int n, pw[max_n];
char s[max_n];

int mul(int x, int y) {
    return 1LL * x * y % mod;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    pw[0] = 1;
    for (int i = 1; i < max_n; ++i) {
        pw[i] = mul(3, pw[i - 1]);
    }
    scanf("%s", s);
    n = strlen(s);
    int ans = 0, cur = 1;
    for (int i = 0; i < n; ++i) {
        if (s[i] == '1') {
            ans += mul(cur, pw[n - i - 1]);
            ans %= mod;
            cur = mul(cur, 2);
        }
    }
    ans += cur;
    ans %= mod;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int n[10],k[10],a,b;
	for(int i=0;i<10;i++)
	{
		cin>>n[i];
	}
	sort(n,n+10);
	a=n[9]+n[8]+n[7];
	for(int i=0;i<10;i++)
	{
		cin>>k[i];
	}
	sort(k,k+10);
	b=k[9]+k[8]+k[7];
	cout<<a<<" "<<b<<endl;
	return 0;
}


Measured memory_bytes: 3180
import numpy as np


def solve(slots_array, K):
    MOD = 998244353
    dp = np.zeros((K+1, K+1), np.int64)
    dp[0][0] = 1
    for i in range(len(slots_array) - 1, -1, -1):
        new_dp = dp.copy()
        for j in range(K, -1, -1):
            for k in range(K-1, -1, -1):
                new_dp[j][k] += new_dp[j][k+1]
        new_dp %= MOD
        for t in range(1, slots_array[i] + 1):
            new_dp[t:, t:] += dp[:-t, :-t]
        dp = new_dp
    # print(dp)
    return np.sum(dp[:K+1, 0]) % MOD

def main():     
    S, K_str = input().split()
    K = int(K_str)

    slots = []
    index = 0
    while index < len(S):
        prev_index = index
        while index < len(S) and S[index] == '1':
            index += 1
        slots.append(index - prev_index)
        index += 1

    K = min(sum(slots) + 1, K)
    print(solve(np.array(slots, np.int64), K))


def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', 'i8(i8[:], i8)')(solve)
    cc.compile()

if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()

Measured memory_bytes: 29112
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    string s; cin>>s;
    int n = s.length();
    int ans = 0;
    rep(i,n/2) {
        if (s[i]!=s[n-i-1]) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int MX = 100005;
int n, m, q[MX], u, v, p[MX];
ll a[MX], b[MX], dp[MX], s[MX];
vi adj[MX], to[MX];
int parent (int a) { return p[a] == a ? a : p[a] = parent(p[a]); }

void dfs (int u) {
	for (int v : to[u]) dfs(v), s[u] += s[v];
	s[u] += b[u], dp[u] = to[u].size() ? 1e18 : a[u] + b[u];
	for (int v : to[u]) dp[u] = min(dp[u], s[u] - s[v] + max(dp[v], a[u]));
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	iota(p, p+MX, 0);
	iota(q, q+MX, 1);

	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> a[i] >> b[i];
		a[i] = max(a[i] - b[i], 0ll);
	}

	while (m--) {
		cin >> u >> v;
		adj[u].pb(v);
		adj[v].pb(u);
	}

	sort(q, q+n, [&] (int i, int j) {
		return a[i] < a[j];
	});

	for (int i = 0; i < n; i++) {
		u = q[i];
		for (int v : adj[u]) {
			if (parent(u) == parent(v) || a[u] < a[v]) continue;
			v = parent(v);
			to[u].pb(v);
			p[v] = u;
		}
	}

	dfs(q[n-1]);
	cout << dp[q[n-1]] << endl;

	return 0;
}


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

int main() {
    int n;
    cin >> n;
    double a=n/1.08;
    int b=a;
    double c=b*1.08, d=(b+1)*1.08;
    int e=c,f=d;
    if(e==n){
        cout << b << endl;
    }
    else if(f==n){
        cout << b+1<< endl;
    }
    else{
        cout << ":(" << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#define LL long long
#define MAXN 100010
using namespace std;

struct edge{
	int to,next,w;
	edge(int _to=0,int _next=0,int _w=0):to(_to),next(_next),w(_w){}
}e[MAXN<<1];

int n;
int g[MAXN],nume;
int size[MAXN],maxs[MAXN];
LL ve[MAXN];

void addEdge(int u,int v,int w){
	e[nume]=edge(v,g[u],w);
	g[u]=nume++;
}

void dfs(int x,int p){
	size[x]=1; maxs[x]=0;
	for(int i=g[x];~i;i=e[i].next)
		if(e[i].to^p){
			ve[e[i].to]=e[i].w;
			dfs(e[i].to,x);
			size[x]+=size[e[i].to];
			if(size[e[i].to]>maxs[x]) maxs[x]=size[e[i].to];
		}
	if(n-size[x]>maxs[x]) maxs[x]=n-size[x];
}

int main(){
#ifdef DEBUG
	freopen("D.in","r",stdin);
#endif
	memset(g,-1,sizeof g);
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		addEdge(u,v,w);
		addEdge(v,u,w);
	}
	dfs(1,0);
	LL ans=0;
	for(int i=2;i<=n;i++) ans+=2*ve[i]*min(size[i],n-size[i]);
	for(int i=2;i<=n;i++)
		if(size[i]==n-size[i]){
			ans-=ve[i];
			printf("%lld\n",ans);
			return 0;
		}
	int root=1;
	for(int i=1;i<=n;i++)
		if(maxs[i]<maxs[root]) root=i;
	int temp=0x7FFFFFFF;
	for(int i=g[root];~i;i=e[i].next)
		if(e[i].w<temp) temp=e[i].w;
	ans-=temp;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 8448
#include <stdio.h>

int main()
{   int n,m;
    scanf("%d%d",&n,&m);
    if(n==1){
        printf("%d",m);
        return 0;
    }
    int d=m/n;
    int ans;
    for(int i=1;i<=d;i++){
        if(m%i==0)ans=i;
    }
    printf("%d",ans);
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int n, a[100], count, count1, count2,  count3;
int main()
{
	std::cin >> n;
	for(int i = 0; i < n; i++)
	{
		std::cin >> a[i];

	}
	for(int i = 0; i < n; i++)
	{
		if(a[i] == a[i+1])
		{
			count2++;
			if(a[i] == a[i+2])
			{
				count1++;
				i++;
			}else
			{
				count++;
				i++;
			}
			
		}
	}
	if(count2 == n-1)
	{
		if(n <= 2)
		{
			std::cout << count;
		}else
		{
			std::cout << count2 - 2;
		}
	}else
	{
		std::cout << count + count1; 
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
#define ll long long int
using namespace std;

int main()
{
    ll l, r;
    cin >> l >> r;

    ll ans, i, j;
    ll minAns = 9999999999;
    for(i = l; i < min(r, l + 2019); i ++)
    {
    	for(j = i + 1; j <= min(r, l + 2019); j ++)
    	{
    		ans = (i * j) % 2019;
    		minAns = min(ans, minAns);
    	}
    }
    cout << minAns << endl;
}

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

int main(){
	long double a,b,c;
	cin >> a >> b >> c;

	long double d = (c-a-b) ;
	if(d>0 && d*d > a*b*4) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}



Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
// const ll MOD=998244353;

int S[15][15];
int P[15];

int main(){
  int N,M; cin>>N>>M;
  rep(i,M){
    int k; cin>>k;
    rep(j,k){
      int a; cin>>a; a--;
      S[i][a]=1;
    }
  }
  rep(i,M) cin>>P[i];
  int ans=0;
  rep(bit,(1<<N)){
    int cnt[M]={};
    rep(i,M) rep(j,N){
      if(((1<<j)&bit)&&S[i][j]) cnt[i]++;
    }
    int flag=1;
    rep(i,M) if(cnt[i]%2!=P[i]) flag=0;
    if(flag) ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
field = gets.split(' ').map(&:to_i)
cur = 0
h = field[0]
line = []
h.times{
    line[cur] = gets.chomp.chars
    cur += 1
}
ans = []
i = 0
(h*2).times{
    ans[i]=line[(((i+2)/2)-1).floor]
    print "#{ans[i].join}\n"
    i += 1
}


Measured memory_bytes: 2172
#include<bits/stdc++.h>
#define lli	long long int
#define pb push_back
#define M 1000000007
#define pi 3.1415926535897932384626433832795028841971
#define rep(i,a,b)	for(i=a;i<b;i++)
using namespace std;
int main()
{
	char ch1,ch2,ch3;
	string s1,s2,s3,str;
    lli i,j,k,a,m,n,x,y,t,z,d,sum=0,ans=0,temp;
    cin >> n >> m;t=m;
    lli s[m],c[m];
    for(i=0;i<m;i++){
    	cin >> s[i] >> c[i];
	}
	set<lli>se;
	if(n==1){
		if(m==0){
			cout << "0" << endl;return 0;
		}
		for(i=0;i<m;i++){
			se.insert(c[i]);
		}
		if(se.size()!=1){
			cout << "-1" << endl;return 0;
		}
		cout << c[0] << endl;return 0;
	}
	else if(n==2){
		if(m==0){
			cout << "10" << endl;return 0;
		}
		lli v[3];
		for(i=0;i<3;i++)	v[i]=(-1);
		for(i=0;i<m;i++){
			if(v[s[i]]==(-1)){
				v[s[i]]=c[i];
			}
			else{
				if(v[s[i]]!=c[i]){
					cout << "-1" << endl;return 0;
				}
			}
		}
		if(v[1]==0){
			cout << "-1" << endl;return 0;
		}
		if(v[1]==(-1))	v[1]=1;
		if(v[2]==(-1))	v[2]=0;
		cout << v[1] << v[2] << endl;return 0;
	}
    else{
    	if(m==0){
    		cout << "100" << endl;return 0;
		}
		lli v[4];
		for(i=0;i<4;i++)	v[i]=(-1);
		for(i=0;i<m;i++){
			if(v[s[i]]==(-1))	v[s[i]]=c[i];
			else{
				if(v[s[i]]!=c[i]){
					cout << "-1" << endl;return 0;
				}	
			}
		}
		if(v[1]==0){
			cout << "-1" << endl;return 0;
		}
		if(v[1]==(-1))	v[1]=1;
		if(v[2]==(-1))	v[2]=0;
		if(v[3]==(-1))	v[3]=0;
		cout << v[1]<<v[2] <<v[3] << endl;return 0;
	}
    
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
string S;
cin>>S;
int count=0;
int ans=0;
for(int i=0; i<S.length(); i++){
	if(S[i]=='A'||S[i]=='T'||S[i]=='G'||S[i]=='C'){
	count++;
	}else{
		ans = max(ans,count);
		count = 0;	
	}
}
ans = max(ans,count);
printf("%d\n",ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}


//for(int i = ; i < ; i++){}

int main(){
  int x,a,b;
  cin>>x>>a>>b;
  if(abs(x-a)>abs(x-b))cout<<'B'<<endl;
  else cout<<'A'<<endl;
  return 0;
}




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

using namespace std;

//Recursive Definition
long long maximumCost(long long * weights, long long * values, long long N, long long W){
if(N == 1){
  if(weights[N-1] <= W){
   return  values[N-1];
  }else{
   return 0;
  }
}else if(N > 1){
  if(weights[N-1] <= W){
   return  max(values[N-1] + maximumCost(weights,values,N-1,W-weights[N-1]),maximumCost(weights,values,N-1,W));
  }else{
   return maximumCost(weights,values,N-1,W);
  }
}
}
//Now Using Memoization
//Bottom up algorithm Reference: https://www.geeksforgeeks.org/0-1-knapsack-problem-dp-10/
long long knapSack(long long W, long long * weights, long long * values, long long N) {
   long long i, w;
   long long WN[N+1][W+1];
   for (i = 0; i <= N; i++) {
       for (w = 0; w <= W; w++){
           if (i==0 || w==0){
           WN[i][w] = 0;
           }else if (weights[i-1] <= w){
           WN[i][w] = max(values[i-1] + WN[i-1][w-weights[i-1]],WN[i-1][w]);
           }else{
           WN[i][w] = WN[i-1][w];
           }
       }
   }
   return WN[N][W];
}

int main(){
    long long N;
    cin>>N;
    long long W;
    cin>>W;
    long long * weights = new long long[N];
    long long * values = new long long[N];
    for(long long i = 0; i < N;i++){
     cin>>weights[i];
     cin>>values[i];
    }
  //  cout<<maximumCost(weights,values,N,W)<<endl;
    cout<<knapSack(W,weights,values,N)<<endl;
    delete[] weights;
    delete[] values;
    return 0;
}

Measured memory_bytes: 79104
#include<iostream>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a>b){
		for (int i=0;i<a;i++){
			cout<<b;
		
		}
	
	}
	if(b>a){
		for(int i=0;i<b;i++){
			cout<<a;
		
		}
	
	}
	if(a==b){
		for(int i=0;i<b;i++){
			cout<<a;
		}
	
	}
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <limits>
#include <tuple>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>
#include <iomanip>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = n-1; i >= 0; --i)
#define REP(i, s, n) for (int i = s; i< (int)(n); ++i)
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  ll n, x;
  cin >> n >> x;
  vector<ll> a(n);
  rep(i, n) {
    cin >> a.at(i);
  }
  ll inf = static_cast<ll>(1e18);
  vector<ll> b(n);
  rep(i, n) {
    b.at(i) = a.at(i);
  }
  vector<ll> maxmagic(n);
  vector<ll> select_j(n);
  ll ans = inf;
  rep(k, n) {
    ll sum = x * k;
    rep(i, n) {
      sum += b.at(i);
      b.at(i) = min(b.at(i), a.at((i + k + 1) % n));
    }
    ans = min(ans, sum);
  }

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


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

int main()
{
    int n;scanf("%d",&n);
    if(n==1||n==2||n==3||n==4||n==5||n==6||n==7||n==8||n==9||n==10||n==12||n==14||n==15||n==16||n==18||n==20||n==21||n==24||n==25||n==27||n==28||n==30||n==32||n==35||n==36||n==40||n==42||n==45||n==48||n==49||n==54||n==56||n==63||n==64||n==72||n==81)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define RANGE(i,n) for(int i=0;i<n;i++)
typedef long long ll;

using namespace std;

signed main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    RANGE(i,N) cin >> A[i];
    ll dp[N][2];
    dp[0][0] = A[0];
    dp[0][1] = 0;
    dp[1][0] = A[0] + A[1];
    dp[1][1] = - A[0] - A[1];
    for(int i=2; i<N; i++){
        dp[i][0] = max(dp[i-1][0], dp[i-1][1]) + A[i];
        dp[i][1] = max(dp[i-1][0] - 2 * A[i-1] - A[i],dp[i-1][1] + 2 * A[i-1] - A[i]);
    }
    //RANGE(i,N) cout << dp[i][0] << endl;
    cout << max(dp[N-1][0], dp[N-1][1]) << endl;
}


Measured memory_bytes: 2560
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//要素数受け取り
		int n = sc.nextInt();
		//積みかねの合計値
		int tmp1;
		int tmp2;
		int tmp;
		Integer [] list = new Integer[n];
		for(int i = 0; i < n; i ++){
			list[i] = sc.nextInt();
		}
		Arrays.sort(list);
		List<Integer> Sortlist = new ArrayList<>(Arrays.asList(list));
		
		for(int t = n -1; 0 < t  ; t = t -1){
			tmp1 = Sortlist.get(t);
			tmp2 = Sortlist.get(t - 1);
			if(tmp1 == tmp2){
				Sortlist.remove(t);
			}
		}
		System.out.println(Sortlist.size());
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
long long n, m;
int main()
{
     scanf("%lld %lld", &n, &m);
     if(n*2>=m)printf("%lld\n", m/2);
     else 
     {
        long long ans=n;
	m-=2*n;
	ans+=m/4;
	printf("%lld\n", ans);
     }
}


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

const int mod = 1000000007;

string s;
char buf[3010];
long long dp[3010][3010], sum[3010][3010];

int main(){
	int n;
	scanf("%d%s", &n, buf), s = buf;
	s = " " + s;
	dp[0][1] = 1, sum[0][1] = 1;
	for (int i = 1; i < n; i++){
		for (int j = 1; j <= i + 1; j++){
			if (s[i] == '>') dp[i][j] = (sum[i - 1][i] - sum[i - 1][j - 1] + mod) % mod;
			else dp[i][j] = sum[i - 1][j - 1];
		}
		for (int j = 1; j <= i + 1; j++){
			sum[i][j] = (dp[i][j] + sum[i][j - 1]) % mod;
		}
	}
	printf("%d\n", sum[n - 1][n]);
	return 0;
}


Measured memory_bytes: 140032
#!/usr/bin/python

from sys import stdin

def solve(ds):
  return ds[1] == ds[2] and (ds[1] == ds[0] or ds[2] == ds[3])

N = stdin.readline().strip()
ds = [int(N[i]) for i in range(len(N))]
print("Yes" if solve(ds) else "No")

Measured memory_bytes: 2568
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <iomanip>
#include <tuple>
#include <map>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int main() {
    int n,k; cin >> n >> k;
    int r,s,p; cin >> r >> s >> p;
    string t; cin >> t;
    map<char,int> mp;
    mp['s'] = r;
    mp['p'] = s;
    mp['r'] = p;
    ll ans = 0;
    for (int i = 0; i < k; i++) {
        int cur = i;
        while(cur < n) {
            ans += mp[t[cur]];
            if(cur+k < n && t[cur] == t[cur+k]) cur += 2 * k;
            else cur += k;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 512
#include 	<ext/pb_ds/assoc_container.hpp> 
#include 	<ext/pb_ds/tree_policy.hpp> 
#include 	<iostream>
#include 	<queue>
#include 	<tuple>
#include 	<vector>
#include	<bits/stdc++.h>
#include	<algorithm>
#include 	<cmath>
#include 	<map>
#include 	<string>
#include 	<iomanip> 
#include 	<ctype.h>
#define 	ll  long long int
#define		read(a) long long int a; cin>>a;
#define 	readstr(s) string s; cin>>s;
#define 	readc(c) char c; cin>>c;
#define 	readarr(a,l) long long int a[l]={0}; for(ll i=0;i<l;i++) cin>>a[i];
#define 	loop(i,a,b) for(ll i=a;i<b;i++)
#define 	rloop(i,a,b) for(ll i=a;i>b;i--)
#define 	loopchar() for(char c='a';c<='z';c++)
#define 	printarr(a, n) fori (i, 1, n) cout << a[i] << " "; cout << endl;
#define		printv(v) for (int i: v) cout << i << " "; cout << endl;
#define 	loopitr(vec) for(auto itr=vec.begin();itr!=vec.end();itr++)
#define 	ff first
#define 	ss second
#define 	readmtrx(i,j,a,b) ll arr[a][b]={0};for(ll i=0;i<a;i++)for(ll j=0;j<b;j++) cin>>arr[i][j];
#define 	all(a) a.begin(), a.end()
#define 	yes cout <<"YES"<<endl;
#define 	no cout <<"NO"<<endl;
#define 	sc(x) cout << (#x) << " is " << (x) << endl;
#define 	fast ios_base::sync_with_stdio(false);cin.tie(0);
#define 	pb(p) push_back(p)
#define 	mp make_pair
#define 	fsort(vec) sort(vec.begin(),vec.end())
#define 	rsort(vec) sort(vec.begin(),vec.end(),compare)
#define 	Endl endl
#define 	ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define 	roundoff std::cout << std::setprecision(15)
#define 	inf 9223372036854775807
#define 	infn -9223372036854775807
#define 	pi 3.14159265358979323846
const 		int mod = 1e9+7; 
#define 	intsize ll size = trunc(log10(num)) + 1
#define 	REVERSE(vec) reverse(vec.begin(),vec.end())
using 		namespace __gnu_pbds; 
using 		namespace std;

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; }

//code start from here 

int main() {
	fast;
	read(a)
	read(b)
	read(c)
	read(d)
	ll sum=0;
	ll m=min(a,d);
	sum+=m;
	d-=m;
	ll n= min(d,b);
	sum+=0;
	d-=n;
	ll p=min(d,c);
	sum-=p;
    
	cout<<sum<<endl;
	return 0;
}

//ends here 

Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<map>
#include<stack>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<sstream>
 
 
#define reps(i,f,n) for(int i = f; i < int(n); i++)
#define rep(i,n) reps(i,0,n)
//typedef long long ll;

using namespace std;

const int INF = 1000000000;
const int N = 16;
const int MAX = 1<<N;

pair<double,int> dp[N][MAX];

int n;
int id[N];
int dis_c[N];
int weight[N];
int w[MAX];
int dist[N][N];


int main(void){
	
	int shift = 0;
	
	rep(i,N)rep(j,MAX)dp[i][j] = pair<double,int>(INF, INF);
	rep(i,N)rep(j,N)dist[i][j] = INF;
	rep(i,N)dist[i][i] = 0;
	
	scanf("%d", &n);
	
	rep(i,n){
		scanf("%d %d %d", &id[i], &dis_c[i], &weight[i]);
	}
	
	shift = 1<<n;
	
	rep(i,shift){
		int sum = 0;
		rep(j,n){
			if(i & 1<<j){
				sum += weight[j];
			}
		}
		w[i] = sum;
 	}
	
	rep(i,n)rep(j,n){
		dist[i][j] = dist[j][i] = abs(dis_c[i] - dis_c[j]);
	}
	
	rep(i,n)
		dp[i][1<<i] = pair<double,int>(0, -1);
	
	
	rep(i,shift){
		rep(j,n){
			if(i&(1<<j)){
				rep(k,n){
					if(!(i&(1<<k))){
						if(k==j)continue;
//						printf("dp[%d][%d].f = %lf, dist[%d][%d] = %d, w[%d] = %d\n", j,i,dp[j][i].first, k, i, dist[j][k], i, w[i]);
						if(dp[k][i|1<<k].first > dp[j][i].first + dist[j][k] * w[i]){
							dp[k][i|1<<k].first = dp[j][i].first + dist[j][k] * w[i];
							dp[k][i|1<<k].second = j;
						}
					}
				}
			}
		}
	}
	
	
	
	int ans = INF;
	int p = -1;
	int x = shift -1;
	rep(i,n){
		if(ans > dp[i][x].first){
			ans = dp[i][x].first;
			p = i;
		}
	}
	
	stack<int> s;
	
	while(p != -1 && x != 0){
		int n = dp[p][x].second;
		s.push(id[p]);
		x -= (1<<p);
		p = n;
	}
	
	while(!s.empty()){
		printf("%d", s.top());
		s.pop();
		if(!s.empty())printf(" ");
	}
	puts("");
	
	
	return 0;
}

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

int main(){
  int N;
  long long int X;
  cin>>N>>X;
  long long int a[N];
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  long long int ans=0;
  if(a[0] > X){
    ans += a[0]-X;
    a[0] = X;
  }
  for(int i=0;i<N-1;i++){
    long long int s=a[i]+a[i+1];
    if(s > X){
      long long int d = s-X;
      ans += d;
      a[i+1] -= d;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>

using namespace std;

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

    double total_sum = 0;
    while(no_of_gits--)
    {
        string currency;
        double value;
        cin >> value >> currency ;

        const long long CONVERSION_RATE = 380000;
        total_sum += (currency == "JPY" ? value : CONVERSION_RATE*value);
    }

    cout << total_sum;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,D,X,eatSum;
    cin >> N >> D >> X;
    vector<int> A(N);
    for(int i = 0;i < N;i ++){
        cin >> A[i];
    }
    for(int i = 0;i < N;i ++) for(int j = 0;j*A[i] + 1 <= D;j ++) eatSum ++;
    cout << eatSum + X << endl;
    return 0;
}

Measured memory_bytes: 256