akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <queue>
#include <cctype>
#include <climits>
#include <stack>
using namespace std;
  
 
  
int main(){
  
    int n; 
    while(scanf("%d",&n),n){
 
        vector<pair<int,int> > rw(n);
        int r_max=-1,sum_r=0,sum_w=0;
        for(int i=0;i<n;i++){
            cin>>rw[i].first>>rw[i].second;
            sum_r+=rw[i].first;
            sum_w+=rw[i].second;
			r_max=max(r_max,rw[i].first);
        }
        sort(rw.begin(),rw.end(),greater< pair<int,int> >());
 
        int r0=rw[0].first;
		r0=r_max;
        int r=sum_r-r0;
 


        if(r0 <= r){
            cout<<sum_r+sum_w<<endl;
        }else{
 
            int res=2*r0;
            vector<vector<bool> > dp(1001,vector<bool>(1000,false));
 
            dp[1][0]=true;
            for(int i=1;i<n;i++){
                for(int j=0;j<=1000;j++){
                    if(dp[i][j]){
                        dp[i+1][j]=true; 
                        if(j+rw[i].second<=1000)
                            dp[i+1][j+rw[i].second]=true; 
                    }
                }
            }
 
            int opt=0;
            for(int i=1;i<=r0-r;i++){
                if(dp[n][i]) opt=i;
            }
 
            res+=sum_w-opt;
            printf("%d\n",res);
 
 
 
        }
         
         
    }
}

Measured memory_bytes: 3416
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000


int main(){
	vector<long long>a;
	int n, k;
	long long x, s1;

	f(j, 9){
		a.push_back(j + 1);
	}
	s1 = 1;
	f(i, 14){
		s1 = s1 * 10;
		f(j, 9){
			a.push_back(s1*(j + 2) - 1);
		}
	}
	k = 0;
	s1 = 1;
	while (k < 13){
		k++;
		s1 = s1 * 10;
		x = 1;
		for (;;){
			if ((x / 10) + (x % 10) + (9 * (k + 1)) < (10 * (x + 1)))break;
			f(j, 9){
				a.push_back(((10 * x) + j + 1)*s1 - 1);
			}
			x++;
		}
	}
	sort(a.begin(), a.end());

	scanf("%d", &n);
	f(i, n)printf("%lld\n", a[i]);

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100
  
void Preorder(int);
void Inorder(int);
void Postorder(int);
  
struct Node{
  int parent, left, right;
};
   
struct Node Tree[MAX];
int n;

int main(){
  int root = 0,i,j,a;
  scanf("%d",&n);
   
  for( i = 0 ; i < n ; i++ ){
    Tree[i].parent = -1;
    Tree[i].left = -1;
    Tree[i].right = -1;
  }
  
  for( i = 0; i < n ; i++ ){
    scanf("%d", &a);
    scanf("%d %d", &Tree[a].left, &Tree[a].right);
    if(Tree[a].left != -1) Tree[Tree[a].left].parent = a;
    if(Tree[a].right != -1) Tree[Tree[a].right].parent = a;
  }
  
  for( i = 0 ; i < n ; i++ ){
    if( Tree[i].parent == -1 ) root = i;
  }
  
  printf("Preorder\n");
  Preorder(root);
  
  printf("\nInorder\n");
  Inorder(root);
  
  printf("\nPostorder\n");
  Postorder(root);
  printf("\n");
  
  return 0;
}

void Preorder(int i){
  printf(" %d",i);
  if ( Tree[i].left != -1 ) Preorder( Tree[i].left );
  if ( Tree[i].right != -1 ) Preorder( Tree[i].right );
}
  
void Inorder(int i){
  if( Tree[i].left != -1 ) Inorder( Tree[i].left );
  printf(" %d",i);
  if( Tree[i].right != -1 ) Inorder( Tree[i].right);
}
    
void Postorder(int i){ 
  if( Tree[i].left != -1 ) Postorder( Tree[i].left );
  if( Tree[i].right != -1 ) Postorder( Tree[i].right );
  printf(" %d",i);
    
}

Measured memory_bytes: 616
#include<cstdio>
long long n,a[200005],v[200005],ans;
int main(){
	scanf("%lld",&n);
	for(long long i=1;i<=n;++i)
		scanf("%lld",&a[i]),++v[a[i]];
	for(long long i=1;i<=n;++i)
		ans+=(v[i]*(v[i]-1))>>1;
	for(long long i=1;i<=n;++i)
		printf("%lld\n",ans-v[a[i]]+1);
	return 0;
} 

Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define trav(a,x) for(auto &a:x)
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vi a(n);
    rep(i,0,n) cin >> a[i];
    int j=0;
    int x=0;
    ll ans=0;
    rep(i,0,n) {
        while(j<n && (x&a[j])==0) {
            x|=a[j];
            ++j;
        }
        ans+=j-i;
        x^=a[i];
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allg(v) v.begin(), v.end(), greater<int>()



signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  cout << ((n-1)*n )/2 << "\n";
  
  //cout << (  ?"Yes" :"No") << "\n";
  
  //cout << fixed << setprecision(15) << n << "\n";

}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))

#define DEBUG(x) cout<<#x<<": "<<(x)<<endl

int n;
ll m;
ll a[25];
int p[25];

double P[1<<20];
ll f[1<<20];
ll V[1<<20];
const ll INF = 1ll<<60;

int main(){
	scanf("%d%lld",&n,&m);
	REP(i,n)scanf("%lld",a+i);
	REP(i,n)scanf("%d",p+i);
	// P
	REP(msk,1<<n){
		P[msk] = 1.0;
		REP(i,n)P[msk] *= (double)((msk>>i&1)==1 ? p[i] : 100-p[i])/100.0;
	}
	// f
	FOR(msk,1,1<<n){
		ll lcm = 1;
		REP(i,n)if(msk>>i&1){
			ll mul = a[i] / __gcd(a[i], lcm);
			// lcm * mul >= 1<<60
			// mul >= (1<<60) / lcm
			CHMIN(mul, (INF+lcm-1)/lcm);
			lcm = lcm * mul;
		}
		f[msk] = m / lcm;
		if(__builtin_popcount(msk)%2==0)f[msk] = -f[msk];
		// DEBUG(f[msk]);
	}
	// V
	REP(msk,1<<n)V[msk] = f[msk];
	REP(i,n)REP(msk,1<<n)if(msk>>i&1)V[msk]+=V[msk^(1<<i)];
	// REP(msk,1<<n)DEBUG(V[msk]);
	// ans
	double ans = 0.0;
	REP(msk,1<<n)ans += P[msk]*V[msk];
	printf("%.9f\n",ans);
	return 0;
}


Measured memory_bytes: 27796
import java.util.Scanner;

public class Main {
	static int N, K;
	static int[] A;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		K = sc.nextInt();
		A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		System.out.println((N - 2) / (K - 1) + 1);
	}
}

Measured memory_bytes: 50336
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin>> S;
    int N=S.length();
    int ans=N;
    rep(i,0,N-1){
        if (S[i]!=S[i+1]){
            ans=min(max(i+1, N-i-1), ans);
        }
    }
   cout << ans<<"\n";
}

Measured memory_bytes: 512
// #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <numeric>
// #include <windows.h>
using namespace std;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = V<VV<T>>;
template<class T1, class T2> using P = pair<T1, T2>;
using I = int;
using D = double;
using B = bool;
using C = char;
using S = string;
using LL = long long;
using LD = long double;
using ULL = unsigned long long;
using PII = P<I, I>;
using VPII = V<PII>;
using PLL = P<LL, LL>;
using VPLL = V<PLL>;
using VI = V<I>;
using VVI = VV<I>;
using VLL = V<LL>;
using VVLL = VV<LL>;
using VC = V<C>;
using VVC = VV<C>;
using VS = V<S>;
using VVS = VV<S>;
using VB = V<B>;
using VVB = VV<B>;
#define REP(type, i, n) for (type i = 0; i < (type)(n); ++i)
#define REP2(type, i, m, n) for (type i = (m); i < (type)(n); ++i)
#define REPR(type, i, n) for (type i = (n)-1; i >= 0; --i)
#define REPR2(type, i, m, n) for (type i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a, type) sort(ALL(a), greater<type>())
#define SORTF(a, comp) sort(ALL(a), comp)
#define REVERSE(a) reverse(ALL(a))
#define SIZE(a, type) ((type)(a).size())
#define bit_search(bit, n) REP(LL, bit, 1LL<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) (lower_bound(ALL(a), (x)) - a.begin())
#define bisect_right(a, x) (upper_bound(ALL(a), (x)) - a.begin())
#define INPUT(a) REPx(&x, a) cin >> x;
#define INPUT2(a) REPx(&x, a) INPUT(x);
#define INPUTP(a) REPx(&x, a) cin >> x.first >> x.second;
#define ENDL cout << endl;

const int INF = 2e9;
// const LL INF = 9e18;
const LL MOD = 1e9+7;

template<class T> using PRIORITY_QUEUE = priority_queue< T, V<T>, greater<T> >;
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;}
template<class T> inline void debug1(V<T> A){REP(int, i, SIZE(A, int)){if (A[i] == INF) cout << "I ";else cout << A[i] << " ";}ENDL}
template<class T> inline void debug2(VV<T> A){REP(int, i, SIZE(A, int)){REP(int, j, SIZE(A[i], int)){if (A[i][j] == INF) cout << "I "; else cout << A[i][j] << " ";}ENDL}}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VI A(n), B(n);
  REP(int, i, n) cin >> A[i] >> B[i];
  SORT(A); SORT(B);
  double ma, mb;
  int ans;
  if (n % 2)
  {
    ma = A[n/2];
    mb = B[n/2];
    ans = mb - ma + 1;
  }
  else
  {
    ma = (double(A[n/2-1]) + double(A[n/2])) / 2.0;
    mb = (double(B[n/2-1]) + double(B[n/2])) / 2.0;
    ans = (mb-ma+0.5)/0.5 ;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4736
#ABC138-E Strings of Impurity
"""
sの好きなだけのループに対する部分文字列tを求める
tにあってsにない文字がある時点でno
そうでないならば必ず達成可能で、
tに対してループを回し(i)、
sのj文字目に関して、それより後に初めて出てくるt[i+1]の場所をindexで返し,i+=1,j=そのindex
にする。
そのようなindexがないならば、j=0とし、またはじめから回す。
"""
import sys
import bisect
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

s = readline().rstrip().decode('utf-8')
t = readline().rstrip().decode('utf-8')
s_s = set(list(s))
t_s = set(list(t))
flag = 1 if s_s & t_s == t_s else 0

if not flag:
    print(-1)
    exit()

#lst1:各アルファベットごとに、何番目に出てくるか
lst1 = [[] for _ in range(26)]
kijun = ord("a")
for idx,i in enumerate(s):
    lst1[ord(i)-kijun].append(idx)

i = 0
roop = 0
count = 0
while True:
    if i >= len(t):
        print(roop*len(s)+count)
        break
    now = ord(t[i])-kijun
    res = bisect.bisect_left(lst1[now],count)
    if res == len(lst1[now]):
        roop += 1
        count = 0
        res = bisect.bisect_left(lst1[now],count)
        count = lst1[now][res]+1 #その次の文字から
    else:
        count = lst1[now][res]+1
    i += 1
    

Measured memory_bytes: 54384
#include <stdio.h>
#define X 100



main(){
  int A[X][X], B[X], C[X];
  int n, i, j, k;
  scanf("%d", &n);
  for(i=0;i<n;i++){
       scanf("%d%d", &B[i], &C[i]);
  }
  for(i=0;i<n;i++){
       for(j=0;j<n;j++){
            A[i][j] = 100000000;
       }
  }
  for(i=0;i<n;i++){ A[i][i] = 0; }
  for(i=1;i<n;i++){
    for(j=0;j+i<n;j++){
      for(k=0;k<i;k++){
        int cost = A[j][j+k] + A[j+k+1][j+i] + B[j] * C[j+k] * C[j+i];
        if(A[j][j+i] > cost) {A[j][j+i] = cost; }
      }
    }
  }
  printf("%d\n", A[0][n-1]);
  return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    int N;
    cin >> N;
    vector<int> L(N);
    rep(i, N) cin >> L.at(i);

    sort_g(L);

    int sum = accumulate(all(L), 0);
    sum -= L.at(0);

    cout << (L.at(0) < sum ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
from itertools import product
def main():
    n,m,x=map(int,input().split())
    CA=[[int(_) for _ in input().split()] for i in range(n)]
    ans=10**10
    n_lis=list(product([True,False],repeat=n))
    for comb in n_lis:
        cunt=0
        A=[0]*m
        for i,ca in enumerate(CA):
            if comb[i]:
                cunt+=ca[0]
                for j,aa in enumerate(ca[1:]):
                    A[j]+=aa
        for a in A:
            if a<x:
                break
        else:
            ans=min(ans,cunt)
    if ans==10**10:
        print(-1)
    else:
        print(ans)

if __name__=='__main__':
    main()

Measured memory_bytes: 9520
// #pragma GCC optimize("O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	for (int& i : a) cin >> i;
	map<int, int> cnt;
	ll ans = 0;
	for (int i = n - 1; i >= 0; i--) {
		ans += cnt[a[i] + i];
		cnt[i - a[i]]++;
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

#define FOR(i,n) for(int i=0; i<n; ++i)
#define FORR(i,a,n) for(int i=a; i<n; ++i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
void printfv(VI a){ int n = a.size(); FOR(i, n) cout << a[i] << " "; }

int main(void){

    int H, W, h, w;

    cin >> H >> W >> h >> w;

    cout << (H-h)*(W-w);
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include<algorithm>
#include<map>

using namespace std;

map<int,bool> mp;

int main() {
  int n,t,cnt;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&cnt);
    mp[cnt]=true;
  }
  cnt = 0;
  scanf("%d",&t);
  for(int i=0;i<t;i++){
    scanf("%d",&n);
    cnt += (mp[n]);
  }
  printf("%d\n",cnt);
}


Measured memory_bytes: 9696
#include <bits/stdc++.h>
typedef long long int lli;
using namespace std;
#pragma region DEBUG
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#pragma endregion DEBUG
#define MOD 1000000007
#define MAX 500005
#define endl "\n"
vector <lli> below(MAX);
vector <lli> ans(MAX);
lli n;
void DFS(lli s, vector <bool> &visited, vector<vector<lli> >&adj){
    visited[s] = true;
    ans[s] = INT_MIN;
    for(auto i : adj[s]){
        if(!visited[i]){
            DFS(i,visited,adj);
            lli q = below[i]+1;
            ans[s] = max(ans[s], q);
            below[s] += below[i]+1;
        }
    }
    ans[s] = max(ans[s], n-1ll-below[s]);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    
   // freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout)
    lli t;
    //cin>>t;
    t = 1;
    while(t--){
       // lli n;
        lli a,b,c,d;
        cin>>a>>b>>c>>d;
        cout<<max({a*c, a*d, b*d, b*c})<<endl;
        
    }
}

Measured memory_bytes: 11028
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int a,b,c,cnt,aa[110000];
string s;
signed main()
{
	cin>>a>>b;
	if(a%(b*2+1)==0){
		cout<<a/(b*2+1);
	}else{
		cout<<a/(b*2+1)+1;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


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

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,k; string s;
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}

int main() {
	cin >> s;
	if (s <= "2019/04/30") {
		cout << "Heisei" << endl;
	}
	else {
		cout << "TBD" << endl;
	}
}

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

long long n,a,m,b,c,qq;
string ss;
int main() {
    cin>>n;
    map<string,long long>v;
    for (int i=0; i<n; i++){
        cin>>ss;
        v[ss]++;
        a=max(a,v[ss]);
    }
    for (auto i: v){
        if (i.second==a){
            cout<<i.first<<endl;
        }
    }
}


Measured memory_bytes: 25216
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let  n: i32 = read();
    let  m: i32 = read();

    let ans = if n >= 10 || m >= 10 { -1 } else { n*m };

    println!("{}", ans);
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+9;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL my_pow(int x, int y){
	LL a=1;
	REP(i,y){
		a *= x;
		a %= MOD;
	}
	return a % MOD;
}
void Main()
{
	string s,t;
	cin >> s >> t;

	cout << t << s << endl;
/*
	int len1 = SIZE(s);
	int len2 = SIZE(t);

	int m;
	if (len1 > len2){
		m = len1;
	}
	else{
		m = len2;
	}

	REP(i,m){
		if(i<len2){
			cout << t[i];
		}
		if(i<len1){
			cout << s[i];
		}
	}
	cout << endl;
*/
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

// 最長共通部分列

int lcm[3001][3001]; // dp[i][j] : Sのi番目までと、Tのj番目までの最長部分列
string S, T;

string lcms(int i,int j) {
	if (i == 0 || j == 0) return string("");
	if (S[i-1] == T[j-1]) return lcms(i - 1, j - 1) + S[i-1];
	else {
		if (lcm[i][j] == lcm[i - 1][j] ) return lcms(i - 1, j);
		else return lcms(i, j - 1);
	}
}

void solve() {
	cin >> S >> T;

	// S[i-1] == T[j-1] のときは lcm[i][j] = lcm[i-1][j-1]+1
	// S[i-1] != T[j-1] のときは SかTのどちらかの末尾は使わない

	for (int i = 0; i <= S.size(); i++) lcm[i][0] = 0;
	for (int j = 0; j <= T.size(); j++) lcm[0][j] = 0;

	for (int i = 1; i <= S.size(); i++) {
		for (int j = 1; j <= T.size(); j++) {
			if (S[i-1] == T[j-1]) lcm[i][j] = lcm[i - 1][j - 1] + 1;
			else lcm[i][j] = max(lcm[i - 1][j], lcm[i][j - 1]);
		}
	}

	cout << lcms(S.size(), T.size()) << endl;
}

int main() {
	solve();

	return 0;
}

Measured memory_bytes: 35968
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define loop(i,x,n) for(ll i = x;i<n;i++)
#define loopr(i,x,n) for(ll i = n-1;i>=x;i--)
#define S(v) sort(v.begin(), v.end());
#define ff first
#define ss second
map<ll,bool> empty;


int main()
{		
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll t = 1;
	// cin>>t;
	while(t--){
		ll n , m , k;
		cin>>n>>m>>k;
		vector<ll> row(n, 0), col(m, 0);
		set<ll> x, y;
		map<pair<ll,ll>, bool> mp;
		vector<pair<ll,ll>> v(k);
		loop(i,0,k){
			ll a, b;
			cin>>a>>b;
			row[a-1]++;
			col[b-1]++;
			mp[make_pair(a-1, b-1)] = 1;
			v[i] = make_pair(a-1,b-1);
		}
		ll mx1 = *max_element(row.begin(), row.end()), mx2  = *max_element(col.begin(), col.end());
		ll ans = mx1+mx2 - 1;
		loop(i,0,n){
			if(row[i] == mx1)x.insert(i);
		}
		loop(i,0,m){
			if(col[i] == mx2)y.insert(i);
		}
		ll sum = 0;
		for(auto p:v){
			// cout<<p.first<<" "<<p.second<<endl;
			if(x.find(p.first) != x.end() && y.find(p.second) != y.end())sum++;
		}
		// cout<<sum<<endl;
		// for(auto i:x)cout<<i<<" ";cout<<endl;
		// for(auto i:y)cout<<i<<" ";cout<<endl;
		// cout<<mx1<<" "<<mx2;
		cout<<(sum - x.size()*y.size()  == 0 ? ans : ans+1 );
	}
}
/*

1 5 4 1 2 2 4

*/




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

int main() {
  int Q;
  cin >> Q;
  vector<bool> prime(100010,true);
  prime[0]=false;
  prime[1]=false;
  for (int i=2;i<100010;i++){
    if (prime[i]){
      for (int j=2;i*j<100010;j++){
        prime[i*j]=false;
      }
    }
  }
  vector<int> count(100010,0);
  for (int i=3;i<100010;i++){
    count[i]=count[i-1];
    if (prime[i]&&prime[(i+1)/2]){
      count[i]++;
    }
  }
  for (int i=0;i<Q;i++){
    int l,r;
    cin >> l >> r;
    cout << count[r]-count[l-1] << endl;
  }
}      

Measured memory_bytes: 1024
def int_(num_str):
    return int(num_str) - 1


N, M = map(int, input().split())
graph = [set() for _ in range(N)]
for _ in range(M):
    a, b = map(int_, input().split())
    graph[a].add(b)
    graph[b].add(a)
for i in range(1, N-1):
    if (0 in graph[i]) and (N-1 in graph[i]):
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")


Measured memory_bytes: 67708
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll MOD = (pow(10, 9) + 7);

int main() {
	ll a, b, c, d; cin >> a >> b >> c >> d;
	ll x = b / c - (a-1) / c;
	ll y = b / d - (a-1) / d;
	ll z = b / lcm(c,d) - (a-1) / lcm(c,d);

	cout << (b - a + 1) - (x + y - z) << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath> 
#include <algorithm>
#define For(i,j,k) for(int i=j;i<=k;i++)
#define Dow(i,j,k) for(int i=j;i>=k;i--)
#define LL long long
using namespace std ;
inline int read() {
	int x = 0 , f = 1 ;
	char ch = getchar() ;
	while(ch<'0'||ch>'9') { if(ch=='-') f = -1 ; ch = getchar() ; }
	while(ch>='0'&&ch<='9') { x = x * 10+ch-48 ; ch = getchar() ; }
	return x * f ;
}

const int N = 1e5+11,mod = 1e9+7;
int n,ans;
int a[N],b[N],tot;

int main() {
	n=read();
	For(i, 1, n) a[i]=read();
	sort(a+1,a+n+1);
	if(n&1) b[++tot] = 0;
	int s;
	if(n&1) s = 2;
	else s = 1;
	while(s<n) {
		b[++tot]=s;b[++tot]=s;
		s+=2;
	}
	For(i, 1, n) if(a[i]!=b[i]) {
		puts("0");
		return 0;
	}
	ans = 1;
	For(i, 1, n/2) ans=ans*2%mod;
	printf("%d\n",ans);
	return 0;
}






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

using namespace std;

int main(){
	int t;
	cin>>t;
	int ans=0;
	int b[100];
	for(int i=0;i<t-1;i++){
		cin>>b[i];
		//cout<<b[i]<<" ";
	}
	for(int i=t-2;i>=0;i--){
		//cout<<b[i]<<endl;
		if(i==t-2) ans+=b[i];
		else
			ans+=min(b[i],b[i+1]);
		if(i==0) ans+=b[0];
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=200050;
int a[N],cnt[N];
int main()
{
	int n,i;
	scanf("%i",&n);
	for(i=1;i<=n;i++) scanf("%i",&a[i]);
	int sz=1,top=n,bot=1,ans,mid;
	while(top>=bot)
	{
		sz=top+bot>>1;
		mid=sz;
		vector<pair<int,int> > hi;
		for(i=1;i<=n;i++) cnt[i]=0;
		for(i=1;i<=n;i++)
		{
			if(i>1)
			{
				if(a[i]>a[i-1]) continue;
				while(hi.size() && hi.back().first>a[i])
				{
					cnt[hi.back().second]--;
					hi.pop_back();
				}
				cnt[1]=a[i]-hi.size();
				if(cnt[sz]==a[i]) sz++;
				int j=a[i];
				//if(!hi.size() || hi.back().first!=j) hi.push_back(make_pair(j,1));
				bool done=0;
				while(hi.size() && hi.back().first==j)
				{
					if(hi.back().second==sz)
					{
						cnt[hi.back().second]--;
						cnt[1]++;
						hi.pop_back();
						j--;
					}
					else
					{
						int f=hi.back().second;
						cnt[f]--;
						cnt[f+1]++;
						hi[hi.size()-1].second++;
						done=1;
						break;
					}
				}
				if(!done)
				{
					cnt[1]--;
					cnt[2]++;
					hi.push_back(make_pair(j,2));
				}
			}
		}
		if(sz==mid) top=mid-1,ans=mid;
		else bot=mid+1;
	}
	printf("%i\n",ans);
	return 0;
}

Measured memory_bytes: 1792
#方針: 中心点は 101×101パターンしかないので全探索できる。
n = gets.to_i
ary = Array.new(n){gets.split.map(&:to_i)}.sort_by{|a| a[2]}.reverse

(0..100).each do |i|
  (0..100).each do |j|
    tmp1 = [] #h>0が矛盾しないか判定用
    tmp2 =[] #h=0が矛盾しないか判定用

    ary.each do |a|
      if a[2]>0
        tmp1 << (a[0]-i).abs + (a[1]-j).abs + a[2]
      else
        tmp2 << a
      end
    end

    flag1 = tmp1.all?{|t| t==tmp1[0]}
    flag2 = tmp2.all?{|t| tmp1[0] - (t[0]-i).abs - (t[1]-j).abs <=0}

    puts "%d %d %d" % [i,j,tmp1[0]] if flag1&&flag2

  end
end

Measured memory_bytes: 2424
n, q = map(int, input().split())
s = input()

lc = [0]
c = 0
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        c += 1
    lc.append(c)

for i in range(q):
    l, r = map(int, input().split())
    print(lc[r-1]-lc[l-1])


Measured memory_bytes: 51504
using System;
 class Program{
    static void Main(){
    string[] str = Console.ReadLine().Split(' ');
    int a=int.Parse(str[0]);
    int b=int.Parse(str[1]);
    int c=int.Parse(str[2]);
    Console.WriteLine(a<b&&b<c?"Yes":"No");
    }
}


Measured memory_bytes: 15924
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static final Scanner sc    = new Scanner(System.in);
    static final int     MOD   = (int) 1E9 + 7;
    static final long    INF_L = (long) 4E18;

    public static void main(String[] args) {
        int H = nint();
        int W = nint();
        
        final char EMPTY = '.'; // unused
        final char WALL = '#';
        
        char[][] a = nchars2(H, W, 1, 0);
        int[][] ans = new int[H+1][W+1];
        ans[1][0] = 1;
        
        for (int h = 1; h <= H; h++) {
            for (int w = 1; w <= W; w++) {
                if (a[h][w] == WALL) {
                    continue;
                }
                ans[h][w] = ans[h-1][w] + ans[h][w-1];
                ans[h][w] %= MOD;
            }
        }
        
        System.out.println(ans[H][W]);
    }

    @Deprecated
    static int nint() {
        return sc.nextInt();
    }

    @Deprecated
    static int[] nints(int N) {
        return nints(N, 0, 0);
    }

    @Deprecated
    private static int[] nints(int N, int padL, int padR) {
        int[] a = new int[padL + N + padR];
        for (int i = 0; i < N; i++)
            a[padL + i] = nint();
        return a;
    }

    static long nlong() {
        return sc.nextLong();
    }

    static long[] nlongs(int N) {
        return nlongs(N, 0, 0);
    }

    static long[] nlongs(int N, int padL, int padR) {
        long[] a = new long[padL + N + padR];
        for (int i = 0; i < N; i++)
            a[padL + i] = nlong();
        return a;
    }

    static double ndouble() {
        return sc.nextDouble();
    }

    static double[] ndoubles(int N) {
        return ndoubles(N, 0, 0);
    }

    static double[] ndoubles(int N, int padL, int padR) {
        double[] d = new double[N + padL + padR];
        for (int i = 0; i < N; i++) {
            d[padL + i] = ndouble();
        }
        return d;
    }

    static String nstr() {
        return sc.next();
    }

    static char[] nchars() {
        return sc.next().toCharArray();
    }

    static char[] nchars(int padL, int padR) {
        char[] temp = sc.next().toCharArray();
        char[] ret = new char[temp.length + padL + padR];
        System.arraycopy(temp, 0, ret, padL, temp.length);
        return ret;
    }

    static char[][] nchars2(int H, int W) {
        return nchars2(H, W, 0, 0);
    }

    static char[][] nchars2(int H, int W, int padLU, int padRD) {
        char[][] a2 = new char[H + padLU + padRD][W + padLU + padRD];
        for (int i = 0; i < H; i++)
            System.arraycopy(nchars(), 0, a2[padLU + i], padLU, W);
        return a2;
    }

    static long min(long... ls) {
        return Arrays.stream(ls).min().getAsLong();
    }

    static long max(long... ls) {
        return Arrays.stream(ls).max().getAsLong();
    }

    static long abs(long a) {
        return Math.abs(a);
    }
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

vector<ll> enum_prime(ll N){
	deque<bool> is_prime(N+1,true);
	vector<ll> P;
	for(ll i=2;i<=N;i++){
		if(is_prime[i]){
			for(ll j=i*i;j<=N;j+=i){
				is_prime[j] = false;
			}
			P.emplace_back(i);
		}
	}
	return P;
}

vector<ll> prime_factor(ll n){
	ll sn = sqrt(n)+1;
	auto prime_list = enum_prime(sn);
	vector<ll> res;
	for(int i=0,ei=prime_list.size();i<ei;i++){
		ll v = prime_list[i];
		if(v*v>n) break;
		while(!(n%v)){
			n /= v;
			res.push_back(v);
		}
	}
	if(n>1){
		res.push_back(n);
	}

	return res;
}

ll EulerPhiFunction(ll n,vector<ll> p){
	for(auto& x:p){
		n = n*(x-1LL)/x;
	}
	return n;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	auto N=in();
	auto A=prime_factor(N);
	A.erase(unique(ALL(A)),A.end());

	out(EulerPhiFunction(N,A));
	return 0;
}


Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,min,ans;
  cin>>n;
  vector<int>p(n);
  int i=0;
  while(i<n){
      cin>>p.at(i);
      i++;
  }
  i=0;
  ans=0;
  min=p.at(0);
  while(i<n){
    if(min>=p.at(i)){
        min=p.at(i);
        ans++;
    }
      i++;
  }
  cout<<ans<<endl;
  
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
#define int long long
signed main() {
	int n, m, x, y; cin >> n >> m >> x >> y;
	int p = -100, q = 100;
	for (int i = 0; i < n; i++) {
		int k; cin >> k;
		p = max(k, p);
	}
	for (int i = 0; i < m; i++) {
		int k; cin >> k;
		q = min(k, q);
	}
	for (int z = -100; z <= 100; z++) {
		if (x < z&&z <= y && p < z&&z <= q) {
			cout << "No War\n";
			return 0;
		}
	}
	cout << "War\n";
}

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

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli > plli;
typedef vector<lli> vlli;
typedef vector<plli > vplli;

#define rep(i,a) for(i = 0 ; i < a ; i++)
#define repr(i,a) for(i = a ; i >= 0 ; i--)
#define REP(i,a,b) for(i = a ; i <= b ; i++)
#define REPR(i,a,b) for(i = a ; i >= b ; i--)

#define scan(N) scanf("%lld",&N)
#define print(N) printf("%lld",N)
#define scan2(N1,N2) scanf("%lld %lld",&N1,&N2)
#define print2(N1,N2) printf("%lld %lld",N1,N2)
#define scan3(N1,N2,N3) scanf("%lld %lld %lld",&N1,&N2,&N3)
#define print3(N1,N2,N3) printf("%lld %lld %lld",N1,N2,N3)

#define mem(a,b)memset(a,b,sizeof(a))
#define opt ios_base::sync_with_stdio(false);cin.tie(NULL);
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))
#define sqr(x) (x)*(x)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl

#define endl '\n'

const long long INF = 2000000000000;
const long long MOD = 1000000007;
const long long MAXN = 100005;

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

lli power(lli a,lli b)
{
    lli value;
    if(!b)
    	return 1;
    else if(b%2==0) {
        value = power(a,b/2)%MOD;
        return (value * value)%MOD;
    }
    else {
        value = power(a,b/2)%MOD;
        return ((a*value)%MOD*(value))%MOD;
    }
}

int main()
{
    opt;
    lli n, m;
    cin >> n >> m;

    if(n >= 2 and m >= 2)
        cout << (n-2)*(m-2);
    if(n == 1 and m == 1)
        cout << 1;
    else if(n == 1 and m > 2)
        cout << m-2;
    else if(n > 1 and m == 1)
        cout << n-2;
    return 0;

}










Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

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

    // vector<ll> dp(100);
    // dp[0] = 1;
    map<ll, ll> factors;
    factors[1] = 1;
    FOR(i, 2, N) {
        map<ll, ll> i_factor = prime_factor(i);
        for(auto p = i_factor.begin(); p != i_factor.end(); ++p) {
            factors[p->first] += p->second;
        }
    }


    vector<ll> f3 = vector<ll>(101), f5 = vector<ll>(101), f15 = vector<ll>(101), f25 = vector<ll>(101), f75 = vector<ll>(101);

    for(auto p = factors.begin(); p != factors.end(); ++p) {
        // cerr << "a_i = " << p->first << " n_i = " << p->second << endl;
        if(p->second >= 74) f75[p->first]++;
        if(p->second >= 24) f25[p->first]++;
        if(p->second >= 14) f15[p->first]++;
        if(p->second >= 4) f5[p->first]++;
        if(p->second >= 2) f3[p->first]++;
    }

    // REP(i, 101) {
    //     cerr << f3[i] << " " << f5[i] << " " << f25[i] << endl;
    // }

    ll ans = 0;
    FOR(i, 1, 100) if(f75[i] > 0) ans++;
    FOR(i, 1, 100) FOR(j, 1, 100) if(i != j && f5[i] > 0 && f15[j] > 0) ans++; 
    FOR(i, 1, 100) FOR(j, 1, 100) if(i != j && f3[i] > 0 && f25[j] > 0) ans++; 
    FOR(i, 1, 100) FOR(j, 1, 100) FOR(k, 1, j-1) if(i != j && j != k && k != i && f3[i] > 0 && f5[j] > 0 && f5[k] > 0) ans++; 

    cout << ans << endl;

    return 0;
}

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

int main(void){
	int l[10],i,ans,v1,v2,ls;
	double t,s;
	
	while(1){
	
	for(i=0;i<10;i++){
		if(scanf("%d,",&l[i])==EOF)return 0;
	}
	scanf("%d,%d",&v1,&v2);
	
	for(i=0,ls=0;i<10;i++){
		ls+=l[i];
	}
	
	t=(double)ls/(double)(v1+v2);
	
	s=(double)v1*t;
	
	for(ls=0,i=0;i<10;i++){
		ls+=l[i];
		if(s<=(double)ls)break;
	}
	
	printf("%d\n",i+1);
	
	}
	
	return 0;
}

Measured memory_bytes: 0
N = gets.to_i
a = gets.split.map(&:to_i)

p = 0
ans = []
N.times do |i|
  ans[i] = 0
end


(N-1).times do |i|
  ans[a[i] - 1] = ans[a[i] - 1] + 1
end
puts ans

Measured memory_bytes: 34572
def main():
  t = input().split(" ")
  A = int(t[0])
  B = int(t[1])
  
  if B < 0:
    if (B - A) % 2 == 1:
    	print("Positive")
    else :
    	print("Negative")
  elif 0 < A:
    print("Positive")
  else:
    print("Zero")
    
main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<31)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, m, ans;
bool g[10][10];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n >> m;
    rep(i, 0, m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a][b] = g[b][a] = true;
    }
    vector<int> a(n);
    erep(i, 1, n) a[i-1] = i;
    do {
        if (a[0] != 1) continue;
        bool flag = true;
        rep(i, 0, n-1) {
            if (!g[a[i]-1][a[i+1]-1]) {
                flag = false;
                break;
            }
        } 
        if (flag) ans++;
    } while (next_permutation(all(a)));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,c,d,e,k;
  scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&k);
  if(e-a <= k){
    printf("Yay!");
  }
  else{
    printf(":(");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
#define ll long long int
using namespace std;

int main()
{
    ll a, b, x;
    cin >> a >> b >> x;

    ll ans = b / x - a / x;
    if(a % x == 0)
    	ans ++;
    cout << ans << endl;
}

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

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

    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    sort(a.begin(), a.end(), greater<ll>());

    ll res = a[0];
    ll rest = n-2;
    int ptr = 1;
    while(rest){

        if(rest > 1){
            res += a[ptr] * 2;
            ++ptr;
            rest -= 2;
        }
        else{
            res += a[ptr];
            break;
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 4784
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;


int main() {
    ios_base::sync_with_stdio(false);

    int v,e;
    cin >> v >> e;
    vector<vector<ll>> d(v,vector<ll>(v,1e18));
    rep(i,v) d[i][i]=0;
    rep(i,e) {
        int s,t,c;
        cin >> s >> t >> c;
        d[s][t]=c;
    }
    rep(i,v) {
        rep(j,v) {
            rep(k,v) {
                if (d[j][i]!=1e18 && d[i][k]!=1e18) d[j][k]=min(d[j][k],d[j][i]+d[i][k]);
            }
        }
    }
    bool flag=1;
    rep(i,v) {
        if (d[i][i]<0) flag=0;
    }
    if (flag) {
        rep(i,v) {
            rep(j,v) {
                if (d[i][j]==1e18) cout << "INF";
                else cout << d[i][j];
                if (j<v-1) cout << ' ';
            }
            cout << endl;
        }
    } else {
        cout << "NEGATIVE CYCLE" << endl;
    }


    return 0;   
}



Measured memory_bytes: 3240
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] d=new int[n];
		Arrays.fill(d,-1);
		Map<Integer,Map<Integer,Integer>> l=new HashMap<>();
		Map<Integer,List<Integer>> m=new HashMap<>();
		for(int i=0;i<n;i++){
			m.put(i,new ArrayList<>());
			l.put(i,new HashMap<Integer,Integer>());
		}
		for(int i=0;i<n-1;i++){
			int u=sc.nextInt()-1;
			int v=sc.nextInt()-1;
			int w=sc.nextInt()%2;
			m.get(u).add(v);
			m.get(v).add(u);
			l.get(u).put(v,w);
			l.get(v).put(u,w);
		}

		d[0]=0;
		Deque<Integer> q=new ArrayDeque<>();
		q.add(0);
		while(q.size()>0){
			int r=q.pollFirst();
			for(int p:m.get(r)){
				if(d[p]!=-1)
					continue;
				d[p]=d[r]+l.get(r).get(p);
				q.offerFirst(p);
			}
		}
		for(int i=0;i<n;i++){
			if(d[i]%2==0)
				System.out.println(0);
			else
				System.out.println(1);
		}
	}
}


Measured memory_bytes: 154336
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

bool isPrime(int n){
  if(n < 2) return false;
  else if(n == 2) return true;
  else if(n%2==0) return false;

  for(int i=3;i<=sqrt(n);i++){
    if(n%i==0) return false;
  }
  return true;
}

int main(){
  int n;
  cin >> n;
  for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
      if(n==i*j){
        cout<< "Yes" <<endl;
        return 0;
      }
    }
  }
  cout<< "No" <<endl;
}


Measured memory_bytes: 256
from collections import Counter

n = int(input())
s = [input() for _ in range(n)]

m = int(input())
t = [input() for _ in range(m)]

sc = Counter(s)
tc = Counter(t)
res = 0 
for s_key, s_value in zip(sc.keys(), sc.values()):
    t_value = tc[s_key]
    if s_value - t_value > res:
        res = s_value - t_value
print(res)

Measured memory_bytes: 3316
/*"The more that I try, the more that I want
The more that I want, the more that I grind" - Joyner Lucas*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define llpow(a,b) (ll)(pow(a,b)+0.5)
#define lb(a,val) min((int)a.size()-1, (int)(lower_bound(a.begin(),a.end(),val)-a.begin()))
#define lbs(a,val) (int)(lower_bound(a.begin(),a.end(),val)-a.begin())
#define ub(a,val) min((int)a.size()-1, (int)(upper_bound(a.begin(),a.end(),val)-a.begin()))
#define ubs(a,val)  (int)(upper_bound(a.begin(),a.end(),val)-a.begin())
#define f first
#define up(a,b) max(a,b)
#define s second
#define INF 9223372036854775807
const int mod = 1000000007;
const int mj = 2e5 + 5;
template <typename T> T add(T& a, T b){a+=b;while(a>=mod)a-=mod;while(a<0)a+=mod;}
template <typename T> T mul(T& a, T b){ a = a*b%mod;}
template <typename T> T up_self(T& a, T b){a = up(a,b);}
template <typename T> T min_self(T& a, T b){a = min(a,b);}
string find_largest_pref_palindrome(const string& a){string s = a;reverse(s.begin(),s.end());s = a+"%"+s;int c = 0;vector<int> pref(2*((int)a.size()) +2);for(int i = 1; i< s.size() ; i++ ){while(c!=0&&s[i]!=s[c])c = pref[c-1];if(s[i]==s[c])c++;pref[i] = c;}return s.substr(0,c);}
ll binexpomodulo(ll x, ll y){ll res =1;x%=mod;if(!x)return 0;while(y){if(y&1){mul(res, x);}mul(x,x);y>>=1;}return res;}
ll nCrInOr(ll n, ll r){ll res = 1;if(r>n-r)r = n-r;ll rin = 1;for(ll i = 1; i <=r ; i++)rin = (rin*i)%mod;rin = binexpomodulo(rin,mod-2);for(ll i = 1; i <= r; i++)res = (res*(n-i+1))%mod;res = (res*rin)%mod;return res;}
int msb(ll n){int ans;for(int i = 0 ; i < 64;  i++)if(n&(1LL<<i))ans = i+1;return ans;}
/*All the macros below are copied from nik_y(OG)*/
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define all(c) c.begin(),c.end()
#define endl "\n"
#define get(a,n) fl(i,0,n)  cin>>a[i];
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
int main()
{
	Shazam;
	ll k,a,b; cin>>k>>a>>b;
	if(b-b%k>=a)
		cout<<"OK"<<endl;
	else
		cout<<"NG"<<endl;
  	return 0;
}

Measured memory_bytes: 3656