akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
 
public class Main{
 
	public static void main(String[] $){
		Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int K = s.nextInt();
        int[] d = new int[K];
        int[][] A = new int[K][N];
        for(int i = 0; i < K; i++){
            d[i] = s.nextInt();
            for(int j = 0; j < d[i]; j++){
                A[i][j] = s.nextInt();
            }
        }

        boolean[] treat = new boolean[N];
        int T = N;
        for(int i = 0; i < K; i++){
            for(int j = 0; j < d[i]; j++){
                if(treat[A[i][j]-1] == false){
                    treat[A[i][j]-1] = true;
                    T--;
                }
            }
        }
        
        System.out.println(T);
        
        
	}
} 

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

using namespace std;

string s;

int main() {
	cin >> s;
	
	for (int i = 0; i < s.length()-1; i++) {
		if (s[i] == s[i + 1]) {
			cout << i + 1 << " " << i + 2 << endl;
			return 0;
		}
		if (i + 2 != s.length()) {
			if (s[i] == s[i + 2]) {
				cout << i + 1 << " " << i + 3 << endl;
				return 0;
			}
		}
	}

	cout << -1 << " " << -1 << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<map>
#include<stdio.h>
typedef long long ll ;
using namespace std ;
map < char , char > lw;
map < char , ll > sv ;
int main()
{
    char arr[200005],used[200005];
    lw['s']='r';
    lw['p']='s';
    lw['r']='p';
    ll n,k,R,S,P,sum=0;
    cin >> n >> k ;
    cin >> R >> S >> P ;
    sv['r']=R;
    sv['s']=S;
    sv['p']=P;
    scanf("%s",arr);
    for(int i=0;i<n;i++)
    {
        char c = arr[i] ;
        c = lw[c];
        if(i>=k)
        {
            if(used[i-k]!=c){sum+=sv[c];used[i]=c;}
            else
            {
                if(c=='s')
                {
                    if(sv['r']>sv['p'])
                    {
                        arr[i]='p';
                    }
                    else
                    {
                        arr[i]='r';
                    }
                }
                else if (c=='r')
                {
                   if(sv['s']>sv['p'])
                    {
                        arr[i]='p';
                    }
                    else
                    {
                        arr[i]='s';
                    }
                }
                else
                {
                    if(sv['r']>sv['s'])
                    {
                        arr[i]='s';
                    }
                    else
                    {
                        arr[i]='r';
                    }
                }
            }
        }
        else
        {
            sum+=sv[c];
            used[i]=c;
        }
    }
    cout << sum << endl;
    return 0;
}


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

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

    int a,b;
    cin>>a>>b;

    int ans=0;

    for(int i=1;i<=9;i++)for(int j=0;j<=9;j++)for(int k=0;k<=9;k++)
    {
        int n=i*10000+j*1000+k*100+j*10+i;
        if(a<=n&&n<=b)ans++;
    }

    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 3564
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left
MOD = int(1e9)+7
INF = float('inf')


def solve():
    # n, m = [int(x) for x in input().split()]
    n, m = [int(x) for x in input().split()]
    s = []
    for _ in range(m):
        k, *r = [int(x) - 1 for x in input().split()]
        s.append(r)
    p = [int(x) for x in input().split()]
    ans = 0
    for i in range(2 ** n): # mask
        ok = 1
        for j in range(m): # bulb
            pp = p[j]
            cnt = 0
            for ss in s[j]:
                if i & (1 << ss):
                    cnt += 1
            if cnt % 2 != pp:
                ok = 0
        ans += ok
    print(ans)

    


t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<string> a(n);
  vector<string> b(m);
  for (int i = 0; i < n; i ++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < m; i ++) {
    cin >> b.at(i);
  }

  for (int i = 0; i < n; i ++) {
    for (int j = 0; j < n; j ++) {
      if (i + m - 1 >= n || j + m - 1 >= n) {
        continue;
      }

      bool match = true;
      for (int k = 0; k < m; k ++) {
        for (int l = 0; l < m; l ++) {
          if (a.at(i + k).at(j + l) != b.at(k).at(l)) {
            match = false;
          }
        }
      }
      if (match) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>

#define rep(i, n) for (int i = 0; i < n; i++) 
#define rrep(i, n) for(int i = n-1; i>=0; i--)
#define range(i, n, m) for (int i = n; i < m; i++) 
#define rrange(i, n, m) for (int i = n - 1; i => m; i--) 
#define MOD 1000000007

typedef long long int ll;
typedef unsigned long long int ull;


using namespace std;

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


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

	ll N;
	string s;

	cin >> N >> s;

	ll R, B;
	R = 0;
	B = 0;
	rep(i, N) {
		if (s[i] == 'R') {
			R++;
		}
		else {
			B++;
		}
	}

	if (B < R) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}



	return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
l000=[]
l001=[]
l010=[]
l100=[]
for i in range(n):
    x,y,z=map(int,input().split())
    l000.append((x+y+z,x,y,z))
    l001.append((x+y-z,x,y,z))
    l010.append((x-y+z,x,y,z))
    l100.append((-x+y+z,x,y,z))
l000.sort()
l001.sort()
l010.sort()
l100.sort()
dx=[0]*8
dy=[0]*8
dz=[0]*8
for i in range(m):
    dx[0]+=l000[i][1]
    dy[0]+=l000[i][2]
    dz[0]+=l000[i][3]
    dx[1]+=l000[-i-1][1]
    dy[1]+=l000[-i-1][2]
    dz[1]+=l000[-i-1][3]
    dx[2]+=l001[i][1]
    dy[2]+=l001[i][2]
    dz[2]+=l001[i][3]
    dx[3]+=l001[-i-1][1]
    dy[3]+=l001[-i-1][2]
    dz[3]+=l001[-i-1][3]
    dx[4]+=l010[i][1]
    dy[4]+=l010[i][2]
    dz[4]+=l010[i][3]
    dx[5]+=l010[-i-1][1]
    dy[5]+=l010[-i-1][2]
    dz[5]+=l010[-i-1][3]
    dx[6]+=l100[i][1]
    dy[6]+=l100[i][2]
    dz[6]+=l100[i][3]
    dx[7]+=l100[-i-1][1]
    dy[7]+=l100[-i-1][2]
    dz[7]+=l100[-i-1][3]
ans=abs(dx[-1])+abs(dy[-1])+abs(dz[-1])
for i in range(7):
    ans=max(ans,abs(dx[i])+abs(dy[i])+abs(dz[i]))
print(ans)


Measured memory_bytes: 39152
#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back

using namespace std;

// #define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline void chmax(T& a,T const& b){a=max(a,b);}
template<class T> inline void chmin(T& a,T const& b){a=min(a,b);}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,M,X,Y;
  int ma,mi;
  cin >> N >> M >> ma >> mi ;
  rep(i,N){
    int x; cin >> x ;
    chmax(ma,x);
  }
  rep(i,M){
    int x; cin >> x ;
    chmin(mi,x);
  }
  if(ma<mi) cout << "No War" << endl;
  else cout << "War" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

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

















int main(){
    int n, m;
    scanf("%d %d", &n, &m);
    int sum = 0;
    for(int i = 0; i < m; i++){
        int a;
        scanf("%d", &a);
        sum += a;
    }
    printf("%d\n", max(n - sum, -1));
}

Measured memory_bytes: 3832
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 1010101010101010;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
const ll mod = 1000000007;
ll k_mod(ll x){
  ll ans=1;
  rep(i,x){
    ans*=(i+1);
    ans%=mod;
  }
  return ans;
}
ll modpow(ll x, ll n){
  ll ans=1;
  while(n!=0){
    if(n&1) ans=ans*x%mod;
    x=x*x%mod;
    n=n>>1;
  }
  return ans;
}
ll invmod(ll x){
  return modpow(x,mod-1);
}
ll modcom(ll x, ll y){
  ll ans=1LL;
  ans*=k_mod(x);
  ans%=mod;
  ll z=modpow(k_mod(y),1000000005);
  z*=modpow(k_mod(x-y),1000000005);
  z%=mod;
  ans*=z;
  ans%=mod;
  /*ans*=invmod(k_mod(y));
  cout<<ans<<endl;
  ans%=mod;
  cout<<ans<<endl;
  ans*=invmod(k_mod(x-y));
  cout<<ans<<endl;
  ans%=mod;
  cout<<ans<<endl;*/
  return ans;
}
int main(){
  ll x,y; cin>>x>>y;
  if((x+y)%3!=0){
    cout<<0<<endl;
    return 0;
  }
  ll a,b;
  a=(x+y)/3;
  b=abs(x-y);
  b=(a-b)/2;
  if(b<0){
    cout<<0<<endl;
    return 0;
  }
  //aCbを調べれば良い

  //cout<<k_mod(a)<<endl;
  //cout<<invmod(k_mod(a))<<endl;
  cout<<modcom(a,b)<<endl;
}


Measured memory_bytes: 3628
h, w = map(int, input().split())
field = [input() for i in range(h)]
AX = [1, 1, 0, -1, -1, -1, 0, 1]
AY = [0, 1, 1, 1, 0, -1, -1, -1]
ANS = [''] * h
for y in range(h):
	for x in range(w):
		if field[y][x] == '#':
			ANS[y] += '#'
		else:
			count = 0
			for dy, dx in zip(AY, AX):
				ny = y + dy
				nx = x + dx
				if not 0 <= ny < h:
					continue
				if not 0 <= nx < w:
					continue
				if field[ny][nx] == '#':
					count += 1
			ANS[y] += str(count)
for s in ANS:
	print(s)

Measured memory_bytes: 39920
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
            }
            long ans = 0;
            for (int i = 0; i < n; i++)
            {
                ans += a[i] / 2;
                a[i] %=2;
                if (i == n - 1) break;
                int tmp = Math.Min(a[i], a[i + 1]);
                ans += tmp;
                a[i] -= tmp;
                a[i + 1] -= tmp;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 7128
import java.util.*;
import java.util.stream.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Map<String, Integer> map = new HashMap<>();
    for (int i = 0; i < N; i++) {
      String t = sc.next();
      int c = 0;
      if (map.get(t) != null) {
        c = map.get(t);
      }
      map.put(t, ++c);
    }
    Optional<Integer> max = map.values().stream().max(Comparator.naturalOrder());
    map.entrySet().stream()
      .filter(e -> e.getValue().equals(max.get()))
      .map(Map.Entry::getKey)
      .sorted()
      .forEach(System.out::println);
  }
}

Measured memory_bytes: 87180
/*
* じょえチャンネル
* 高評価・チャンネル登録よろしくおねがいします！
* https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
*/

#include <bits/stdc++.h>


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


#define inf (int)(3e18)
#define int long long
#define mod (int)(1000000007)

#define intt long long
#define P pair<int,int>

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

using namespace std;

//Library
//モッドパウ
int modpow(int x, int y, int m = mod) {
    int res = 1;
    while (y) {
        if (y % 2) {
            res *= x;
            res %= m;
        }
        x = x * x % mod;
        y /= 2;
    }
    return res;
}

int mypow(int x, int y) {
    int res = 1;
    while (y) {
        if (y % 2) {
            res *= x;
        }
        x = x * x;
        y /= 2;
    }
    return res;
}
//is the number (x) a prime number?
bool prime(int x) {
    for (int i = 2; i * i <= x; i++) {
        if (!(x % i)) {
            return false;
        }
    }
    return true;
}


//saidai-kouyakusuu
inline int gcd(int x, int y) {
    if (!y) {
        return x;
    }
    return gcd(y, x % y);
}


//number of keta
int keta(int x) {
    int ans = 0;
    while (x) {
        x /= 10;
        ans++;
    }
    return ans;
}

//sum of keta
int ketasum(int x) {
    int ans = 0;
    while (x) {
        ans += x % 10;
        x /= 10;
    }
    return ans;
}

inline int lcm(int x, int y) {
    int ans = x / gcd(x, y) * y;
    return ans;
}
int twobeki(int x) {
    int ans = 0;
    while (1) {
        if (!(x & 1)) {
            ans++;
            x /= 2;
        }
        else {
            break;
        }
    }
    return ans;
}


template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
    if (lhs < rhs) {
        lhs = rhs;
        return 1;
    }
    return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
    if (lhs > rhs) {
        lhs = rhs;
        return 1;
    }
    return 0;
}
void Yes(){
    cout<<"Yes"<<endl;
}
void No(){
    cout<<"No"<<endl;
}
void YES(){
    cout<<"YES"<<endl;
}
void NO(){
    cout<<"NO"<<endl;
}


#define fin(i) scanf("%lld",&i)
#define fout(i) printf("%lld",i)
#define fendl printf("\n")
//Library-End

int n,a[100004],ans,b,c;

signed main() {
    cin>>b>>c;
    cout<<max({c+b,b-c,c*b})<<endl;
    
   // cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>

int main()
{
    int n;
    std::cin >> n;
    int p[n];
    int q[n];
    for (int i = 0; i < n; ++i) {
        std::cin >> p[i];
        q[i] = p[i];
    }
    int cnt = 0;
    std::sort(p, p + n);
    for (int i = 0; i < n; ++i) {
        if (p[i] != q[i]) {
            ++cnt;
        }
    }

    std::cout << (cnt == 0 || cnt == 2 ? "YES" : "NO");


    return EXIT_SUCCESS;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int N, X;
  int m[110];
  cin >> N >> X;
  int sum = 0, min = 1001001;
  for(int i = 0; i < N ;i++){
    cin >> m[i];
    sum += m[i];
    if(min > m[i]) min = m[i];
  }
  int ans = N + (X - sum) / min;

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
struct P {
	int time, cost;
};
struct Q {
	int x, y;
};
const int inf = 1000000;
int a[1000][1000];
int g[1000][1000];
P b[1000][1000];
int main() {
	int h, w;
	cin >> h >> w;
	string s;
	for (int i = 0; i < h; i++) {
		cin >> s;
		for (int j = 0; j < w; j++) {
			if (s[j] == '.') a[i][j] = 0;
			else a[i][j] = (int)s[j] - '0';
			g[i][j] = 0;
			b[i][j] = P{ 0,0 };
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == 0) {
				for (int x = -1; x <= 1; x++) {
					for (int y = -1; y <= 1; y++) {
						if (i + x < h&&i + x >= 0 && j + y < w&&j + y >= 0) {
							g[i + x][j + y]++;
						}
					}
				}
			}
		}
	}
	queue<Q>p;
	int sum = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] != 0 && a[i][j] <= g[i][j]) {
				a[i][j] = 0;
				b[i][j] = P{ 1,0 };
				sum = 1;
				for (int x = -1; x <= 1; x++) {
					for (int y = -1; y <= 1; y++) {
						if (i + x < h&&i + x >= 0 && j + y < w&&j + y >= 0) {
							p.push(Q{ i + x,j + y });
							b[i + x][j + y] = P{ 2,b[i + x][j + y].cost + 1 };
						}
					}
				}
			}
		}
	}
	while (!p.empty()) {
		Q t = p.front(); p.pop();
		int i = t.x, j = t.y;
		if (a[i][j] <= g[i][j] + b[i][j].cost&&a[i][j] != 0) {
			a[i][j] = 0;
			sum = max(sum, b[i][j].time);
			for (int x = -1; x <= 1; x++) {
				for (int y = -1; y <= 1; y++) {
					if (i + x < h&&i + x >= 0 && j + y < w&&j + y >= 0&&a[i+x][j+y]!=0) {
						if (a[i + x][j + y] > g[i + x][j + y] + b[i + x][j + y].cost) {
							b[i + x][j + y] = P{ max(b[i + x][j + y].time,b[i][j].time + 1),b[i + x][j + y].cost + 1 };
							if (b[i + x][j + y].time >= 1736) {
								int o = 0;
							}
						}
						if (a[i + x][j + y] != 0 && a[i + x][j + y] <= g[i + x][j + y] + b[i + x][j + y].cost) {
							p.push(Q{ i + x,j + y });
						}
					}
				}
			}
		}
	}
	cout << sum << endl;
	cin >> sum;
}

Measured memory_bytes: 18832
#include<iostream>
using namespace std;
typedef long long ll;

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);
    
    ll k, a, b;
    cin >> k >> a >> b;

    ll ans = 0;
    if (b <= a + 2) ans = k + 1;
    else {
        if (k <= a-1) ans = k;
        else {
            ans = a;
            k -= a - 1; // a枚たまった時の残りターン
            if (k % 2 == 0) ans +=  k / 2 * (b - a);
            else ans += k / 2 * (b - a) + 1;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3188
import java.io.*;
class Main {
    public static void main(String[] args) {
       try{ double i = 0,num = 0;
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line = reader.readLine();
        double r = Double.parseDouble(line);

        i = 2 * Math.PI * r;
        num = Math.PI * r * r;

        System.out.printf("%.10f %.10f\n",num,i);
        }catch(IOException e){
            System.out.println(e);
        }catch(NumberFormatException e){
            System.out.println("put the number");
        }
    }
}



Measured memory_bytes: 24788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
vector<int> dp(100010);
vector<bool> Eratosthenes(int n){
    vector<bool> isprime(n+1,1);
    isprime[0]=0;
    isprime[1]=0;
    for(int i=2;i*i<n;i++){
        if(isprime[i]){
            for(int j=1;i*(j+1)<n;j++){
                isprime[i*(j+1)]=0;
            }
        }
    }
    return isprime;
}
void query(){
    int l,r;cin>>l>>r;
    l--;
    cout<<dp[r]-dp[l]<<endl;
}
void Main(){
    ll q;cin>>q;
    vector<bool> prime=Eratosthenes(100010);
    For(i,1,100001) dp[i]=dp[i-1]+(prime[i]&&prime[(i+1)/2]);
    For(i,0,q) query();
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 1024
import math

n = int(input())

factors = []

m2 = 0
while n > 1 and n % 2 == 0:
	m2 += 1
	n //= 2
if m2:
	factors.append((2,m2))

m3 = 0
while n > 1 and n % 3 == 0:
	m3 += 1
	n //= 3
if m3:
	factors.append((3,m3))

i = 5
l = int(math.sqrt(n)) + 1

while n > 1 and i < l:
	if n % i == 0:
		m = 0
		while n > 1 and n%i == 0:
			m += 1
			n //= i
		factors.append((i, m))
	i += 2

if n != 1:
	factors.append((n,1))

ans = 0

for _, m in factors:
	count = 0
	s = 0
	while s < m:
		count += 1
		s += count
	ans += count if s == m else count - 1

print(ans)

Measured memory_bytes: 9288
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <bits/stdc++.h>

class TaskA {
public:
	void solve(std::istream& in, std::ostream& out);
};

void TaskA::solve(std::istream& in, std::ostream& out){
    int a,b,c;
    in >> a >> b >> c;
    out << std::min(a+b,std::min(b+c,c+a))<<"\n";
};

int main() {
	TaskA solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<cmath>
using namespace std;
#define int long long int
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,x,t;
	cin>>n>>x>>t;
	int j;
	for(j=1;j<=100000;j++)
	{
		if(x*j>=n)
		{
			cout<<t*j<<endl;
			exit(0);
		}
	}
}


Measured memory_bytes: 3596
#include<iostream>
#define mod 1000000007
#define lim 200000
using namespace std;
unsigned long long store[lim];  //store[i]=i!% mod

unsigned long long power(int n,unsigned long long k ,int m=1000000007)  //return n^k % m
{
 if(k==0) return 1;
 if(k==1) return n;
 unsigned long long f=power(n,k/2,m);
 unsigned long long p=(f*f)%m;
 if(k%2!=0)
  p=(p*n)%m;

 return p;
}


unsigned long long invmod(int n,int m)
{
 return power(n,m-2,m);
}


unsigned long long smcomb(int n,int r,int m)      //evaluates comb for small numbers (n<mod,n<10^7) ,mod must be a prime no.
{
 if(n<r) return 0;
 if(n==r) return 1;
 if(r==0) return 1;
 unsigned long long ans=store[n],x=invmod(store[n-r],m),y=invmod(store[r],m);
 ans=(ans*x)%m;
 ans=(ans*y)%m;
 return ans;
}

void create_store(int m)
{

       store[0]=1;
    for(int i=1;i<lim;i++)
    {
        store[i]=(store[i-1]*i)%m;
    }

}
long long ways(long long h,long long w)
{
    return smcomb(h+w-2,h-1,mod);
}

int main()
{
    create_store(mod);
    long long H,W,A,B;
    cin>>H>>W>>A>>B;

    long long term=0,term2;
    for(int i=0;i<H-A;i++)
    {
        //cout<<ways(i+1,B)<<" "<<ways(H-i,W-B)<<"\n";
        term+=ways(i+1,B)*ways(H-i,W-B);
        term%=mod;
    }
    term2=H-A-1;
    term2=term2*(term2+1)/2;
    term2%=mod;
    //term+=mod-term2;
    term%=mod;
    cout<<term;
    return 0;
}


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

int main() {
  vector<int> X(9);
  for (int i=0; i<9; i++) cin >> X.at(i);

  int N;
  cin >> N;

  vector<int> Y(N);
  for (int i=0; i<N; i++) cin >> Y.at(i);

  // 012, 345, 678, 036, 147, 258, 048, 246

  for (int i=0; i<N; i++) {
    for (int j=0; j<9; j++) {
      if (X.at(j) != -1) {
        if (X.at(j) == Y.at(i)) X.at(j) = -1;
      }
    }
  }
  
  bool flg = false;
  if (X.at(0) == -1 && X.at(1) == -1 && X.at(2) == -1) flg = true;
  if (X.at(3) == -1 && X.at(4) == -1 && X.at(5) == -1) flg = true;
  if (X.at(6) == -1 && X.at(7) == -1 && X.at(8) == -1) flg = true;
  if (X.at(0) == -1 && X.at(3) == -1 && X.at(6) == -1) flg = true;
  if (X.at(1) == -1 && X.at(4) == -1 && X.at(7) == -1) flg = true;
  if (X.at(2) == -1 && X.at(5) == -1 && X.at(8) == -1) flg = true;
  if (X.at(0) == -1 && X.at(4) == -1 && X.at(8) == -1) flg = true;
  if (X.at(2) == -1 && X.at(4) == -1 && X.at(6) == -1) flg = true;
  
  if (flg) {
	cout << "Yes" << endl;
  } else {
	cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>



constexpr long long int MOD = 998244353LL;
long long int power(const long long int base, const long long int exp) {
	switch (exp) {
	case 0LL: return 1;
	case 1LL: return base % MOD;
	default: return power(base * base % MOD, exp / 2) * power(base, exp % 2) % MOD;
	}
}
int main() {
	long long int m, n; int k; std::cin >> m >> n >> k;
	if (m < k) {
		std::cout << 0 << '\n';
		return 0;
	}
	std::vector<long long int> factorial(k, 1), inverse(k, 1), inverse_factorial(k, 1);
	for (auto i = 2; i < k; ++i) {
		factorial[i] = (i * factorial[i - 1]) % MOD;
		inverse[i] = (MOD - MOD / i) * inverse[MOD % i] % MOD;
		inverse_factorial[i] = inverse[i] * inverse_factorial[i - 1] % MOD;
	}
	std::vector<long long int> just_string(k, 0);
	for (auto i = 1; i < k; ++i) {
		just_string[i] = power(i, n);
		for (auto j = 1; j < i; ++j) {
			just_string[i] -= factorial[i] * inverse_factorial[i - j] % MOD * inverse_factorial[j] % MOD * just_string[j] % MOD;
			just_string[i] %= MOD;
		}
	}
	std::vector<long long int> falling_factorial(k, 1);;
	for (auto i = 1; i < falling_factorial.size(); ++i) {
		falling_factorial[i] = (m - i + 1) % MOD * falling_factorial[i - 1] % MOD;
	}
	long long int result = power(m % MOD, n);
	for (auto i = 1; i < k; ++i) {
		result -= falling_factorial[i] % MOD * inverse_factorial[i] % MOD * just_string[i] % MOD;
		result %= MOD;
	}
	std::cout << (result + MOD) % MOD << '\n';
	return 0;
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1000000007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

void calc(vector<double> &xR, vector<double> &xL, vector<double> &xC, int p, vector<double> &ts){
    double xr = -1e32;
    double xl = -1e32;
    double xc = -1e32;
    for(auto x : xR) xr = max(xr, p*x);
    for(auto x : xL) xl = max(xl, p*x);
    for(auto x : xC) xc = max(xc, p*x);
    double mx = max(xr, max(xl, xc));
    if(xc==mx && !xC.empty() && !xR.empty()) ts.push_back(xc-xr);
    if(xl==mx && !xL.empty() && !xC.empty()) ts.push_back(xl-xc);
    if(xl==mx && !xL.empty() && !xR.empty()) ts.push_back((xl-xr)*0.5);
}

int main(){
    int N;
    cin >> N;
    vector<double> xR, xL, xC, yR, yL, yC;
    REP(i, N){
        double x, y;
        char d;
        cin >> x >> y >> d;
        if(d=='R'){
            xR.push_back(x);
            yC.push_back(y);
        }
        if(d=='L'){
            xL.push_back(x);
            yC.push_back(y);
        }
        if(d=='U'){
            yR.push_back(y);
            xC.push_back(x);
        }
        if(d=='D'){
            yL.push_back(y);
            xC.push_back(x);
        }
    }
    vector<double> ts;
    ts.push_back(0.0);
    calc(xR, xL, xC, 1, ts);
    calc(xL, xR, xC, -1, ts);
    calc(yR, yL, yC, 1, ts);
    calc(yL, yR, yC, -1, ts);
    cerr << ts << endl;
    double ans = 1e32;
    for(auto t : ts){
        double xmax = -1e32;
        double ymax = -1e32;
        double xmin = +1e32;
        double ymin = +1e32;
        for(auto x : xR){
            xmax = max(xmax, x + t);
            xmin = min(xmin, x + t);
        }
        for(auto x : xL){
            xmax = max(xmax, x - t);
            xmin = min(xmin, x - t);
        }
        for(auto x : xC){
            xmax = max(xmax, x);
            xmin = min(xmin, x);
        }
        for(auto y : yR){
            ymax = max(ymax, y + t);
            ymin = min(ymin, y + t);
        }
        for(auto y : yL){
            ymax = max(ymax, y - t);
            ymin = min(ymin, y - t);
        }
        for(auto y : yC){
            ymax = max(ymax, y);
            ymin = min(ymin, y);
        }
        ans = min(ans, (xmax-xmin)*(ymax-ymin));
    }
    cout << fixed << setprecision(32) << ans << endl;
    return 0;
}



Measured memory_bytes: 2156
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

const int INF = 1e6;
int minCost[101][510][110]; // n, thousand, coin

int main(){

    while(true){
        int n;
        cin >> n;
        if(n == 0){
            break;
        }

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

        for(int i = 0; i <= n; i++){
            for(int j = 0; j <= 500; j++){
                for(int k = 0; k <= n; k++){
                    minCost[i][j][k] = INF;
                }
            }
        }

        minCost[0][0][0] = 0;

        for(int i = 0; i < n; i++){
            for(int j = 0; j < 500; j++){
                for(int k = 0; k < n; k++){
                    int temp = minCost[i][j][k];
                    if(temp == INF){
                        continue;
                    }

                    minCost[i + 1][j][k] = min(minCost[i + 1][j][k], minCost[i][j][k]);

                    int nextJ;
                    int small = 1000 * j - temp - 500 * k;
                    int r = p[i] % 1000;
                    if(r != 0 && r <= 500){
                        nextJ = j + (p[i] / 1000) + 1;
                        minCost[i + 1][nextJ][k + 1] = min(minCost[i + 1][nextJ][k + 1], temp + p[i]);
                    }
                    else{
                        if(r == 0){
                            if(small >= 500){
                                nextJ = j + (p[i] / 1000);
                                minCost[i + 1][nextJ][k + 1] = min(minCost[i + 1][nextJ][k + 1], temp + p[i]);
                            }
                        }
                        else if(small >= r - 500){
                            nextJ = j + (p[i] / 1000) + 1;
                            minCost[i + 1][nextJ][k + 1] = min(minCost[i + 1][nextJ][k + 1], temp + p[i]);
                        }
                    }

                    nextJ = j + (int)ceil((double)p[i] / 1000);
                    minCost[i + 1][nextJ][k] = min(minCost[i + 1][nextJ][k], temp + p[i]);
                }
            }
        }

        int c, s;
        c = 0;
        s = 0;
        for(int i = 0; i <= 500; i++){
            for(int j = 0; j <= n; j++){
                int temp = minCost[n][i][j];
                if(temp == INF){
                    continue;
                }
                if(j > c){
                    c = j;
                    s = temp;
                }
                else if(j == c && temp < s){
                    s = temp;
                }
            }
        }

        cout << c << " " << s << endl;
    }

    return 0;
}


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

public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str,strArray[];
		int a=0,b=0,ab=0,o=0;

		while((str=br.readLine()) != null){
			strArray = str.split(",");

			if(strArray[1].equals("A")){
				a++;
			}else if(strArray[1].equals("B")){
				b++;
			}else if(strArray[1].equals("AB")){
				ab++;
			}else{
				o++;
			}
		}

		System.out.printf("%d\n%d\n%d\n%d\n",a,b,ab,o);

	}
}

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

int A[2000001],H;

int parent(int i){return i/2;}
int left(int i){return 2*i;}
int right(int i){return 2*i+1;}

void maxHeapify(int i){
  int l,r;
  l=left(i);
  r=right(i);
  
  int largest=i;
  if(0<l&&l<=H){
    if(l<=H&&A[l]>A[i]) largest=l;
    else largest=i;
  }
  if(0<r&&r<=H)if(r<=H&&A[r]>A[largest])largest=r;
  if(largest!=i){
    swap(A[i],A[largest]);
    maxHeapify(largest); 
  }
}

void heapIncreaseKey(int i,int key){
  if(key<A[i]) return ;

  A[i]=key;
  while(i>1&&A[parent(i)]<A[i]){
    swap(A[i],A[parent(i)]);
    i=parent(i); 
  }
}

void insert(int key){
  A[++H]=-INT_MAX;
  heapIncreaseKey(H,key);
}

int heapExtractMax(){
  if(H<1) return -INT_MAX;
  int max=A[1];
  A[1]=A[H];
  H--;
  maxHeapify(1);
  
  return max;
}

int main(){
  string com;
  
  while(1){
    int k;
    cin>>com;
    if(com[0]=='e'&&com[1]=='n') break;
    else if(com[0]=='i'){
      cin>>k;
      insert(k);
    }else if(com[0]=='e'&&com[1]=='x')cout<<heapExtractMax()<<endl;
  }
 
  return 0;
}

Measured memory_bytes: 5288
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define INF 1ll<<60;
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; }

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

int main(){
    vector<string> s(3);
    rep(i, 3) cin >> s[i];

    int turn = 0;

    while(true){
        if(s[turn].empty()){
            cout << char('A'+turn) << endl;
            return 0;
        }
        int n_turn = s[turn][0] - 'a';
        s[turn].erase(0, 1);
        turn = n_turn;
    }

    return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define ld long double

using namespace std;

int main() {
	int n;
	cin >> n;
	if(n%2 == 0) cout << "0.5000000\n";
	else {
		int x = n/2 + 1;
		cout << fixed << setprecision(10) << (ld)(x) / (ld)(n) << endl;
	}
}

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

using namespace std;

int main() {
  int x, y, z, k;
  cin >> x >> y >> z >> k;
  vector<long long> a, b, c, ab, ans;
  long long tmp;
  for (int i = 0; i < x; i++) {
    cin >> tmp;
    a.push_back(tmp);
  }
  for (int i = 0; i < y; i++) {
    cin >> tmp;
    b.push_back(tmp);
  }
  for (int i = 0; i < z; i++) {
    cin >> tmp;
    c.push_back(tmp);
  }

  sort(c.begin(), c.end(), greater<long long>());
  for (int i = 0; i < x; i++) {
    for (int j = 0; j < y; j++) {
      ab.push_back(a[i] + b[j]);
    }
  }
  sort(ab.begin(), ab.end(), greater<long long>());
  for (int i = 0; i < min(k, (int)ab.size()); i++) {
    for (int j = 0; j < min(k, (int)c.size()); j++) {
      ans.push_back(ab[i] + c[j]);
    }
  }
  sort(ans.begin(), ans.end(), greater<long long>());
  for (int i = 0; i < k; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

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

using namespace std;

typedef long long int64;

int64 f(int64 b, int64 n)
{
  if(n < b) return (n);
  return (f(b, n / b) + n % b);
}

int64 Search(int64 N, int64 S)
{
  if(N < S) return(-1);
  if(N == S) return (N + 1);
  for(int64 i = 2; i * i <= N; i++) {
    if(f(i, N) == S) return (i);
  }
  for(int64 i = sqrt(N); i > 0; i--) {
    if((N - S) % i == 0 && f((N - S) / i + 1, N) == S) return ((N - S) / i + 1);
  }
  return (-1);
}

int main()
{
  int64 N, S;
  cin >> N >> S;
  cout << Search(N, S) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int t[4],n[4],sale[4],i;
  
  for(i=0;i<4;i++){
    scanf("%d %d",&t[i],&n[i]);
  }
  for(i=0;i<4;i++){
    if(t[i]==1){
      sale[i]=6000*n[i];
    }else if(t[i]==2){
      sale[i]=4000*n[i];
    }else if(t[i]==3){
      sale[i]=3000*n[i];
    }else{
      sale[i]=2000*n[i];
    }
    printf("%d\n",sale[i]);
  }
  return 0;

}

Measured memory_bytes: 600
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define mod 1000000007
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

// 二項係数計算
long long COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y)* mod_pow(kai(y, y), mod - 2, mod) % mod;
}
void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
struct edge { int to, cost; };
int par[114514], rrank[114514];//親、木の深さ
void init(int n) {
	rep(i, n) {
		par[i] = i;
		rrank[i] = 0;
	}
}
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else return par[x] = find(par[x]);
}
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rrank[x] < rrank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rrank[x] == rrank[y])rrank[x]++;
	}
}
bool same(int x, int y) {
	return find(x) == find(y);
}
int n;
int w[114];
signed main() {
	cin >> n;
	rep(i, n)cin >> w[i];
	int ans = inf;
	for (int t = 0; t < n-1; t++) {
		int memo1 = 0, memo2 = 0;
		for (int i = 0; i <= t; i++)memo1 += w[i];
		for (int i = t + 1; i < n; i++)memo2 += w[i];
		ans = min(ans, abs(memo1 - memo2));
	}
	cout << ans << endl;
	ggr
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>
#include<math.h>
using namespace std;

int main() {
	int a, b, c, d, ans;
	string str;
	cin >> str;
	a = str[0] - '0';
	b = str[1] - '0';
	c = str[2] - '0';
	d = str[3] - '0';
	ans = 7 - a;
	if ((ans - b - c - d) == 0)
	{
		cout << a << '+' << b << '+' << c << '+' << d;
	}
	else
		if ((ans - b - c + d) == 0)
		{
			cout << a << '+' << b << '+' << c << '-' << d;
		}
		else
			if ((ans - b + c - d) == 0)
			{
				cout << a << '+' << b << '-' << c << '+' << d;
			}
			else
				if ((ans - b + c + d) == 0)
				{
					cout << a << '+' << b << '-' << c << '-' << d;
				}
				else
					if ((ans + b - c - d) == 0)
					{
						cout << a << '-' << b << '+' << c << '+' << d;
					}
					else
						if ((ans + b - c + d) == 0)
						{
							cout << a << '-' << b << '+' << c << '-' << d;
						}
						else
							if ((ans + b + c - d) == 0)
							{
								cout << a << '-' << b << '-' << c << '+' << d;
							}
							else
								if ((ans + b + c + d) == 0)
								{
									cout << a << '-' << b << '-' << c << '-' << d;
								}
	cout << "=7" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
//#define for(i,a,b) for(int i=(a);i<=(b);i++)
#define ppi pair<int,int>
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int N = 105;
const double pi = acos(-1.0);
const ll mod = 1e9+7;
void init(){ios::sync_with_stdio(false);cin.tie(0);} 
template<class T>inline void read(T &res)
{
	char c;T flag=1;
	while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
	while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
int main()
{
	init();
	ll a,b,n;
	cin>>a>>b>>n;
	if(n>=b)n=b-1;
	cout<<(ll)floor(a*n/b);
	return 0;
}

Measured memory_bytes: 3648
cake = 4
donuts = 7
money = gets.to_i

cakeNum = 0
donutsNum = 0

result = "No"

donutsArray = Array.new
cakeArray = Array.new

(money/ cake + 1).times do
    cakeArray.push(cake * (cakeNum))
    cakeNum += 1
end
(money / donuts + 1).times do
    donutsArray.push(donuts * (donutsNum))
    donutsNum += 1
end

cakeArray.each do |cakeItem|
    if cakeItem == money then
        result = "Yes"
    end
    donutsArray.each do |donutsItem|
        if (cakeItem + donutsItem == money) || (donutsItem == money) then
            result = "Yes"
        end
    end
end

puts result


Measured memory_bytes: 1788
class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

def solve(k, a, b)
  x = (a / k) * k

  return true if a == x

  x += k

  return x <= b
end

def main(argv)
  k = InputLine.to_i
  (a, b) = InputLine.to_ia

  puts (solve(k, a, b) ? 'OK' : 'NG')
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 14272
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 999999

ll min(ll a, ll b){
	if (a>b){return b;}
	else {return a;}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<ll> x(n);
	REP(i, n){cin >> x[i];}
	vector<ll> sorted_x(n);
	REP(i, n){sorted_x[i] = x[i];}
	sort(sorted_x.begin(), sorted_x.end());
	ll s_median = sorted_x[n/2-1];
	ll l_median = sorted_x[n/2];
	REP(i, n){
		if (x[i] > s_median){cout << s_median << endl;}
		else {cout << l_median << endl;}
	}
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 
#define PI 3.141592653589793238

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;
typedef gp_hash_table<long int,long int> HashTable;

int main(){
   IOS;
 /*    #ifndef ONLINE_JUDGE
         freopen("in.txt",  "r",  stdin);
         freopen("out.txt", "w", stdout);
     #endif */
   
   long int x;
   cin>>x;

   long int num = x / 500;
   long int ans = num * 1000;
   long int num2 = (x % 500) / 5;
   ans += num2 * 5;
   cout<<ans;
   return 0;
}

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

int input()
{
    int value;
    std::cin>>value;
    return value;
}

int main()
{
    std::vector<int> vec;
    int n;
    std::cin >> n;
    for(int i = 0;i<n;++i)
        vec.push_back(input());
    std::reverse(vec.begin(),vec.end());
    for(auto i = 0;i < n;++i)
    {
        std::cout << vec[i] << (i==n-1?"":" ");
    }
    std::cout << std::endl;
    return 0;
}

Measured memory_bytes: 3144
/***************************************************
 * Problem Name : A.cpp
 * Problem Link :
 * OJ           :
 * Verdict      : Trying
 * Date         : 2020-02-16
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.begin(), v.end())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm (ll a, ll b) {
    return a * b / __gcd (a, b);
}
/************************************ Code Start Here ******************************************************/
int main () {
    //~ __FastIO;
    //~ cout << setprecision (10);
    //~ cout << fixed;
    int a, b, c;
    cin >> a >> b >> c;
    set<int>st;
    st.insert (a);
    st.insert (b);
    st.insert (c);

    if (st.size() == 2) {
        cout << "Yes\n";

    } else {
        cout << "No\n";
    }

    return 0;
}


Measured memory_bytes: 256