akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
#include <map>

using namespace std;

int N , K;
char s[20];
int d[26];

int main(){
	scanf("%d%d" , &N , &K);
	for(int i = 0 ; i < N ; ++i){
		scanf(" %s" , s);
		++d[s[0] - 'A'];
	}
	int ans = 0;
	bool b = 1;
	while(b){
		sort(d , d + 26 , greater<int>());
		for(int i = 0 ; i < K ; ++i){
			if(d[i] == 0){
				b = 0;
			}
			--d[i];
		}
		if(b) ++ans;
	}
	printf("%d\n" , ans);
	return 0;
}


Measured memory_bytes: 128
// DP
package main

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

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

type intSlice []int

func (s intSlice) fill(x int) {
	for i := 0; i < len(s); i++ {
		s[i] = x
	}
}

func main() {
	const maxW = 100000

	N := readInt()
	W := readInt()

	dp := make(intSlice, maxW+1)
	dp.fill(math.MaxInt64)
	dp[0] = 0

	for i := 0; i < N; i++ {
		w := readInt()
		v := readInt()
		for j := maxW - v; j >= 0; j-- {
			if dp[j] == math.MaxInt64 {
				continue
			}
			if dp[j]+w <= W {
				dp[j+v] = min(dp[j+v], dp[j]+w)
			}
		}
	}
	i := maxW
	for dp[i] == math.MaxInt64 {
		i--
	}
	fmt.Println(i)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


Measured memory_bytes: 1408
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
int dp[6][1010];//動的計画法
int prime[10000001];
char str[1010][1010];
vector<pair<int,int> > pc[100001];
int ABS(int a){return max(a,-a);}
int main(){
   string str;
   int count=0;
   cin>>str;
    if(str[0]!='A'){ 
        cout<<"WA"<<endl;
        return 0;
    }
    if(str[str.length()-1]=='C'||str[1]=='C'){
        cout<<"WA"<<endl;
        return 0;
    }
    if((str[1]>='A')&&(str[1]<='Z')){
        cout<<"WA"<<endl;
        return 0;
    }
    for(int i=2;i<str.length();i++){
        if(str[i]=='C') count++;
        if(count==2){
            cout<<"WA"<<endl;
            return 0;
        }
      if((str[i]=='A')||(str[i]=='B')||((str[i]>='D')&&(str[i]<='Z'))){
        cout<<"WA"<<endl;
        return 0;
        }
    }
    if(count==0) cout<<"WA"<<endl;
    else cout<<"AC"<<endl;
    return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
const ll INF=1e9+7;
const ll N = 200002;
string s;
vector<string> ans;
set<string> se;
ll k;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>s>>k;
	FOR(i,0,s.size()){
		FOR(j,1,6){
			if(i+j<=s.size()){
				string t=s.substr(i,j);
				if(se.count(t)!=1){
					ans.pb(t);
					se.insert(t);
				}
			}
		}
	}
	SORT(ans);
	cout<<ans[k-1]<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<math.h>

#define MAX 100
#define INF INFINITY

void matrixChain(int *);

int n,m[MAX][MAX];


int main()
{
  int i,p[MAX],skip;

  scanf("%d",&n);

  for(i = 0 ; i < n ; i++)
    {
      scanf("%d %d",&p[i],&skip);
    }
  
  if(i == n) p[n] = skip;
 
  matrixChain(p);
  
  printf("%d\n",m[1][n]);
  
  return 0;
}

void matrixChain(int *p)
{
  int i,j,l,q,k;
  
  for(i = 1 ; i <= n ; i++)
    {
      m[i][i] = 0;
    }

  for(l = 2 ; l <= n ; l++)
    {
      for(i = 1 ; i <= n-l+1 ; i++)
	{
	  j = i+l-1;
	  m[i][j] = INF;
	  for(k = i ; k < j ; k++)
	    {
	      q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
	      if(m[i][j] > q) m[i][j] = q;
	    }
	}
    }

  return;
}



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

int main()
{
	string S;
	cin >> S;

	int w;
	cin >> w;

	string result = "";

	int i = 0;
	while (i < S.size())
	{
		result += S[i];
		i += w;
	}

	cout << result <<endl;
	
	return 0;
}

Measured memory_bytes: 256
import queue

N, M = map(int, input().split())
graph = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    graph[A-1].append(B-1)
    graph[B-1].append(A-1)

up = [-1 for _ in range(N)]
up[0] = 0

q = queue.Queue()
q.put(0)
while not q.empty():
    now = q.get()
    for x in graph[now]:
        if up[x] != -1:
            continue
        up[x] = now
        q.put(x)

print('Yes')
for i in range(1, N):
    print(up[i]+1)

Measured memory_bytes: 34316
using System;
using System.Collections;
using System.Linq;


public class Test
{	public static void Main()
	{
		string[] line = Console.ReadLine().Split(' ');

		if(line[1] == "+")
		{
			Console.WriteLine(int.Parse(line[0]) + int.Parse(line[2]));
		}
		else
		{
			Console.WriteLine(int.Parse(line[0]) - int.Parse(line[2]));
		}
	}
}

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

#define ll long long
#define sd(x) scanf("%d", &(x))
#define pii pair<int, int>
#define F first
#define S second
#define all(c) ((c).begin()), ((c).end())
#define sz(x) ((int)(x).size())
#define ld long double

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<", "<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	for(int i = 0;i < (int)v.size(); i++){
		if(i)os<<", ";
		os<<v[i];
	}
	os<<"}";
	return os;
}

#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int N = 5005;
int dp[N][N], dp2[N][N], prefdp[N];
int p2[N];
const int mod = 1e9 + 7;
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
	int x = 1 % mod;
	while(b){
		if(b & 1) x = mul(x, a);
		a = mul(a, a);
		b >>= 1;
	}
	return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main(){
	p2[0] = 1;
	for(int i = 1; i < N; i++) p2[i] = add(p2[i - 1], p2[i - 1]);
	int n, A, B; cin >> n >> A >> B;
	if(A > B) swap(A, B);
	for(int j = 0; j <= n; j++) dp[j][B] = dp2[j][B] = p2[j];
	for(int j = 1; j <= n; j++){
		for(int i = 0; i < B; i++){
			dp[j][i] = dp[j - 1][i + 1];
			// < A zeroes, then one
			dp[j][i] = add(dp[j][i], sub(
				j >= 2 ? prefdp[j - 2] : 0, j - A - 1 < 0 ? 0 : prefdp[j - A - 1]));
			// atleast A zeroes
			if(j >= A){
				dp[j][i] = add(dp[j][i], dp2[j - A][min(B, i + A)]);
			}
			dp2[j][i] = add(dp2[j - 1][i + 1], dp[j - 1][i + 1]);
			if(i == 1) prefdp[j] = add(prefdp[j - 1], dp[j][i]);
		}
	}
	cout << dp[n][0] << endl;
}

Measured memory_bytes: 199172
// Born Sinner
// old but im not that old
// fuck all you hoes get a grip
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;

public class Main
{
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next(){
            while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
        long nextLong(){
            return Long.parseLong(next());
        }
        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            } catch (Exception e){
                e.printStackTrace();
            }
            return str;
        }
    }
    static int modPower(int x, int y, int mod){
        int res = 1;
        x %= mod;
        if(x==0) return 0;
        while(y>0){
            if(y%2==1){
                res = (res*x)%mod;
            }
            y = y>>1;
            x = (x*x)%mod;
        }
        return res;
    }
    static class pair<T1, T2>{
        T1 first;
        T2 second;
        pair(T1 first, T2 second){
            this.first = first;
            this.second = second;
        }
    }
    static int gcd(int a, int b){
        if(b == 0) return a;
        return gcd(b, a%b);
    }

    public static void main (String[] args) throws java.lang.Exception
    {
        FastReader in = new FastReader();
        int n = in.nextInt();
        while(n-->0) System.out.print("ACL");
    }
}


Measured memory_bytes: 32548
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const int MAXN = 100010;
const int INF = 2147483600;
const LL Mod = 1000000007LL;

int N; LL a[MAXN+1]; 
LL fac[MAXN+1],f[MAXN+1],ifac[MAXN+1],inv[MAXN+1];

inline LL C(LL n,LL m){
	return fac[n]*ifac[m]%Mod*ifac[n-m]%Mod;
}

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read(); for(int i=1;i<=N;i++) a[i]=read(); fac[0]=1; ifac[0]=1; inv[1]=1;
	for(int i=2;i<=N;i++) inv[i]=(Mod-(Mod/i)*inv[Mod%i]%Mod)%Mod;
	for(int i=1;i<=N;i++){
		fac[i]=fac[i-1]*i%Mod; ifac[i]=ifac[i-1]*inv[i]%Mod;
		f[i]=(f[i-1]*i%Mod+f[i-1]+fac[i])%Mod;
	} LL ans=0;
	for(int i=1;i<=N;i++){
		int d=(f[i-1]*fac[N-i]%Mod*C(N,i)%Mod+f[N-i]*fac[i-1]%Mod*C(N,N-i+1)%Mod)%Mod;
		(ans+=d*a[i]%Mod+fac[N]*a[i]%Mod)%=Mod;
	} printf("%lld\n",ans);
	return 0;
}




Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b
ll f(ll a,ll b){
	if(b==0)return 1;
	if(b%2==0){
		ll t=f(a,b/2);
		return t*t;
	}
	return a*f(a,b-1);
}

signed main(){
	int n; cin>>n;
	vl a(n);
	vl b(n);
	vl c(n);
	rep(i,0,n)cin>>a[i];
	rep(i,0,n){
		c[i]++;
		if(a[i]%2==1)b[i]++;
		if((a[i]-1)%2==1)b[i]++;
		c[i]++;
		if((a[i]+1)%2==1)b[i]++;
		c[i]++;
	}
	ll x=1,y=1;
	rep(i,0,n)x*=c[i],y*=b[i];
	cout<<x-y<<endl;
	//cout<<x<<" "<<y<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define bg begin()
#define end end()
#define sz size()
#define vi vector<int>
#define vl vector<long long int>
int main(){
	fast;
	ll a,b;
	cin>>a>>b;
	if(a+b>9)
		cout<<"error";
	else
		cout<<a+b;
	return 0;
}



Measured memory_bytes: 3568
#include "bits/stdc++.h"
using namespace std;
int main()
{
	int a, b;
	string s;
	cin >> a >> b >> s;
	for(int i = 0; i < a; ++i)
	{
		if(s[i] < '0' || '9' < s[i])
		{
			printf("No\n");
			return 0;
		}
	}
	if(s[a] != '-')
	{
		printf("No\n");
		return 0;
	}
	for(int i = a + 1; i <= a + b; ++i)
	{
		if(s[i] < '0' || '9' < s[i])
		{
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
}

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

typedef vector<vector<int> > Graph;

const int MAXN = 15;
const int MAXM = 101;

int N, M;
double P;
vector<int> U, V;
double dp[1<<MAXN];

int main() {
  cin >> N >> M >> P;
  P /= 100.0;
  for(int i = 0; i < M; ++i) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    U.push_back(a);
    V.push_back(b);
  }

  for(int i = 1; i < (1<<N); ++i) {
    dp[i] = 1.0;
    int v0 = 1;
    while(!(i & v0)) v0 <<= 1;
    for(int j = i; j; j = (j-1) & i) {
      if(j == i) continue;
      if(!(j & v0)) continue;
      double q = 1.0;
      for(int k = 0; k < M; ++k) {
        if(i >> U[k] & 1 && i >> V[k] & 1 &&
           (j >> U[k] & 1) ^ (j >> V[k] & 1)) {
          q *= P;
        }
      }
      dp[i] -= dp[j] * q;
    }
  }
  printf("%.12f\n", dp[(1<<N) - 1]);
  return 0;
}

Measured memory_bytes: 1392
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[0].split(" ");
  var N = parseInt(tmp[0], 10);
  var D = parseInt(tmp[1], 10);

  var intInput = [];

  for(var i=1; i<=N; i++){
    intInput[i-1] = toIntAll(input[i].split(" "));
    // console.log(intInput[i-1]);
  }


  var count = 0;
  for(var i=0; i<(N-1); i++){
    for(var j=i+1; j<N; j++){
      var result = calcDistance(intInput[i], intInput[j]);
      if(Number.isInteger(result)){
        count++;
        // console.log(["final ",i,j,result]);
      }
    }
  }
  console.log('%d',count);
}

function toIntAll(input){
  var out = []
  for(var i=0; i<input.length; i++){
    out[i] = parseInt(input[i]);
  }
  return out;
}

function calcDistance(yArr, zArr){
  var sum = 0;
  // console.log(yArr);
  // console.log(yArr.length);
  
  for(var i=0; i<yArr.length; i++){
    sum += Math.pow(yArr[i] - zArr[i], 2);
    // console.log([yArr[i],zArr[i],sum]);
  }
  sum = Math.sqrt(sum);;
  // console.log(sum);
  return sum;
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

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

using namespace std;

typedef int Weight;
struct Edge{
  int src, dest; Weight weight;
  bool operator < (const Edge &rhs) const {return weight < rhs.weight;}
};

typedef vector<Edge> Edges;

// Light version

struct UnionFind {
  vector<int> p;
  UnionFind (int n) { p.assign(n, -1); }
  int root(int x) { return p[x] < 0 ? x : p[x] = root(p[x]); }
  void merge(int x, int y) { if (root(x) != root(y)) p[root(y)] = x; }
};

// Kruskal
// N, operator <
Edges kruskal(UnionFind& uf, Edges &es) {
  Edges res;
  REP(i, es.size()) {
    Edge e = es[i];
    if(uf.root(e.src) != uf.root(e.dest)) {
      uf.merge(e.src, e.dest);
      res.push_back(e);
    }
  }
  return res;
}

int main() {
  while(1){
    int n,m;
    cin>>n>>m;
    if(!n)break;
    multimap<int,int> hm;
    vector<int> hv;
    REP(i,n) {
      int h;
      cin>>h;
      hm.insert(make_pair(h,i));
      hv.push_back(h);
    }
    Edges es;
    REP(i,m) {
      int a,b,c;
      cin>>a>>b>>c;
      --a;--b;
      es.push_back((Edge){a,b,c});
    }
    sort(es.begin(), es.end());
    int64_t csum = 0;
    UnionFind uf(n);
    for(int i=1000000; i>0; --i) {
      auto p = hm.equal_range(i);
      if (p.first == p.second) continue;
      Edges ee;
      for(Edge e:es) {
        if (hv[e.src] >= i && hv[e.dest] >= i) ee.push_back(e);
      }
      vector<int> iss;
      REP(j,n)
        if (hv[j] >= i)
          iss.push_back(j);
      Edges brg = kruskal(uf,ee);
      bool ok = true;
      REP(j,iss.size()) {
        if (uf.root(iss[j]) != uf.root(iss[0]))
          ok = false;
      }
      if (!ok) {
        csum = 0;
        uf = UnionFind(n);
      } else {
        for (Edge e:brg) {
          csum += e.weight;
        }
      }
    }
    cout << csum << endl;
  }
  return 0;
}

Measured memory_bytes: 2144
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

typedef pair<int, int> P;


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

	reple(i, 1, 50000)
	{
		int tmp = (int)floor(i * 1.08);
		if (tmp == n)
		{
			cout << i << endl;
			return 0;
		}
	}

	cout << ":(" << endl;
	return 0;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    ll N;
    cin >> N;
    vector<ll> F(N);
    REPS(i,sqrt(N)+1){
        REPS(l,sqrt(N)+1){
            REPS(r,sqrt(N)+1){
                if(i*i+l*l+r*r+i*l+l*r+r*i <= N){
                    F[i*i+l*l+r*r+i*l+l*r+r*i-1]++;
                }
            }
        }
    }
    REP(i,N)cout << F[i] << "\n";
}

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

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
using vi  = vector<int>;
using vvi = vector<vi>;

int n, m;
vvi g;
vi color; // 0:未彩色、1,-1:彩色済み

int dfs(int s){ // sを根としてdfs
  stack<int> st;
  color[s] = 1;
  st.push(s);
  
  while(!st.empty()){
    int now = st.top();
    st.pop();
    
    rep(i, g[now].size()){
      int next = g[now][i];

      if(color[next]){
	if(color[now] != color[next]) continue;
	else return next;
      }
      
      color[next] = -color[now];
      st.push(next);
    }
  }
  return -1;
}

int paintable(){
  rep(i,n)
    if(color[i] == 0){
      int res = dfs(i);
      if(res != -1) return res;
    }
  return -1;
}

signed main(){
  while(cin >> n >> m, n){
    g.clear();
    g.resize(n);
    rep(i,m){
      int u, v; cin >> u >> v;
      u--; v--;
      g[u].push_back(v);
      g[v].push_back(u);
    }

    color.clear();
    color.resize(n);
    int res = paintable();
    if(res != -1){
      cout << 0 << endl;
      continue;
    }
    set<int> ans;
    int pos = 0, neg = 0;
    rep(i,n)
      if(color[i] == 1) pos++;
      else neg++;
    if(pos % 2 == 0) ans.insert(pos/2);
    if(neg % 2 == 0) ans.insert(neg/2);
    cout << ans.size() << endl;
    for(auto a : ans)
      cout << a << endl;
  }
}


Measured memory_bytes: 3080
#include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef unsigned long long u64;
typedef signed long long l64;
u64 over = 1000000007;

void comb(vector<vector <long long int> > &v){
  for(int i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(int k = 1;k <v.size();k++){
    for(int j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, p;
  cin >> n >> p;
  int odd = 0;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    if (a%2 == 1) odd++;
  }
  int even = n - odd;
  vector<vector<long long int> > v(n+1,vector<long long int>(n+1,0));
  comb(v);
  u64 ret = 0;
  for (int i = p; i <= odd; i+=2) {
    ret += v[odd][i];
  }
  for (int i = 0; i < even; ++i) {
    ret *= 2;
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        if(s.equals("Sunny")){
            System.out.println("Cloudy");
        }else if(s.equals("Cloudy")){
            System.out.println("Rainy");
        }else{
            System.out.println("Sunny");
        }
    }
}

Measured memory_bytes: 21460
S = input()
N = len(S)

if N == 1:
    print(S)
    exit()

ans = 0
for i in range(2 ** (N - 1)):
    signs = bin(i)[2:].zfill(N - 1).replace('0', '+').replace('1', ' ')

    tmp_s = S[0]
    for j, sign in enumerate(signs):
        tmp_s += sign + S[j + 1]

    ans += eval(tmp_s.replace(' ', ''))

print(ans)


Measured memory_bytes: 38896
#include<iostream>
#include<cstdio>
#define pi 3.141592653589
using namespace std;	

int main(){
	double r;
	cin >> r;
	double men = pi * r * r;
	double cir = pi * r * 2.0;
	printf("%f %f\n", men, cir);

	return 0;
}

Measured memory_bytes: 1232
#include <iostream>

using namespace std;
int main() {
        int a, b, c;
        cin >> a >> b >> c;
        if(a == b && a == c)
                cout << "No";
        else if((a == b || a == c) || ((b == a || b == c) || (c == a || c ==b)))
                cout << "Yes";
        else
                cout << "No";
        cout << "\n";
        return 0;
}


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

int n,m,x;
vector<int> c;
vector<vector<int>> a;
int ans = 10000000;

void dfs(int dep, vector<bool> v){
  //cout << dep << endl;
  if(dep == n){
    int mon = 0;
    vector<int> mv = vector<int>(m,0);
    for(int i=0; i<n; ++i){
      if(v[i]){
        mon += c[i];
        for(int j=0; j<m; ++j){
          mv[j] += a[i][j];
        }
      }
    }
    bool tmp = true;
    for(auto i: mv){
      if(i < x){tmp = false;}
    }
    if(tmp && ans > mon){ans = mon;}
    return;
  }
  
  v[dep] = true;
  dfs(dep+1, v);
  v[dep] = false;
  dfs(dep+1, v);
}

int main(){
  cin >> n >> m >> x;
  c = vector<int>(n);
  a = vector<vector<int>>(n);
  //for(auto i: a){i = vector<int>(m);}
  for(int i=0; i<n; ++i){a[i] = vector<int>(m);}
  //cout << "frg1" << endl;
  for(int i=0; i<n; ++i){
    cin >> c[i];
    for(int j=0; j<m; ++j){
      cin >> a[i][j];
    }
  }
  //cout << "frg2" << endl;
  vector<bool> frg = vector<bool>(n,0);;
  dfs(0, frg);
  if(ans != 10000000){cout << ans << endl;}
  else{cout << -1 << endl;}
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cout << #x << ": " << x << '\n';

const int MOD = 1000 * 1000 * 1000 + 7;

int mod(int n) {
    n %= MOD;
    if (n < 0) return n + MOD;
    else return n;
}   
int fp(int a, int p) {
    int ans = 1, c = a;
    for (int i = 0; (1ll << i) <= p; ++i) {
        if ((p >> i) & 1) ans = mod(ans * c);
        c = mod(c * c);
    }   
    return ans;
}   
int dv(int a, int b) { return mod(a * fp(b, MOD - 2)); }

struct M {
ll x;
M (int x_) {
    x = mod(x_);
}   
M () {}
M operator + (M y) {
    int ans = x + y.x;
    if (ans >= MOD)
        ans -= MOD;
    return M(ans);
}
M operator - (M y) {
    int ans = x - y.x;
    if (ans < 0)
        ans += MOD;
    return M(ans);            
}   
M operator * (M y) {
    return M(x * y.x % MOD);   
}   
M operator / (M y) {
    return M(x * fp(y.x, MOD - 2) % MOD);
}   
M operator + (int y) {
    return (*this) + M(y);
}
M operator - (int y) {
    return (*this) - M(y);
}   
M operator * (int y) {
    return (*this) * M(y);
}   
M operator / (int y) {
    return (*this) / M(y);
}   
M operator ^ (int p) {
    return M(fp(x, p));
}   
void operator += (M y) {
    *this = *this + y;
}   
void operator -= (M y) {
    *this = *this - y;
}   
void operator *= (M y) {
    *this = *this * y;
}
void operator /= (M y) {
    *this = *this / y;
}   
void operator += (int y) {
    *this = *this + y;
}   
void operator -= (int y) {
    *this = *this - y;
}   
void operator *= (int y) {
    *this = *this * y;
}
void operator /= (int y) {
    *this = *this / y;
}   
void operator ^= (int p) {
    *this = *this ^ p;
}
};  

const int N = 2e5+7;
M f[N], inv[N];
void prec() {
    f[0] = M(1);
    for (int i = 1; i < N; ++i)
        f[i] = f[i - 1] * M(i);
    inv[N - 1] = fp(f[N - 1].x, MOD - 2);
    for (int i = N - 2; i >= 0; --i)
        inv[i] = inv[i + 1] * M(i + 1);
}
M C(int n, int k) {
    return f[n] * inv[k] * inv[n - k];
}   

signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n, A, B;
    cin >> n >> A >> B;

    prec();    

    vector <M> ex(2 * n);
    for (int i = 0; i < 2 * n; ++i) {
        ex[i] = M(i) / ( M(A + B) / M(100) );
    }   

    M ans(0);           
    M pa = M(A) / M(A + B);
    M pb = M(B) / M(A + B);
    for (int i = 0; i < n; ++i) {
        // A * n + B * i
        M en = C(n + i - 1, i) * ((pa ^ n) * (pb ^ i));
        ans += en * ex[n + i];                    
    }   
    for (int i = 0; i < n; ++i) {
        // B * n + A * i
        M en = C(n + i - 1, i) * ((pa ^ i) * (pb ^ n));
        ans += en * ex[n + i];
    }   
    cout << ans.x << endl;
}

Measured memory_bytes: 7940
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

const int MAX_N = 1e5+10;
ll dp[MAX_N][3];

ll d[MAX_N][3];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i, n) rep(j, 3) cin >> d[i][j];
    REP(i, 1, MAX_N) rep(j, 3) dp[i][j] = -1e18;
    rep(i, n) {
        rep(j, 3) rep(k, 3) if(j != k) {
            dp[i+1][k] = max(dp[i+1][k], dp[i][j] + d[i][k]);
        }
    }
    ll ans = -1e18;
    rep(i, 3) ans = max(ans, dp[n][i]);
    cout << ans << endl;
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    
    int counter[26] = {0};
    
    for (auto c: s) {
        counter[c - 'a']++;
    }
    
    for (int i = 0; i < 26; i++) {
        if (counter[i] > 1) {
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;
    return 0;
}

Measured memory_bytes: 888
n=str(input())
if any([n[-1]=="2",n[-1]=='4',n[-1]=='5',n[-1]=='7',n[-1]=='9']):
    print('hon')
elif any([n[-1]=="0",n[-1]=='1',n[-1]=='6',n[-1]=='8']):
    print('pon')
else:
    print('bon')

Measured memory_bytes: 9132
n,*a=map(int,open(0).read().split())
b,m=sum(a),n*-~n//2
n-=1
c=b//m
f=b%m>0
for i,j in zip(*[iter([a[-1]]+a*2)]*2):
  j-=i
  if n:
    t=min(0,j//n)
    f|=c!=j+n*-t-t
print('YNEOS'[f::2])

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

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

int main() {
	int a, b, c, d;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	int ans = min(a, b) + min(c, d);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
<?php

$ref = array(
	'black' => array(0, 0, 0),
	'blue' => array(0, 0, 255),
	'lime' => array(0, 255, 0),
	'aqua' => array(0, 255, 255),
	'red' => array(255, 0, 0),
	'fuchsia' => array(255, 0, 255),
	'yellow' => array(255, 255, 0),
	'white' => array(255, 255, 255),
);

while ($line = trim(fgets(STDIN))) {
	$r = hexdec(substr($line, 1, 2));
	$g = hexdec(substr($line, 3, 2));
	$b = hexdec(substr($line, 5, 2));
	$d2 = PHP_INT_MAX;
	$color = '';
	foreach ($ref as $name => $c) {
		$dtmp = ($r - $c[0]) * ($r - $c[0]) + ($g - $c[1]) * ($g - $c[1]) + ($b - $c[2]) * ($b - $c[2]);
		if ($dtmp < $d2) {
			$color = $name;
			$d2 = $dtmp;
		}
	}
	echo $color . "\n";
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using tsii = tuple<string, int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int n,k,ans=0;
    cin>>n>>k;
    vector<int> h(n);
    for (int i = 0; i < n; i++)
    {
        cin>>h[i];
        if(h[i]>=k) ans++;
    }
    
    cout<<ans<<endl;
    return 0;
}

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

int main() {
	int ah,am,sh,sm,k;
	cin>>ah>>am>>sh>>sm>>k;
	int tt=sh-ah;
	tt=tt*60;
	if(sm>=am)
	tt+=sm-am;
	else
	tt-=am-sm;
	cout<<tt-k<<endl;
	return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>



int main(void){

int n;
scanf("%d",&n);
int h=n/3600;
int m=(n%3600)/60;
int s=(n%3600)%60;
printf("%d:%d:%d\n",h,m,s);

return 0;
}



Measured memory_bytes: 2120
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int
main(int argc, char *argv[])
{
    char str[BUFSIZ];

    scanf("%s", str);
    if (str[2] == str[3] && str[4] == str[5]) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }

    return EXIT_SUCCESS;
}


Measured memory_bytes: 128
import fractions
def gcd(x,y):
    if x < y:
        x, y = y, x
    if y == 0:
        return x

    return fractions.gcd(x%y, y)

n = int(input())
a = list(map(int, input().split()))
L = [0]
R = [0]
now1 = 0
now2 = 0
ans = 0

for i in range(n-1):
    now1 = gcd(now1,a[i])
    L.append(now1)

    now2 = gcd(now2,a[-i-1])
    R.append(now2)

for i in range(n):
    ans = max(ans, gcd(L[i], R[n-i-1]))

print(ans)

Measured memory_bytes: 16152
import math
import fractions

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans
'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

'''

#a = list(map(int, input().split()))


x,y,a,b,c = list(map(int, input().split()))

aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
cc = list(map(int, input().split()))

aa.sort(reverse=True)
bb.sort(reverse=True)
cc.sort(reverse=True)

nowa = min(x,a)
nowb = min(y,b)
nowc = (x+y)-nowa-nowb

total = sum(aa[0:nowa])+sum(bb[0:nowb])+sum(cc[0:nowc])
#print(total)
#print(aa,bb,cc)
maxim = total
while(nowc < c and(nowa>0 or nowb >0)):
    nowc += 1
    total += cc[nowc-1]
    if(nowa==0):
        nowb-=1
        total -= bb[nowb]
    elif(nowb==0):
        nowa -= 1
        total -= aa[nowa]
    elif(aa[nowa-1]>bb[nowb-1]):
        nowb-=1
        total -= bb[nowb]
    else:
        nowa -= 1
        total -= aa[nowa]
    if(maxim < total):
        maxim = total
    #print(total,nowa,nowb,nowc)
print(maxim)


Measured memory_bytes: 125604
N = int(input())
A = [input() for _ in range(N)]
if len(set(A)) != N:
  print("No")
  exit()
for i, a in enumerate(A):
  if i == 0:
    continue
  if a[0] != A[i-1][-1]:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 9116
N,X = map(int,input().split())
def func(N,X):
    if N == 0:
        return 1
    elif X == 1:
        return 0
    elif 2 <= X <= 2**(N+1) -2:
        return func(N-1,X-1)
    elif X == 2**(N+1)-1:
        return 2**N
    elif 2**(N+1) <= X <= 2**(N+2)-4:
        return 2**N + func(N-1,X-(2**(N+1)-1))
    else:
        return 2*(2**N)-1
print(func(N,X))

Measured memory_bytes: 3064
# D - Knapsack 1
N,W = map(int,input().split())
value = []
weight = []
for _ in range(N):
    w,v = map(int,input().split())
    value.append(v)
    weight.append(w)

# DP テーブル
# dp[i][j]: i-1 番目までの品物から重さが j を超えないように選んだときの価値の最大値
# W <= 100000, N <= 100 よりテーブルの個数を決める
dp = [[0]*100010 for _ in range(102)]

# DP テーブル全体を初期化
for i in range(102):
    for j in range(100010):
        dp[i][j] = 0# 最大化問題

# DP ループ
# v-1 番目の荷物に対する情報を dp[v] に記録
for v in range(1,N+1):
    for w in range(W+1):
        # v-1 番目の品物を選ぶ場合
        if (w - weight[v-1]) >= 0:
            dp[v][w] = max(dp[v][w],dp[v-1][w - weight[v-1]] + value[v-1])
        # v-1 番目の品物を選ばない場合
        dp[v][w] =  max(dp[v][w],dp[v-1][w])
        
# 価値の総和の最大値を出力
print(dp[N][W])

Measured memory_bytes: 153656
use proconio::input;

fn main() {
    input! {
        n: usize,
        mut v: [usize; n]
    }

    v.sort();
    
    let arr = {
        let mut arr = vec![true; v[n-1]+1];
        for &x in v.iter() {
            if arr[x] {
                let mut next = x+x;
                while next <= v[n-1] {
                    arr[next] = false;
                    next += x;
                }
            }
        }
        arr
    };

    let ans = {
        let mut ans = 0;
        let mut prev = v[0]-1;
        let mut flag = false;
        for &x in v.iter() {
            if (x != prev) && arr[x] && !flag {
                ans += 1;
            } else if (x != prev) && arr[x] && flag {
                ans += 1;
                flag = false;
            } else if (x == prev) && arr[x] && !flag {
                ans -= 1;
                flag = true;
            }
            prev = x;
        }
        ans
    };

    println!("{}",ans)

}


Measured memory_bytes: 6100
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c;
  cin>>a>>b>>c;
  cout<<a+b+c-max({a,b,c})<<endl;
  return 0;

}


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

int main() {
	int a,b;
  	cin >>a >> b;
  	if(a >= 13)
      cout << b << endl;
  	else if(a <= 5)
      cout << 0 << endl;
  	else
      cout << b/2 << endl;
  	
  
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long unsigned int ll;

ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  int N;
  cin >> N;
  ll lcm = 1LL;
  ll T;
  for (int i = 0; i < N; ++i) {
    cin >> T;
    lcm = T / gcd(T, lcm) * lcm;
  }

  cout << lcm << endl;
  return 0;
}


Measured memory_bytes: 256
def f(k, n):
    n_str = str(n)
    digit = len(n_str)
    head = int(n_str[0])
    rest = int(n_str[1:]) if digit > 1 else 0

    if k == 1:
        return 9*(digit-1) + head
    if k == 2:
        if n <= 10:
            return 0
        else:
            return 9 * (digit-1) * (head-1) + f(1,rest) + f(2, 10**(digit-1)-1)
    if k == 3:
        if n < 111:
            return 0
        else:
            return 9**2 * (digit-1)*(digit-2)//2 * (head-1) + f(2,rest) + f(3, 10**(digit-1)-1)


n = int(input())
k = int(input())

print(f(k,n))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
#define endl '\n'

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[MAX];

void get_all_primes(int upto_primes, vector<int> &primes){
    primes.clear();
    vector < bool > mark(upto_primes +2,true);

    for(int i=3 ; i * i <= upto_primes ; i+=2){
        if(mark[i]){
            for(int j=i*i ; j<=upto_primes ; j+=2*i){
                mark[j]=false;
            }
        }
    }
    primes.push_back(2);
    for(int i=3 ; i<=upto_primes ; i+=2 ){
        if(mark[i]){
            primes.push_back(i);
        }
    };
}

void solve() {
    vi primes;
    get_all_primes(100000 , primes);
    vi c;
    for(int i = 1 ; i < primes.size() ; i++){
        if(binary_search(primes.begin() , primes.end() ,  (primes[i] + 1) / 2))
            c.push_back(primes[i]);
    }
    memset(dp , 0 , sizeof(dp));
    for(auto i : c){
        dp[i] = 1;
    }
    for(int i = 1 ; i < MAX ; i++){
        dp[i] += dp[i-1];
    }
    int q;
    cin>>q;
    while(q--){
        int l , r;
        cin>>l>>r;
        cout<<dp[r] - dp[l-1]<<endl;
    }
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 2420
while True:
    a,op,b=input().split()
    a=int(a)
    b=int(b)
    if op=='?':
        break
    elif op=='+':
        ans=a+b
    elif op=='-':
        ans=a-b
    elif op=='*':
        ans=a*b
    elif op=='/':
        ans=a//b
    print(ans)


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

using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;

#define out(a) cout << a << endl
#define out1(a) cout << a
#define in(a) cin >> a
#define in2(a, b) cin >> a >> b
#define in3(a, b, c) cin >> a >> b >> c
#define rep(i, N) for (ll i = 0; i < (ll)N; i++)
#define rep1(i, N) for (ll i = 1; i <= (ll)N; i++)
#define repi(i, j, N) for (ll j = (ll)i + 1; j < (ll)N; j++)
#define all(v) v.begin(), v.end()

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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;
constexpr ll mod = 1e9 + 7;

void solve();

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

void solve()
{
    string s;
    in(s);
    int ans = 0;
    int flag = 0;
    rep(i, s.size())
    {
        if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C')
        {
            flag++;
        }
        else
        {
            chmax(ans, flag);
            flag = 0;
        }
    }
    chmax(ans, flag);
    out(ans);
}

Measured memory_bytes: 256
// Problem : C - Splitting Pile
// Contest : AtCoder Regular Contest 078
// URL : https://atcoder.jp/contests/arc078/tasks/arc078_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define size(x) (int)x.size()

const int N = 1e6 + 1, mod = 1e9 + 7, inf = 2e9;

int n;
ll ans = LLONG_MAX, sum[N];

int main() { cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	for (int i = 1, x; i <= n; i++) {
		cin >> x;
		sum[i] = sum[i - 1] + x;
	}
	for (int i = 1; i < n; i++) {
		ans = min(ans, abs(2 * sum[i] - sum[n]));
	}
	cout << ans;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>
#define PI 3.1415926

int main ()
{
    double a,b,c,s,l,h,seigen,yogen;
 
    scanf("%lf %lf %lf",&a,&b,&c);
    
	seigen = sin(c/180*PI);
    
	yogen = cos(c/180*PI);
    
	s=a*b*seigen/2;
    
	l=a+b+sqrt(a*a+b*b-2*a*b*yogen);
    
	h=b*seigen;
    
	printf("%f\n%f\n%f\n",s,l,h);
 
    return 0;
}

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

int main(){
    int first = 0;
    int second = 0;
    int third = 0;
    int array[10];
    
    for(int i=0; i<10; i++){
        cin >> array[i];
    }
    sort(array, array+10);
    for(int i=9; i>6; i--){
        cout << array[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	if(s[2]==s[3] && s[4]==s[5]) cout << "Yes";
	else cout << "No";
	return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
#define MAXX 200010
 
#define PI   3.14159265358979323846264338327950
 
#define PB push_back 
#define F first
#define S second
 
#define ll 	long long 
 
#define mod  1000000007
 

 
int main()
{
	FAST;
	int a[7];
	int x = 0;
	int o = 0;
	for(int i = 0; i < 5; i ++){
		cin >> a[i];
		if(a[i] % 10){
			x = max(10 -  a[i]%10, x);
			
		}
		
	}
	int ans = 0;
	for(int i = 0; i < 5; i ++){
		
			ans += a[i];
			if(a[i]% 10 ){
				ans += 10;
			ans -= a[i]%10;
			}
			
		
	}
	ans -= x;
	cout << ans;
	return 0;
}

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

int main(void)
{
    IOS
    int a, b, k;
    cin >> a >> b >> k;
    set<int> ans;
    REP(i,k) {
        auto ret = ans.insert(a+i);
        if (!ret.second) break;
        ret = ans.insert(b-i);
        if (!ret.second) break;
    }

    for(auto x:ans) {
        cout << x << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
//#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
// namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
// using ll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for(ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
// using int = ll;
ll gcd(ll m, ll n) {
    if(n == 0)
        return abs(m);
    return (gcd(n, m % n));
}
void putYN(bool b) {
    if(b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
void swap(ll &a, ll &b) {
    ll tmp = a;
    a = b;
    b = tmp;
}
ll combi(ll n, ll k) {
    ll r = 1, rr = 1;
    for(ll i = 0; i < k; ++i) {
        r *= (n - i);
        rr *= (i + 1);
        // r %= 1000000007;
        // rr %= 1000000007;
    }
    r /= rr;
    // r %= 1000000007;
    return r;
}

int main() { 
    ll N;
    cin >> N;
    vector<string> S(N);
    FOR(i, N) {
        cin >> S[i];
        sort(S[i].begin(), S[i].end());
    }
    sort(S.begin(), S.end());
    FOR(i, N) {
        //cout <<S[i]<< endl;
        ;
    }
    ll num = 0;
    string now = S[0];
    ll same = 1;
    FOR(i, N-1) { 
        ll ii = i + 1;
        if(now==S[ii]){
            num += same;
            same += 1;
        }else{
            same = 1;
            now = S[ii];
        }
    }
    cout << num << endl;
}


Measured memory_bytes: 2560
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

// 1 点更新区間取得
// 条件は要素がモノイドであること（あるいは半群？）

template <typename T, typename E>
struct SegmentTree{
    using F = function<T(T, T)>;
    int n;
    F f;
    T ti;
    vector<T> dat;
    SegmentTree(){};
    SegmentTree(F f, T ti, const vector<int> &v):f(f),ti(ti){
        int sz = v.size();
        n = 1;
        while(n < sz) n <<= 1;
        dat.assign(2 * n - 1, ti);
        for(int i = 0; i < sz; i++) dat[n - 1 + i] = v[i];
        for(int i = n - 2; i >= 0; i--) dat[i] = f(dat[2 * i + 1], dat[2 * i + 2]);
    }

    // x 番目(0 - indexed) の要素を val に更新
    void update(int x, T val){
        x += (n - 1);
        dat[x] = val;
        while(x > 0){
            x = (x - 1) / 2;
            dat[x] = f(dat[2 * x + 1], dat[2 * x + 2]);
        }
    }

    // 区間[a, b)を取得する
    T get(int a, int b, int k, int l, int r){
        if(r <= a || b <= l) return ti;
        if(a <= l && r <= b) return dat[k];
        T vl = get(a, b, k * 2 + 1, l, (l + r) / 2);
        T vr = get(a, b, k * 2 + 2, (l + r) / 2, r);
        return f(vl, vr);
    }
    
    T get(int  a, int b){
        return get(a, b, 0, 0, n);
    }
};


signed main(){

    int n, q; cin >> n >> q;
    int ti = 0;
    vector<int> v(n, ti);
    // 関数, 単位元, 元の配列の順に宣言
    SegmentTree<int, int> rmq([](int a, int b){return a + b;}, ti, v);
    
    for(int i = 0; i < q; i++){
        int c, x, y; cin >> c >> x >> y;
        if(c) cout << rmq.get(x - 1, y) << endl;
        else rmq.update(x - 1, y + rmq.get(x - 1, x));
    }

    return 0;
}




Measured memory_bytes: 5756