akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  int a,b;
  cin>>a>>b;
  int ans=(a+b+1)/2;
  cout<<ans<<endl;
  return 0;
}

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

int main(void){
  int CD,Buyer;
  int cnt100,cnt500,cnt1000;
  int change;

  while(1){

    cnt100 = cnt500 = cnt1000 = 0;
    change = 0;

    cin >> CD >> Buyer;

    if( CD == 0 && Buyer == 0 ) break;

    change = Buyer - CD;

    while( change != 0 ){

    if( change >= 1000 ){

      change -= 1000;
      cnt1000++;

    }

    else if( change >= 500 && change < 1000 ){

      change -= 500;
      cnt500++;

    }

    else if( change >= 100 && change < 500 ){

      change -= 100;
      cnt100++;

    }

    }

    cout << cnt100 <<" "<< cnt500 <<" "<< cnt1000 << endl;

  }

  return 0;

}
 
   

Measured memory_bytes: 1160
using System;
using System.IO;
using System.Text;

public static class Program
{
    public static void Main(string[] args) 
    {
        var line1 = System.Console.ReadLine().Trim();
        string [] inpt = line1.Split(' ');
        var a = int.Parse(inpt[0]);
        var b = int.Parse(inpt[1]);
        if (a > b)
        {
            var tmp = b;
            b = a;
            a = tmp;
        }

        if ((b - a) % 2 == 0)
        {
            System.Console.WriteLine("{0}", a+(b-a)/2);
        }
        else
        {
            System.Console.WriteLine("IMPOSSIBLE");
        }
    }
}

Measured memory_bytes: 13268
#include <iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int num, k;
llong cargo[MAX];

int check(llong weight)
{
	int i = 0;
	for (int j = 0; j < k; j++)
	{
		llong s = 0;
		while (s + cargo[i] <= weight)
		{
			s += cargo[i];
			i++;
			if (i == num) return num;
		}
	}
	return i;
}

int solve()
{
	llong left = 0;
	llong right = 100000 * 10000;
	llong mid;
	while (right - left > 1)
	{
		mid = (left + right) / 2;
		int v = check(mid);
		if (v >= num) right = mid;
		else left = mid;
	}
	return right;
}

int main()
{
	cin >> num >> k;
	for (int i = 0; i < num; i++)
	{
		cin >> cargo[i];
	}
	llong ans = solve();
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3884
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
// #include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define INF 1050000000;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main() //input->compute->output
{
        int N;
        cin >> N;
        string m = "";
        vector<vector<int>> h(100000 + 10, vector<int>(3));
        rep(i, N)
        {
                rep(j, 3)
                {
                        cin >> h[i][j];
                }
        }

        ll dp[100000 + 10][3];
        rep(i, 100000 + 10)
        {
                rep(j, 3)
                {
                        dp[i][j] = 0;
                }
        }

        rep(i, N)
        {
                rep(j, 3)
                {
                        rep(k, 3)
                        {
                                if (k != j)
                                {
                                        dp[i + 1][k] = max(dp[i][j] + h[i][k], dp[i + 1][k]);
                                }
                        }
                }
                int x = max({dp[i][0], dp[i][1], dp[i][2]});
                if (x == dp[i][0])
                {
                        m += '0';
                }
                else if (x == dp[i][1])
                {
                        m += '1';
                }
                else
                {
                        m += '2';
                }
        }
        debug(m);
        cout << max({dp[N][0], dp[N][1], dp[N][2]}) << endl;
        return 0;
}

Measured memory_bytes: 8320
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <numeric>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <stack>

using namespace std;

#define rep(i,n) for(int i = 0; i<n ; i++)
#define FOR(i,a,n) for(int i=a; i<n; i++)
#define REPSTR(i,s) for(int i=0; (s)[i]; i++)
#define REPITR(i,s) for(auto i=(s).begin(); i!=(s).end();i++)

#define RANGE(a,i,b) ((a)<=(i)&&(i)<=(b))

#define pb push_back
#define mp make_pair

#define ALL(a) (a).begin(), (a).end()

#define EXIST(s,x) ((s).find(x)!=(s).end())

#define SET(a,c) memset(a,c,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))

#ifdef _DEBUG
#define DEBUG(x) cerr<<#x<<":"<<x<<endl
#else
#define DEBUG(x)
#endif

#define PRINTJOIN(x,n) rep(i,n){if(i)cout<<" ";cout<<x[i];}cout<<endl 

#define INF 1001001001
#define LLINF 1001001001001001001LL

typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef stringstream SS;

#define PQ priority_queue

#define FST first
#define SEC second

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

bool revert[1123];

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n, m;
    cin>>n>>m;
    rep(i, m){
        int c, d;
        cin>>c>>d;
        FOR(j, c, d) {
            revert[j]=true;
        }
    }
    int ans=0;
    rep(i, n){
        ans+=revert[i]*2+1;
    }
    cout<<ans+1<<endl;
	return 0;
}


Measured memory_bytes: 3224
n, m = gets.chomp.split.map(&:to_i)
edges = []
$graph = Array.new(n).map{Array.new()}

m.times {
  a, b = gets.chomp.split.map(&:to_i)
  a -= 1; b-= 1;
  edges.push( [a, b] )
  $graph[a].push(b)
  $graph[b].push(a)
}

def bfs(u, v, n)
  is_visited = [ false ]*n
  is_visited[0] = true
  que = [ 0 ]
  while not que.empty?
    cur = que.shift
    for adj in $graph[cur] do
      if is_visited[adj] == true ||
          cur == u && adj == v ||
          cur == v && adj == u then
        next
      end
      is_visited[adj] = true
      que.push(adj)
    end
  end
  return is_visited.all?
end

ans = 0
m.times { |i|
  u = edges[i][0]
  v = edges[i][1]
  if bfs(u, v, n) == false
    ans += 1
  end
}

p ans

Measured memory_bytes: 1788
#https://note.nkmk.me/python-union-find/
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def main():
    N, M = [int(i) for i in input().split()]
    uf = UnionFind(N)
    for i in range(M):
        A,B = [int(i) for i in input().split()]
        uf.union(A-1,B-1)
    print(uf.group_count()-1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 13088
def readinput():
    s=input()
    return s

def main(s):
    y=int(s[:4])
    m=int(s[5:7])
    d=int(s[9:])
    if m<=4:
        return 'Heisei'
    else:
        return 'TBD'

if __name__=='__main__':
    s=readinput()
    ans=main(s)
    print(ans)


Measured memory_bytes: 9116
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/03/12.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//
//
//

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

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const ll MOD = 1000000007;
//#define __DBG__


void solve(void){
  
  int N;
  cin >> N;
  
  vector<int> A(N), B(N);
  REP(i,N){
    // 0-indexed
    cin >> A[i];
    B[i]=A[i];
  }
  
  sort(ALL(B), greater<int>());
  
  int ans=0;
  
  REP(i,N){
    if(A[i]==B[0]){
      cout << B[1];
    }
    else
    {
      cout << B[0];
    }
    cout << endl;
  }
  
  return;
   
}

#define TESTCASES 1

int main(int argc, const char * argv[]) {

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

    REP(i,TESTCASES){
      solve();
    }
 
    return 0;
}


Measured memory_bytes: 3328
#include <bitset>
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  string X;
  cin >> X;
  int base_count = 0;
  rep(i, N) {
    if (X[i] == '1') ++base_count;
  }
  int count_p = base_count + 1;
  int rem_p = 0;
  vector<int> Ymod_p(N + 1);
  Ymod_p[0] = 1 % count_p;
  rep(i, N) {
    rem_p = rem_p * 2 + (X[i] == '1');
    rem_p %= count_p;
    Ymod_p[i + 1] = (Ymod_p[i] << 1) % count_p;
  }

  int count_m = base_count - 1;
  int rem_m = 0;
  vector<int> Ymod_m(N + 1);
  if (count_m > 0) {
    Ymod_m[0] = 1 % count_m;
    rep(i, N) {
      rem_m = rem_m * 2 + (X[i] == '1');
      rem_m %= count_m;
      Ymod_m[i + 1] = (Ymod_m[i] << 1) % count_m;
    }
  }

  rep(i, N) {
    int rem = 0;
    if (X[i] == '0') {
      rem = (rem_p + Ymod_p[N - 1 - i]) % count_p;
    } else {
      if (count_m == 0) {
        cout << 0 << endl;
        continue;
      }
      rem = (rem_m - Ymod_m[N - 1 - i] + count_m) % count_m;
    }

    int answer = 1;
    while (rem) {
      rem %= bitset<32>(rem).count();
      ++answer;
    }
    cout << answer << endl;
  }
  return 0;
}


Measured memory_bytes: 5220
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(ll (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;

////const long long MOD = 1000000007;
//

mat(dp,100001,13)
void solve(std::string S){
  ll amari=10;
  if(S[S.size()-1]!='?'){
    dp[0][S[S.size()-1]-'0']++;
  }
  else{
    rep(i,10){
      dp[0][i]++;
    }
  }
  repf(i,1,S.size()){
    amari%=13;
    if(S[S.size()-1-i]!='?'){
      rep(j,13){
        dp[i][((S[S.size()-1-i]-'0')*amari+j)%13]+=dp[i-1][j];
        dp[i][((S[S.size()-1-i]-'0')*amari+j)%13]%=MOD;
      }
    }else{
      rep(j,10){
        rep(k,13){
          dp[i][((j)*amari+k)%13]+=dp[i-1][k];
          
          dp[i][((j)*amari+k)%13]%=MOD;
        }
      }
    }
    amari*=10;
  }
  op(dp[S.size()-1][5])
  /*rep(i,S.size()){
    rep(j,13){
      cout<<dp[i][j]<<" ";
    }cout<<endl;
  }*/
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 13696
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
//コピペするとこ



//-------------------------------------------------


int main()
{
  int a, b ;
  cin >> a >> b ;
  if(a*b%2==0){
    cout <<"No"<<endl ;
  }
  else{
    cout <<"Yes"<<endl ;
  }

  return 0 ;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B,M;cin>>A>>B>>M;
  vector<int> a(A);
  vector<int> b(B);
  for(int i=0;i<A;i++) cin>>a[i];
  for(int i=0;i<B;i++) cin>>b[i];
  int mina,minb;
  mina=*min_element(a.begin(),a.end());
  minb=*min_element(b.begin(),b.end());
  int ans=mina+minb;
  for(int i=0;i<M;i++){
    int a1,b1,discount;
    cin>>a1>>b1>>discount;
    ans=min(ans,a[a1-1]+b[b1-1]-discount);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    string s;cin>>s;
    string t;
    rep(i,s.size()){
        if(i<s.size()-1&&(s[i]=='B'&&s[i+1]=='C')){
            t.push_back('D');
            i++;
        }
        else t.push_back(s[i]);
    }
    //cout<<t<<endl;
    reverse(t.begin(),t.end());
    vector<ll> a(t.size(),0);
    rep(i,t.size())if(t[i]=='D')a[i]++;
    rep(i,t.size()-1)a[i+1]=(t[i+1]=='D'||t[i+1]=='A')? a[i]+a[i+1]:0;
    reverse(t.begin(),t.end());
    reverse(a.begin(),a.end());
    ll res=0;
    rep(i,t.size()-1){
        if(t[i]=='A'){
            //cout<<i<<" "<<a[i+1]<<endl;
            res+=a[i+1];
        }
    }
    cout<<res<<endl;
}


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

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

    int l[n];

    for (int i = 0; i < n; i++) cin >> l[i];

    sort(l, l + n, greater<int>());

    int ans = 0;
    for (int i = 0; i < k; i++) ans += l[i];

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
def count(l):
    res = {}
    for d in l:
        if d in res:
            res[d] += 1
        else:
            res[d] = 1
    return res

n = int(input())
data = list(map(int, input().split()))
if data[0] != 0:
    print(0)
    exit()
data = count(data)
mod = 998244353
if data[0] != 1:
    print(0)
    exit()
ans = 1
for depth, edges in data.items():
    if depth == 0:
        continue
    if depth - 1 not in data:
        print(0)
        exit()
    ans *= data[depth-1]**edges
    ans %= mod
print(ans%mod)

Measured memory_bytes: 19552
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int a[200005];
int main(){
	 int k,n,i; 
	 int ma;
	 cin>>k>>n;
	 for(i=1;i<=n;i++)
	 cin>>a[i];
	 
	 sort(a+1,a+n+1);
	 ma=a[2]-a[1];
	 for(i=3;i<=n;i++){
	 	if(a[i]-a[i-1]>ma) ma=a[i]-a[i-1];
	 }                              
	 
	 ma=max(k-a[n]+a[1],ma);
	 cout<<k-ma<<endl;
	 return 0;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

char ACGT(int i){
	switch(i){
		case 0:
			return 'A';
		case 1:
			return 'C';
		case 2:
			return 'G';
		case 3:
			return 'T';
	}
}

int main(){
	short N,i,j,k,l;

	string memo[64]; //3桁のメモ
	long ans[2][64]={};
	long final_ans=0;
	short current_index=0,next_index=1;

	cin >> N;

	//3文字のACGTパターンを生成
	for(i=0;i<64;++i){
		memo[i]="";
		memo[i]+=ACGT(i>>4);
		memo[i]+=ACGT((i>>2)%4);
		memo[i]+=ACGT(i%4);

		if(memo[i]=="AGC" || memo[i]=="GAC" || memo[i]=="ACG"){
			//ans[current_index][i]=0;
		}else{
			ans[current_index][i]=1;
		}
	}

	for(i=3;i<N;++i){
		for(j=0;j<64;++j){
			ans[next_index][j]=0;
		}
		for(j=0;j<64;++j){
			for(k=0;k<4;++k){
				if(memo[j][1]=='A' && memo[j][2]=='G' && ACGT(k)=='C'){continue;}
				if(memo[j][1]=='G' && memo[j][2]=='A' && ACGT(k)=='C'){continue;}
				if(memo[j][1]=='A' && memo[j][2]=='C' && ACGT(k)=='G'){continue;}
				if(memo[j][0]=='A' && memo[j][2]=='G' && ACGT(k)=='C'){continue;}
				if(memo[j][0]=='A' && memo[j][1]=='G' && ACGT(k)=='C'){continue;}
				
				for(l=0;l<64;++l){
					if(ans[current_index][l]==0){continue;}
					if(memo[j][1]==memo[l][0] && memo[j][2]==memo[l][1] && ACGT(k)==memo[l][2]){
						ans[next_index][l]+=ans[current_index][j];
						ans[next_index][l]%=1000000007;
					}
				}
			}
		}
		
		current_index^=1;
		next_index^=1;
		
	}

	for(i=0;i<64;++i){
		//cout << memo[i] << "  " << ans[current_index][i] << "  " << ans[next_index][i] << endl;
		final_ans+=ans[current_index][i];
		final_ans%=1000000007;
	}

	cout << final_ans << endl;

	return 0;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    s=chomp(readline())
    n=length(s)
    move=[0 for i in 1:n]
    res=0
    for i in n:-1:1
        if s[i]=='L'
            res=0
        else
            res+=1
            move[i]=res
        end
    end
    for i in 1:n
        if s[i]=='R'
            res=0
        else
            res-=1
            move[i]=res
        end
    end
    ans=[0 for i in 1:n]
    for i in 1:n
        if move[i]%2==0
            ans[i+move[i]]+=1
        else
            if move[i]>0
                ans[i+move[i]-1]+=1
            else
                ans[i+move[i]+1]+=1
            end
        end
    end
    println(join(ans," "))
end
main()

Measured memory_bytes: 168932
x1,y1,x2,y2 = map(int, input().split())

a = x2 - x1
b = y2 - y1
x3 = x2 - b
y3 = y2 + a
x4 = x3 - a
y4 = y3 - b

print(x3,y3,x4,y4)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long first = scanner.nextLong();
        long second = scanner.nextLong();

        if (first > second) {
            foundLeastCommonMultiple(first, second);
        } else {
            foundLeastCommonMultiple(second, first);
        }
    }

    private static void foundLeastCommonMultiple(long bigger, long lesser) {
        boolean isFound = false;
        int biggerMultiplier = 1;
        int lesserMultiplier = 1;
        while (!isFound) {
            long biggerSum = bigger * biggerMultiplier;
            long lesserSum = lesser * lesserMultiplier;
            if (biggerSum == lesserSum) {
                System.out.println(biggerSum);
                isFound = true;
            } else if (biggerSum > lesserSum) {
                lesserMultiplier++;
            } else {
                biggerMultiplier++;
            }
        }
    }
}

Measured memory_bytes: 23764
//
// Created by yamunaku on 2020/03/22.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    //CFS;
    int n, s;
    cin >> n >> s;
    vi a(n);
    rep(i, n) cin >> a[i];
    vl dp(s + 1, 0);
    dp[0] = 1;
    rep(i, n){
        if(a[i] > s) continue;
        if(s == a[i]){
            dp[s] = (dp[s] + (i + 1) * (n - i)) % MOD;
            continue;
        }
        dp[s] = (dp[s] + dp[s - a[i]] * (n - i)) % MOD;
        perl(j, a[i] + 1, s){
            dp[j] = (dp[j] + dp[j - a[i]]) % MOD;
        }
        dp[a[i]] = (dp[a[i]] + dp[0] * (i + 1)) % MOD;
    }
    cout << dp[s] << endl;
    return 0;
}

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

int main(void)
{
  long int x, k, d;
  scanf("%ld %ld %ld", &x, &k, &d);

  if(x<0) x = -1*x;

  long int ans;
  if(x/d >= k) ans = x - d*k;
  else{
    long int time;
    time = x / d;
    if(((k-time)%2)==0) ans = x - time*d;
    else ans = labs(x - time*d - d);
  }

  printf("%ld\n", ans);

  return 0;
}


Measured memory_bytes: 1696
#include<cstdio>
#include<cstdlib>
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>

typedef long long ll;
const int Max = 1e5 + 5;
using namespace std;

int main(){
	int i, j, n, m, k;
	ll ans;
	while(~scanf("%d", &n)){
		if(n == 25) cout << "Christmas" << endl;
		else if(n == 24) cout << "Christmas Eve" << endl;
		else if(n == 23) cout << "Christmas Eve Eve" << endl;
		else cout << "Christmas Eve Eve Eve" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N int
	fmt.Scan(&N)

	p := make([]int, N)
	s := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&p[i])
	}
	copy(s, p)
	sort.Ints(s)

	c := 0
	for i := 0; i < N; i++ {
		if p[i] != s[i] {
			c++
			if c > 2 {
				break
			}
		}
	}
	ans := "NO"
	if c == 0 || c == 2 {
		ans = "YES"
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

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

// 無限大の値
const ll  lINF = 1LL << 60;
const int iINF = 1 << 29;

int main(void){
  string s;
  cin >> s;
  int a=0, b=0, c=0;

  rep(i,3){
    if(s[i]=='a')a=1;
    if(s[i]=='b')b=1;
    if(s[i]=='c')c=1;
  }
  cout << (a&&b&&c ? "Yes" : "No") << endl;
  return 0;
} 

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

using namespace std;

int main(){
  string row;
  cin >> row;
  
  long long res = 0;
  long long cw = 0;
  for (int i=0; i<row.size(); i++){
    switch(row[i]){
      case 'W':
        res += i - cw;
        cw++;
        break;
      case 'B':
        break;
    }
  }
  
  cout << res << endl;
  
  return 0;
}

Measured memory_bytes: 640
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j;
  int a[1000][1000],b[1001][1001],h,w,n,x,y;
  while(cin>>h>>w>>n&&h+w+n){
    for(i=0;i<h;i++)
      for(j=0;j<w;j++)
	cin>>a[j][i];
    memset(b,0,sizeof(b));
    b[0][0]=n;
    for(i=1;i<w+h;i++){
      x=i-1;
      y=0;
      for(j=0;j<i;j++){
	if(x<w&&y<h){
	  if(b[x][y]%2){
	    if(a[x][y]){
	      a[x][y]=0;
	      b[x+1][y]+=b[x][y]/2+1;
	      b[x][y+1]+=b[x][y]/2;
	    }else{
	      a[x][y]=1;
	      b[x+1][y]+=b[x][y]/2;
	      b[x][y+1]+=b[x][y]/2+1;
	    }
	  }else{
	    b[x+1][y]+=b[x][y]/2;
	    b[x][y+1]+=b[x][y]/2;
	  }
	}
	x--;
	y++;
      }
    }
    for(x=y=0;x!=w&&y!=h;){
      if(a[x][y])
	y++;
      else
	x++;
    }
    cout<<y+1<<" "<<x+1<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define int long long int
#define f(i,s,e) for(i=s;i<e;++i)
#define fb(i,s,e) for(i=s;i>=e;i--)
#define ff(i,s,e,f) for(i=s;i<e && f;++i)
#define mem(arr,val) memset(arr, val, sizeof(arr))
#define mems(arr, val, n) memset(arr, val, n)
#define vec vector<int>
#define pr trip
#define vp vector<trip>
#define lim 1000000
#define mod 1000000007
#define Arena ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define READ freopen("/home/raghav/Downloads/a_example.txt","r",stdin);
using namespace std;
int i=0,j=0;

signed main()
{
    Arena
    float a,b;cin>>a>>b;
    float x1=a*12.5,x2=(a+1)*12.5;
    float y1=b*10,y2=(b+1)*10;
    if(x2<=y1 || y2<=x1)
        cout<<-1<<endl;
    else
        cout<<ceil(max(x1,y1))<<endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
#define mems(p) memset(p,-1,sizeof(p))
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define nl "\n"

const int mxN = 1e5;
const ll MOD = 1e9 + 7;

void fast()
{ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

ll gcd(ll a, ll b) {
	return b ? gcd(b, a%b) : a;
}

int main() {
	fast();
	int n;
	ll d;
	cin >> n >> d;
	int ans = 0;
	for (int i = 0; i < n; ++i)
	{
		ll x, y;
		cin >> x >> y;
		if (x*x + y*y <= d*d) {
			++ans;
		}
	}
	cout << ans << nl;
}

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

int main(){
  int n,k;
  int a[200010];
  cin >> n >> k;
  for(int i=0; i<n; ++i) {cin >> a[i];}
  int num[n+1] = {0};
  for(int i=0; i<n; ++i) {num[a[i]]++;}
  sort(num, num+n+1);
  int sum = 0;
  for(int i=0; i<=n-k; ++i){ sum += num[i]; }
  cout << sum << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <algorithm>

using namespace std;

int main(void) {

	int a, b;
	bool ans = false;
	cin >> a >> b;
	if (a % 2 == 0 || b % 2 == 0) ans = true;

	if (ans) { cout << "Even"; }
	else { cout << "Odd"; }

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
//#include<unordered_map>
//#include<unordered_set>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include <cstring>
#include <functional>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1Int<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P; 
const int N = 200005;
//////////////////////////////
 
int n;
string s;
int dp[N];
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
 
	memset(dp, 0, sizeof dp);
 
	cin >> s;
	n = s.size();
	dp[1] = 1;
	if (s[0] == s[1])dp[2] = 1;
	else dp[2] = 2;
 
	for (int i = 3; i <= n; i++) {
		if (s[i - 1] != s[i - 2]) dp[i] = dp[i - 1] + 1;
		else dp[i] = dp[i - 3] + 2;
	}
 
	cout << dp[n] << endl;
 
	return 0;
}

Measured memory_bytes: 1488
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
using namespace std;
ll binpow(ll x,ll y)/* (x^y)%p in O(log y) */{ll res=1;while (y > 0){if(y&1)res=(res*x);y = y>>1;x=(x*x);}return res;}
ll binpowmod(ll x,ll y,ll p)/* (x^y)%p in O(log y) */{ll res=1;x=x%p;while (y > 0){if(y&1)res=(res*x)%p;y = y>>1;x=(x*x)%p;}return res;}
ll mod_inverse(ll n,ll p)/* Returns n^(-1) mod p */{return binpowmod(n,p-2,p);}
ull gcd(ull x,ull y)
{
    if(y==0)
        return x;
    return gcd(y,x%y);
}
bool comp(pair<ll,ll> x,pair<ll,ll> y)
{
    return x.first>y.first;
}
bool comp_pairs_by_s(pair<ll,ll> &x ,pair<ll,ll> &y)
{
    return x.second<y.second;
}
bool isPowerOfTwo (ll x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}

class cmp      //comparator for priority_queue 
{               //declaration: priority_queue<int,vector<int>,cmp>
public:         
    bool operator()(pair<int,int> A,pair<int,int> B)
    {
        if(abs(A.first-A.second)==abs(B.first-B.second))
            return A.first>B.first;
        return abs(A.first-A.second)<abs(B.first-B.second);
    }
};
// int prime[100005]={0};
// void sieve(void)
// {
//  int i,j;
//  for(i=0;i<100005;i++)
//         prime[i]=1;
//  prime[0]=0,prime[1]=0;
//  for(i=2;i<=sqrt(100005);i++){
//      if(prime[i]){
//          for(j=i*i;j<100005;j+=i){
//              prime[j]=0;
//          }
//      }
//  }
    
// }
void swap(int &x,int &y){
    int temp=x;
    x=y;
    y=temp;
}

void solve()
{   
    int n;
    cin>>n;
    vector<int> v(n);
    for(auto &it : v)
        cin>>it;
    sort(v.begin(),v.end());
    double ans=0;
    ans=((double)v[0]+v[1])/2;
    for(int i=2;i<n;i++){
        ans=(ans+v[i])/2;
    }
    cout<<fixed;
    cout<<setprecision(5);
    cout<<ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}


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

assumption = 0
a = 0
b = 0


for i in range(N - 1):
  a += A[i +1]
 
  b += A[i]
 
  
  if assumption > A[i +1] - A[i]:
    assumption = assumption
  else:
    assumption = A[i +1] - A[i]
  

if assumption > (K - A[-1] + A[0]):
  result = a - b - assumption +  (K - A[-1] + A[0])

else:
  result = a - b 
 
print(result)


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

n, m = map(int, input().split()) 
a_list = list(map(int, input().split())) 

num_cnt_dict = {}
for a in a_list:
    num_cnt_dict.setdefault(a,0)
    num_cnt_dict[a] += 1

for i in range(m):
    b, c = map(int, input().split()) 
    num_cnt_dict.setdefault(c,0)
    num_cnt_dict[c] += b

# print(num_cnt_dict)

curr_sum = 0
curr_n_cnt = 0
num_cnt_list = sorted(num_cnt_dict.items(), key=lambda x:x[0], reverse=True)
# print(num_cnt_list)
for num_cnt in num_cnt_list:
    num = num_cnt[0]
    cnt = num_cnt[1]
    if n - curr_n_cnt > cnt:
        curr_sum += num*cnt
        curr_n_cnt += cnt
    else:
        curr_sum += num*(n- curr_n_cnt)
        break

print(curr_sum)

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

#define FO(i,a,b) for (int i = (a); i < (b); i++)
#define sz(v) int(v.size())

using namespace std;

int n, k;
vector<int> u[2005];
int ss[2005];
int f[2005][2005];
int tmp[2005];

void go(int i, int p) {
    ss[i] = 1;
    vector<int> c;
    for (int j : u[i]) if (j != p) {
        go(j, i);
        ss[i] += ss[j];
        c.push_back(j);
    }
    //printf("ss[%d]=%d\n", i, ss[i]);
    int cs = 1;
    for (int j : c) {
        int ncs = cs + ss[j];
        FO(a,0,ncs) tmp[a] = 1e9;
        FO(a,0,cs) FO(b,0,ss[j]) if (a+b+1 <= k) {
            tmp[max(a,b+1)] = min(tmp[max(a,b+1)], f[i][a]+f[j][b]);
        }
        FO(a,cs,ncs) f[i][a] = f[i][a-1];
        FO(a,0,ncs) f[i][a] = min(tmp[a], f[i][a] + ss[j]);
        FO(a,1,ncs) f[i][a] = min(f[i][a], f[i][a-1]);
        cs = ncs;
    }

    //FO(j,0,ss[i]) printf("f[%d][%d]=%d\n", i+1, j, f[i][j]);
}

int main() {
    scanf("%d %d", &n, &k);
    FO(i,0,n-1) {
        int a, b; scanf("%d %d", &a, &b); a--; b--;
        u[a].push_back(b);
        u[b].push_back(a);
    }
    go(0,-1);
    int res = 1e9;
    FO(i,0,n) {
        res = min(res, f[i][ss[i]-1] + n - ss[i]);
    }
    printf("%d\n", res);
}



Measured memory_bytes: 13184
import java.util.*;

public class Main {
	static String N;
	public static long mama(int ini, int fina, long pepe) {
		if(fina>=N.length()&ini>=N.length())return pepe;
		if(fina>=N.length()) return mama(fina,fina,pepe+=Long.parseLong(N.substring(ini,fina)));
		return mama(fina,fina+1,pepe+Long.parseLong(N.substring(ini,fina)))+
				mama(ini,fina+1,pepe);
	}
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		N = scn.next();
		System.out.println(mama(0,1,0L));
		scn.close();
	}
}

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

s = input().strip()
if s[0] == "A":
    if s[2:-1].count("C") == 1:
#        print(s[2:-1])
        tmp = s[2:-1].replace("C","",1)
        s = s[1:2] + tmp + s[-1]
#        print(s)
        b = True
        for c in s:
            if c < "a":
                b = False
                break
        if b:
            print("AC")
            exit()
print("WA")


Measured memory_bytes: 3060
def sort(num):
    for i in range(len(num) - 1):
        for j in range(i + 1, len(num)):
            if num[i] > num[j]:
                tmp = num[i]
                num[i] = num[j]
                num[j] = tmp
                
    return num
            
num = input("").split()

num = sort(num)

a = int(num[0])
b = int(num[1])
c = int(num[2])
    
print(f"{a} {b} {c}")


Measured memory_bytes: 5612
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static int[] e;
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            e = new int[n + 1];

            foreach (var i in Enumerable.Range(2, n  - 1))
            {
                var cur = i;
                foreach ( var j in Enumerable.Range(2, i - 1))
                {
                    while (cur % j == 0)
                    {
                        e[j]++;
                        cur /= j;
                    }
                }
            }

            var ans = Num(75) + Num(25) * (Num(3) - 1) + Num(15) * (Num(5) - 1) + Num(5) * (Num(5) - 1) * (Num(3) - 2) / 2;
            Console.WriteLine(ans);
        }

        static int Num(int m)
        {
            return e.Count(z => z >= m - 1);
        }
    }
}


Measured memory_bytes: 13268
/*"Nothing is true."*/
#include<bits/stdc++.h>
using namespace std;
inline int min(int _a, int _b) {return _a < _b ? _a : _b;}
inline int max(int _a, int _b) {return _a > _b ? _a : _b;}
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;

template <class _T> inline void rd(_T &_a) {
	int _f=0,_ch=getchar();_a=0;
	while(_ch<'0' || _ch>'9'){if(_ch=='-')_f=1;_ch=getchar();}
	while(_ch>='0' && _ch<='9')_a=(_a<<1)+(_a<<3)+_ch-'0',_ch=getchar();
	if(_f)_a=-_a;
}

int a[200], s[200], ss[200], n;

int main() {
	//freopen("Atcoder090_c.in","r",stdin);
	//freopen("Atcoder090_c.out","w",stdout);
	rd(n);
	for(int i = 1, x;i <= n; ++i) {
		rd(x);
		s[i] = s[i - 1] + x;
	}
	for(int i = 1;i <= n; ++i) rd(a[i]);
	for(int i = n;i >= 1; --i) {
		ss[i] = ss[i + 1] + a[i];
	}
	int ans = 0;
	for(int i = 1;i <= n; ++i) {
		ans = max(ans, s[i] + ss[i]);
	}
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <string>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if((a*b)%2 == 0)cout << "Even" << endl;
    else cout << "Odd" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
char a;
int main()
{
	cin >> a;
	if (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
		{
			cout << "vowel";
		}
		else
			{
				cout << "consonant";
			}
	return 0;	
 } 

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


int isprime(int c) {
	if (c == 1) return 0;
	int i;
	for (i = 2; i*i <= c; i++) {
		if (c%i == 0) {
			return 0;
		}
	}
	return 1;
}



int main(void) {
	int q, i, k;
	scanf("%d", &q);
	int l[q + 10];
	int r[q + 10];
	int count=0;
	int a, b, c;
	int maxl = 0;
	int maxr = 0;
	int sup,ans;
	for (i = 0; i < q; i++) {
		scanf("%d %d", &l[i], &r[i]);
		maxl = max(l[i], maxl);
		maxr = max(r[i], maxr);

	}
	sup = max(maxl, maxr);
	int anscount[sup + 10];
	anscount[0] = 0;
	anscount[1] = 0;
	for (i = 2; i < sup + 1; i++) {
		c = i + 1;
		if (c % 2 == 0) {
			c = c / 2;
			a = isprime(i);
			b = isprime(c);
			if (a == 1 && b == 1) {
				count++;
			}
			anscount[i] = count;
		}
	}
	for (i = 0; i < q; i++) {
		ans = anscount[r[i]] - anscount[l[i]];
		c = l[i] + 1;
		if (c % 2 == 0) {
			c = c / 2;
			a = isprime(l[i]);
			b = isprime(c);
			if (a == 1 && b == 1) {
				ans = ans + 1;

			}
			
		}
		printf("%d\n", ans);
	}

	return 0;

}


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

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

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

}

Measured memory_bytes: 3612
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    B solver = new B();
    solver.solve(1, in, out);
    out.close();
  }

  static class B {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
      int N = in.nextInt();
      long res = 0;

      for (int i = 1; i <= N; i++) {
        if (i % 3 != 0 && i % 5 != 0) res += i;
      }
      out.print(res);
    }

  }
}



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

int main(){
    string S;
    cin >> S;
    int N;
    N = S.size() / 2;
    int cnt=0;
    rep(i, N){
        if(S[i] != S[S.size()-1-i]){
            //cout << S[i] << " "<<S[N-1-i]<<endl;
            cnt++; 
        }
    }
    cout << cnt << endl;
}


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

class Solution {
  vector<bool> freeRow, freeCol;
  int freeRowNum, freeColNum;
  int n, m;
  struct Place {
    int num;
    int id;
    Place(int num, int id) : num(num), id(id) {}
    bool operator<(Place oth) const {
      return num < oth.num;
    }
  };
  vector<Place> row, col;
  const long long MOD = 1e9 + 7;
public:
  void run(istream &in, ostream &out) {
    in >> n >> m;
    freeRow.assign(n, false);
    freeRowNum = n;
    freeCol.assign(m, false);
    freeColNum = m;
    for (int i = 0; i < n; ++i) {
      int a; in >> a;
      row.emplace_back(a, i);
    }
    for (int i = 0; i < m; ++i) {
      int a; in >> a;
      col.emplace_back(a, i);
    }
    sort(row.begin(), row.end());
    sort(col.begin(), col.end());
    auto rowFront = [&](int a) -> bool {
      return row.size() and row.back().num == a;
    };
    auto colFront = [&](int a) -> bool {
      return col.size() and col.back().num == a;
    };
    long long ans = 1;
    for (int i = n * m; i >= 1; --i) {
      if (rowFront(i) and colFront(i)) {
        ans *= 1;
        freeRow[row.back().id] = true;
        --freeRowNum;
        row.pop_back();

        freeCol[col.back().id] = true;
        --freeColNum;
        col.pop_back();
      }
      else if (rowFront(i)) {
        ans = ans * (m - freeColNum) % MOD;
        freeRow[row.back().id] = true;
        --freeRowNum;
        row.pop_back();
      }
      else if (colFront(i)) {
        ans = ans * (n - freeRowNum) % MOD;
        freeCol[col.back().id] = true;
        --freeColNum;
        col.pop_back();
      }
      else {
        ans = ans * ((m - freeColNum) * (n - freeRowNum) - n * m + i)% MOD;
      }
    }
    out << ans << '\n';;
  }
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  Solution().run(cin, cout);
  return 0;
}



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

int main(){
    int n;
    cin >> n;
    vector<int> v;
    int sum = 0;
    for(int i=0;i<n;++i){
        int s;
        cin >> s;
        sum += s;
        if(s % 10 > 0)v.push_back(s);
    }

    if(sum % 10 > 0)cout << sum << endl;
    else if(v.size() == 0)cout << 0 << endl;
    else{
        sort(v.begin(), v.end());
        cout << sum - v[0] << endl;
    }

    return 0;
}


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

using namespace std;

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

    vector<int> E(N + 1, 0), W(N + 1, 0);
    for (int q = 0; q < M; ++q) {
        string S;
        cin >> S;
        int cnt = 0;
        for (int i = 1; i <= N; ++i) {
            if (S[i - 1] == 'E') ++cnt;
            E[i] += cnt;
        }

        reverse(S.begin(), S.end());
        cnt = 0;
        for (int i = 1; i <= N; ++i) {
            if (S[i - 1] == 'W') ++cnt;
            W[i] += cnt;
        }
    }

    int ans = 0, mincost = W[N];  // 左からans個がW
    for (int i = 1; i <= N; ++i) {
        int cost = E[i] + W[N - i];
        if (cost < mincost) {
            ans = i;
            mincost = cost;
        }
    }

    cout << ans << " " << ans + 1 << endl;
    return 0;
}



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

const int MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; ++i) cin >> A[i];

  long long res = 0;
  long long two_factor = 1;
  for (int d = 0; d < 60; ++d) {
    long long even = 0, odd = 0;
    for (int i = 0; i < N; ++i) {
      if (A[i] & (1LL << d))
        ++odd;
      else
        ++even;
    }
    long long add = (odd * even) % MOD * two_factor % MOD;
    res = (res + add) % MOD;
    two_factor = (two_factor * 2) % MOD;
  }
  cout << res << endl;
}


Measured memory_bytes: 5620
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long int
#define INF 5000000000000000000

int main(){
    int n,ink;
    cin >> n >> ink;
    vector<LL> x(n),y(n);
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i];
    }

    LL result = INF;

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            for(int k = 0; k < n; k++){
                for(int l = 0; l < n; l++){
                    LL xb = min(x[l],min(x[k],min(x[i],x[j])));
                    LL xa = max(x[l],max(x[k],max(x[i],x[j])));
                    LL yb = min(y[l],min(y[k],min(y[i],y[j])));
                    LL ya = max(y[l],max(y[k],max(y[i],y[j])));
                    int count = 0;
                    for(int s = 0; s < n; s++){
                        if(x[s] <= xa && x[s] >= xb && y[s] <= ya && y[s] >= yb){
                            count++;
                        }
                    }
                    if(count >= ink){
                        if(result > (xa-xb)*(ya-yb)){
                            result = (xa-xb)*(ya-yb);
                        }
                    }
                }
            }
        }
    }

    cout << result << endl;

    
    return 0;
}

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

using namespace std;

int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  int index=0;
  int count=0;
  while(s.find("ABC",index)!= string::npos){
    auto z=s.find("ABC",index);
    count++;
    //cout<<z<<endl;
    index=z+1;
    //cout<<index<<endl;
  }
  cout<<count<<endl;
  return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = 1e9;
const LL LLINF = 1e18;

void solve()
{
    LL x;
    cin >> x;
    cout << 2 * (x / 11) + ((x % 11) != 0) * ((x % 11) <= 6 ? 1 : 2) << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}

Measured memory_bytes: 256