akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def root(x):
    if par[x] == x:
        return x
    par[x] = root(par[x])
    return par[x]

def union(x,y):
    x = root(x)
    y = root(y)
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1

n, m = LI()
edges = [[] for _ in range(n)]
par = [i for i in range(n)]
rank = [0] * n
for _ in range(m):
    a, b = LI()
    if root(a-1) != root(b-1):
        union(a-1, b-1)

cnt = [0] * n
for i in range(n):
    cnt[root(i)] += 1
print(max(cnt))



Measured memory_bytes: 103040
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};


#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


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







void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    vector<int> x(1000); rep(i,n) cin >> x[i];
    
    int ans_p = -1;
    int minsum = 10000000;
    for (int p = 1; p < 100; p++) {
        int sum = 0;
        for (int xi = 0; xi < n; xi++) {
            sum += (x[xi]-p)*(x[xi]-p);
        }
        if(sum < minsum) ans_p = p;
        minsum = min(minsum,sum);
    }
    cout << minsum << endl;
    
}



signed main() {
    solve();
    return 0;
}



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

int main()
{
    int h, a;
    cin >> h >> a;
    cout << ((h % a == 0) ? (h / a) : (h / a + 1)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <vector>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF (INT_MAX/3)
#define PSB push_back
typedef long long LL;
//#define int long long

//booooooooooooost

#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;	//多倍長整数(mp::cpp_int)



signed main() {

	mp::cpp_int N, X;
	cin >> N >> X;
	
	
	mp::cpp_int ans = 0;
	mp::cpp_int a = N, b = X > N - X ? X : N - X;

	if (X == N - X) ans = 3 * X;
	else {
		while (1) {
			mp::cpp_int tmp = b;
			if (a != N) ans += 3 * (a / b) * b;
			b = a % b;
			a = tmp;
			if (b == 0) break;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

int main(void) {
    int n;
    std::scanf("%d", &n);
    int a[n];
    for (int i = 0; i < n; i++) {
        std::scanf("%d", &a[i]);
    }
    std::sort(a, a + n, std::greater<int>());
    int x = 0, y = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            x += a[i];
        }
        else {
            y += a[i];
        }
    }
    std::printf("%d\n", x - y);
    return 0;
}

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

using namespace std;

#define MODULE 1000000007
#define MP make_pair

template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

typedef pair<int, int> P;
typedef long long LL;
const int INF = INT_MAX / 2;    //int_max->2*e+9
const int MAXN = 100001;

/*struct edge {
    edge(int to, int cost) : to(to), cost(cost) {}
    int to, cost;
};
vector<edge> graph[MAXN];*/


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

//-----Template---------
char c[12];
int main(){
    ios::sync_with_stdio(false);
    for(int i=0;i<12;i++){
        cin>>c[i];
    }
    for(int i=0;i<12;i++){
        cout<<c[i];
        if(i==3)
            cout<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>

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

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

const int MAX = 100005;
const int INF = 1 << 30;
vector<int> a[MAX];
int pr[MAX];

void dijkstra(int n) {
  int d[n + 1];
  rep(i, n + 1) {
    d[i] = INF;
    pr[i] = -1;
  }

  priority_queue<P> q;

  d[1] = 0;
  q.push(make_pair(0, 1));
  while (!q.empty()) {
    auto p = q.top();
    q.pop();

    int u = p.second;
    int c = -p.first;
    if (d[u] < c) continue;

    for (auto v : a[u]) {
      if (d[v] == INF) {
        if (d[u] + 1 < d[v]) {
          d[v] = d[u] + 1;
          pr[v] = u;
          q.push(make_pair(-d[v], v));
        }
      }
    }
  }
}

void bfs(int n) {
  int dist[n + 1];
  rep(i, n + 1) { dist[i] = INF; }

  queue<int> q;
  q.push(1);
  dist[1] = 0;

  while (!q.empty()) {
    int u = q.front();
    q.pop();

    for (auto v : a[u]) {
      if (dist[v] != INF) continue;
      dist[v] = dist[u] + 1;
      pr[v] = u;
      q.push(v);
    }
  }
}

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

  rep(i, m) {
    int u, v;
    cin >> u >> v;
    a[u].push_back(v);
    a[v].push_back(u);
  }

  // dijkstra(n);
  bfs(n);

  cout << "Yes" << '\n';
  for (int i = 2; i < n + 1; ++i) { cout << pr[i] << '\n'; }

  return 0;
}


Measured memory_bytes: 10752
/********************/
/* K B G D E L T A */
/*     DA-IICT      */
/********************/
 
#include<bits/stdc++.h>
using namespace std;
using   ll=long long;
using   ld=long double;
#define fast           ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl           "\n"
#define F(i,n)         for(ll i=0;i<n;i++)
#define rep(i,a,b)     for(ll i=a;i<b;i++)
#define repp(i,a,b)    for(ll i=a;i>=b;i--)
#define pb             push_back
#define mp             make_pair
#define vll            vector<ll>
#define f              first
#define s              second
#define pll            pair<ll,ll>
#define ALL(v)         v.begin(),v.end()
#define ALLR(v)        v.rbegin(),v.rend()
#define pii            3.14159265358979323
#define mod            1000000007
 
void solve()
{
    ll n;

    cin>>n;

    vector<ld> a(n);

    F(i,n)
    {
        cin>>a[i];
    }

    sort(ALL(a));

    long double tt=(a[0]+a[1])/2;

    for(int i=2;i<n;i++)
    {
        tt=(tt+a[i])/2;
    }

    cout<<tt;
}
 
signed main(){
 
    fast;
 
    ll t=1;
 
    //cin>>t;
 
    while(t--)
    {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 256
N, X, Y = map(int, input().split())
Prov = []
Prov.append(N)
Prov.append(X)
Prov.append(Y)
if X + Y > N:
    C = (X + Y) - N

else:
    C = 0

if 1 <= X and 1 <= Y:
    print(min(Prov), C)

else:
    print(0, 0)


Measured memory_bytes: 3060
#include <iostream>

#define N 10000

using namespace std;

int main(){

  int n;
  int sum=0;
  int count=0;
  int prime[N];

  for(int i = 0;i < N; i++){
    prime[i] = 1;
  }
  prime[0]=0;

  for(int i = 1;i < 100; i++){
    if(prime[i] == 1){
      for(int j = (i+1); (i+1)*j <= N; j++){
	prime[(i+1)*j - 1] = 0;
      }
    }
  }

  /*
  for(int i = 0;i < 60; i++){
   // cout << i << ":";
    if(prime[i] == 1){
      cout << i+1 << "  ";
    }
  }
  cout << endl;
  */

  while(cin >> n){
    if(n == 0)break;
    sum = 0;    

    for(int i = n-1; i >= 0; i--){
      sum = 0;
      for(int j = i; j >= 0; j--){
	if(prime[i] == 0){break;}
	if(prime[j] == 1){
	  sum += j+1;
	  //cout << "prime: "<< j+1 << " ";
	  if(sum == n){
	    //cout << "hit!!" << sum << endl;
	    sum = 0;
	    count++;
	    break;
	  }
	  if(sum >= n){
	    //cout << endl;
	    sum = 0;
	    break;
	  }
	}
      }
    }


    cout << count << endl;
    count = 0;
  }

  return 0;
}

Measured memory_bytes: 0
from sys import stdin
import math
A,B = [int(x) for x in stdin.readline().rstrip().split()]
f = False
for i in range(1,100000):
    if math.floor(i*0.08) == A and math.floor(i*0.1) == B:
        print(i)
        f = True
        break
if not f:
    print(-1)

Measured memory_bytes: 3060
i;main(n){
	char s[20];
	int r = 999;
	gets(s);
	for (;i<9;) {
		char t[] = {s[i],s[i+1],s[i+++2]};
		n=abs(753-atoi(t));
		r=n<r?n:r;
	}
	printf("%d\n", r);
}

Measured memory_bytes: 128
/**
 * @author      : omgursocute
 * @created     : 26/01/2020
 * @task        : A
 */

// ===== TEMPLATE STARTS HERE ===== //

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#define FORa(i, a, b) for(ll i = (a); i <= (b); ++i)
#define FORb(i, a, b, c) for(ll i = (a); i <= (b); i += (c))
#define FORn(i, n) for(ll i = 0; i < (n); ++i)
#define FORra(i, a, b) for(ll i = (a); i >= (b); --i)
#define FORrb(i, a, b, c) for(ll i = (a); i >= (b); i -= (c))
#define FORrn(i, n) for(ll i = ((n)-1); i >= 0; --i)
#define NUMARGC(_1, _2, _3, _4, NAME, ...) NAME
#define FOR(...) NUMARGC(__VA_ARGS__, FORb, FORa, FORn)(__VA_ARGS__)
#define RFOR(...) NUMARGC(__VA_ARGS__, FORrb, FORra, FORrn)(__VA_ARGS__)

#define XFOR(i, x) for(__typeof((x).begin()) i = (x).begin(); i != (x).end(); ++i)
#define RXFOR(i, x) for(__typeof((x).rbegin()) i = (x).rbegin(); i != (x).rend(); ++i)

#define pll pair<ll, ll>
#define pii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define range(x, a, b) ((x).begin()+a), ((x).begin()+b)
#define pb push_back

#define sqr(x) 1ll*(x)*(x)
#ifndef ONLINE_JUDGE
#define debug(x) cerr << '[' << #x << ']' << " = " << x << '\n'
#else
#define debug(x) "cute"
#endif

namespace io {
	void Speed() {
		ios::sync_with_stdio(false);
		cin.tie(NULL); cout.tie(NULL);
	}
#ifndef ONLINE_JUGDE
	void In(string s) {freopen(s.c_str(), "r", stdin);}
	void Out(string s) {freopen(s.c_str(), "w", stdout);}
	void setIO(string s) {In(s + ".inp"); Out(s + "out");}
#endif
}

// ======= TEMPLATE ENDS HERE ======= //

int main() {
	io::Speed();
	
	int h, a;
	cin >> h >> a;
	cout << (h/a) + ((h % a) ? 1 : 0);

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

int ans = 0;
string s;

void dfs(int k, int sum, int tmp){
    if(k == s.size() - 1){
        // cout << sum + tmp<<endl;
        ans += sum + tmp;
        return;
    }
    //+の場合
    dfs(k + 1, sum + tmp, s[k + 1] - '0');
    //else
    dfs(k + 1, sum, tmp * 10 + (s[k + 1] - '0'));
}

signed main(){
    cin >> s;
    dfs(0, 0, s[0] - '0');
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, K;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> K;
  long long s = 0;
  for (int b=K+1; b<=N; b++) {
    for (int a=0; a<=N; a+=b) {
      int hi = b-1;
      if (a+b > N) {
        hi = N%b;
        if (hi < K) continue;
      }
      s += (hi-K+1);
      if (a == 0 && K == 0) s--;
    }
  }
  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  int n=a.size();
  int m=b.size();
  int l=c.size();
  if(a[n-1]==b[0] && b[m-1]==c[0])cout << "YES" << endl;
  else cout << "NO" << endl;

}



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

#define TRIAL_MAX 30
int main() {
  int n;
  int x, buf;
  int i;
  int min_trial, c_trial;
  
  cin >> n;
  
  min_trial = TRIAL_MAX;
  for (i = 0; i < n; i++) {
    cin >> x;
    buf = x;
    
    for (c_trial = 0; c_trial < min_trial; c_trial++) {
      if ((buf % 2) != 0) {
        break;
      } else {
        buf /= 2;
      }
    }
      
    if (c_trial < min_trial) {
      min_trial = c_trial;
    }
    
    if (min_trial == 0) {
      break;
    }
  }
  cout << min_trial << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;

int main(void)
{
    IOS
    int n; cin >> n;
    vector<double> v(n);


    REP(i,n) {
        cin >> v[i];
    }
    sort(ALL(v));

    double ans = v[0];
    FOR(i,1,n) {
        ans = (ans + v[i])/2;
    }

    cout << setprecision(10) << ans << endl;
    
    return 0;
}

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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll mod = (ll)1e9 + 7;
const ll mxN = 200200;

void solve() {
	string s;
	cin>>s;
	vector<ll> a(26,0);
	for(auto i:s)
		a[i-'a']=(a[i-'a']+1)%2;
	puts(accumulate(all(a),0)==0?"Yes":"No");
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(20);
	cout << fixed;

	//ll t;cin>>t;while(t--)
	solve();

}


Measured memory_bytes: 256
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
using graph = vector<vector<int>>;
typedef long long ll;


int main() {
	ll n,mem,j;
	cin >> n;
	vector<int> array(n);
	for (int i = 0; i < n; i++){
		cin >> array[i];
	}
	for (ll i = 0; i < n; i++) {
		mem = array[i];
		j = i - 1;
		while (j >= 0 && array[j] > mem) {
			array[j+1] = array[j];
			j--;
		}
		array[j+1] = mem;
		for (ll k = 0; k < n; k++) {
			cout << array[k];
			if (k + 1 < n) {
				cout << " ";
			}
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3100
import collections
import bisect

N, M = map(int, input().split())
P = [list(map(int, input().split())) for i in range(M)]

ans = collections.defaultdict(list)

for p, y in sorted(P):
    ans[p] += [y]
for p, y in P:
    print("%06d%06d"%(p, bisect.bisect(ans[p], y)))

Measured memory_bytes: 43324
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Maybe
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt = fst . fromJust . BS.readInt

readIntList = map readInt . BS.words

getIntList = readIntList <$> BS.getLine

main = do
  [n, k, s] <- getIntList
  let t = if s > 10 ^ 5 then 1 else s + 1
  putStrLn $ concat (intersperse " " (map (\x -> show x) (replicate k s ++ replicate (n - k) t)))


Measured memory_bytes: 5348
#include <stdio.h>
#define NIL -1

int F[45];
int fibonacci(int n)
{
  int ans;
  if(F[n]!=NIL)
    {
      return F[n];
    }
  else
    {
     ans=fibonacci(n-1)+fibonacci(n-2);
     F[n]=ans;
     return ans;
    }
}

main()
{
  int n,i;
  for(i=2;i<45;i++)
    {
      F[i]=NIL;
    }
  F[0]=1;
  F[1]=1;
  scanf("%d",&n);
  printf("%d\n",fibonacci(n));
  return 0;
}

Measured memory_bytes: 596
#include "bits/stdc++.h"
#define hhh cerr<<"hhh"<<endl
#define see(x) cerr<<(#x)<<'='<<(x)<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pr;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&c<48)c=getchar();if(c=='-')f=-1,c=getchar();while(c>47)x=x*10+(c^48),c=getchar();return f*x;}

const int maxn = 3e5+7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;

ll qpow(ll a,ll k=mod-2,ll p=mod){ll s=1;while(k){if(k&1)s=s*a%p;a=a*a%p;k>>=1;}return s;}

int main() {
    ll s=0, s1=0;
    int n=read();
    for(int i=1; i<=n; ++i) {
        ll a=read();
        s=(s+a)%mod;
        s1=(s1+a*a)%mod;
    }
    cout<<((s*s-s1)%mod+mod)*qpow(2)%mod<<endl;
}

Measured memory_bytes: 3632
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==
*/

main :-
    get_number(A),
    X is A * A * A + A * A + A,
    writeln(X).


Measured memory_bytes: 8120
n = int(input())
l0 = 2
l1 = 1
lis = []
lis.append(l0)
lis.append(l1)

for i in range(2,n+1):
    temp = lis[i-1] + lis[i-2]
    lis.append(temp)

print(lis[n])


Measured memory_bytes: 2940
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <string>
#include <numeric>
#include <stack>
#include <cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define rep(i, a, N) for(int i = a; i < N; i++)
#define rrep(i, a, N) for(int i = a; i >= N; i--)

const int inf = 1000000000;

//#define DEBUG

int main() {
    string s, t, u;
    int a, b;

    cin >> s >> t;
    cin >> a >> b;
    cin >> u;

    if (s == u) a--;
    else if (t == u) b--;
    cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    int n;
    double x[10],sum=0;
    string u[10];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x[i]>>u[i];
    }
    for(int i=0;i<n;i++){
        if(u[i] == "JPY"){
            sum +=x[i];
        }else{
            sum += x[i]*380000;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
int main(){
    long long n;
    scanf("%lld",&n);
    long long l[n],r[n];
    for(int i=0;i<n;i++){
        scanf("%lld%lld",&l[i],&r[i]);
    }
    std::sort(l,l+n);
    std::sort(r,r+n);
    int y=0;
    while(r[y]<l[n-y-1])y++;
    long long ans=0;
    for(int i=0;i<y;i++){
        ans+=l[n-i-1]-r[i];
    }
    long long g=0;
    if(y!=0)if(l[n-1]<0)g=0-l[n-y];
    if(y!=0)if(r[0]>0)g=r[y-1];
    int e,f;e=0;f=0;
    if(r[y]<0)e=0-r[y];
    if(l[n-y-1]>0)f=l[n-y-1];
    if(e>g)g=e;
    if(f>g)g=f;
    ans+=g;
    long long anf;

        e=0;f=0;
        if(r[0]<0)e=0-r[0];
        if(l[n-1]>0)f=l[n-1];
        if(e>0)anf=e;
        if(f>e)anf=f;
    if(ans<anf)ans=anf;
    printf("%lld\n",ans*2);
}

Measured memory_bytes: 1664
#!/usr/bin/env python3

def main():
    S = input()
    T = input()
    ans = 0
    for i in range(len(S) - len(T) + 1):
        cnt = 0
        for j in range(len(T)):
            if S[i + j] == T[j]:
                cnt += 1
        ans = max(ans, cnt)
    print(len(T) - ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9060
#include <iostream>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
using namespace std;
typedef long long ll;
typedef vector<int>VI;
typedef pair<int,int>P;
typedef pair<double,double>P_D;
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define reprev(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define ALL(a)  (a).begin(),(a).end()
#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define fi first
#define se second
#define MAX 100100//5
#define MAX_N 200100
#define MAX_B 1001001//6
#define MAX_S 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
#define MOD 1000000007
#define INF 1<<30
#define INFTY 1000000000000000001LL
#define MAX_INT INT_MAX

int main(){
    string S;cin>>S;
    int n=S.length();
    bool ans=1;
    rep(i,n)if(S[i]!=S[n-i-1]){ans=0;break;}
    int k=(n-1)/2;
    rep(i,k-1){
        if(S[i]!=S[k-i-1]){ans=0;break;}
    }
    int t=(n+3)/2;
    int j=0;
    for(int i=t-1;i<n;i++){
        if(S[i]!=S[n-j-1]){ans=0;break;}
        j++;
    }
    cout<<(ans?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<cstdio>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
#include<utility>
#include<queue>
#include<stack>
#define pi 3.14159
#define Inf (int)pow(2., 12.)

using namespace std;
typedef std::pair<int, int> mypair;
queue<mypair> qu;
#define M 1000000

 
int main(){
	string str;
	char c;
	while(getline(cin, str)) {
		if(str == ".") { break; }
		stack<char> st;
		for(int i = 0; i < str.size(); i++) {
			if(str[i] == '(') { st.push('(');}
			else if(str[i] == '[') { st.push('[');}
			else if(str[i] == ')') {
				if(st.empty()) {
					st.push(')');
					break;
				}
				c = st.top();
				if(c == '(') {st.pop();}
				else {
					break;
				}
			}
			else if(str[i] == ']') {
				if(st.empty()) {
					st.push(']');
					break;
				}
				c = st.top();
				if(c == '[') {st.pop();}
				else {
					break;
				}
			}
		}
		if(st.empty()) { cout << "yes" <<endl;}
		else { cout << "no" <<endl;}
	}
	
}

Measured memory_bytes: 1176
#include <iostream>
#include <cstdio>
#include <stack>
using namespace std;

int main(){
    int n,debt=100000;
    cin >> n;
    for(int i=0;i<n;i++){
        debt*=1.05;
        if((debt-(debt/1000)*1000)>0){
            debt=(debt/1000 + 1)*1000;
        }
    }
    cout << debt << endl;
    return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main(void)
{
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(a>b){
        if(c>d)printf("%d",b+d);
        else printf("%d",b+c);
    }
    else{
        if(c>d)printf("%d",a+d);
        else printf("%d",a+c);
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if (a < b && b < c)
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}


Measured memory_bytes: 3112
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin>>s;
	s="0"+s;
	int out=0,n=s.size();
	vvi dp(n+1,vi(2,inf));
	dp[0][0]=0;
	rep(i,n)rep(j,2){
		int a;
		if(j==0)a=s[i]-'0';
		else a='9'-s[i];
		cmin(dp[i+1][j],dp[i][j]+a);
		cmin(dp[i+1][j^1],dp[i][j]+a+1);
	}
	cout<<dp[n][0]<<endl;
/*

	3143
	 143
	  43
	  57
	 857
	  57
	  43
	
*/	
	
	/*
	reverse(all(s));
	s+="0";
	
	int out=0;
	rep(i,s.size()){
		if(s[i]<='4'||(s[i]=='5'&&s[i+1]!='9'))out+=s[i]-'0';
		else{
			out+='9'-s[i]+1;
			s[i+1]++;
			for(int j=i+1;j<s.size()-1;j++){
				if(s[j]>'9'){
					s[j]='0';
					s[j+1]++;
				}else break;
			}
		}
	}
	
	cout<<out<<endl;
	*/
}









Measured memory_bytes: 55880
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	
	ans := make([]byte, 3);
	for i := 0; i < 3; i++ {
	    text := ScanText(scanner)
	    ans[i] = text[i]
	}
	fmt.Println(string(ans))
}

func ScanInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func ScanFloat64(scanner *bufio.Scanner) float64 {
	scanner.Scan()
	f, e := strconv.ParseFloat(scanner.Text(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func ScanText(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

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

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

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

Measured memory_bytes: 640
#include <iostream>

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

	const int table[] = {
		111, 222, 333, 444, 555, 666, 777, 888, 999
	};

	for ( int i = 0; i < sizeof( table ) / sizeof( table[0] ); i++ )
	{
		if ( N <= table[i] )
		{
			std::cout << table[i] << std::endl;
			break;
		}
	}

	return ( 0 );
}


Measured memory_bytes: 256
#include <iostream>

int MAX_COST = 1000;

int main() {
  int N,T;
  std::cin >> N >> T;

  int cs[N], ts[N];
  for (int i = 0; i < N; ++i) {
    std::cin >> cs[i] >> ts [i];
  }

  int ans = MAX_COST + 1;
  for (int i = 0; i < N; ++i) {
    if (ts[i] > T) continue;
    ans = (ans > cs[i]) ? cs[i] : ans;
  }

  if (ans > MAX_COST) {
    std::cout << "TLE" << std::endl;
    return 0;
  } else {
    std::cout << ans << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    
    vector<int> zero, one;
    vector<pii> v;
    int n, k; string s; cin >> n >> k >> s;
    
    if (n == 1) {
        cout << 1 << '\n';
        return 0;
    }
    
    int cnt = 1;
    if (s[0] == '0') one.push_back(0);
    
    for (int i = 1; i < s.length(); i++) {
        if (s[i] != s[i - 1]) {
            if (s[i - 1] == '0') zero.push_back(cnt);
            else one.push_back(cnt);
            cnt = 0;
        }
        cnt++;
    }
    
    if (s[s.length() - 1] == '0') {
        one.push_back(0);
        zero.push_back(cnt);
    }
    else one.push_back(cnt);

    for (int i = 0; i < zero.size(); i++) {
        v.push_back(pii(zero[i] + one[i] + one[i + 1], zero[i] + one[i + 1]));
    }
    
    k = min(k, (int)v.size());
    
    if (v.size() == 0) {
        cout << n << '\n';
        return 0;
    }
    
    int m = -1;
    for (int i = 0; i < v.size() - k + 1; i++) {
        int tmp = v[i].first;
        for (int j = i + 1; j < i + k; j++) {
            tmp += v[j].second;
        }
        m = max(m, tmp);
    }

    cout << m << '\n';
    
    return 0;
}


Measured memory_bytes: 1484
#include<iostream>
#include<cstdio>
using namespace std;
int a[100010];
long long ans,maxx;
int main()
{
	int i,n,m;
	while(cin>>n>>m&&n!=0&&m!=0)
	{
		ans=-9999999,maxx=0;
		for(i=1;i<=n;i++)
		{
			cin>>a[i];
			if(i<m)maxx+=a[i];
			else if(i>=m)
			{ 
			    maxx+=a[i];
			    if(maxx>ans)ans=maxx;
			    maxx-=a[i-m+1];
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/04/24  Problem: ABC 123 B / Link: http://abc123.contest.atcoder.jp/tasks/abc123_b  ----- */


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

	int N = 5;
	vector<int> a(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	VI idx(N);
	iota(ALL(idx), 0);
	LL ans = LINF;
	do {
		LL sub = 0;
		FOR(i, 0, N - 1) {
			sub += ((9+a[idx[i]]) / 10) * 10;
		}
		sub += a[idx.back()];

		ans = min(ans, sub);
	} while (next_permutation(ALL(idx)));
	
	cout << ans << "\n";

	return 0;
}


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

#define all(v) begin(v), end(v)
#define endl '\n';
#define pii pair<int, int>

const int N = 1e6;
int mp[N+1];

bool factor(int x) {
    bool good = true;
    for (int i = 2; i*i <= x; i++) {
        if (x % i == 0) {
            if (mp[i] > 0) {good = false; break;};
            if (x/i != i) {
                if (mp[x/i] > 0) {good = false; break;};
            }
        }
    }
    return good;
}

int32_t main() { 
    ios_base::sync_with_stdio(0); 
    cin.tie(0);

    int n; cin >> n;
    vector<int> a(n), b;
    
    for (int& x : a) {
        cin >> x;
        mp[x]++;
    }
    sort(all(a));
    if (mp[1]) {
        if (mp[1] == 1) {
            cout << 1 << endl;
        }
        else {
            cout << 0 << endl;
        }
        return 0;
    }
    int ans = 0;
    for (int& x : a) {
        if (mp[x] > 1) continue;
        if (factor(x)) ans++;
    }
    cout << ans << endl;    
}


Measured memory_bytes: 7784
#include <iostream>
#include <string>
#include <vector>

using namespace std;

bool isStable(vector<string> v1,vector<string> v2,int n){
  for(int i=0; i<n; ++i){
    if(v1[i][0] !=v2[i][0]) return false;
  }

  return true;
}

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

  vector<string> v1;
  v1.resize(n+1);
  for(int i=0; i<n; ++i){
    cin>>v1[i];
  }
  
  vector<string> v2 = v1;
  
  for(int i = 0; i < n; ++i){
    for(int j = n-1; j >= i + 1; --j){
      if(v1[j][1] < v1[j-1][1]){
	swap(v1[j],v1[j-1]);
      }
    }
  }
  //
  for(int i = 0; i < n; ++i){
    int minj = i;
    
    for(int j = i; j < n; ++j){
      if(v2[j][1] < v2[minj][1]){
	minj = j;
      }
    }
    swap(v2[i],v2[minj]);
  }
  

  for(int i=0; i<n; ++i){
    cout<<v1[i];
    if(i<n-1) cout << " ";
  }
  cout << endl << "Stable" << endl;;

  for(int i=0; i<n; ++i){
    cout<<v2[i];
    if(i<n-1) cout << " ";
  }
  cout << endl;

  if(isStable(v1,v2,n))
    cout<<"Stable"<<endl;
  else
    cout<<"Not stable"<<endl;

  

  return 0;
}



Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;cin >> s;
    int t;cin >> t;
    int n=s.size();
    string u="";
    for(int i=0;i<n;i++){
        u+='0';
    }
    if(n<t){
        cout << 0 << endl;
        return 0;
    }
    long long ans=0;
    string q;
    if(t==1){
        for(int i=0;i<n;i++){
            for(char x='1';x<='9';x++){
                q=u;
                q[i]=x;
                if(q<=s){
                    ans++;
                }
            }
        }
    }
    else if(t==2){
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                for(char x='1';x<='9';x++){
                    for(char y='1';y<='9';y++){
                        q=u;
                        q[i]=x;
                        q[j]=y;
                        if(q<=s){
                            ans++;
                        }
                    }
                }
            }
        }
   }
    else{
        ans+=(n-1)*(n-2)*(n-3)/6*9*9*9;
            for(int j=1;j<n;j++){
                for(int k=j+1;k<n;k++){
                    for(char x='1';x<='9';x++){
                        for(char y='1';y<='9';y++){
                            for(int z='1';z<='9';z++){
                                q=u;
                                q[0]=x;
                                q[j]=y;
                                q[k]=z;
                                if(q<=s){
                                    ans++;
                                }
                            }
                        }
                    }
                }
            }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (int i=(m);i<(n);++i)
#define test(x) cout << #x << ' ' << x << endl;
#define eb emplace_back
#define pb push_back
#define mp make_pair 
lli dp[100001],w[100],value[100],n;

lli dpp(int ww) {
	fop (i,0,n) {
		for (int j=ww;j>=w[i];--j) {
			dp[j]=max(dp[j],dp[j-w[i]]+value[i]);
		}
	}
	return dp[ww];
}




int main () {
	int m;
	cin >> n >> m;
	fop (i,0,n) {
		cin >> w[i] >> value[i];
	}
	fop (i,0,100001) dp[i]=0;
	cout << dpp(m);
}

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

int main(){
    int n, *x;

    cin >> n;
    x = new int[n + 5];
    
    for(int *p = x; true; ++p){
        *p = n;
        if(p == &x[n]) break;
    }
    x[0] = 0;

    for(int i=0, a; i<n; ++i){
        a=1;    if(i+a < n+1)x[i+a] = min(x[i+a], x[i] + 1);
        for(int k=1, a=6; pow(a, k) <= n && i + pow(a, k) < n+1; ++k){
            x[i + (int)pow(a, k)] = min(x[i + (int)pow(a, k)], x[i] + 1);            
        }
        for(int k=1, a=9; pow(a, k) <= n && i + pow(a, k) < n+1; ++k){
            x[i + (int)pow(a, k)] = min(x[i + (int)pow(a, k)], x[i] + 1);
        }
    }

    cout << x[n] << endl;

    delete[] x;
}


Measured memory_bytes: 768
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>

inline int read() {
    int x = 0, f = 1; char ch = getchar();
    while(ch > '9' || ch < '0') { if(ch == '-') f = -1; ch = getchar(); }
    do x = x * 10 + ch - 48, ch = getchar(); while(ch >= '0' && ch <= '9');
    return x * f;
}

inline int gcd(const int &a,const int &b) {
    if(b) return gcd(b,a % b);
    return a;
}

int main() {
    short n = read();
    int ans = 0;
    for(short i = 1; i <= n;++i)
        for(short j = 1;j <= n;++j)
            for(int k = 1;k <= n;++k)
                ans += gcd(gcd(i,j),k);
    std::printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3752
import math
a,b = map(int,input().split())
ans = 0
count = 0
dummy2 = 1/a
for i in range(1,a+1):
  while(1):
    if i >= b:
      break
    i *= 2
    count += 1
    #print(i,count)
  ans += ((1/2)**count)*dummy2
  count = 0
print(ans)

Measured memory_bytes: 3060
import sys
input = sys.stdin.readline

X, N = map(int, input().split())
plist = list(map(int, input().split()))
diff = []
for i in range(0, 102):
    if i not in plist:
        diff.append(i)

diff.sort()
diff = [(item, abs(item - X)) for item in diff]

nearest = -1
min_v = 1000
for idx, item in diff:
    if item < min_v:
        min_v = item
        nearest = idx

print(nearest)


Measured memory_bytes: 9132
#include <stdio.h>

#define N 100

int min(int, int);

int main()
{
  int i, j, k, l, n, p[N+1], m[N+1][N+1];

  scanf("%d", &n);
  for(i=1; i<=n; i++) {
    scanf("%d %d", &p[i - 1], &p[i]);
  }

  for (i = 1; i <= n; i++ ) {
    m[i][i] = 0;
  }
  for (l = 2; l <= n; l++ ) {
    for (i = 1; i <= n - l + 1; i++ ) {
      j = i + l - 1;
      m[i][j] = (1 << 21);
      for (k = i; k <= j - 1; k++ ) {
        m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
      }
    }
  }
  printf("%d\n", m[1][n]);

  return 0;
}

int min(int a, int b)
{
  if(a < b)
    return a;
  else
    return b;
}

Measured memory_bytes: 636
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int h, w, n;
    cin >> h >> w >> n;
    cout << (n+max(h, w)-1)/(max(h, w)) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(void) {
	int N;
	cin >> N;
	vector<int> a(N);
	int two = 0;
	int four = 0;
	int other = 0;
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
		if (a[i]%2 == 0) {
			if (a[i]%4 == 0) {
				++four;
			}
			else {
				++two;
			}
		}
		else {
			++other;
		}
	}

	if (two == N) {
		cout << "Yes" << endl;
	}
	else {
		if (two != 0) {
			--four;
		}
		if (other != 0) {
			four -= other - 1;
		}
		
		if (four < 0) {
			cout << "No" << endl;
		}
		else {
			cout << "Yes" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

/**
 * C - Ubiquity
 * 長さ N の整数の列 A1,A2,…,AN であって以下の条件をすべて満たすものはいくつありますか。
 * 0≤Ai≤9
 * Ai=0 なる i が存在する。
 * Ai=9 なる i が存在する。
 * ただし、答えはとても大きくなる可能性があるので、10 9乗+7 で割った余りを出力してください。
 */
public class Main {
    private static final long MOD  = ( long ) ( Math.pow( 10, 9 ) + 7 );  // 1000000007

    public static void main( String[] args ) {

        Scanner sc = new Scanner( System.in );
        // 入力値
        int n = sc.nextInt();

        if( 1 < n ) {
//            double pow10 = Math.pow( 10, n );
//            double pow9 = Math.pow( 9, n );
//            double pow8 = Math.pow( 8, n );
//
//            long result = (long) ( pow10 - pow9 - pow9 + pow8 );
//            result %= MOD;

            long result = powmod( 10, n ) - powmod( 9, n ) - powmod( 9, n ) + powmod( 8, n );
            result %= MOD;
            result = ( result + MOD) % MOD;

            System.out.println( result );
        }
        else System.out.println( 0 );

        sc.close();
    }

    private static long powmod( long x, long n ){
        long res = 1;
        for( long i = 0; i < n; i++ ) {
            res = res * x % MOD;
        }
        return res;
    }
}

Measured memory_bytes: 35712
while True:
    n, m = map(int, input().split())
    if n == 0:
        break
    a = [0] * n
    b = [0] * m
    sum_a = 0
    sum_b = 0
    for i in range(n):
        a[i] = int(input())
        sum_a += a[i]
    for i in range(m):
        b[i] = int(input())
        sum_b += b[i]
    a = sorted(a)
    b = sorted(b)
    d = sum_a - sum_b
    if d % 2 != 0:
        print(-1)
    else:
        d /= 2
        ok = False
        for i in range(n):
            for j in range(m):
                if a[i] - b[j] == d:
                    print(a[i], b[j])
                    ok = True
                    break
            if ok:
                break
        if not ok:
            print(-1)



Measured memory_bytes: 5604
/* 
 * Project: AtCoder Beginners Contest 138 A - Red or Not
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/08/27
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cstdint>
using namespace std;

uint32_t a;
char s[10];

void solve() {

    if (a >= 3200)
        printf("%s\n", s);
    else
        printf("red\n");

}

int main() {

    scanf("%d", &a);
    scanf("%s", s);

    solve();

}

Measured memory_bytes: 3168
program abc2
 implicit none
 character(len=3),allocatable::t(:)
 integer::N,ishotb=0,ishota=0,p=0,q=0,r=0,s=0
 read(*,*)N
 allocate(t(N))
 do ishotb=1,N
  read(*,*)t(ishotb)
 end do
 do ishota=1,N
  if(t(ishota)=="AC ")then
   p=p+1
  end if
  if(t(ishota)=="WA ")then
   q=q+1
  end if
  if(t(ishota)=="TLE")then
   r=r+1
  end if
  if(t(ishota)=="RE ")then
   s=s+1
  end if
 end do
 print'(a,i0)',"AC x ",p
 print'(a,i0)',"WA x ",q
 print'(a,i0)',"TLE x ",r
 print'(a,i0)',"RE x ",s
end program abc2

Measured memory_bytes: 3124
X, Y = map(int, input().split())

kame = 0
turu = 0
kame = X
while True:
    if (kame * 4 + turu * 2 == Y):
        print('Yes')
        exit()

    if (kame == 0 or turu == X):
        break

    kame -= 1
    turu += 1


print('No')


Measured memory_bytes: 9176
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int N = ni();
        int[] d1 = new int[N];
        int[] d2 = new int[N];
        
        for (int i = 0; i < N; i++) {
            d1[i] = ni();
            d2[i] = ni();
        }
        String ans = "No";
        for (int i = 2; i < N; i++) {
            if((d1[i]==d2[i])&&(d1[i-1]==d2[i-1])&&(d1[i-2]==d2[i-2])){
                ans = "Yes";
            }
        }
 
        out.println(ans);
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);

    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 33136
#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;

int main(){
  int L; cin>>L;
  cout<<20<<" ";
  int cnt=19+max(0,__builtin_popcount(L)-1);
  rep(i,20) if((1<<(i+1))-1<L) cnt++;
  cout<<cnt<<endl;
  
  for(int i=1;i<20;i++){
    cout<<i<<" "<<i+1<<" "<<0<<endl;
    if((1<<i)-1<L){
      cout<<i<<" "<<i+1<<" "<<(1<<(i-1))<<endl;
    }
  }
  int LL=L;
  bool flag=0;
  for(int i=19;i>=0;i--){
    if((1<<i)&LL){
      if(flag==0) flag=1;
      else{
       cout<<i+1<<" "<<20<<" "<<LL-(1<<i)<<endl;
       LL-=(1<<i);
      }
    }
  }
  return 0;
}


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

int K;

int main() {
    cin >> K;
    long long snuke = 1;
    for (int i = 0; i < K; i++) {
        long long sum = 0, d = 1;;
        while (snuke / d > 0) {
            sum += snuke / d % 10;
            d *= 10;
        }
        d = 1;
        while (snuke > sum * d) {
            int x = snuke / d % 10;
            sum += 9 - x;
            snuke += (9 - x) * d;
            d *= 10;
        }
        cout << snuke << endl;
        snuke++;
    }
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reve(a) reverse(a.begin(), a.end())
typedef long long ll;
const ll MOD = 1e9+7;

int main(){
  int s, k;
  cin >> k >> s;
  int i, j, ans=0;
  if(k>=s){
  for(i=0; i<=s; i++){
    for(j=0; j<=s; j++){
      if(i+j>s) break;
      else if(s-i-j<=k) ans++;
    }
  }
  cout << ans << endl;}
  else {
    for(i=0; i<=k; i++){
    for(j=0; j<=k; j++){
      if(i+j>s) break;
      else if(s-i-j<=k) ans++;
    }
  }
      cout << ans << endl;

  }
}

Measured memory_bytes: 256