akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool has_key(T mp, U key) { return mp.find(key) != mp.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; }
template<class T, class U>T rem(T a, U b) { return a - b*floor(a/b); }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;

bool fittable(string s, string t)
{
        bool flg = true;
        if (count(all(s), '?') == len(s)) return true;
        rep(i, 0, len(s)) {
                if (s[i] == '?' or t[i] == '?') continue;
                if (s[i] != t[i]) flg = false;
        }
        return flg;
}

int main()
{
        string S;
        string T;
        cin >> S >> T;
        ll tlen = len(T);
        bool flg = false;
        ll pos = -1;
        rep(i, 0, len(S) - tlen + 1) {
                string substr = S.substr(i, tlen);
                if (fittable(substr, T)) {
                        pos = i;
                        flg = true;
                }
        }
        
        if (! flg) {
                cout << "UNRESTORABLE" << endl;
                return 0;
        } else {
                rep(j, 0, tlen) {
                        S[pos+j] = T[j];
                }
        }
        //cout << "S: " <<  S << endl;
        rep(i, 0, len(S)) {
                if (S[i] == '?')
                        cout << 'a';
                else
                        cout << S[i];
        }
        cout << endl;
}

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

using namespace std;

int main() {
  while( 1 ) {
    int n;
    cin >> n;
    if( !n ) { return EXIT_SUCCESS; }

    vector<int> key;
    key.reserve( n );
    for( int i = 0; i < n; i++ ) {
      cin >> key[ i ];
    }

    string s, d;
    const string sts = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    int slen = sts.size();
    int invd[ 128 ];
    for( int i = 'a'; i <= 'z'; i++ ) {
      invd[ i ] = i - 'a';
    }
    for( int i = 'A'; i <= 'Z'; i++ ) {
      invd[ i ] = i - 'A' + slen / 2;
    }
    cin >> s;
    d = s;
    int len = s.size();

    for( int i = 0; i < len; i++ ) {
      int idx = ( i + n ) % n;
      d[ i ] = sts[ ( invd[ s[ i ] ] - key[ idx ] + slen ) % slen ];
    }
    cout << d << endl;
  }
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	for (int i = 1; i * i <= n; i ++){
		if (n % i == 0 && n / i < 10 && i < 10){
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
}


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

const int MAXN = 1e5 + 100;

int N;

int dp[MAXN][10];
int v[MAXN][10];

int main() {
    ios::sync_with_stdio(false);
    cin >> N;
    for (int i = 1;i <= N; ++i) {
        cin >> v[i][0] >> v[i][1] >> v[i][2];
    }

    for (int i = 1; i <= N; ++i) {
        for (int j = 0;j <=2; ++j) {
            if (j == 0) {
                dp[i][j] = max(dp[i - 1][1] + v[i][j], dp[i - 1][2] + v[i][j]);
            }
            if (j == 1) {
                dp[i][j] = max(dp[i - 1][0] + v[i][j], dp[i - 1][2] + v[i][j]);
            }
            if (j == 2) {
                dp[i][j] = max(dp[i - 1][0] + v[i][j], dp[i - 1][1] + v[i][j]);
            }
        }
    }
    cout << max(dp[N][0], max(dp[N][1], dp[N][2]));
    return 0;
}

Measured memory_bytes: 8064
#include <iostream>

using namespace std;

int main () {

    int A;
    int B;
    int freeSockets = 1;
    int strips = 0;

    cin >> A >> B;

    while (freeSockets < B) {

        freeSockets--;
        freeSockets+=A;
        strips++;
    }

    cout << strips << endl;
}

Measured memory_bytes: 256
n,m=gets.split.map &:to_i
a=Array.new(n).map{Array.new(n)}
n.times do|i|
  a[i]=gets.chomp.chars
end
b=Array.new(m).map{Array.new(m)}
m.times do|i|
  b[i]=gets.chomp.chars
end
(n-m+1).times do|i|
  c=0
  (n-m+1).times do|j|
    m.times do|k|
      if a[k][j..j+m-1]==b[k][0..m-1]
        c+=1
      else
      break
      end
      if c==m
         puts :Yes
       exit
     end
   end
 end
end
puts :No


Measured memory_bytes: 1916
a,b,c,k = map(int, input().split())
ans = 0

if a >= k:
    ans += k
    print(ans)
    k -=a
else:
    ans += a
    k -= a

if k >0:
    if b >= k:
        print(ans)
        k -=b
    else:
        k -=b

if k > 0:
    if c >= k:
        ans -=k
        print(ans)
        k -=c
    else:
        k -=c
        print(ans)


Measured memory_bytes: 9200
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * bit全探索サンプル
 * atcoder C - たくさんの数式
 *
 */
class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
		long length = s1.length();
		
		long totalAll =0;
		// 1<<n == Math.pow(2,n)
		// 1をnだけ左にビットシフトする -> 2のn乗の事
		// 2進数で）0001 -> 1000
		for(int i=0; i<(1<<length-1); i++){
			List<String> list = new ArrayList<>();
			for(int j=0; j<length-1; j++){
				list.add(s1.substring(j,j+1));
				if((1& i>>j) == 1){
//					System.out.print("1");
					list.add("+");
				} else {
//					System.out.print("0");
				}
			}
			list.add(s1.substring(s1.length()-1,s1.length()));
//			System.out.println(list);
			String aa = "";
			long total = 0;
			for(String a:list){
				if(a.equals("+")){
					total += Long.parseLong(aa);
					aa = "";
				} else {
					aa += a;
				}
			}
			if(!aa.equals("")){
				total += Long.parseLong(aa);
			}
			totalAll += total;
		}
		System.out.println(totalAll);
	}
}


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

int S(int n){
  return n==0?0:n%10+S(n/10);
}

 int main(){
     int N;
     cin>>N;
     if(N%S(N)==0){
         cout<<"Yes";
     }
     else{
        cout<<"No";
     }
  }

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;


bool solve(){
	int n;
	cin>> n;
	if(!n) return false;

	int w, h;
	cin>> w>> h;
	vector<vector<int> > field(h,vector<int> (w,0));
	for(int i=0;i<n;i++){
		int x, y;
		cin>> y>> x;
		field[x-1][y-1]++;
	}
	int s, t;
	cin>> s>> t;
	
	int ans = 0;
	for(int i=0;i<h-t+1;i++){			//+1
		for(int j=0;j<w-s+1;j++){		//+1...
			int cnt = 0;
			for(int i2=0;i2<t;i2++){
				for(int j2=0;j2<s;j2++){
					cnt += field[i+i2][j+j2];
				}
			}
			ans = max(ans, cnt);
		}
	}
	cout<< ans<< endl;
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	while(solve());

	return 0;
}

 

Measured memory_bytes: 1256
#include <iostream>

using namespace std;
int main(){
    int i,j,n,y; cin >> n >> y;
    for(i=0;i<=n;i++){
        for(j=0;j<=n;j++){
            int k = n - i - j;
            if(k<0) continue;
            if(1000*k + 5000*j + 10000*i==y){
                cout << i << " " << j << " " << k  << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " "<< -1 << endl;
}

Measured memory_bytes: 3612
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	for (int h = 0; h < 10; h++) {
		long long n, m, a = 0, sum = 0, ans = 0; string s; cin >> n;
		if(n==0){
		    return 0;
		}
		cin>>m>>s;
		int test[123456] = { 0 };
		for (int h = 0; h < m - 2; h++) {
			if (s[h] == 'I' && s[h + 1] == 'O' && s[h + 2] == 'I') {
				sum++; h += 1;
			}
			else if (sum != 0) {
				test[a] = sum;
				a++; sum = 0;
			}
		}
		test[a] = sum;
		a++;

		for (int h = 0; h < a; h++) {
			if (test[h] >= n) {
				ans += test[h] - n + 1;
			}
		}
		cout << ans << endl;
	}
}



Measured memory_bytes: 4468
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

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

    int64_t a,b;
    _rep(i,sqrt(N),1){
        if(N%i==0){
            a=i;
            b=N/a;
            break;
        }
    }

    int ans=max(to_string(a).size(),to_string(b).size());
    cout<<ans<<endl;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc123/tasks/abc123_b
package main

import "fmt"
import "bufio"
import "os"
import "strconv"
import "math"

var _sw = bufio.NewScanner(os.Stdin)

func main() {
	var t [5]int

	rem := -1

	for i := range t {
		t[i] = nextInt()
		if rem == -1 || (t[i]%10 != 0 && t[i]%10 < t[rem]%10) {
			rem = i
		}
	}

	ans := 0
	for i := range t {
		if i == rem {
			ans += t[i]
		} else {
			ans += int(math.Ceil(float64(t[i])/10)) * 10
		}
	}

	fmt.Println(ans)
}

func init() {
	_sw.Split(bufio.ScanWords)
}

func nextInt() int {
	if _sw.Scan() == false {
		panic(_sw.Err())
	}
	i, e := strconv.Atoi(_sw.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	if _sw.Scan() == false {
		panic(_sw.Err())
	}
	return _sw.Text()
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

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


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

int T,D;
int ta,tb;
int da,db;

int main(){
    cin>>T>>D;
    cin>>ta>>tb;
    cin>>da>>db;

    double ans=INT_MAX;


    for(int i=0;i*da<=D;i++){
        for(int j=0;j*db<=D-i*da;j++)if(i||j){
            ans=min(ans,fabs(T-1.0*(ta*i*da+tb*j*db)/(i*da+j*db)));
        }
    }


    printf("%.6lf\n",ans);
    return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
typedef signed long long ll;
#define FOR(i,to) for(i=0;i<(to);i++)

int64_t n; 
int H,W,Ch,Cw,Dh,Dw;
int cost[1010][1010];
int main() {
	int i,j,k,l,r,x,y; string s;
    deque<int> Q;

    cin>>H>>W>>Ch>>Cw>>Dh>>Dw;
    Ch--;Cw--;Dh--;Dw--;

    string S[H];
    FOR(i,H) cin>>S[i]; 

    FOR(i,1010){
        FOR(j,1010) cost[j][i]=1000000;
    }
    cost[Ch][Cw]=0;
    Q.push_front(Ch*1000+Cw);

    while(Q.size()){
		int cy=Q.front()/1000;
		int cx=Q.front()%1000;
		Q.pop_front();

        if(cy==Dh&&cx==Dw){
            std::cout << cost[cy][cx];
            return 0;
        }
    
        int dirY[4]={1,0,-1, 0};
        int dirX[4]={0,1, 0,-1};
        int ty;
        int tx;
        FOR(i,4){

            ty=cy+dirY[i];
            tx=cx+dirX[i];

            if(ty>=H||tx>=W||ty<0||tx<0||S[ty][tx]=='#') continue;

            if(cost[cy][cx]<cost[ty][tx]){
                cost[ty][tx]=cost[cy][cx];
                Q.push_front(ty*1000+tx);
            }
        }
        for(ty=max(cy-2,0);ty<=min(cy+2,H);ty++){
            for(tx=max(cx-2,0);tx<=min(cx+2,W);tx++){
                if(S[ty][tx]=='.'&&cost[cy][cx]+1<cost[ty][tx]){
                    cost[ty][tx]=cost[cy][cx]+1;
                    Q.push_back(ty*1000+tx);
                }
            }
        }
    }
    cout<<-1<<endl;
}


Measured memory_bytes: 9516
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  bool finished = false;
  string N;
  cin >> N;
  
  if(N.at(0) == '7' || N.at(1) == '7' || N.at(2) == '7'){
    cout << "Yes" << endl;
  }
  
  else if(N.at(0) != '7' && N.at(1) != '7' && N.at(2) != '7'){
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d,x;
  double da,db;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> a >> b >> c;
  
  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------

  if(c <= a+b) anss = "Yes";
  else anss = "No";

  cout << anss << endl;

}

Measured memory_bytes: 256
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct edge{int to,cost;};
typedef pair<int,int> P;

bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isPrime(int x){if(x==1)return 0;if(x==2)return 1;if(x%2==0)return 0;for(int i=3;i*i<=x;i++)if(x%i==0)return 0;return 1;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)&&islower(c));}
void printvi(vector<int> v){rep(i,0,v.size()){if(i)cout<<" ";cout<<v[i];}cout<<endl;}
void printvil(vector<int> v){rep(i,0,v.size()){cout<<v[i]<<endl;}}
void printvvi(vector<vector<int>> v){
    rep(i,0,v.size()){
        rep(j,0,v[i].size())cout<<v[i][j];
        cout<<endl;
    }
}
void printvstr(vector<string> v){
    rep(i,0,v.size()){
        cout<<v[i]<<endl;
    }
}

signed main (){
    int r;
    cin>>r;
    if(r<1200)cout<<"ABC"<<endl;
    else if(r<2800)cout<<"ARC"<<endl;
    else cout<<"AGC"<<endl;
    
}
/*

*/


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    if(a<=c&&b<=d&&c<=b){
      System.out.println(b-c);
    }else if(c<=a&&d<=b&&a<=d){
      System.out.println(d-a);
    }else if(a<=c&&a<=d&&b>=c&&b>=d){
      System.out.println(d-c);
    }else if(c<=a&&c<=b&&d>=a&&d>=b){
      System.out.println(b-a);
    }else{
      System.out.println(0);
    }
  }
}


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

using namespace std;

#define debug(x,y) cout<<(#x)<<" " <<(#y)<<" is " << (x) <<" "<< (y) << endl
#define watch(x) cout<<(#x)<<" is " << (x) << endl
#define fast ios_base::sync_with_stdio(false)
#define fie(i,a,b) for(i=a;i<b;i++)
#define MOD 1000000007
#define mod 998244353
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define ll long long
#define lld long long int
#define ALL(x) (x).begin(),(x).end()

typedef vector<lld> vi;
typedef vector<vector<lld>> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<pair<lld, lld>> vpi;
typedef long long LL;

/*
f(n) = f(n-1) + f(n-3); n >= 6
f(3) = 1;	
f(4) = 1;
f(5) = 1;
*/

int main() {
	fast;
	cin.tie(0);
	lld n;
	cin >> n;
	vi f(n+1);
	f[3] = f[4] = f[5] = 1;
	for (int i = 6; i <= n; i++) {
		f[i] = f[i-1] + f[i-3];
		f[i] %= MOD;
	}
	cout << f[n] << endl;
}


Measured memory_bytes: 3620
import math
n=int(input())
alist=input()
blist=[]
swit=0
for i in range(n-1):
    now=abs(int(alist[i+1])-int(alist[i]))
    if now==1:
        swit=1
    blist.append(now)
if swit==1:
    for i in range(n-1):
        if blist[i]==2:
            blist[i]=0
else:
    for i in range(n-1):
        if blist[i]==2:
            blist[i]=1
dekai=100
while len(blist)>1:
    clist=[]
    dekai=math.floor(math.log(len(blist),2))
    katamari=2**dekai
    kosu=len(blist)-katamari+1
    nanko=0
    for i in range(katamari):
        if blist[i]==1:
            nanko+=1
    clist.append(nanko%2)
    for i in range(kosu-1):
        nanko+=blist[katamari+i]-blist[i]
        clist.append(nanko%2)
    blist=clist

if swit==1:
    print(blist[0])
else:
    print(blist[0]*2)

Measured memory_bytes: 116432
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+18;

Int n, m;
// Int a[100005], b[100005];
vector<Int> G[100005];

int main() {
    ios::sync_with_stdio(false);
    cin >> n >> m;
    map<Int, Int> mp;
    for (Int i = 0; i < n - 1 + m; i++) {
        Int a, b;
        cin >> a >> b;
        G[a].emplace_back(b);
        mp[b]++;
    }
    Int s = 0;
    for (Int i = 1; i <= n; i++) {
        if (mp[i] == 0) s = i;
    }
    vector<Int> res(n + 1, 0);
    res[s] = 0;
    queue<Int> q;
    q.push(s);
    while (!q.empty()) {
        Int v = q.front();
        q.pop();
        for (Int i = 0; i < (Int)G[v].size(); i++) {
            Int to = G[v][i];
            mp[to]--;
            if (mp[to] == 0) {
                q.push(to);
                res[to] = v;
            }
        }
    }
    for (Int i = 1; i <= n; i++) dump(res[i]);
    return 0;
}

Measured memory_bytes: 13312
s,t=map(str, input().split())
a,b=map(int, input().split())
u=input()
if s==u:
    if t==u:
        print(a-1,b-1)
    else:
        print(a-1,b)
else:
    if t==u:
        print(a,b-1)
    else:
        print(a,b)



Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int K = scanner.nextInt();
    long M = 1_000_000_007;

    List<Integer> factors = new ArrayList<>();
    factors.add(0);
    for (int i = 1; i * i <= N; i++) {
      int j = N / i;
      factors.add(i);
      if (j != i) factors.add(j);
    }
    Collections.sort(factors);

    int F = factors.size() - 1;
    long[][] dp = new long[K][F + 1];
    for (int i = 1; i <= F; i++) {
      dp[0][i] = factors.get(i);
    }
    for (int i = 1; i < K; i++) {
      for (int j = 1; j <= F; j++) {
        dp[i][j] = dp[i][j - 1];
        dp[i][j] += dp[i - 1][F - j + 1] * (factors.get(j) - factors.get(j - 1)) % M;
        if (dp[i][j] >= M) dp[i][j] -= M;
        //for (int k = 1; k <= F - j + 1; k++) {
        //  dp[i][j] += dp[i - 1][k];
        //  if (dp[i][j] >= M) dp[i][j] -= M;
        //}
        //dp[i][j] *= factors.get(j) - factors.get(j - 1);
        //dp[i][j] %= M;
      }
    }

    System.out.println(dp[K - 1][F]);
  }
}


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

struct Point { double x, y; };

void koch(int n, Point a, Point b) {
  if ( n == 0 ) return;

  Point s, t, u;
  double th = M_PI * 60.0 / 180.0;  // 度からラジアンへ単位を変換

  s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
  s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
  t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
  t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

  koch(n - 1, a, s);
  printf("%.8f %.8f\n", s.x, s.y);
  koch(n - 1, s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  koch(n - 1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  koch(n - 1, t, b);
}

int main() {
  Point a, b;
  int n;

  scanf("%d", &n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n", a.x, a.y);
  koch(n, a, b);
  printf("%.8f %.8f\n", b.x, b.y);

  return 0;
}


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

int main() {
	int N,T,ans = 10000; cin >> N >> T;
	for(int i = 0 ; i < N ; i++){
		int c,t; cin >> c >> t;
		if(T >= t){
			ans = min(ans,c);
		}
	}
	if(ans == 10000){
		cout << "TLE" << endl;
		return 0;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
maxL = 0
minR = N
for i in range(M):
    L, R = map(int, input().split())
    maxL = max(maxL, L)
    minR = min(minR, R)
if minR - maxL >= 0:
    print(minR - maxL + 1)
else:
    print(0)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#include<numeric>
#include<stack>
#include<queue>
#include<functional>
#include<cassert>
#include<set>
#include<numeric>
#define rep(a,b) for(ll a=0;a<b;++a)
#define REP(a,b,c,d) for(ll a=b;a<c;a+=d)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
using p_i = pair<int, int>;
int main() {
	char b; cin >> b;
	if (b == 'A')b = 'T';
	else if (b == 'C')b = 'G';
	else if (b == 'G')b = 'C';
	else if (b == 'T')b = 'A';
	cout << b << endl;
	cin >> b;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(10)
#define highest(x) (63 - __builtin_clzl(x))

#define no cout << "No" << endl; exit(0)

int main(){
    int N, H;
    cin >> N >> H;
    int a_max = 0;
    int b[N];
    for(int i = 0; i < N; i++){
        int a;
        cin >> a >> b[i];
        a_max = max(a_max, a);
    }
    sort(b, b + N, greater<int>());
    int ans = 0;
    for(int i = 0; b[i] >= a_max && i < N; i++){
        H -= b[i];
        ans++;
        if(H <= 0){
            cout << ans << endl;
            return 0;
        }
    }
    cout << ans + (H + a_max - 1) / a_max << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

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

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

int a[1123] = {};
int b[1123] = {};
VI c[1123] = {};

const int MAX_A = 4096;
LL dp[4096][2] = {};

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M; cin >> N >> M;

    REP(i,MAX_A) REP(j,2) dp[i][j] = LINF;
    dp[0][0] = 0;


    REP(i,M){
        cin >> a[i] >> b[i];
        REP(j,b[i]){
            int tc; cin >> tc;
            c[i].eb(tc);
        }
    }

    REP(i,M){
        int base = 0;
        for(int t : c[i]){
            base += (1 << (t-1));

        }

        REP(j,MAX_A){
            dp[j][(i+1)%2] = dp[j][i%2];
        }


        REP(j,MAX_A){
            dp[j|base][(i+1)%2] = min(min(a[i] + dp[j][i%2],dp[j|base][(i+1)%2]), dp[j|base][i%2]);

        }

        REP(j,MAX_A){
            dp[j][i%2] = LINF;
        }
    }

    int maxbit = pow(2,N) - 1;

    if(dp[maxbit][M%2] == LINF){
        cout << -1 << endl;
    }else{
        cout << dp[maxbit][M%2] << endl;
    }




}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,a[200],dp[200009][209],W,w[200],k;

ll f(ll brt, ll idx){
	if(idx>n)return 0;
	if(dp[brt][idx]!=-1)return dp[brt][idx];
	if(brt+w[idx]<=W){
		dp[brt][idx]=max(f(brt+w[idx],idx+1)+a[idx],f(brt,idx+1));
	}
	else dp[brt][idx]=f(brt,idx+1);
	return dp[brt][idx];
}

int main(){
	cin >> n >> W;
	for(int i=1; i<=n; i++)cin >> w[i] >> a[i];
	memset(dp,-1,sizeof dp);
	cout << f(0,1) << endl;
}



Measured memory_bytes: 326784
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define Rep(i,n) for(int i=1;i<=(n);++i)
using LL = long long;
using ULL = unsigned long long;

int main()
{
	LL n, k;
	cin >> n >> k;
	n %= k;
	cout << min(n, k-n) << endl;
	return 0;
}



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

int main(){
  map< string, set<int> > index;
  string word;
  int page;

  while (cin >> word >> page){
    index[word].insert( page );
  }
  map< string, set<int> >::iterator it1 = index.begin();
  set<int>::iterator it2;
  while( it1 != index.end() ){
    cout << (*it1).first << endl;
    it2 = index[(*it1).first].begin();
    cout << *it2;
    it2++;
    while( it2 != index[(*it1).first].end() ){
      cout << ' ' << *it2;
      it2++;
    }
    cout << endl;
    it1++;
  }
  return 0;
}

Measured memory_bytes: 1228
char s[9];x,l;
int P(a){
	sprintf(s,"%d",a),l=strlen(s);
	for(x=0;x<l&s[x]==s[l-x-1];x++);
	return x==l;
}
main(){
	int n,i;
	scanf("%d",&n);
	for(i=0;;i++){
		if(P(n-i)){printf("%d\n",n-i);return 0;}
		if(P(n+i)){printf("%d\n",n+i);return 0;}
	}
	exit(0);
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
using namespace std;
//typedef
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<string> VS;
//repetition
#define FOR(i,a,b) for(int i=int(a); i<int(b); ++i)
#define FORD(i,a,b) for(int i=int(a); i<int(b); --i)
#define REP(i,N) for(int i=0; i<int(N); ++i)
#define REPD(i,N) for(int i=0; i<int(N); --i)
//container util
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//constant
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7
#define MAXR 100000 //配列の最大のrenge
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
    int a; cin >> a;
    if (a==1) cout<<0;
    if(a == 0)cout<<1;
}

Measured memory_bytes: 3632
import java.util.Scanner;
import java.lang.Math;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] r = new int[n];
        for (int i = 0; i < n; i++) {
            r[i] = sc.nextInt();
        }

        int minv = r[0];
        int maxv = Integer.MIN_VALUE;
        for (int i = 1; i < n; i++) {
            maxv = Math.max(maxv, r[i] - minv);
            minv = Math.min(minv, r[i]);
        }
        System.out.println(maxv);
    }
}



Measured memory_bytes: 100988
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional> // std::function<void(int)>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 111111;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a,b;
    cin>>a;
    cout<<180*(a-2)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--){
        int v;
        cin>>v;
        int ctr=8;
        for(int i=400;i<=2000;i+=200){
            if(v>=i&&v<i+200){
                cout<<ctr<<"\n";
                break;
            }
            ctr--;
        }
    }
    return 0;
}

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


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

    int n, m;
    cin >> n >> m;
    vector<vector<int>> edge(n, vector<int>());
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        edge[a - 1].push_back(b - 1);
        edge[b - 1].push_back(a - 1);
    }

    int ans = 1;
    vector<bool> seen(n);
    for (int i = 0; i < n; ++i) {
        if (seen[i]) continue;
        int count = 1;
        queue<int> q;
        q.push(i);
        seen[i] = true;
        while (!q.empty()) {
            int now = q.front();
            q.pop();
            for (int next : edge[now]) {
                if (seen[next]) continue;
                seen[next] = true;
                count++;
                q.push(next);
            }
        }
        ans = max(ans, count);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 14824
'use strict';

function main(arg) {
    let temp = arg.split(" ").map(n=>parseInt(n)).sort((a,b) => b-a);
    let big  = (String(temp[0]) + String(temp[1]));

    console.log( parseInt(big) + temp[2]);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
/*There's a possibility*/
/*but stop sucking first*/
#define dbg(...) ; 
#define db(...) ; 
#include "bits/stdc++.h"
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define f(i,a,b) for(i=a;i<b;i++)
#define fr(i,a,b) for(i=a;i>=b;i--)
#define endl '\n'
#define tst cout<<'*';
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define pf push_front
using namespace std;

ll dp[105][100005];

int main()
{
    fast;
    int n,W,i,j;
    cin>>n>>W;
    int w[n+1],v[n+1];
    f(i,1,n+1)
        cin>>w[i]>>v[i];

    f(i,1,n+1)
        f(j,0,W+1)
        {
            dp[i][j]=dp[i-1][j];
            if(j-w[i]>=0)
                dp[i][j]=max(dp[i][j],v[i]+dp[i-1][j-w[i]]);
        }
    db(dp,0,n,0,W);
    cout<<dp[n][W];
}

Measured memory_bytes: 81768
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define eb          emplace_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define mp(x,y)     make_pair(x,y) 
#define exit(x)     cout<<x<<"\n",return
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,a,n)   for(ll i=a;i<n;i++)
#define frr(i,a,n)  for(ll i=n-1;i>=a;i--)
const ll N=500005;
const ll mod = 1e9 + 7;

using namespace std;

  ll a[500];

void solve()
{
  ll T=1;
  //cin>>T;
  while(T--)
  {
 // string s;
  ll n,m,k,x=0,y=0,c=0,q,ans=0;
  cin>>n>>m;
  for (ll i = 0; i < n; ++i)
  {
    cin>>k;
    fr(j,0,k)
    {
      cin>>x;
      a[x]++;
    }

  }
for (int i = 0; i < 50; ++i)
{
  if(a[i]==n)
  { 
    c++;
  }
}
c(c);

 }
}

signed main(){
   
        ios_base::sync_with_stdio(false);   
        cin.tie(NULL);
       solve();
    return 0;
    }


Measured memory_bytes: 256
#include <stdio.h>
int main(){
char a[100000];
for(int i=0;i<100000;i++)a[i]='\0';
scanf("%s",a);
for(int i=0;a[i]!='\0';i++)if(a[i]=='A'&&a[i+1]=='C'){
printf("Yes\n");
return 0;
}
printf("No\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define int long long
#define all(x) (x).begin(), (x).end()

const int nmax = (int)1e5 + 10;
const int emax = (int)1e6 + 10;

   




signed main() {

   ios_base :: sync_with_stdio(false);
   cin.tie(0); cout.tie(0);


   
   int a, b, c;
   cin >> a >> b >> c;
   cout << ((a ^ b) ^ c) << endl;

                             
   return 0;
}


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

int main(){
	int n;	cin >> n;
	int a[n];
	for (int i = 0; i < n; ++i){
		cin >> a[i];
	}
	bool isApproved = true;
	for (int i = 0; i < n; ++i){
		if(!(a[i]&1)){
			if(a[i]%3 != 0 and a[i]%5 !=0){
				isApproved = false;
				break;
			}
		}
	}
	if(isApproved)	puts("APPROVED");
	else			puts("DENIED");
	return 0;
}

Measured memory_bytes: 256
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0: break
    for x in range(int(H / 2)):
        if W % 2 != 0:
            print('#.'*int(W / 2) + "#")
        else: print('#.'*int(W / 2))
        if W % 2 != 0:
            print('.#'*int(W / 2) + ".")
        else: print('.#'*int(W / 2))
    if H % 2 != 0:
        if W % 2 != 0: print('#.'*int(W / 2) + "#")
        else: print('#.'*int(W / 2))
    print()



Measured memory_bytes: 5616
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int n, x; cin >> n >> x;
    vi L(n); for(auto& e : L) cin >> e;

    int cnt = 1;
    int cur = 0;
    rep(i, n){
        cur = cur + L[i];
        if(cur <= x){
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}


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

int main(){
    ll x;
    cin >> x;
    ll ans = 0;
    ans += 2*(x/11);
    if(x%11 <= 6 && x%11 > 0){
        ans++;
    }
    else if(x%11 > 6 && x%11 <11){
        ans += 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[1001];
char goal[2]={'C','F'};
int top=0;
int main()
{
    gets(s);
    for(int i=0;i<strlen(s);i++)
    {
        if(s[i]==goal[top])
            top++;
        if(top==2)
            break;
    }
    if(top==2)
        cout<<"Yes"<<endl;
    else 
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import math
n = 100000
integer = [i for i in range(2,n+1)]
prime = set()
while integer[0] <= math.sqrt(n):
    p = integer[0] 
    prime.add(p)
    integer = [i for i in integer if i % p != 0]
prime = prime | set(integer)
like = set()
likesum = [0]*(n+1)
for i in prime:
    if (i+1)//2 in prime:
        like.add(i)
for i in range(n):
    if i in like:
        likesum[i+1] = likesum[i] + 1
    else:
        likesum[i+1] = likesum[i]    
q = int(input())
for i in range(q):
    l,r = map(int,input().split())
    print(likesum[r+1]-likesum[l])



Measured memory_bytes: 8576
using System;
class Example
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int a = 1, b = 1;
        int t ;
        for(int i = 0; i < n - 1; i++)
        {
            t = a;
            a = a + b;
            b = t;
        }
        Console.WriteLine(a);
    }
}

Measured memory_bytes: 9180
use std::collections::BinaryHeap;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };

    let n: usize = sc.read();
    let m: usize = sc.read();
    let mut heap = BinaryHeap::new();
    for _ in 0..n {
        let a: usize = sc.read();
        heap.push(a);
    }
    for _ in 0..m {
        let x = heap.pop().unwrap();
        heap.push(x / 2);
    }

    let sum = heap.into_iter().sum::<usize>();
    println!("{}", sum);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
import java.io.*;
class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(sc.readLine());
        int m = 0;
        int l=0;
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n / i; j++) {
                m = n - (j * i);
                if (m != 0) {
                    l++;
                }
            }
        }
        System.out.println(l);
    }
}


Measured memory_bytes: 32792
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}

typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
  ll A, B, Q; cin >> A >> B >> Q;
  vector<ll> s, t, x;
  s.PB(-LLINF);
  t.PB(-LLINF);
  REP(i, A) {
    ll si; cin >> si;
    s.PB(si);
  }
  s.PB(LLINF);
  REP(i, B) {
    ll ti; cin >> ti;
    t.PB(ti);
  }
  t.PB(LLINF);
  REP(i, Q) {
    ll xi; cin >> xi;
    x.PB(xi);
  }

  REP(i, Q) {
    ll sl = *(upper_bound(ALL(s), x[i]) - 1);
    ll sr = *lower_bound(ALL(s), x[i]);
    ll tl = *(upper_bound(ALL(t), x[i]) - 1);
    ll tr = *lower_bound(ALL(t), x[i]);
    ll ans = LLINF;
    ans = min(ans, x[i] - min(tl, sl));
    ans = min(ans, max(tr, sr) - x[i]);
    ans = min({ans, x[i] + sr - 2*tl, 2*sr - x[i] - tl});
    ans = min({ans, x[i] + tr - 2*sl, 2*tr - x[i] - sl});
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <utility>

using namespace std;

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

#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)

int n, q, s[100000];

bool search(int x) {
    int ok = 0, ng = n;
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        if (s[mid] <= x) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    return s[ok] == x;
}

int main() {
    int ans = 0;
    cin >> n;
    REP(i, n) cin >> s[i];
    cin >> q;
    REP(i, q) {
        int t;
        cin >> t;
        if (search(t)) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3364
#include<stdio.h>

int main(void){
  char S[200];
  int K,count=0;
  
  scanf("%d",&K);
  scanf("%s",S);
  
  for(int i=0;S[i]!='\0';i++){
    count++;
  }

  if(count<=K){
    printf("%s",S);
  }else{
    for(int i=0;i<K;i++){
      printf("%c",S[i]);
    }
    printf("...");
  }
  
  return 0;
}

Measured memory_bytes: 1732
#!/usr/bin/env python3
n, *A = map(int, open(0).read().split())
a=sorted(A)
if n%2:
    print(sum(a[-n//2+1:])*2 - sum(a[:n//2])*2 - min(a[n//2+1]-a[n//2],a[n//2]-a[n//2-1]))
else:
    print(sum(a[n//2+1:])*2 -sum(a[:n//2-1])*2 +a[n//2] -a[n//2-1])


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


int main(){
    string S,T ; 
    cin >> S >> T ; 
    int ans = 0; 
    rep(i,S.size()){
        if(S[i] != T[i]) ans++ ; 
    }
    cout << ans  << "\n" ; 
}

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

using namespace std;

struct pos{
		int x,y;
	pos(int _x,int _y){x=_x;y=_y;}
};

int a[1000][1000],m[1000][1000],sh,sw;

int  ans(int p,int q,int h,int w,int count);

void map(int H,int W){
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cout << m[i][j] << " ";
		}
		cout<<"\n";
	}
	cout<<"\n";
}

int main(){
	int H,W,count,d,T;
	char b;
	cin>>H;
	cin>>W;
	cin>>d;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin>>b;
			if('1'<=b&&b<='9'){
				a[i][j]=b-48;
			}else if(b=='X'){
				a[i][j]=-1;
			}else if(b=='S'){
				sh=i;
				sw=j;
				a[i][j]=0;
			}else if(b=='.'){
				a[i][j]=0;
			}
		}
	}
	for(T=0,count=0;count<d;count++){
		//map(H,W);
		T+=ans(sh,sw,H,W,count);
	}
	//map(H,W);
	cout<<T<<endl;
	return 0;
}

int ans(int p,int q,int h,int w,int count){
	int gx,gy;
	//cout<<sh<<" "<<sw<<"\n";
	int dy[4]={-1,0,0,1},dx[4]={0,-1,1,0};
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			m[i][j]=-1;
			if(a[i][j]==count+1){
				gx=i;
				gy=j;
			}
		}
	}
	sh=gx;
	sw=gy;
	m[p][q]=0;
	queue<pos> Q;
	Q.push(pos(p,q));
	while(Q.size()){
		//cout<<Q.size()<<" \n";
		pos b=Q.front();
		Q.pop();
		for(int i=0;i<=3;i++){
			if(0<=b.x+dx[i]&&b.x+dx[i]<h&&0<=b.y+dy[i]&&b.y+dy[i]<w&&m[b.x+dx[i]][b.y+dy[i]]==-1){
				if(a[b.x+dx[i]][b.y+dy[i]]!=-1){
					Q.push(pos(b.x+dx[i],b.y+dy[i]));
					m[b.x+dx[i]][b.y+dy[i]]=m[b.x][b.y]+1;
				}
			}
		}
	}
	return m[gx][gy];
}

Measured memory_bytes: 9032
import math

N = int(input())
k = math.ceil((2 * N) ** 0.5)
if N * 2 != k * (k - 1):
    print('No')
else:
    print('Yes')
    print(k)
    S = [[k - 1] for _ in range(k)]
    cnt = 1
    for i in range(k):
        for j in range(i+1, k):
            S[i].append(cnt)
            S[j].append(cnt)
            cnt += 1
    for i in range(k):
        print(" ".join(map(str, S[i])))

Measured memory_bytes: 45660
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    i64 x, y, z, k;
    std::cin >> x >> y >> z >> k;
    std::vector<i64> a(x), b(y), c(z);
    for (auto &el : a) std::cin >> el;
    for (auto &el : b) std::cin >> el;
    for (auto &el : c) std::cin >> el;
    std::vector<i64> v, w;
    for (int i = 0; i < y; i++) for (int j = 0; j < z; j++) v.emplace_back(b[i] + c[j]);
    std::sort(v.begin(), v.end(), std::greater<>());
    for (int i = 0; i < std::min(k, y * z); i++) for (int j = 0; j < x; j++) w.emplace_back(a[j] + v[i]);
    std::sort(w.begin(), w.end(), std::greater<>());
    for (int i = 0; i < k; i++) std::cout << w[i] << '\n';
    std::cout << std::flush;

    return 0;
}


Measured memory_bytes: 43368