akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;

int main() {
	int i,j,n,flag=0;
	cin>>n;
	for( i=0;i<=25;i++ )
	{
		for( j=0;j<=14;j++ )
			if( i*4+j*7==n )
			{
				flag=1;
				break;
			}
			if( flag )
				break;
	}
	if( flag )
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return 0;
	}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
class Main {
    static long ans=0;
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int N = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(br.readLine());
        int[] ar = new int[2*N];
        for(int i=0; i<2*N; i++)
            ar[i]=Integer.parseInt(st.nextToken());

        Arrays.sort(ar);
        int ans=0;
        for(int i=0; i<2*N; i+=2){
            ans+=ar[i];
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23380
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
	//freopen("1.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ans = 1e18;
    for (int i=0; i <= x; i++){
		int th = i*a + (x-i)*2*c;
        int rest = y - (x-i);
        if (rest > 0) th += rest*b;
        ans = min(ans, th);
    }
    for (int i=0; i <= y; i++){
		int th = i*b + (y-i)*2*c;
        int rest = x - (y-i);
        if (rest > 0) th += rest*a;
        ans = min(ans, th);
    }
    cout << ans;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();

            TreeSet<Integer> set = new TreeSet<>();
            for (int i = A; i < Math.min(A + K, B); i++) {
                set.add(i);
            }
            for (int i = Math.max(B - (K - 1), A); i <= B; i++) {
                set.add(i);
            }

            for (Integer i : set) {
                System.out.println(i);
            }
        }
    }
}


Measured memory_bytes: 27884
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <functional>
#include <math.h>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ld INF = 1e18;
typedef pair< ld, int > P;
const ll mod = 1e9+7;

struct UnionFind {

  vector<int> par, height, size;

  UnionFind(int N) {
    init(N);
  }

  void init(int N) {
    par.resize(N);
    for (int i = 0; i < N; i++) par[i] = i;
    height.resize(N);
    size.resize(N, 1);
  }

  int root(int x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  int getsize(int x) {
    return size[root(x)];
  }

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return;
    if (height[x] < height[y]) {
      par[x] = y;
      size[y] += size[x];
    } else {
      par[y] = x;
      size[x] += size[y];
    }
  }

  bool same(int x, int y) {
    return root(x) == root(y);
  }

};

template <typename T>
vector<T> slide_min(vector<T>& a, int k) {
  int n = a.size();
  vector<T> b(n-k+1);
  deque<T> deq;
  for (int i = 0; i < n; i++) {
    while(!deq.empty() && a[i] <= a[deq.back()]) deq.pop_back();
    deq.push_back(i);
    if (i-k+1 >= 0) {
      b[i-k+1] = a[deq.front()];
      if (deq.front() == i-k+1) deq.pop_front();
    }
  }
  return b;
}

template <typename T>
vector<T> slide_max(vector<T>& a, int k) {
  int n = a.size();
  vector<T> b(n-k+1);
  deque<T> deq;
  for (int i = 0; i < n; i++) {
    while(!deq.empty() && a[i] >= a[deq.back()]) deq.pop_back();
    deq.push_back(i);
    if (i-k+1 >= 0) {
      b[i-k+1] = a[deq.front()];
      if (deq.front() == i-k+1) deq.pop_front();
    }
  }
  return b;
}

int main() {
  int N, K; cin >> N >> K;
  vector<ll> P(N);
  for (int i = 0; i < N; i++) cin >> P[i];
  UnionFind uf1(N), uf2(N);
  for (int i = 0; i < N-1; i++) {
    if (P[i] < P[i+1]) uf1.unite(i, i+1);
  }
  vector<int> vs;
  for (int i = 0; i+K <= N; i++) {
    if (uf1.same(i, i+K-1)) vs.push_back(i);
  }
  if (vs.size() > 1) {
    for (int i = 0; i < vs.size()-1; i++) uf2.unite(vs[i], vs[i+1]);
  }
  vector<ll> m = slide_min(P, K), M = slide_max(P, K);
  for (int i = 0; i+K < N; i++) {
    if (P[i] == m[i] and P[i+K] == M[i+1]) uf2.unite(i, i+1);
  }
  unordered_set<int> s;
  for (int i = 0; i+K <= N; i++) s.emplace(uf2.root(i));
  cout << s.size() << endl;
}


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

int main(void){
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    
    if(abs(a-c) <= d){
        printf("Yes");
    } else if (abs(a - b) <= d && abs(b - c) <= d){
        printf("Yes");
    } else {
        printf("No");
    }
}

Measured memory_bytes: 128
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
  int a, b;
  int coin[3] = {1000, 500, 100};
  int num[3];

  while(1) {
    cin >> a >> b;
    if(a+b == 0) break;

    int money = b-a;
    fill(num, num+3, 0);

    REP(i, 3) {
      if(money/coin[i] > 0) {
	while(money/coin[i] != 0) {
	  money -= coin[i];
	  num[i]++;
	}
      }
    }
    cout << num[2] << ' ' << num[1] << ' ' << num[0] << endl;
  }
}

Measured memory_bytes: 1160
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()
a = int(a)
b = int(b)
c = int(c)
d = int(d)
e = int(e)
k = int(k)
if 0 <= a and b and c and d and e and k <=123 :
    if a < b < c < d < e:
        te = e - a
        if te <= k:    
            print("Yay!")
        else:
            print(":(")    

Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String str = in.next();
		int num = 0;
		for(int i=0;i<4;i++) {
			char nowChar = str.charAt(i);
			if(nowChar=='+') {
				num++;
			}else if(nowChar=='-') {
				num--;
			}
		}
		System.out.println(num);
	}
}


Measured memory_bytes: 23636
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;
constexpr int dy[4] = { 0,1,0,-1 }; constexpr int dx[4] = { 1,0,-1,0 };

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

    int M = 0;
    for (int i = 0; i * (i - 1) <= 2 * N; ++i) {
        if (i * (i - 1) == 2 * N) {
            M = i;
        }
    }
    if (M == 0) {
        write("No");
        return 0;
    }
    write("Yes");

    vv<int> ans(M);
    int n = 1;
    rep(i, 0, M - 1) ans[0].push_back(n++);
    rep(i, 1, M - 1) {
        rep(j, 0, i) {
            ans[i].push_back(ans[j][i]);
        }
        rep(j, i, M - 1) ans[i].push_back(n++);
    }
    rep(i, M - 1) ans[M - 1].push_back(ans[i][i]);

    write(M);
    for (auto&& v : ans) {
        cout << v.size();
        for (int n : v) cout << ' ' << n;
        cout << endl;
    }
}


Measured memory_bytes: 4216
#include <iostream>
using namespace std;
#include <cstdio>
#include <cstdlib>
#include <string>

struct Node{
    int key;
    Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(int k){
    Node *y = NIL;
    Node *x  = root; // root of T

    Node *z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while(x != NIL){
        y = x;
        if(z->key < x->key){
            x = x->left;
        } else x = x->right;
    }
    z->parent = y;

    if(y == NIL){
        root = z;
    } else if(z->key < y->key){
        y->left = z;
    } else {
        y->right = z;
    }
}
void inorder(Node *u){
    if( u == NIL) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}
void preorder(Node *u){
    if(u == NIL) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main(){
    int n, i, x;
    string com;

    scanf("%d", &n);
    for(i=0; i<n; i++){
        cin >> com;
        if(com == "insert"){
            scanf("%d", &x);
            insert(x);
        } else if(com == "print"){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}


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


int main() {
  
  cout << "Yes" << endl;
  
  long long N,M;
  cin >> N >> M;
  
  vector<long long> ans(N);
  vector<vector<long long>> G(N, vector<long long> (0));
  for (int i = 0; i < M; ++i) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vector<long long> dist(N, -1);
  queue<long long> que;
  
  
  
  dist[0] = 0;
  que.push(0);

  while (!que.empty()) {
    long long v = que.front();
    que.pop();

    for (int nv : G[v]) {
      if (dist[nv] != -1) continue;

      dist[nv] = dist[v] + 1;
      ans[nv] = v+1;
      que.push(nv);
    }
  }
  
  for (int i=1; i<N; i++) {
    cout << ans[i] << endl;
  }
  
}


Measured memory_bytes: 13664
// Aizu Vol-5 0516: Maximum Sum
// 2017.8.30 bal4u@uu

#include <stdio.h>

int a[100003], s[100003];

int main()
{
	int n, k;
	int i, ans, f;

	while (scanf("%d%d", &n, &k) && n) {
		scanf("%d", a), s[0] = a[0];
		for (i = 1; i < n; i++) {
			scanf("%d", a+i);
			s[i] = s[i-1] + a[i];
			if (i >= k) s[i] -= a[i-k];
		}
		for (f = 1, i = k-1; i < n; i++) {
			if (f) f = 0, ans = s[i];
			else if (s[i] > ans) ans = s[i];
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1380
#include <stdio.h>
#define SIZE 2
void compare(int a[SIZE]){
  if(a[0]<=a[1]){
    printf("unsafe\n");
  }
  else{
    printf("safe\n");
  }
}

int main(void){
  int num[SIZE];
  scanf("%d %d", &num[0], &num[1]);
  compare(num);
  return 0 ;
}


Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

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

    std::vector<int> xs(n), cnt(n, 0);
    for (auto& x : xs) {
        std::cin >> x;
        ++cnt[--x];
    }

    std::set<int> ss;
    for (int x = 0; x < n; ++x) ss.insert(x);
  	// まだ決まっていない数の集合

    std::vector<int> ans;
    ans.reserve(n);

    int out = -1;  // 直前の数に指されている数
    while (ss.size() > 4) {
        int x = *ss.begin();
        if (x == out) {
          	// 指されていたら次へ
            if (ss.size() == 1) {
                std::cout << -1 << std::endl;
                return 0;
            } else {
                x = *(++ss.begin());
            }
        }

        int k = ss.size();
        int y = xs[x];
        if (ss.count(y) && cnt[y] == k - 1) x = y;
      	// y以外がyを指している場合

        ss.erase(x);
        ans.push_back(x);
        --cnt[xs[x]];
        out = xs[x];
    }

  	// 最後の全探索
    std::vector<int> rem(ss.begin(), ss.end());
    do {
        auto tmpans = ans;
        for (auto x : rem) ans.push_back(x);

        bool ok = true;
        for (int i = 0; i < n - 1; ++i) {
            if (ans[i + 1] == xs[ans[i]]) ok = false;
        }

        if (ok) {
            for (auto x : ans) std::cout << x + 1 << " ";
            std::cout << std::endl;
            return 0;
        }

        ans = tmpans;
    } while (std::next_permutation(rem.begin(), rem.end()));

    std::cout << -1 << std::endl;
    return 0;
}


Measured memory_bytes: 6656
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);

    int n = Integer.parseInt(r.readLine());
    int a[] = new int[200001];
    int x[] = new int[200001];

    for(int i = 0; i < n; i++)
    {
      a[i] = Integer.parseInt(r.readLine());
    }

    if(a[0] > 0)
    {
      System.out.println(-1);
      System.exit(0);
    }

    for(int i = 0; i < n; i++)
    {
      if(a[i + 1] - a[i] > 1)
      {
        System.out.println(-1);
        System.exit(0);
      }
    }

    long v = 0;
    for(int i = 1; i <= n; i++)
    {
      if(a[i - 1] + 1 == a[i])
      {
        v++;
      }
      else
      {
        v += a[i];
      }
    }
    System.out.println(v);

  }
}


Measured memory_bytes: 68312
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define sc(x) scanf("%d", &x)
#define sc2(x, y) scanf("%d%d", &x, &y)
#define sc3(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define sc4(x, y, z, t) scanf("%d%d%d%d", &x, &y, &z, &t)
#define print(x) printf("%d ", x)
#define println(x) printf("%d\n", x)
#define println2(x, y) printf("%d %d\n", x, y)
#define println3(x, y, z) printf("%d %d %d\n", x, y, z)
#define println4(x, y, z, t) printf("%d %d %d %d\n", x, y, z, t)
#define mp make_pair
#define pb push_back
#define ft first
#define sd second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define endl '\n'                           // CommentInInteractive
#define DB(x) cerr << #x << " = " << x << endl

const ld eps = 1e-6;
const int inf = INT_MAX;
const ll INF = LLONG_MAX;

void solve() {
    string s;
    cin >> s;
    if (s == "AAA" || s == "BBB") cout << "No" << endl;
    else cout << "Yes" << endl;
}

//#define FILES
//#define TIME

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

#ifdef FILES
    freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

    auto start = chrono::high_resolution_clock::now();
    solve();
    auto stop = chrono::high_resolution_clock::now();

#ifdef TIME
    cerr << chrono::duration_cast <chrono::milliseconds> (stop - start).count() << " ms\n";
#endif
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
    int h,w;
    cin >> h >> w;
    vector<string> a(h);
    for(int i = 0; i < h; i++){
        cin >> a[i];
    }

    vector<vector<ll> > dp(h,vector<ll>(w,0));
    dp[0][0] = 1;

    for(int i = 1; i < h; i++){
        if(a[i][0] == '#') break;
        else dp[i][0] = 1;
    }
    for(int i = 1; i < w; i++){
        if(a[0][i] == '#') break;
        else dp[0][i] = 1;
    }

    for(int i = 1; i < h; i++){
        for(int j = 1; j < w; j++){
            dp[i][j] = dp[i-1][j] + dp[i][j-1];
            dp[i][j] %= mod;
            if(a[i][j] == '#') dp[i][j] = 0;
        }
    }

    // for(int i = 0; i < h; i++){
    //     for(int j = 0; j < w; j++){
    //         cout << dp[i][j] << " ";
    //     }printf("\n");
    // }

    cout << dp[h-1][w-1] << endl;



    return 0;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p;
    cin >> n >> k;
    ll arr[n];
    long double d, e, f = 0, cum[n], h = 0;
    for(i = 0; i < n; i++){
        cin >> arr[i];
        d = arr[i];
        e = (d*(d+1))/2;
        e = (long double)e/d;
        f += e;
        cum[i] = f;
    }
    h = cum[k-1];
    for(i = k; i < n; i++){
       h = max(h,cum[i]-cum[i-k]);
    }
    cout << fixed << setprecision(12) << h;

    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+5;
//int a[N];

int main()

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

    int x, a;

    cin >> x >> a;

    if (x < a) cout << "0";
    else cout << "10";

    return 0;
}


Measured memory_bytes: 256
import math
n,p=map(int,input().split())
a=list(map(int,input().split()))
x=[]
for i in a:
  x.append(abs(i-p))
  
if len(x)==1:
  print(x[0])
  
else:
  pin=x[0]
  for i in range(1,len(x)):
    pin=math.gcd(pin,x[i])
    
  print(pin)

Measured memory_bytes: 90540
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>
#include <cassert>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>
#include <functional>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* ---------- Functions */
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int N;
    string str;
    cin >> N >> str;

    vector<int> R(N+1, 0);
    vector<int> G(N+1, 0);
    vector<int> B(N+1, 0);
    for (int i = N-1; i>= 0; i--) {
        R[i] = R[i+1];
        B[i] = B[i+1];
        G[i] = G[i+1];
        if (str[i] == 'R') R[i]++;
        if (str[i] == 'G') G[i]++;
        if (str[i] == 'B') B[i]++;
    }

    int ret = 0;
    for (int i = 0; i < N-2; i++) {
        for (int j = i+1; j < N-1; j++) {
            int diff = j - i;
            int k = j + diff;
            if (str[i] == str[j]) continue;

            int tmp = 0;
            if (str[i] != 'R' && str[j] != 'R') {
                tmp += R[j+1];
                if (k < N && str[k] == 'R') tmp--;
            } else if (str[i] != 'G' && str[j] != 'G') {
                tmp += G[j+1];
                if (k < N && str[k] == 'G') tmp--;
            } else {
                tmp += B[j+1];
                if (k < N && str[k] == 'B') tmp--;
            }

            ret += tmp;
        }
    }

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3720
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 100100100100100100;
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;
 
int main () {
    
    ll w,h,x,y; cin >>w>>h>>x>>y;

    double ans = (double) h * (double) w / ((double) 2);
    cout << setprecision(12) << ans << endl;

    if (x == w - x && y == h - y) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    } 
}


 

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <cmath>
#include <tuple>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;

int main(int argc, char *argv[])
{
	int i, j, x;
	cin >> x;
	for (i = x;; i++) {
		bool isPrime = true;
		for (j = 2; j <= sqrt(i); j++) {
			if (i % j == 0) {
				isPrime = false;
				break;
			}
		}
		if (isPrime)
			break;
	}

	cout << i << endl;

	return 0;
}


Measured memory_bytes: 256
m = int(input())
while m:
    m -= 1
    ax, ay, bx, by = map(int, input().split())
    n = int(input())
    dx, dy = bx - ax, by - ay
    intersections = set()
    while n:
        n -= 1
        sx, sy, tx, ty, o, l = map(int, input().split())
        tdx, tdy = tx - sx, ty - sy
        asx, asy = sx - ax, sy - ay
        denom = dx * tdy - dy * tdx
        if not denom:
            continue
        r = (tdy * asx - tdx * asy) / denom
        s = (dy * asx - dx * asy) / denom
        if not 0 < r < 1 or not 0 < s < 1:
            continue
        intersections.add((r, o == l))

    pl, counter = -1, -1
    for r, l in sorted(intersections):
        counter += pl != l
        pl = l
    print(max(counter, 0))

Measured memory_bytes: 7684
//
// Created by moono on 2018/10/27.
//

#include <iostream>
#include <string>
#include <cmath>
using namespace std;


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


    int max_v = 1;
    for(int i = 2; i < 32; i++){
        int j = 2, v1 = 0, v2 = 0;
        while(true){
            v1 = pow(i, j++);
            if(v1 > x) break;
            v2 = v1;
        }

        if(v2 > max_v) max_v = v2;
    }

    cout << max_v << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>ll(b);i--)
using ll = long long;
using namespace std;

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
//sort(a, a + N, greater<ll>())   // descend
//sort(a, a+N)                    //  ascend

/* 
void comb(vector<vector <ll> > &v) {
	ll mod=1000000007;
	rep (i,0,v.size()) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	rep (k,1,v.size()) {
		rep (j,1,k) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%mod;
		}
	}
}
/*main内でnCn~nC0 生成 **
vector<vector<ll> > v(n + 1, vector<ll>(n + 1, 0));
comb(v);
*/

int main(){
	ll n,k;
	cin>>n>>k;
	vector<ll> a;
	ll b[110000];
	rep(i,0,n){cin>>b[i];a.push_back(b[i]);}
	ll x=b[0];
	bool p=false;
	rep(i,0,n-1) x =GCD(x,a[i+1]);
	sort(a.rbegin(),a.rend());
	if(a[0]>=k && k%x==0)cout<<"POSSIBLE";
	else cout<<"IMPOSSIBLE";
}




Measured memory_bytes: 1912
import math
import re
import copy

h1,m1,h2,m2,k = map(int,input().split())
w1 = h1*60 + m1
w2 = h2 * 60 + m2
w3 = (w2-w1+24*60)%(24*60)
w3 = w3 - k
print(w3)

Measured memory_bytes: 9852
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
#define        u64             uint64_t
#define        ll              long long
#define        endl            "\n"
#define        PI              acos(-1)
#define        fi              first
#define        si              second
#define        mkp             make_pair
#define        pb              push_back
#define        set0(arr)       memset(arr, 0, sizeof(arr))
#define        setinf(arr)     memset(arr, 126, sizeof(arr))
#define        all(x)          (x).begin(),(x).end()
#define        sz(v)           ((int)(v).size())
#define        IOS             ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
using          pll        =      pair<ll, ll> ;
using          vl         =      vector<ll> ;
using          vpll       =      vector<pll> ;
using          mll        =      map<ll, ll> ;
using          mcl        =      map<char, ll> ;
using          msl        =      map<string,ll> ;
using          sl         =      set<ll> ;
using          sc         =      set<char> ;
using          dl         =      deque<ll> ;
const int N = 1e6+5 ;

ll      mod = 1e9+7 ;
vl      adj[N] ;
vpll    adjc[N] ;
ll      vis[N] ;
ll      arr[N] ;



int main()
{
    IOS;
    ll a, b, c, d, n, m, p, x, y, z, i, j, k, f = 0, tc, cnt = 0, sum = 0, mul = 1, mi = 1e18, ma = -1e18;
    string   str ;
    char     ch ;
    double   db, db1,db2 ;
    ll       l, r ;
    //code

   cin>>n>>d;
   cnt=0;
   for(i=0;i<n;i++)
   {
          cin>>a>>b;
          a=abs(a);
          b=abs(b);
          db1=a*a;
          db2=b*b;
          db=sqrt(db1+db2);
          if(db<=d)
              cnt++;
   }
   cout<<cnt<<endl;

    //code
    return 0;
}




Measured memory_bytes: 50500
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();
		if (a * b % 2 == 0) {
			System.out.println("Even");
		} else {
			System.out.println("Odd");
		}
		sc.close();
	}
}


Measured memory_bytes: 23508
#include<iostream>
#include<deque>
#include<algorithm>
#include<math.h>
#include<string>
#include<queue>
#include<iterator>
using namespace std;
int main(){

	long long n, k, t, x;
	cin >> n >> t;
	priority_queue<long long>d;
	for (int i = 0; i < n; i++) {
		cin >> x;
		d.push(x);
	}

	if (d.size() == 1) {
		long long f = (d.top() >> t);
		cout << f << endl;
		return 0;
	}
	while (t > 0) {
		k = d.top() / 2;
		d.pop();
		t--;
		d.push(k);
	}
	long long sum = 0;
	for (int i = 0; i < d.size(); ) {
		sum+=d.top();
		d.pop();
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 1400
// Ballazt
//0a..brute force
//0b..greedy
//1..memorizatton of some sort	remember something cleverly
//2..sort
//3..binary search	keep check a particular solution
//4..dp				repeating strucutre,limited choices
//5..dfs/bfs		matrix with obstacles
//6..correlate to graph in some way		each state is a point
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"


int main()

{
	ios::sync_with_stdio(0);
	cin.tie(0);

	ll x;
	cin>>x;

	for(int i=-1000;i<1000;i++)
	{
		for(int j=-1000;j<1000;j++)
		{
			//cout<<i<<" "<<j<<" ij "<<endl;
			if(pow(i,5)-pow(j,5)==x)
			{
				cout<<i<<" "<<j;
				return 0;
			}

		}
	}



	
}

Measured memory_bytes: 4112
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<complex>
using namespace std;
typedef long long int llint;
int main(){
	int a, b;
	cin >> a >> b;
	if ((a + b) % 2 == 0){
		cout << (a + b) / 2 << endl;
	}
	else{
		cout << (a + b) / 2 + 1 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import heapq

n, m = map(int, input().split())
ab = []
for i in range(n):
    a, b = map(int, input().split())
    if a > m:
        continue
    ab.append((a, b))
ab = sorted(ab, key=lambda a: a[0])
q = []
day = 0
index = 0
total = 0
while day <= m:
    while index < len(ab) and day >= ab[index][0]:
        heapq.heappush(q, - ab[index][1])
        index += 1
    if len(q) > 0:
        total += - q[0]
        heapq.heappop(q)
    day += 1
print(total)


Measured memory_bytes: 20432
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x7fffffff
#define INFL 0x7fffffffffffffffLL

/* 最大公約数 */
long gcd(long m, long n) {
	long temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

int main() {
	ll		a,b,c,i,j,k,n,m,x,y,ans = 0;
	string	str;

	cin >> k;

	for(a=1;a<=k;a++) {
		for(b=1;b<=k;b++) {
			for(c=1;c<=k;c++) {
				ans += gcd(a , gcd(b , c) );
			}
		}
	}

	cout << ans << endl;

}


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

using namespace std;
int a, b;
int main() {
    scanf("%d %d", &a, &b);
    if (a % 3 == 0 || b % 3 == 0)
        printf("Possible");
    else if ((a+b)%3 == 0)
        printf("Possible");
    else
        printf("Impossible");

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int a, b, i, e;
    string m[100][100];
    cin>> a;
    cin >> b;
    for(i= 0;i<100; i++){
        for(e=0;e<50; e++){
            m[i][e] = '#';
        }
    }
    for(i= 0;i<100; i++){
        for(e=50;e<100; e++){
            m[i][e] = '.';
        }
    }
    a--;
    b--;
    if(a>0){
        for(i=0;i<100; i=i+2){
            e = 0;
            while((e<50)&&(a>0)){
                m[e][i] = '.';
                a--;
                e = e + 2;
            }
        }
    }
    if(b>0){
        for(i=0;i<100; i=i+2){
            e = 51;
            while((e<=99)&&(b>0)){
                m[i][e] = '#';
                b--;
                e = e + 2;
            }
        }
    }
    cout<<"100 100";
    cout<<'\n';
    for(i=0;i<100;i++){
        for(e=0;e<100;e++){
            cout<<m[i][e];
        }
        cout<<'\n';
    }
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int lli;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s;
    cin>>s;
    lli i;
    for(i=0;i<s.length();i++)
    {
        if(s[i]=='7')
        {
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		for(int i = 0; i < 10000; i++) {
			int a = sc.nextInt();
			if(a == 0) {
				break;
			} else {
				System.out.println("Case " + (i + 1) +": " + a);
			}
		}
	}
}

Measured memory_bytes: 40276
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <cassert>
#include <cstring>

using namespace std;

const int N = 1e5 + 7;

int n, a[N];

void fail() {
	puts("NO");
	exit(0);
}

void accept() {
	puts("YES");
	exit(0);
}

long long start[N];

int main() {
	scanf("%d", &n);
	long long tot = 0, once = 0;
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		tot += a[i];
		once += i;
	}
	if (tot % once != 0) {
		fail();
	}
	if (n == 1) {
		accept();
	}
	long long times = tot / once;
	a[n + 1] = a[1];
	long long tot_s = 0;
	for (int i = 1; i <= n; i++) {
		// x - (n - 1) * (times - x) = delta
		// n x = delta + (n - 1) * times
		long long delta = a[i + 1] - a[i] + (n - 1) * times;
		//cout << delta << endl;
		if (delta % n != 0) fail();
		start[i] = times - delta / n;
		if (start[i] < 0) fail();
		tot_s += start[i];
		if (tot_s > times) fail();
	}
	if (tot_s == times) {
		accept();
	} else {
		fail();
	}
	return 0;
}


Measured memory_bytes: 1536
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String ss = sc.next();
        for (int i = 1; i < 4; i++) {
            if (ss.charAt(i) == ss.charAt(i-1)) {
                System.out.println("Bad");
                System.exit(0);
            }
        }
        System.out.println("Good");
    }

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);

int main()
{
    fastio;
    int n,m,i,j,a,b,t;
    cin>>n;
    vector<int>v1;
    for(i=0;i<n;i++)
    {
        cin>>a;
        v1.push_back(a);
    }
    cin>>m;
    for(i=0;i<m;i++)
    {
        cin>>a>>b;
        int s=0;
        for(j=0;j<v1.size();j++)
        {
            if((j+1)!=a)
                s+=v1[j];
            else
                s+=b;
        }
        cout<<s<<"\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
using P = pair<int,int>;
using ll = long long;
const int MOD = 1e9+7;
#define rep(i,N) for(int (i) = 0; (i) < (N);++(i))

int gcd(int n,int m){return m?gcd(m,n%m):n;}

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> A(N);
    int MAX = -1;
    rep(i,N) cin >> A[i],MAX = max(MAX,A[i]);
    int g = A[N-1];
    rep(i,N-1) g = gcd(A[i],g);
    
    if(K <= MAX && K % g == 0) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

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

using namespace std;

int main(){

  int n,m;
  cin>>n>>m;
  int a[100][100];
  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++) cin>>a[i][j];

  int b[100];
  for(int i=0;i<m;i++) cin>>b[i];

  int c[100] = {};
  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++) c[i] += a[i][j] * b[j];

  for(int i=0;i<n;i++) cout<<c[i]<<endl;

}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define mxn 100005
using namespace std;
vector<int>adj[mxn];
int dfs(int x, int p)
{
    int xr= 0;
    for(int i=0; i<adj[x].size(); i++)
    {
        int y= adj[x][i];
        if(y!=p)xr^= (1+dfs(y, x));
    }
    return xr;
}
int main()
{
    int n;
    scanf("%d", &n);
    for(int i=1; i<n; i++)
    {
        int x, y;
        scanf("%d %d", &x, &y);
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    if(dfs(1, 1))puts("Alice");
    else puts("Bob");
    return 0;
}


Measured memory_bytes: 13792
n,m=[int(x) for x in input().split()]
a=0
S=0
L=[]
for i in range(m):
  s,c=[int(x) for x in input().split()]
  L.append([s,c])
if n!=1:
  for i in range(10**(n-1),10**n):
    I=str(i)
    l=[]
    for j in range(m):
      s,c=L[j][0],L[j][1]
      if I[s-1]!=str(c):
        l.append(False)
    if l==[]:
      ans=i
      a=1
      break
else:
  for i in range(10**n):
    I=str(i)
    l=[]
    for j in range(m):
      s,c=L[j][0],L[j][1]
      if I[s-1]!=str(c):
        l.append(False)
    if l==[]:
      ans=i
      a=1
      break
if a==0:
  print(-1)
elif a==1:
  print(ans)

Measured memory_bytes: 9208
#define		_CRT_SECURE_NO_WARNINGS

#include <cstdio>

#define		MAX		3000

int main()
{
	int		n, m;

	for (int i = 0; i < MAX; i++)
	{
		scanf("%d", &n);
		scanf("%d", &m);
		if ((n == 0) && (m == 0)) break;

		if (n < m)	printf("%d %d\n", n, m);
		else		printf("%d %d\n", m, n);
	}

	return 0;
}

Measured memory_bytes: 2588
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  string S;
  cin >> S;
  int N=S.size();
  if (N==9) {
    cout << S.at(0) << endl;
  }
  else {
    for (int i=0; i<N-9; i++) {
      cout << S.at(i);
    }
    cout << S.at(N-9) << endl;
  }
}


Measured memory_bytes: 3520
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

#define MAX_V 100000
#define INF 100000000

vector<int> G[MAX_V];
vector<int> sirube;
vector<int> dist;

void add_edge(int from, int to){
    G[from].push_back(to);
}

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

    for(int i=0; i<M; i++){
        add_edge(A[i]-1, B[i]-1);
        add_edge(B[i]-1, A[i]-1);
    }

    sirube = vector<int>(N, INF);
    dist = vector<int>(N, INF);

    sirube[0] = 0;
    dist[0] = 0;

    queue<int> que;
    que.push(0);

    while(!que.empty()){
        int s = que.front();
        int d = dist[s];
        que.pop();
        for(int i=0; i<G[s].size(); i++){
            int t = G[s][i];
            if(d+1 < dist[t]){
                dist[t] = d+1;
                que.push(t);
                sirube[t] = s;
            }
        }
    }

    for(int i=1; i<N; i++){
        if(dist[i] == INF){
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";
    for(int i=1; i<N; i++){
        cout << sirube[i] + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 12116
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

fun main(args: Array<String>) {
    val n = readLong()
    var res = n - 1
    var l = 2L
    var r = 0L
    while (l * l <= n) {
        r = n
        if (n % l == 0L) {
            r /= l
            res = (r + l - 2L).coerceAtMost(res)
        }

        l++
    }
    print(res)
}

Measured memory_bytes: 31872
a=input()

if int(a)%10 == 3:
	print("bon")
  
elif int(a)%10 == 0:
	print("pon")
    
elif int(a)%10 == 1:
	print("pon")

elif int(a)%10 == 6:
	print("pon")
    
elif int(a)%10 == 8:
	print("pon")    
    
else:
	print("hon")

Measured memory_bytes: 9056
#include<stdio.h>

#define MAX 100
#define INF 100000000
#define WHITE 0
#define GRAY 1
#define BLACK 2

typedef struct{
  int data[MAX];
  int head;
  int tail;
}queue;

queue Q;

int n,d[MAX],g[MAX][MAX],color[MAX];

void bfs(int);
void enqueue(int);
int dequeue();
int isEmpty();

int main(){
  int i,j,k,m,v;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d %d",&k,&m);
    for(j=0;j<m;j++){
      scanf("%d",&v);
      g[k-1][v-1] = 1;
    }
  }
  for(i=0;i<n;i++) d[i] = INF;

  bfs(0);

  for(i=0;i<n;i++){
    if(d[i] == INF)printf("%d %d\n",i+1,-1);
    else printf("%d %d\n",i+1,d[i]);
  }
  return 0;
}

void bfs(int s){
  int v,u;

  d[s] = 0;
  color[s] = GRAY;
  Q.head = Q.tail = 0;
  enqueue(s);

  while(isEmpty()){
    u = dequeue();
    if(u == INF) break;
    for(v=0;v<n;v++){
      if(g[u][v] == 0) continue;
      if(color[v] == WHITE){
	d[v] = d[u] + 1;
	color[v] = GRAY;
	enqueue(v);
      }
    }
    color[u] = BLACK;
  }
}

void enqueue(int s){

  if(Q.tail >= n) return;
  
  Q.data[Q.tail] = s;
  Q.tail++;
}

int dequeue(){
  int s;

  if(Q.head == Q.tail)return INF;

  s = Q.data[Q.head];
  Q.head++;

  return s;
}
int isEmpty(){
  if(Q.head == Q.tail) return 0;
  else return 1;
}



Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <cstring>
#define PI pair<int,int>
using namespace std;
unsigned char m[257][257][4];
int main()
{
  int n,i,j,k,l;
  string s;
  PI p[4] = { PI(0,-1), PI(-1,0), PI(-1,-1), PI(-1,1) };
  for(;;){
    cin >> n;
    if(n==0) break;
    memset(m,0,sizeof(m));
    l = 0;
    for(i=1;i<=n;i++){
      cin >> s;
      for(j=1;j<=n;j++){
	if(s[j-1] == '1'){
	  for(k=0;k<4;k++){
	    m[i][j][k] = m[i+p[k].first][j+p[k].second][k]+1;
	    if(l<m[i][j][k]) l = m[i][j][k];
	  }
	}
      }
    }
    cout << l << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define N 100010
#define INF 1e18
using namespace std;
long long n,k,x[N],v[N],a[N]={},b[N]={},c[N]={},d[N]={};
long long vtl=0,vtr=0,ans=-INF,i;
int main(){
	cin>>n>>k;
	for(i=0;i<n;i++)cin>>x[i]>>v[i];
	for(i=0;i<n;i++){
		vtl+=v[i];
		vtr+=v[n-i-1];
		a[i+1]=max(a[i],vtl-x[i]);
		b[i+1]=max(b[i],vtl-x[i]*2);
		c[n-i-1]=max(c[n-i],vtr-(k-x[n-i-1]));
		d[n-i-1]=max(d[n-i],vtr-(k-x[n-i-1])*2);
	}
	for(i=0;i<=n;i++)ans=max(ans,max(a[i]+d[i],b[i]+c[i]));
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4992
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

const int A=0,G=1,C=2,T=3;
ll dp[111][4][4][4];
int main(){
    int n;
    cin>>n;
    rep(i,4)rep(j,4)rep(k,4){
        if(i==A&&j==G&&k==C)continue;
        if(i==G&&j==A&&k==C)continue;
        if(i==A&&j==C&&k==G)continue;
        dp[3][i][j][k]=1;
    }
    for(int i=3;i<n;++i)rep(j,4)rep(k,4)rep(l,4)rep(m,4){
        if(k==A&&l==G&&m==C)continue;
        if(k==G&&l==A&&m==C)continue;
        if(k==A&&l==C&&m==G)continue;
        if(j==A&&l==G&&m==C)continue;
        if(j==A&&k==G&&m==C)continue;
        (dp[i+1][k][l][m]+=dp[i][j][k][l])%=mod;
    }
    ll ans=0;
    rep(i,4)rep(j,4)rep(k,4)ans+=dp[n][i][j][k];
    cout<<ans%mod<<endl;
    return 0;
}

Measured memory_bytes: 256
from sys import stdin
n = int(stdin.readline().rstrip())
al = [int(x) for x in stdin.readline().rstrip().split()]
count = 0
for a in al:
    while 1:
        if a%2 == 0:
            count += 1
            if a/2 == 1:
                break
            a = a/2
        else:
            break
print(count)

Measured memory_bytes: 4148
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
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;
}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;


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

    int N;
    cin >> N;
    vi a(N), b(N), c(N);

    REP(i, N) cin >> a[i];
    REP(i, N) cin >> b[i];
    REP(i, N) cin >> c[i];

    sort(ALL(a));
    sort(ALL(c));

    ll ans = 0;
    REP(i, N){
        auto pos_a = lower_bound(ALL(a),b[i]);
        ll x = distance(a.begin(),pos_a);
        auto pos_c = upper_bound(ALL(c),b[i]);
        ll y = distance(pos_c,c.end());
        ans += (x*y);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1408
<?php

$cup = array(
	"A" => 1,
	"B" => 0,
	"C" => 0
);

while($line = fgets(STDIN)){
	$change = explode(",", $line);
	$change[0] = trim($change[0]);
	$change[1] = trim($change[1]);

	$taihi = $cup[$change[0]];
	$cup[$change[0]] = $cup[$change[1]];
	$cup[$change[1]] = $taihi;
}
echo array_search(1, $cup)."\n";

Measured memory_bytes: 15276
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int sum=0;
  int n;
  cin>>n;
  for(int i=0;i<n;i++)
  {
    int l;
    int r;
    cin>>l>>r;
    sum+=r-l+1;
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        FastScanner sc = new FastScanner();
        Strategy strategy = new MyStrategy();
        strategy.solve(out, sc);
        out.flush();
    }
}

class MyStrategy implements Strategy {
    @Override
    public void solve(PrintWriter out, FastScanner sc) {
        int N = sc.nextInt();
        int min = 2_00_001;
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            int P = sc.nextInt();
            if (P <= min) {
                min = P;
                cnt++;
            }
        }
        out.println(cnt);
    }
}

interface Strategy {
    void solve(PrintWriter out, FastScanner sc);
}

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


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

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

    ll n;
    cin >> n;
    string s;
    cin >> s;
    if(n % 2 == 1) {
        cout << "No";
        return 0;
    }
    string a, b;
    for(int i = 0; i < n / 2; i++) {
        a += s[i];
    }    
    for(int i = n / 2; i < n; i++) {
        b += s[i];
    }
    if(a == b) {
        cout << "Yes";
    } else {
        cout << "No";
    }
}

Measured memory_bytes: 256
N = int(input())
Lists = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(Lists[N-1])

Measured memory_bytes: 38256
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string N;
    cin >> N;

    for (int i = 0; i < N.size(); i++) {
        if (N.at(i) == '7') {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3044