akhauriyash/Code-Regression huggingface dataset:
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int n; cin >> n;
    string c; cin >> c;
    int cntr = 0, cntw = 0;
    rep(i, n) {
        if(c[i] == 'R') ++ cntr;
        else ++ cntw;
    }
    int ret = 0;
    rep(i, n) {
        if(i < cntr && c[i] == 'W') ++ ret;
        if(i >= cntr && c[i] == 'R') ++ ret;
    }
    cout << (ret + 1) / 2 << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3780
import copy
li=[int(input()) for i in range(5)]

ans=10**9
temp=0

for j in li:
    temp = j
    li2 = copy.copy(li)
    li2.remove(j)
    for k in li2:
        if k % 10 != 0:
            temp += k + (10 - (k % 10))
        else:
            temp += k
    ans = min(ans, temp)

print(ans)

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A, B;
  cin >>A>>B;
  int a,b,c;
  a=A+B;
  b=A-B;
  c=A*B;
  vector<int> vec(3);
  vec[0]=a;
  vec[1]=b;
  vec[2]=c;
  sort(vec.begin(),vec.end());
  cout <<vec[2]<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define pb push_back
using namespace std;
const int INF = 1e9;
typedef long long ll;

int main(){
  ll n;
  cin >> n;
  bool f[n];
  REP(i,n){
    f[i] = false;
  }
  ll sum = 0;
  for(int i = 0;i < n;i++){
    if(sum+i+1 <= n){
      sum += i+1;
      f[i] = true;
    }
    else{
      f[i] = true;
      f[sum+i+1-n-1] = false;
      break;
    }
    //cout << sum << endl;
  }
  REP(i,n){
    if(f[i])
      cout << i+1 << endl;
  }
  return 0;
}


Measured memory_bytes: 9984
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    long A, B;
    scan(A, B);
    auto P = aryread();
    long a, b, c;
    foreach (p; P)
    {
        if (p < A + 1)
        {
            a++;
        }
        else if (B < p)
        {
            c++;
        }
        else
        {
            b++;
        }
    }
    min(a, b, c).writeln();
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 2 * 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int t;
map <int, bool> cnt;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    int n;
    cin >> n;
    int a[n + 1];
    bool ok = 1;
    FOR(i, 1, n)
    {

        cin >> a[i];
        if(cnt[a[i]] == 1)
        {
            ok = 0;
        }
        cnt[a[i]] = 1;
    }

    if(ok) cout << "YES";
    else cout << "NO";
    return 0;
}



Measured memory_bytes: 10368
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>

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

using namespace std;

typedef long long int ll;

const ll INF=(ll)1e18;

int main(){
    int N;
    ll C;

    cin >> N >> C;

    vector<ll> x(N+1), v(N+1), vc(N+1);
    x[0] = 0;
    v[0] = 0;
    FOR(i,1,N+1)cin >> x[i] >> v[i];
    vc[0] = v[0];
    FOR(i,1,N+1){
        vc[i] = vc[i-1] + v[i];
    }

    vector<ll> r(N+1);
    r[0] = 0;
    for(int i = 1; i <= N; i++){
        r[i] = max(r[i-1], vc[i]-x[i]);
    }

    vector<ll> l(N+1);
    l[N] = vc[N] - vc[N-1] - (C-x[N]);

    for(int i = N-1; i >= 1; i--){
        l[i] = max(l[i+1], vc[N]-vc[i-1]-(C-x[i]));
    }


    ll ans = 0;
    REP(i,N+1){
        ll tmp = vc[i] -  x[i];
//      printf("%d : %lld\n", i,tmp);
        if(tmp > ans)ans = tmp ;

        if(i < N){
            tmp = vc[i] - 2 * x[i] + l[i+1];
//            printf("%d : %lld\n", i,tmp);
            if(tmp > ans)ans = tmp ;
        }


/*
        for(int j = N; j > i; j--){
            ll tmp = vc[i] - 2 * x[i] - (C - x[j]) + vc[N] - vc[j-1];
//            printf("%d %d : %lld\n", i,j,tmp);
            if(tmp > ans)ans = tmp ;
        }
*/
    }

    for(int i = N; i >= 1; i--){
        ll tmp = vc[N] -  vc[i-1] - (C - x[i]);
//        printf("%d %d : %lld\n", i,i,tmp);
        if(tmp > ans)ans = tmp ;

        tmp = vc[N] - vc[i-1] - 2 * (C - x[i]) + r[i-1];
//            printf("%d %d : %lld\n", i,j,tmp);
        if(tmp > ans)ans = tmp ;

/*
        for(int j = 1; j < i; j++){
            ll tmp = vc[N] - vc[i-1] - 2 * (C - x[i]) - x[j] + vc[j];
//            printf("%d %d : %lld\n", i,j,tmp);
            if(tmp > ans)ans = tmp ;
        }
*/
    }
    cout << ans << endl;
}



Measured memory_bytes: 4224
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
 
using namespace std;
 
#define A_MAX 10000
 
int main (void) {
 
  int n;
  int a[10000] = {0};
  int i, j;
 
  cin >> n;
 
  for(i = 0; i < n; i++) {
    cin >> a[i]; 
  }
 
  sort(a, a + 10000);
 
  for(i = 0; i < 10000; i++){
    if (a[i] > 0) break;
  }
  int st = i - 1;
   
  //cout << a[st + 1] << endl;
 
  stringstream ss1, ss2, ss3, ss4;
 
  string str[4];
  string strAppended;
  int res[12];
  int cnt = 0;
 
 
  ss1 << a[st + 1];
  ss2 << a[st + 2];
  ss3 << a[st + 3];
  if (n == 3) {
    ss4 << A_MAX;
  } else {
    ss4 << a[st + 4];
  }
  str[0] = ss1.str();
  str[1] = ss2.str();
  str[2] = ss3.str();
  str[3] = ss4.str();
 
  for(i = 0; i < 4; i++) {
    for(j = 0; j < 4; j++) {
      if(str[i] == str[j]) continue;
 
      strAppended = str[i] + str[j];
      //cout << "------" << strAppended << endl;
      res[cnt++] = atoi(strAppended.c_str());
    }
  }
 
  sort(res, res + 12);
 
  cout << res[2] << endl;
 
  return 0;
}

Measured memory_bytes: 1292
def judge(nums):
  if nums == []:
    return True
  ret = False
  m = nums[0]
  if nums.count(m) == 3:
    ret = ret or judge(nums[3:])
  if m in nums and m + 1 in nums and m + 2 in nums:
    new_nums = nums[:]
    new_nums.remove(m)
    new_nums.remove(m + 1)
    new_nums.remove(m + 2)
    ret = ret or judge(new_nums)
  return ret

n = int(input())
for _ in range(n):
  nums = list(map(int, input().split()))
  colors = input().split()
  dic = {"R":[], "G":[], "B":[]}
  for num, color in zip(nums, colors):
    dic[color].append(num)
  ans = judge(sorted(dic["R"])) and judge(sorted(dic["G"])) and judge(sorted(dic["B"]))
  print(int(ans))


Measured memory_bytes: 5604
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    int m=abs(a-b)+1;
    if(m%2!=0)
    {
        a=min(a,b);
        cout<<a+((m+1)/2-1)<<endl;
    }
    else
        cout<<"IMPOSSIBLE"<<endl;
    return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
int main(){
  int S;
  cin >> S;
  int num_a = S/100;
  int num_b = S%100;
  if ((num_a <=12 && num_a >=1) && (num_b <= 12 && num_b >= 1)){
    cout << "AMBIGUOUS" << endl;
  }
  else if (num_a <= 12 && num_a >= 1){
    cout << "MMYY" << endl;
  }
  else if (num_b <= 12 && num_b >= 1){
    cout << "YYMM";
  }
  else{
    cout << "NA" << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int inputA, inputB, inputC;

	scanf("%d %d %d", &inputA, &inputB, &inputC);
	
	// Checks if all numbers have the same value
	if (inputA == inputB && inputB == inputC)
	{
		printf("No \n");
	}
	// Checks if inputed numbers are 'poor'
	else if (inputA == inputB || inputA == inputC || inputB == inputC)
	{
		printf("Yes \n");
	}
	else
	{
		printf("No \n");
	}

	return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long n, k;
    cin >> n >> k;
    if (n > k) n %= k;
    cout << min(n, k - n) << endl;
    return 0;
}



Measured memory_bytes: 256
from collections import Counter
n = int(input())
sl = []
for i in range(n):
    s = list(input())
    s.sort()
    sl.append("".join(s))
d = Counter(sl)

def cul(n):
    return n*(n - 1)//2

ans = 0
val = d.values()
for i in val:
    if i > 1:
        ans += cul(i)
print(ans)

Measured memory_bytes: 103588
#ABC113B-Palace.py

from sys import stdin

input = stdin.readline

N = int(input())
T, A = list(map(int,input().split()))
H = list(map(int,input().split()))

temp = [T-i*0.006 for i in H]
diff = [abs(A-i) for i in temp]

print(diff.index(min(diff))+1)


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cctype>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdarg>
using namespace std;

const char UP    = 'N';
const char DOWN  = 'S';
const char RIGHT = 'E';
const char LEFT  = 'W';

class Dice{
public:
    int und;
    int over;
    int up;
    int down;
    int right;
    int left;

    Dice(int arr[]){
        und   = arr[5];
        over  = arr[0];
        up    = arr[4];
        down  = arr[1];
        right = arr[2];
        left  = arr[3];
    }

    void upd(int& a, int& b, int& c, int& d){
        int tmp;
        tmp = a;
        a = b;
        b = c;
        c = d;
        d = tmp;
    }

    void move(char order){
        if (order == UP){
            upd(und, up, over, down);
        }else if(order == DOWN){
            upd(und, down, over, up);
        }else if(order == RIGHT){
            upd(und, right, over, left);
        }else{
            upd(und, left, over, right);
        }
    }

    void act(int len, ...){
        va_list args;
        va_start(args, len);
        char order;
        for(int i = 0; i < len; i ++){
            order = va_arg(args, int);
            move(order);
        }
        va_end(args);
    }

    void show(){
        cout << over << endl;
    }
};

int judge(Dice d1, Dice d2){
    int res = (
        d1.und == d2.und &&
        d1.over == d2.over &&
        d1.up == d2.up &&
        d1.down == d2.down &&
        d1.right == d2.right &&
        d1.left == d2.left
    );
    return res;
}

int main(int argc, char const *argv[])
{
    int a[6], b[6];
    for(auto &i: a){
        cin >> i;
    }
    for(auto &i: b){
        cin >> i;
    }
    Dice d1(a), d2(b);
    for(int i = 0; i < 4; i ++){
        for(int j = 0; j < 4; j ++){
            if (judge(d1, d2)){
                cout << "Yes" << endl;
                return 0;
            }
            d1.move(RIGHT);
        }
        d1.move(DOWN);
    }
    d1.act(2, RIGHT, DOWN);
    for(int j = 0; j < 4; j ++){
        if (judge(d1, d2)){
            cout << "Yes" << endl;
            return 0;
        }
        d1.move(RIGHT);
    }
    d1.act(2, DOWN, DOWN);
    for(int j = 0; j < 4; j ++){
        if (judge(d1, d2)){
            cout << "Yes" << endl;
            return 0;
        }
        d1.move(RIGHT);
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3116
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#include<bits/stdc++.h>
using namespace std;

#if defined(DAIJOBU)
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}

int main(){
	FIO
	
	int n, k;cin >> n >> k;
	vector<int> a(n);
	for(int i = 0; i < n; i++)cin >> a[i];
	sort(a.begin(), a.end());
	if(n == 1){
		if(k == a[0]){
			puts("POSSIBLE");
		}
		else puts("IMPOSSIBLE");
		return 0;
	}
	if(k > a[n - 1]){
		puts("IMPOSSIBLE");
	}
	else{
		int gcd = a[0];
		for(int i = 1; i < n; i++)gcd = __gcd(gcd, a[i]);
		if(k % gcd == 0){
			puts("POSSIBLE");
		}
		else{
			puts("IMPOSSIBLE");
		}
	}
	return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

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

    int n;
    cin >> n;
    int c[1000],s[1000],f[1000];

    rep(i,n-1){
        cin >> c[i] >> s[i] >> f[i];
    }

    rep(i,n-1){
        int cnt =0;
        for(int j=i;j<n-1;j++){
            if(j==i){
                cnt+=c[j]+s[j];
            }
            else{
                if(cnt<=s[j]){
                    cnt = s[j];
                    cnt += c[j];
                }
                else{
                    int m;
                    m = cnt -s[j];
                    m %= f[j];
                    if(m==0){
                        cnt += c[j];
                    }
                    else{
                        cnt += f[j] - m;
                        cnt += c[j];
                    }
                }
            }
        }
        cout << cnt << endl;
    }
    cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
typedef long long ll;
const int maxn = 55;

string a[maxn],b[maxn];
int n,m;

bool solve(){
  for(int i=0;i+m<=n;i++)
  for(int j=0;j+m<=n;j++){
    bool sign=0;
    for(int k=0;k<m;k++)
    for(int r=0;r<m;r++)
    if(b[k][r]!=a[i+k][j+r])sign=1;
    if(!sign)return 1;
  }
  return 0;
}

int main() {
 // freopen("in.cpp","r",stdin);
  cin>>n>>m;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<m;i++)cin>>b[i];
  if(solve())cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


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

main() {

  int i, j, t, y;

  while(1){

    cin >> t >> y;
  
    if(t == 0 && y == 0){
      break;
    }else{
      
      for(i = 0; i < t; i++){
	for(j = 0; j < y; j++){
	  if(i != 0 && i != t-1 && j != 0 && j != y-1 ){
	    printf(".");
	  }else {
	    printf("#");
	  }
	}
	printf("\n");
      }
      printf("\n");
    }
  }
}

Measured memory_bytes: 1112
#include <iostream>
#include <string>
#include <vector>

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

class Point
{
public:
	int x, y;
};

void solve()
{
	int n, m;
	while(cin >> n >> m, n || m)
	{
		string s;
		Point current;
		current.x = 1;
		current.y = 1;
		vector< vector<char> > field(m + 1, vector<char>(n + 1));
		int direction = 0;
		while(cin >> s)
		{
			if(s == "FORWARD" || s == "BACKWARD")
			{
				int size;
				cin >> size;
				if(s == "FORWARD")
				{
					if(current.x + dx[direction] * size <= 0)
					{
						current.x = 1;
					}
					else if(current.x + dx[direction] * size > n)
					{
						current.x = n;
					}
					else
					{
						current.x += dx[direction] * size;
					}

					if(current.y + dy[direction] * size <= 0)
					{
						current.y = 1;
					}
					else if(current.y + dy[direction] * size > m)
					{
						current.y = m;
					}
					else
					{
						current.y += dy[direction] * size;
					}
				}
				else
				{
					if(current.x + dx[(direction + 2) % 4] * size <= 0)
					{
						current.x = 1;
					}
					else if(current.x + dx[(direction + 2) % 4] * size > n)
					{
						current.x = n;
					}
					else
					{
						current.x += dx[(direction + 2) % 4] * size;
					}

					if(current.y + dy[(direction + 2) % 4] * size <= 0)
					{
						current.y = 1;
					}
					else if(current.y + dy[(direction + 2) % 4] * size > m)
					{
						current.y = m;
					}
					else
					{
						current.y += dy[(direction + 2) % 4] * size;
					}
				}
			}
			else if(s == "RIGHT")
			{
				direction = (direction + 1) % 4;
			}
			else if(s == "LEFT")
			{
				if(direction == 0)
				{
					direction = 3;
				}
				else
				{
					--direction;
				}
			}
			else
			{
				cout << current.x << " " << current.y << endl;
				break;
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1244
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>

#define div1 1000000007

using namespace std;

int main(void)
{
    long long X, sum=0, ans=0, i;

    cin >> X;

    for(i=1; sum<X; i++){
        sum += i;

        ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using ull = unsigned long long;
using ll = long long;
using namespace std;

int main(void) {
    int a,b;
    cin >> a >> b;
    
    cout << max({a+b, a*b, a-b}) << endl;
    
    return 0;
}

Measured memory_bytes: 256
import math
a, b, x = map(int, input().split())
y = a*a*b - x
if y == 0:
  print(0)
  exit()

if (a*a*b/2 < x):
  print(90-math.degrees(math.atan((a**3)/(2*y))))
else:
  print(90-math.degrees(math.atan((2*x)/(a* b**2))))


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int a[114514]; int n, ans = 0;
signed main(){
	cin >> n;
	rep(i, n)cin >> a[i];
	for (int i = 0; i < n - 1; i++) {
		if (a[i] - (i + 1) != 0 && a[i + 1] - (i + 2) == 0 && a[i + 2] - (i + 3) == 0)continue;
		if ((a[i] - (i + 1) == 0 || a[i + 1] - (i + 2) == 0)) {
			swap(a[i], a[i + 1]);
			ans++;
		}
	}
	cout << ans << endl;
	getchar(); getchar(); return 0;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265359

int main(void)
{
	int n,tcnt,hcnt;
	string ts,hs;

	cin >> n;
	tcnt = hcnt = 0;
	rep(i, n) {
		cin >> ts >> hs;
		if (ts > hs)
			tcnt += 3;
		else if (ts < hs)
			hcnt += 3;
		else {
			tcnt += 1;
			hcnt += 1;
		}
	}
	cout << tcnt << " " << hcnt << endl;
}



Measured memory_bytes: 3120
s=input().rstrip()
t=input().rstrip()
def func(s,t):
  ds, dt = {}, {}
  for i,j in zip(s,t):
    if i not in ds:
      ds[i] = j
    elif ds[i]!=j:
      return "No"
    if j not in dt:
      dt[j] = i
    elif dt[j]!=i:
      return"No"
  return "Yes"
print(func(s,t))

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int f=100005;
long long jia(long long n)
{
    long long a=0;
    while(n){
        a+=n%10;
        n=n/10;
    }
    return a;
}
int main()
{
    long long n,m,h,a,b;
    long long  k=f;
    cin>>n;
    for(long long i=1;i<n;i++){
        long long j;
        j=n-i;
        m=jia(i)+jia(j);
        if(k>m){
            k=m;
            a=i;
            b=j;
        }
    }
    cout<<k<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
int main(void) {
	int num, i, k, u;
	int v[101];
	const char *fmt;

	scanf("%d", &num);
	for (i = 0; i < num; i++) {
		for (k = 1; k <= num; k++) {
			v[k] = 0;
		}
		scanf("%d %d", &u, &k);
		while (k--) {
			scanf("%d", &u);
			v[u] = 1;
		}
		fmt = "%d";
		for (k = 1; k <= num; k++) {
			printf(fmt, v[k]);
			fmt = " %d";
		}
		putchar('\n');
	}
	return 0;
}

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

int main(){
  int k;
  cin >> k;
  if(k%2==0||k%5==0){
    cout << -1 << endl;
    return 0;
  }
  int ans = 1;
  int s = 7;
  rep(i,10000000){
    if(s%k==0){
        cout << ans << endl;
        return 0;
      }
    s *= 10;
    s +=7;
    ++ans;
    s%=k;
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

int main() {
  int n, c; cin >> n >> c;
  vector<vector<int>> d(c, vector<int>(c));
  vector<vector<int>> cc(n, vector<int>(n));

  REP(i, c)REP(j, c) cin >> d[i][j];
  REP(i, n)REP(j, n) cin >> cc[i][j];

  vector<vector<ll>> mc(3, vector<ll>(c, 0LL));
  REP(i, n)REP(j, n)REP(k, c){
    mc[(i + j) % 3][k] += d[cc[i][j]-1][k];
  }

  ll ans = numeric_limits<ll>::max();
  REP(i, c)REP(j, c)REP(k, c){
    if(i == j || j == k || k == i) continue;
    ll tmp = mc[0][i] + mc[1][j] + mc[2][k];

    ans = min(ans, tmp);
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
    int N, K;
    cin >> N >> K;
    int A[N];
    for (int i = 0; i < N; ++i) cin >> A[i];

    int ans = 0;
    for (int i = N; i > 1; i -= K - 1) ++ans;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
    int n, k;
    cin >> n >> k;
    vector<int> t;
    int i;
    for(i=0; i<n; i++){
        int d;
        cin >> d;
        t.push_back(d);
    }
    sort(t.begin(), t.end());
    int tmp = 0, res = t[k-1]-t[0];
    for(i=1; i<n-k+1; i++){
        tmp = t[i+k-1] - t[i];
        res = min(tmp, res);
        //cout << tmp << " " << res << endl;
    }
    cout << res << endl;
    return 0;
}

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

int main() {
  
  int N, x; cin >> N >> x;
  
  int ans = 0; int64_t sum = 0; int64_t tmp = x;
  
  vector<int> vec(N);
  
  for (int i = 0; i < N; i++) {
    cin >> vec[i];
    sum += vec[i];
  }
  
  sort(vec.begin(), vec.end());
  
  for (int i = 0; i < N; i++) {
    tmp -= vec[i];
    if (tmp < 0) break;
    ans++;
  }
  
  if (sum < x) cout << ans - 1 << endl;
  
  else cout << ans << endl;
  
}

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

#define F first
#define S second

using namespace std;
typedef long double ld;
typedef long long ll;

const int max_n = 100011, inf = 1000111222;
const ll inff = 1000111222333444;



int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int a, b;
    cin >> a >> b;
    if ((a + b) % 2 != 0) cout << "IMPOSSIBLE\n";
    else cout << (a + b) / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

        String s = sc.nextLine();

        final String[] weeks = {"SUN","MON","TUE","WED","THU","FRI","SAT"};

        for (int i = 0; i < weeks.length; i++) {
            if (s.contains(weeks[i])){
                System.out.println(7 - i);
                break;
            }
        }
    }
}

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    string S;
    cin >> S;
    ll cnt[100];
    mem0(cnt);
    for (int i = 0; i < 4; i++) {
        cnt[S[i]-'A']++;
    }
    ll ans = 0;
    for (int i = 0; i < 40; i++) {
        if(cnt[i] == 2){
            ans++;
        }
    }
    Yes(ans == 2);
}

Measured memory_bytes: 3604
#include <iomanip>
#include <iostream>
using namespace std;
int main(void) {
  for(; true;) {
    int h, w;
    cin >> h >> w;
    for(int i = 0; i < h; i++) {
      cout << "#";
      for(int j = 1; j < w-1; j++) {
        if(i != 0 && i != h - 1)
          cout << ".";
        else
          cout << "#";
      }
      cout << "#" << endl;
    }
    if(h == 0 && w == 0)
      break;
    cout << endl;
  }

  return 0;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
typedef long long int ll;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef vector<string> vecstr;
typedef vector<bool> vecbool;
typedef vector<vector<int>> vec2int;
typedef pair<int, int> P;
////////////////////////////////////////////////
void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
////////////////////////////////////////////////
int main() {
  init();
  ll x;
  cin >> x;
  vecll gojou(4001, 0);
  REP(i, 4001) { gojou[i] = i * i * i * i * i; }
  bool ok = false;
  REP(i, 4001) {
    REP(j, 4001) {
      if (gojou[i] - gojou[j] == x) {
        cout << i << " " << j << endl;
        ok = true;
        return 0;
      }
      if (gojou[i] + gojou[j] == x) {
        cout << i << " " << -j << endl;
        ok = true;
        return 0;
      }
    }
  }

  assert(ok);
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
#define ref(i,x,y)for(int i=x;i<=y;++i)
const int N=500010;
int n,k,p[N],q[N],l[N],r[N]; set<int> S;
int main(){
	scanf("%d%d",&n,&k);
	ref(i,1,n)scanf("%d",&p[i]),q[p[i]]=i;
	S.insert(n+1);q[n+1]=n+1;
	ref(i,1,n){
		S.insert(p[i]);if(i>k)S.erase(p[i-k]);
		int id=q[*S.upper_bound(p[i])];
		r[l[id]]=i;l[i]=l[id];l[id]=i;r[i]=id;
	}
	for(int i=l[n+1],j=n;i;i=l[i],--j)p[i]=j;
	ref(i,1,n)printf("%d\n",p[i]);
}

Measured memory_bytes: 34816
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long k = in.nextInt();
		long a = in.nextInt();
		long b = in.nextInt();
		if(1+k>=a && b-a>2) System.out.println((k-a+1)%2==0?(b-a)*(k-a+1)/2+a:(b-a)*((k-a+1)/2)+a+1);
		else System.out.println(k+1);
		in.close();
	}

}

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

int main() {
    int N;
    cin >> N;
    int ans = 0;
    for(int i = 0; i < N; i++) {
        int l,r;
        cin >> l >> r;
        ans += (r-l+1);
    }
    cout << ans << endl;
} 



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

// using ll = long long;
#define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
bool f[105][5][2];
int rewards[105][11];
int n;


int calc(int input) {
  int counts[n] = {0};
  REP(i,n) {
    REP(j,5) {
      REP(k,2) {
        if((input >> (j*2 + k))&1 && f[i][j][k]) ++counts[i];
      }
    }
  }
  int ret = 0;
  REP(i,n) {
    ret += rewards[i][counts[i]];
  }
  return ret;
}
/***** MAIN *****/
signed main() {
  cin >> n;
  
  REP(i,n) {
    REP(j, 5) {
      REP(k, 2) {
        cin >> f[i][j][k];
      }
    }
  }
  REP(i,n) {
    REP(j,11) {
      cin >> rewards[i][j];
    }
  }
  int ans = -MOD;
  for(int i = (1 << 10) - 1; i > 0; --i) {

    ans = max(ans, calc(i));
  }
  cout << ans;
  
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int N,A,B,i,sum,check;
	
	sum = 0;
	
	scanf("%d %d %d",&N,&A,&B);
	for(i=1;i<=N;i++){
		check = 0;
		check += i/10000%10+i/1000%10+i/100%10+i/10%10+i%10;
		if(A<=check && check<=B) sum += i;
	}
	
	printf("%d",sum);
	
	return 0;
}


Measured memory_bytes: 128
from math import sqrt

def F(t):
    return max(len(str(t[0])), len(str(t[1])))

N = int(input())
m = list(map(F,[(r,int(N / r)) for r in range(2, int(sqrt(N)) + 1) if N % r == 0]))
print(min(m) if len(m) != 0 else len(str(N)))

Measured memory_bytes: 3188
#include<iostream>
#include<math.h>
#include <algorithm>
#include<float.h>
#include <limits>
#include <vector> 
#include <numeric>
#include <string.h>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long

using namespace::std;

int jo(ll int jxo, ll int jyo){
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){
  return (toxbig-0x20);
}
char tolow(char toxlow){
  return (toxlow+0x20);
}
  


int main(){
  int a,b;
  cin>>a>>b;
  if(b<a) cout<<a-1;
  else cout<<a;

}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


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

int main() {
    int k;
    cin >> k;
    queue<ll> q;
    rep(i,9) q.push(i+1);
    ll x;
    while (k--) {
        x = q.front(); q.pop();
        if (x%10 == 0) {
            q.push(x*10);
            q.push(x*10+1);
        }
        else if (x%10 == 9) {
            q.push(x*10+8);
            q.push(x*10+9);
        }
        else {
            int y = x % 10;
            q.push(x*10+(y-1));
            q.push(x*10+y);
            q.push(x*10+(y+1));
        }
    }
    cout << x << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
//#include <>
using namespace std;

int main(){
  string S;
  cin >> S;
  int i = 0;

  while(S[i] != '\0'){
    i++;
  }


  for(int j = 0;j < i;j++)cout << "x";

  return 0;
}


Measured memory_bytes: 256
void main() {
	auto N = ri;
	auto B = readAs!(int[]);
	auto arr = new int[](N);
	arr[0] = B[0];
	arr[$ - 1] = B[$ - 1];
	foreach(i; 1..N-1) {
		arr[i] = min(B[i], B[i-1]);
	}
	arr.sum.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
from collections import Counter

n = int(input())
a = map(int, input().split())
d = Counter(a)

s = sum([k*v for k, v in d.items()])

q = int(input())
for _ in range(q):
    b, c = map(int, input().split())
    if b not in d.keys():
        print(s)
        continue
    cc = 0
    s = s + (c-b) * d[b]
    print(s)
    if c in d.keys():
        cc = d[c]
    d[c] = cc + d[b]
    del d[b]



Measured memory_bytes: 22128
package main

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

var (
	s    [][]rune
	h, w int
)

var (
	dx = [4]int{0, -1, 0, 1}
	dy = [4]int{-1, 0, 1, 0}
)

func main() {
	h, w = getInt(), getInt()
	s = make([][]rune, h)
	for i := range s {
		s[i] = []rune(getString())
	}

	ans := "Yes"
	for y := range s {
		for x := range s[y] {
			if (s[y][x] == '#') && (!checker(y, x)) {
				ans = "No"
			}
		}
	}

	fmt.Println(ans)
}

func checker(y, x int) bool {
	ret := false
	for k := 0; k < 4; k++ {
		ny := y + dy[k]
		nx := x + dx[k]
		if (ny < 0) || (ny > h-1) || (nx < 0) || (nx > w-1) {
			continue
		}

		if s[ny][nx] == '#' {
			ret = true
			break
		}
	}

	return ret
}

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
int main(void) {
  int a;
  string s;
  cin >> a >> s;
  if(a >= 3200) {
    cout << s << endl;
    return 0;
  }
  cout << "red" << endl;
  return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn

object Main extends App {

  //
  // std in
  //

  val n = StdIn.readInt()
  val as = StdIn.readLine().split(" ").map(_.toLong).sorted
  val bs = StdIn.readLine().split(" ").map(_.toLong).sorted
  val cs = StdIn.readLine().split(" ").map(_.toLong).sorted

  //
  // main
  //

  println(
    bs.map { b => countUpper(cs, b) * countLower(as, b) }.sum
  )

  //
  // functions
  //

  def countUpper(xs: Array[Long], x: Long): Long = xs.length - upperBound(xs, x)

  def countLower(xs: Array[Long], x: Long): Long = lowerBound(xs, x)

  //
  // libs
  //

  def lowerBound(xs: Array[Long], x: Long): Int = {
    var lSide: Int = -1
    var rSide: Int = xs.length

    while (rSide - lSide > 1) {
      val mid = lSide + (rSide - lSide) / 2

      if (xs(mid) >= x) rSide = mid
      else lSide = mid
    }

    rSide
  }

  def upperBound(xs: Array[Long], x: Long): Int = {
    var lSide: Int = -1
    var rSide: Int = xs.length

    while (rSide - lSide > 1) {
      val mid = lSide + (rSide - lSide) / 2

      if (xs(mid) > x) rSide = mid
      else lSide = mid
    }

    rSide
  }
}


Measured memory_bytes: 81888
#include <stdio.h>
int main(void)
{
	int n, m, l, i, j, k;
	int gyo1[100][100];
	int gyo2[100][100];
	long long int sum = 0;
	scanf("%d %d %d", &n, &m, &l);

	for (i=0;i<n;i++)
	{
		for (j=0;j<m;j++)
		{
			scanf("%d", &gyo1[i][j]);
		}
	}

	for (i=0;i<m;i++)
	{
		for (j=0;j<l;j++)
		{
			scanf("%d", &gyo2[i][j]);
		}
	}
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < l; j++)
		{
			for (k = 0; k < m; k++)
			{
				sum += gyo1[i][k] * gyo2[k][j];
			}
			if (j == l - 1)
			{
				printf("%lld\n", sum);
			}
			else
			{
				printf("%lld ", sum);
			}
			sum = 0;
		}
	}
	return 0;
}

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

using namespace std; 

int main(){ 
  int64_t n;
  cin>>n;
  int64_t ans=0;
  for(int i=0;i<n;i++){
    int l,r;
    cin>>l>>r;
    ans+=r-l+1;
  }
  cout<<ans;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}


vector<Int>getPrime(Int n){
  vector<bool>used(n+1,0);
  
  for(ll i=2;i*i<=n;i++)
    if(!used[i])for(Int j=2;j<=n/i;j++)used[i*j]=1;
  
  vector<Int> res;
  for(Int i=2;i<=n;i++)if(!used[i])res.push_back(i);

  return res;
}

bool isPrime(ll n){
  if(n < 2) return 0;
  for(ll i=2;i*i<=n;i++)if(n%i==0) return 0;
  return 1;
}

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  
  Int l, r;
  cin>>l>>r;

  vector<Int> prime = getPrime(1e5);

  vector<Int> cnt(r - l + 1);
  vector<Int> val(r - l + 1);
  for(int i=0;i<=r-l;i++) val[i] = l + i;
  
  for(Int p:prime){
    Int num = ((l-1)/p) * p + p;
    while(num <= r){
      Int score = 0, tmp = num, pp = 1;
      while(tmp%p == 0) tmp/=p, score++, pp *= p;
      cnt[num - l] += score;
      val[num - l] /= pp;

      num += p;
    }
  }
  Int ans = 0;
  for(Int i=0;i<=r - l;i++) ans += isPrime(cnt[i] + (val[i] != 1));
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 18832
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

///////////////////////////////////////////////////////////////////////////////////////

string s;
ll n1, n2;

int main() {
	rd(s);
	n1 = s.length() % 2;
	(s[0] == s[s.length() - 1]) ? n2 = 1 : n2 = 0;
	if (n1^n2) wrln("First");
	else wrln("Second");
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t { as swift
#define forin(i, f, t) for(auto i = f; i < t; i++)

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

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    auto chip = (x - a) % b;
    cout << chip << endl;
}



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

char ch1[3005],ch2[3005];

int dp[3005][3005];

int nxt[3005][3005];

int len1,len2;

int func(int i,int j)
{
    if(i==len1 || j==len2)return 0;

    if(dp[i][j]!=-1)return dp[i][j];

    int p=0,q=0,re=0;

    if(ch1[i]==ch2[j])
    {
        re=1+func(i+1,j+1);
    }
    else
    {
        p=func(i+1,j);
        q=func(i,j+1);

        if(p>q)nxt[i][j]=1;
        else nxt[i][j]=2;

        re=max(p,q);
    }

    return dp[i][j]=re;
}


int main()
{
    memset(dp,-1,sizeof dp);

    scanf("%s %s",ch1,ch2);

    len1=strlen(ch1);
    len2=strlen(ch2);

    int r=func(0,0);

    int i=0,j=0;

    while(1)
    {
        if(i==len1 || j==len2)
        {
            printf("\n");
            break;
        }

        if(ch1[i]==ch2[j])
        {
            printf("%c",ch1[i]);
            i++,j++;
        }
        else
        {
            if(nxt[i][j]==1)i++;
            else j++;
        }
    }

    return 0;
}


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

using namespace std;

int main() {
   int x,a,b;
   cin >> x >> a >> b;
   cout << (abs(x-a) < abs(x-b) ? "A" : "B") << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long;
ll x;
ll func(ll X,ll Y){//Xを減らす
	ll ret;//どれだけ減らすか
	ret = (X+Y)-x;
	if(ret > X){
		ret = ret - X;
	}
	return ret;
}

int main(){
	int N;
	ll array[100010],answer=0;
	cin >> N >> x;
	for(int i=0;i<N;i++){
		cin >> array[i];
	}
	if(array[0]>x){
		answer += (array[0]-x);
		array[0] = x;
	}
	for(int i=0;i<N-1;i++){
		if(array[i]+array[i+1]<=x)continue;
		
//		if(array[i+1]>=array[i]){
			ll memo = array[i+1];
			array[i+1] -= func(array[i+1],array[i]);
			answer += (memo - array[i+1]);
//		}
		/*
		if(array[i]+array[i+1]<=x)continue;
		
		if(array[i]>array[i+1]){
			ll memo = array[i];
			array[i] -= func(array[i],array[i+1]);
			answer += (memo - array[i]);
		}*/
		/*
		if(array[i]+array[i+1]<=x)continue;
		
		if(array[i+1]>=array[i]){
			ll memo = array[i+1];
			array[i+1] -= func(array[i+1],array[i]);
			answer += (memo - array[i+1]);
		}

		if(array[i]+array[i+1]<=x)continue;
		
				if(array[i]>array[i+1]){
			ll memo = array[i];
			array[i] -= func(array[i],array[i+1]);
			answer += (memo - array[i]);
		}*/
	}
	cout << answer << endl;
	return 0;
}


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

using namespace std;
 
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)

//最大公約数
long gcd(long a, long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}

//最小公倍数
long lcm(long a, long b){
	return (a*b) / gcd(a,b);
}

typedef long long ll;

int main(){
	int t1, t2;
	
	cin >> t1 >> t2;
	
	if (t1+t2 >= 24) cout << t1+t2-24 << endl;
	else cout << t1+t2 << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N;
    cin >> N;
    vector<ll> T(N), A(N);
    rep(i,N){
        cin >> T[i];
    }
    rep(i,N){
        cin >> A[i];
    }
    vector<ll> VT(N), VA(N);
    ll hst = 0;
    rep(i,N){
        if(hst < T[i]){
            VT[i] = 1;
            hst = T[i];
        }
    }
    hst = 0;
    rep(i,N){
        if(hst < A[N-1-i]){
            VA[N-1-i] = 1;
            hst = A[N-1-i];
        }
    }
    ll ans = 1;
    rep(i,N){
        //cout << i << endl;
        if(VT[i]==1 && VA[i]==1){
            if(T[i] == A[i]){
                continue;
            }else{
                cout << 0 << endl;
                return 0;
            }
        }else if(VT[i]){
            if(T[i] > A[i]){
                cout << 0 << endl;
                return 0;
            }else{
                continue;
            }
        }else if(VA[i]){
            if(A[i] > T[i]){
                cout << 0 << endl;
                return 0;
            }else{
                continue;
            }
        }else{
            ans *= min(T[i], A[i]);
            ans %= mo;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 6404
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
using namespace std;
int main() {
	long long a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	if (a[0] % 2 == 0 || a[1] % 2 == 0 || a[2] % 2 == 0) {
		cout << "0" << endl;
	}
	else {
		cout << a[0] * a[1] << endl;
	}
}

Measured memory_bytes: 256
use proconio::{input, marker::Chars};

fn main() {
    input!(n: usize, mut s: Chars);
    s.reverse();
    let p = s.iter().copied().filter(|&c| c == '1').count() as u32;

    let mut dp = vec![0; n + 1];
    for i in 1..=n {
        dp[i] = 1 + dp[i % i.count_ones() as usize];
    }

    let make_pow_of_two = |m: u32| -> Vec<u32> {
        std::iter::successors(Some(1), |x| Some(x * 2 % m))
            .take(n + 1)
            .collect()
    };
    let make_full = |m: u32| -> u32 {
        let mut coeff = 1;
        let mut ans = 0;
        for x in s.iter().copied().map(|c| c == '1') {
            if x {
                ans = (ans + coeff) % m;
            }
            coeff = (coeff * 2) % m;
        }
        ans
    };
    let pow_two_mod_p_plus_one = make_pow_of_two(p + 1);
    let full_mod_p_plus_one = make_full(p + 1);
    let pow_two_mod_p_minus_one = if p == 1 {
        None
    } else {
        Some(make_pow_of_two(p - 1))
    };
    let full_mod_p_minus_one = if p == 1 { None } else { Some(make_full(p - 1)) };

    let ans: Vec<_> = (0..n)
        .map(|i| {
            if s[i] == '0' {
                1 + dp[((full_mod_p_plus_one + pow_two_mod_p_plus_one[i]) % (p + 1)) as usize]
            } else if p == 1 {
                0
            } else {
                1 + dp[((full_mod_p_minus_one.unwrap() + (p - 1)
                    - pow_two_mod_p_minus_one.as_ref().unwrap()[i])
                    % (p - 1)) as usize]
            }
        })
        .collect();

    for x in ans.iter().copied().rev() {
        println!("{}", x);
    }
}


Measured memory_bytes: 6028