akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void){
  int k,n;
  char sen[1002];
  for(k=1;k<=1001;k++){
    scanf("%c",&sen[k]);
    if(sen[k]=='\n') break;
    n++; // n????????????????????????????????????????????¨??????
  }
  for(k=1;k<=n-4;k++){
    if(sen[k]=='a' && sen[k+1]=='p' && sen[k+2]=='p' && sen[k+3]=='l' && sen[k+4]=='e'){
      sen[k]='p';
      sen[k+1]='e';
      sen[k+2]='a';
      sen[k+3]='c';
      sen[k+4]='h';
    }
    else if(sen[k]=='p' && sen[k+1]=='e' && sen[k+2]=='a' && sen[k+3]=='c' && sen[k+4]=='h'){
      sen[k]='a';
      sen[k+1]='p';
      sen[k+2]='p';
      sen[k+3]='l';
      sen[k+4]='e';
    }
  }
  for(k=1;k<=n;k++){
    printf("%c",sen[k]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 524
S=input()
Word=['eraser','erase','dreamer','dream']

while True:
    S_len=len(S)
    if S_len<5:
        break
    else:
        for i in Word:
            S = S.replace(i,"")
        if len(S)==S_len: #一つも文字が消えなかった時break
            break
           
if len(S)==0:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
/*input
5
ababa
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define sz(_a) (ll)(_a.size())
#define FILL(n) memset(n,0,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;

bool kmp(int l, string s) {
    int z = 0;
    vector<int> a(s.length() + 1);
    for (int i = 1; i <= s.length(); i++) {
        int x = i - 1;
        while (x && a[x] != i - 1 && s[a[x]] != s[i - 1]) x = a[x];
        if (x) a[i] = a[x] + 1;
        if (a[i] == l) return true;
    }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    int n, z = 0;
    string s;
    cin >> n >> s;
    for (int i = 0; i < n; i++) {
        int l = i, r = n;
        while (l + 1 < r) {
            int m = (l + r) >> 1;
            string t = s.substr(i, m - i) + '!' + s.substr(m, string::npos);
            if (kmp(m - i, t)) l = m;
            else r = m;
        }
        z = max(z, l - i);
    }
    cout << z;
}


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

/*ソートの時に使う
int sort(const void *a, const void *b){
    return *(int*)a-*(int*)b ;
}
    qsort (data,sizeof(data),sizeof(int),sort); 
*/

int main(void){
    int n;
    scanf("%d",&n) ;
        if (n==1){
            printf ("2\n");
        } else if(n%2==1){
            printf ("%d\n",n*2);
        } else{
            printf ("%d\n",n);
        }
	return 0 ;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int N = Integer.parseInt(scan.next());
	String S = scan.next();

	int x = 0;
	int max = 0;
	for (int i = 0; i < N; i++) {
	    if(S.charAt(i) == 'I') x++;
	    else x--;
	    if(x > max) max = x;
	}

	System.out.println(max);
	scan.close();
    }
}


Measured memory_bytes: 24916
dic = {}
for i in range(97, 123):
    dic[chr(i)] = 0

w = input().strip().lower()

total = 0
while True:
    s = input().strip()
    if s == "END_OF_TEXT":
        break

    for sl in s.lower().split():
        word = ""
        for c in sl:
            if c in dic:
                word += c
        if word == w:
            total += 1

print(total)


Measured memory_bytes: 5564
using System;
using System.Collections;

namespace myApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            ArrayList list = new ArrayList();
            
            for (int i = 0; i < int.Parse(input[0]); i++)
            {
                list.Add(int.Parse(Console.ReadLine()));
            }

            list.Sort();

            int K = int.Parse(input[1]);
            int min = (int)list[K-1] - (int)list[0];
            int wk = 0;
            for(int a = 1; a < list.Count - (K - 1); a++)
            {
                wk = (int)list[a+(K-1)] - (int)list[a];
                if (min > wk)
                {
                    min = wk;
                }
            }
            Console.WriteLine(min);
        
        }
    }
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n;
	ll z, w;
	cin >> n >> z >> w;
	ll a[n];
	for(int i=0; i<n; i++) cin >> a[i];

	if(n==1) cout << abs(a[n-1]-w) << endl;
	else cout << max(abs(a[n-1]-w), abs(a[n-2]-a[n-1])) << endl;
	return 0;
}

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

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		
		while(true){
			String[] tmpArray = br.readLine().split(" ");
			
			int r = Integer.parseInt(tmpArray[0]);
			int c = Integer.parseInt(tmpArray[1]);
			
			if(r == 0 && c== 0){
				break;
			}
			int[][] matrix = new int[r][c];
			
			for(int i = 0; i < r; i++){
				tmpArray = br.readLine().split(" ");
				for(int j = 0; j < c; j++){
					matrix[i][j] = Integer.parseInt(tmpArray[j]);
				}
			}
			
			PermGenerator pg = new PermGenerator(r);
			
			int[][] command = pg.getResult();
			
			int maxAvailable = 0;
			for(int i = 0; i < command.length ; i++){
//				System.out.println("# "+i);
				int[][] reversedMatrix = reverseOsenbei(matrix, command[i]);
				int available = 0;
				for(int j = 0; j < c ; j++){
					int black = 0;
					for(int k = 0; k < r ; k++){
						if(reversedMatrix[k][j] == 1){
							black++;
						}
					}
					available += Math.max(black, r - black);
				}
//				System.out.println(available);
				if(maxAvailable < available){
					maxAvailable = available;
				}
			}
			
			System.out.println(maxAvailable);
		}
	}
	
	static int[][] reverseOsenbei(int[][] matrix, int[] command){
//		System.out.print("op ");
		int[][] newMatrix = new int[matrix.length][matrix[0].length];
		for(int i = 0; i < matrix.length ; i++){
//			System.out.print(command[i]);
				for(int j = 0; j < matrix[0].length ; j++){
					if(command[i] == 1){
						newMatrix[i][j] = (matrix[i][j] + 1)%2;
					}
					else {
						newMatrix[i][j] = matrix[i][j];
					}
//					if(matrix[i][j] != 1 && matrix[i][j] != 0){
//						System.out.println("ILLEGAL NUMBER!!!");
//					}
					
				}
			
		}
//		System.out.println();
		
//		printOsenbei(newMatrix);
		
		return newMatrix;
	}

	static void printOsenbei(int[][] matrix){
		for(int i = 0; i < matrix.length ; i++){
			for(int j = 0; j < matrix[0].length ; j++){
				System.out.print(matrix[i][j]);
			}
			System.out.println();
		}
	}
}

class PermGenerator {
	private int[][] result;
	
	public PermGenerator(int n){
		result = new int[(int)Math.pow(2, n)][n];
		
		permutation(n);
	}
	
	private void permutation(int n){
		int limit = (int)Math.pow(2, n);
		
		for(int i = 0; i < limit ; i++){
			int x = i;
			for(int j = 0; j < n; j++){
				result[i][n - j - 1] = x%2;
				x /= 2;
			}
		}
	}
	
	public void print(){
		for(int i = 0; i < result.length ; i++){
			for(int j = 0; j < result[0].length ; j++){
				System.out.print(result[i][j]);
			}
			System.out.println();
		}
	}
	
	public int[][] getResult(){
		return result;
	}
	
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> a(N - 1), b(N - 1);
    for (int i = 0; i < N - 1; i++)
    {
        cin >> a.at(i) >> b.at(i);
    }
    vector<int> c(N);
    for (int i = 0; i < N; i++)
    {
        cin >> c.at(i);
    }

    vector<vector<int>> tree(N);
    for (int i = 0; i < N - 1; i++)
    {
        tree.at(a.at(i) - 1).push_back(b.at(i) - 1);
        tree.at(b.at(i) - 1).push_back(a.at(i) - 1);
    }
    sort(c.rbegin(), c.rend());

    vector<int> res(N, -1);
    res.at(0) = c.at(0);
    int s = 0;
    int idx = 1;
    queue<int> q;
    q.push(0);
    while (!q.empty())
    {
        int v = q.front();
        q.pop();
        for (auto u : tree.at(v))
        {
            if (res.at(u) > 0)
                continue;
            res.at(u) = c.at(idx);
            s += c.at(idx);
            idx++;
            q.push(u);
        }
    }
    cout << s << endl;
    for (int i = 0; i < N; i++)
    {
        cout << res.at(i) << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
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
/*-------------------------------------------------------------------------------------*/
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M 1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int a;
   cin>>a;
   cout<<(a + a*a + a*a*a)<<endl;

}


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

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> marks(n);
    for(auto &x : marks) cin >> x;
    for(int i = k; i < n; i++) {
        if(marks[i] > marks[i-k]) cout << "Yes";
        else cout << "No";
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 4032
a,b,x,y = (int(i) for i in input().split())
width = x-a
height = y-b
keiro1= 'L'+'U'*(height+1)+'R'*(width+1)+'D'
keiro2= 'L'*width+'D'*height
keiro3= 'R'*width+'U'*height
keiro4= 'R'+'D'*(height+1)+'L'*(width+1)+'U'
ans = keiro1+ keiro2+keiro3+keiro4


print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define MOD 998244353
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 = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
struct edge{//グラフに使うヤツ
    ll from,to,cost;
};
typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

int main(){
    ll x[5];
    for (ll i=0;i<5;i++){
        cin >> x[i];
        if (x[i]==0){
            cout << i+1 << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3596
s=input()
a,b=0,0
if int(s[:2])>0 and int(s[:2])<13:
  a=1
if int(s[2:])>0 and int(s[2:])<13:
  b=1
if a==1 and b==1:
  print("AMBIGUOUS")
elif a==1 and b!=1:
  print("MMYY")
elif a!=1 and b==1:
  print("YYMM")
else:
  print("NA")

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(x) cout << x << endl;
typedef long long ll;

int main() {
    int n; cin >> n;
    vector<int> ans(n);
    int b1; cin >> b1;
    ans[0] = b1;
    ans[1] = b1;

    int cnt = 1;
    REP(i, 1, n - 1){
        int b; cin >> b;
        if(b >= ans[cnt]){
            ans[cnt + 1] = b;
        }else{
            ans[cnt] = b;
            ans[cnt + 1] = b;
        }
        cnt++;
    }
    OP(accumulate(ans.begin(), ans.end(), 0));
}


Measured memory_bytes: 256
//https://atcoder.jp/contests/dp/tasks/dp_a
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin>>n;
	vector<ll> a;
	a.resize(n);
	ll i;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	vector<ll> dp;
	dp.resize(n+5);
	dp[0]=0;
	dp[1]=abs(a[0]-a[1]);
	for(i=2;i<n;i++)
	{
		dp[i]=min((abs(a[i-1]-a[i])+dp[i-1]),(abs(a[i-2]-a[i])+dp[i-2]));
	}
	cout<<dp[n-1]<<"\n";
	return 0;
}

Measured memory_bytes: 4776
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n+1];
  for(int i=2; i<=n; i++)
    cin >> a[i];
  int ans[n+1]={0};
  for(int i=2; i<=n; i++)
    ans[a[i]]++;
  for(int i=1; i<=n; i++)
    cout << ans[i] << endl;
  return 0;
}

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

int c[52][52];
int dfs(int x,int y){
	if( c[y][x] == 0 ) return 0;
	c[y][x] = 0;
	for(int i = -1 ; i <= 1 ; i++)
		for(int j = -1 ; j <= 1 ; j++)
			dfs(x+i,y+j);

}
int main(){
	int w,h;
	while(cin >> w >> h and w){
		memset(c,0,sizeof(c));
		for(int i = 0 ; i < h ; i++){
			for(int j = 0 ; j < w ; j++){
				cin >> c[i+1][j+1];
			}
		}
		int ans = 0;
		for(int i = 1 ; i <= h ; i++){
			for(int j = 1 ; j <= w ; j++){
				if( c[i][j] ){
					ans++;
					dfs(j,i);
				}
			}
		}
		cout << ans << endl;
	}

}

Measured memory_bytes: 3172
input_data = input().split(" ")
M = int(input_data[0])
D = input_data[1]

cnt = 0
for i in range(1,M + 1):
  for j in range(22, int(D) + 1):
    if i == int(str(j)[0]) * int(str(j)[1]) and int(str(j)[1]) != 0  and int(str(j)[1]) != 1:
      cnt += 1
    else:
      pass

print(cnt)

Measured memory_bytes: 3064
#B
A,B,C=map(int,input().split())
K=int(input())
cnt=0
ans="No"
while cnt<K:
    if A>=B:
        B*=2
    elif B>=C:
        C*=2
    if A<B and B<C:
        ans="Yes"
        break
    cnt+=1
print(ans)

Measured memory_bytes: 61588
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


n = int(input())
cnt = [0]*101
ans=0

for i in range(1,n+1):
  lst = factorization(i)
  for j in lst:
    cnt[j[0]]+=j[1]

a,b,c,d,e=0,0,0,0,0

for i in cnt:
  if 2<=i<=3:
    a+=1
  elif 4<=i<=13:
    b+=1
  elif 14<=i<=23:
    c+=1
  elif 24<=i<=73:
    d+=1
  elif 74<=i:
    e+=1


ans+=e
ans+=(d+e)*(a+b+c+d+e-1)
ans+=(c+d+e)*(b+c+d+e-1)
ans+=(b+c+d+e)*(b+c+d+e-1)*(a+b+c+d+e-2)//2


print(ans)

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

using namespace std;

const int md = (int) 1e9 + 7;

inline void add(int &x, int y) {
  x += y;
  if (x >= md) {
    x -= md;
  }
}

int main() {
#ifdef wxh010910
  freopen("input.txt", "r", stdin);
#endif
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int m = *max_element(a.begin(), a.end()) + 1;
  vector<int> sum(m);
  vector<int> dp(n + 1);
  dp[0] = 1;
  for (int i = 0; i < n; ++i) {
    dp[i + 1] = dp[i];
    if (!i || a[i] != a[i - 1]) {
      add(dp[i + 1], sum[a[i]]);
    }
    if (!i || a[i] != a[i - 1]) {
      add(sum[a[i]], dp[i]);
    }
  }
  cout << dp[n] << "\n";
  return 0;
}


Measured memory_bytes: 2560
import java.util.*;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc=new Scanner(System.in);
        while(true){
           int H=sc.nextInt();
           int W=sc.nextInt();
           if(H==0){
               if(W==0)break;
           }
           for(int i=1;i<=H;i++){
                if(i%2==1){
                    for(int j=1;j<=W;j++){
                        if(j%2==1){
                            System.out.print("#");
                        }else{
                            System.out.print(".");
                        }
                    }
                }else{
                    for(int j=1;j<=W;j++){
                        if(j%2==0){
                            System.out.print("#");
                        }else{
                            System.out.print(".");
                        }
                    }
                }
                
                System.out.println();
           }
           System.out.println();
        }
           
    }
}



Measured memory_bytes: 36704
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-6;
const ll LINF = 100200300400500600ll;
const int INF = 1001001001;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {-1,0,1,0};
const int mod = 1000000007;
#define Yes(ifeq) cout<<(( ifeq )? "Yes":"No")<<endl;
template <class T>
vector< T > Divisor(T n) {
  vector< T > ret;
  for(T i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
};

void Main(){
  ull n;
  cin>>n;
  auto d = Divisor(n-1);
  int ans = d.size();

  d = Divisor(n);
  int k = d.size()-1;
  rep( i,k){
    ull a = d[i];
    ull b = n/a;
    if(a!=1 ){
      while( b%a==0 ){
        b/=a;
      } 
      if( b%a==1 ){
        ans++;
      } 
    }
  }
  

  cout<<ans<<endl;
} signed main(int argc,char** argv)
{fastio; myio; myloopset Main();}


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

int main() {
    long long n,a,b;
    cin >> n >> a >> b;
    if(n==1){
        if(a==b) cout << 1 << endl;
        else cout << 0 << endl;
    }
    else cout << max(0LL,(b-a)*(n-2)+1) << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

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

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}


#ifdef LOCAL
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

struct S {
        int t;
        ll d;
    };

bool cmp(S a, S b) {
    return a.d > b.d;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int N, K;
    cin >> N >> K;

    S s[N];
    REP(i, N) {
        int t; ll d;
        cin >> s[i].t >> s[i].d;
    }

    sort(s, s+N, cmp);

    ll cnt = 0;
    ll ans = 0;
    bool f[N+1];
    REP(i, N+1) f[i] = false;

    vector<ll> a;
    REP(i, K) {
        ans += s[i].d;
        if (!f[s[i].t]) {
            ++cnt;
            f[s[i].t] = true;
        } else {
            a.pb(s[i].d);
        }
    }
    ans += cnt * cnt;

    vector<ll> b;
    FOR(i, K, N) {
        if (!f[s[i].t]) {
            f[s[i].t] = true;
            b.pb(s[i].d);
        }
    }

    ll tmp = ans;
    int m = a.size();
    REP(i, min(m, int(b.size()))) {
        tmp += b[i] + 2 * cnt + 1 - a[m-i-1];
        ++cnt;
        ans = max(ans, tmp);
    }

    cout << fixed << setprecision(20);
    cout << ans << endl;

}


Measured memory_bytes: 2624
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    ll x;
    cin >> x;
    ll now = 100;
    int cnt = 0;
    while(now < x){
        cnt++;
        ll sa = now/100;
        now += sa;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<functional>
#include<stack>
#include<list>
#include<set>
#include<deque>
#include<climits>
using namespace std;

typedef long long ll;

int main(){
	int N;
	string S, T;
	cin >> N >> S >> T;
	int cntS[26] = {}, cntT[26] = {};
	for (int i = 0; i < N; i++)
	{
		cntS[S[i] - 'a']++;
		cntT[T[i] - 'a']++;
	}
	priority_queue<int> s, t;
	for (int i = 0; i < 26; i++)
	{
		s.push(cntS[i]);
		t.push(cntT[i]);
	}
	int ans = 0;
	while(!s.empty() || !t.empty())
	{
		//printf("%d, %d\n", s.top(), t.top());
		ans += abs(s.top() - t.top());
		s.pop();
		t.pop();
	}
	printf("%d\n", ans/2);
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    long long power = 1;
    long c = 1000000007;

    for (int i = 1; i <= N; i++) {
        power *= i;
        power %= c;
    }
    cout << power << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  double N;
  cin >> N;
  
  double odd = 0;
  for( int i =1; i <= N; i++ ){
    if( i % 2 == 1 ) odd++;
  }
  cout << fixed << setprecision(10);
  cout << odd/N << endl;
  
  
  
  
}

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

using namespace std;
const int N = 100010;
typedef long long ll;
ll a, b, n, h[N], c;

int ok(ll times) {
    ll tot = 0;
    for (int i = 0; i < n; i++) {
        if (h[i] - times * b <= 0) continue;
        tot += (h[i] - times * b + c - 1) / c;
    }
    return tot <= times;
}

int main() {
    cin >> n >> a >> b;
    c = a - b;
    for (int i = 0; i < n; i++) scanf("%lld", h + i);
    sort(h, h + n);
    int l = (int) ceil(1.0 * h[n - 1] / a), r = (int) floor(1.0 * h[n - 1] / b)+10;
    while (l < r) {
        int mid = (l + r) >> 1;
        if (ok(mid)) r = mid;
        else l = mid + 1;
    }
    cout << l << endl;
    return 0;
}

Measured memory_bytes: 1024
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()

if N == 1 and M == 0:
  print(0)
  exit()

sc = [LIST() for _ in range(M)]

ans = [-1]*N
for s, c in sc:	
  if N >= 2 and s == 1 and c == 0:
    print(-1)
    exit()
  if ans[s-1] != -1 and ans[s-1] != c: #既に値が入ってる
    print(-1)
    exit()
  ans[s-1] = c
    
if ans[0] == -1:
  ans[0] = 1

for i in range(N):
  if ans[i] == -1:
    ans[i] = 0
    
for n in ans:
  print(n, end="")


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

int main(){
  ll n; cin>>n;
  ll zMAX,zMIN,wMAX,wMIN;
  rep(i,n){
    ll x,y; cin>>x>>y;
    if(i==0){
      zMAX = zMIN = x + y;
      wMAX = wMIN = x - y;
    }else{
      ll z = x+y, w = x-y;
      zMAX = max(zMAX,z);
      zMIN = min(zMIN,z);
      wMAX = max(wMAX,w);
      wMIN = min(wMIN,w);
    }
  }
  cout << max(zMAX-zMIN,wMAX-wMIN) << endl;
}

Measured memory_bytes: 3620
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 105
#define fi(a, b, c, d) for(int a = b; i < c; i += d)
#define fl(a, b, c, d) for(ll a = b; i < c; i += d)
#define quit exit(0)

ll N, M, A, B, C;
double arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
string S = "";

int main() {
	ll sum = 0;
	scanf("%lld %lld", &N, &M);
	for(int i = 0; i < N; i++) {
		scanf("%lf", &arr[i]);
		sum += arr[i];
	}	
	double temp = (1.0 / (4 * M)) * sum;
	sort(arr, arr + N);
	reverse(arr, arr + N);
	for(int i = 0; i < M; i++) {
		if(arr[i] < temp) {
			printf("No\n");
			quit;
		}
	}
	printf("Yes\n");
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
int n;
int main()
{
    scanf("%d",&n);
    printf("%d",n*n);
    return 0;
}

Measured memory_bytes: 256
t, a, num = STDIN.gets.chomp.split(' ').map(&:to_i)

if t <= num
  num = num - t
  t = 0
else
  t = t - num
  num = 0
end

if a <= num
  a = 0
else
  a = a - num
end
puts "#{t} #{a}"


Measured memory_bytes: 1788
N = int(input())
XYH = [[0, 0, 0] for _ in range(N)]
for i in range(N):
    XYH[i] = list(map(int, input().split()))

XYH.sort(key = lambda x: x[2], reverse = True)
for x in range(101):
    for y in range(101):
        diff_x = abs(XYH[0][0] - x)
        diff_y = abs(XYH[0][1] - y)
        H = XYH[0][2] + diff_x + diff_y
        for xyh in XYH[1:]:
            if xyh[2] != max(H - abs(xyh[0] - x) - abs(xyh[1] - y), 0):
                break
        else:
            print(x, y, H)
            exit()


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

int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
  	string ans;
  	while(true){
      c -= b;
      if(c <= 0){
          ans = "Yes";
          break;
      }
      a -= d;
      if(a <= 0){
          ans = "No";
          break;
      }
    }
  
	cout << ans << endl;
}

Measured memory_bytes: 3596
H, W, D=[int(x) for x in str(input()).split()]
A=[[0 for x in range(W+1)]]
for i in range(1,H+1):
  b=[0]
  b+=[int(x) for x in str(input()).split()]
  A.append(b)
Q=int(input())
LR=[[0 for x in range(3)]]
for i in range(1,Q+1):
  b=[0]
  b+=[int(x) for x in str(input()).split()]
  LR.append(b)












B=[0 for x in range(H*W+1)]
for i in range(1,W+1):
  for j in range(1,H+1):
    B[A[j][i]]=[j,i]

XY=[0]
for i in range(1,D+1):

  C=[]
  x=i
  s=0
  while x<(H*W-D+1):

    s+=abs(B[x][0]-B[x+D][0])+abs(B[x][1]-B[x+D][1])
    C.append(s)
    x+=D

  C.append(s+abs(B[i][0]-B[x][0])+abs(B[i][1]-B[x][1]))
  XY.append(C)


def mo(x,y):
  if x%y==0:
    return y
  else:
    return x%y

def br(x):
  if x<=0:
    return 0
  else:
    return int(x)

ans=[]
for i in range (1,Q+1):
  if LR[i][1]<LR[i][2] and LR[i][1]==mo(LR[i][1],D):
    g=XY[mo(LR[i][1],D)][br((LR[i][1]-0.1)//D-1)]
    h=XY[mo(LR[i][1],D)][br((LR[i][2]-0.1)//D-1)]

    ans.append(h)
  elif LR[i][1]<LR[i][2]:
    g=XY[mo(LR[i][1],D)][br((LR[i][1]-0.1)//D-1)]
    h=XY[mo(LR[i][1],D)][br((LR[i][2]-0.1)//D-1)]

    ans.append(h-g)
  elif LR[i][1]>LR[i][2]:
    g=XY[mo(LR[i][2],D)][br((LR[i][2]+0.1)//D)-2]
    h=XY[mo(LR[i][2],D)][-1]-XY[mo(LR[i][1],D)][br((LR[i][2]+0.1)//D-2)]
    ans.append(h+g)
  else:
    ans.append(0)

for i in ans:
  print(i)



Measured memory_bytes: 48400
//お勉強中
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const ll mask30 = (1ll << 30) - 1;
const ll mask31 = (1ll << 31) - 1;
const ll RHmod = (1ll << 61) - 1;
ll RHmul(ll A, ll B) {
	ll A1 = A >> 31;
	ll A2 = A & mask31;
	ll B1 = B >> 31;
	ll B2 = B & mask31;
	ll ret = 2 * A1 * B1 + A2 * B2 + ((A1 * B2 + A2 * B1 & mask30) << 31) + (A1 * B2 + A2 * B1 >> 30);
	ret = (ret & RHmod) + (ret >> 61);
	if (ret >= RHmod) return ret - RHmod;
	return ret;
}
ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % RHmod;
		A = A * A % RHmod;
		B >>= 1;
	}
	return kotae;
}

const ll len = 5000;
ll POW[len + 1], IPOW[len + 1], RH[len + 1];
ll RHcalc(int i, int j) {
	ll kari = (RH[j] - RH[i] + RHmod) % RHmod;
	return RHmul(kari, IPOW[i]);
}

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


	int N;
	cin >> N;
	string S;
	cin >> S;


	POW[0] = 1;
	rep(i, len) POW[i + 1] = RHmul(POW[i], 30);
	IPOW[len] = modpow(POW[len], RHmod - 2);
	rep(i, len) IPOW[len - i - 1] = RHmul(IPOW[len - i], 30);
	RH[0] = 0;
	rep(i, N) RH[i + 1] = (RH[i] + RHmul(POW[i], S[i] - 'a' + 1)) % RHmod;


	int L = 0;
	int R = N / 2 + 1;
	while (L + 1 < R) {
		int H = (L + R) / 2;

		int OK = 0;
		set<ll> ST;
		for (int i = 0; i <= N - 2 * H; i++) {
			ST.insert(RHcalc(i, i + H));
			if (ST.find(RHcalc(i + H, i + 2 * H)) != ST.end()) {
				OK = 1;
				break;
			}
		}

		if (OK) L = H;
		else R = H;
	}

	co(L);


	Would you please return 0;
}

Measured memory_bytes: 640
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    n,m = LI()
    a = LI()
    match = [0,2,5,5,4,5,6,3,7,6]
    dp = [-1] * (n+1)
    dp[0] = 0
    for i in range(1,n+1):
        for x in a:
            if i < match[x]: continue
            if dp[i-match[x]] < 0: continue
            dp[i] = max(dp[i],dp[i-match[x]]*10+x)
    print(dp[-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 53208
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<cmath>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	ll n,count=0;
	cin >> n;
	if (n % 2 != 0) {
		cout << 0 << endl;
		return 0;
	}
	for (ll i = 10; i <= n; i*=5) {
		count += n / (i);
	}
	cout << count << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
 
using namespace std;
 
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
#define MAX 100010
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  //  freopen("input.txt","r",stdin);
  //  freopen("output.txt","w",stdout);
    int n,k;
    cin>>n>>k;
    long long int cost[n],a[n];
    for(int i=0;i<n;i++)
    {
    	cin>>a[i];
    	cost[i] = 0;
    }
    cost[0]=0;
    cost[1] = cost[0]+abs(a[1]-a[0]);
    for(int i=2;i<n;i++)
    {
    	long long int mn =INF;
    	for(int j=i-1;j>=max(0,i-k);j--)
    	{
    		mn = min(mn, cost[j]+abs(a[i]-a[j]));
    	}
    	cost[i] = mn;
    }
    cout<<cost[n-1]<<endl;
 	
    

	return 0;
}

Measured memory_bytes: 1792
import           Control.Monad
import           Data.Array.IArray
import           Data.Array.IO

readInts :: IO [Int]
readInts = map read . words <$> getLine

main :: IO ()
main = do
  [n, m, k] <- readInts
  a_uary <- newArray ((0, 0), (n, n)) 0 :: IO (IOUArray (Int, Int) Int)
  b_uary <- newArray ((0, 0), (n, n)) 0 :: IO (IOUArray (Int, Int) Int)
  lrs <- replicateM m readInts
  pqs <- replicateM k readInts

  forM_ lrs $ \[l, r] ->
    writeArray a_uary (l, r) =<< (+1) <$> readArray a_uary (l, r)

  a_ary <- freeze a_uary :: IO (Array (Int, Int) Int)

  forM_ [1..n] $ \i ->
    forM_ [1..n] $ \j ->
      writeArray b_uary (i, j) =<< (\x y z w -> x + y - z + w)
        <$> readArray b_uary (i-1, j)
        <*> readArray b_uary (i, j-1)
        <*> readArray b_uary (i-1, j-1)
        <*> pure (a_ary ! (i, j))

  b_ary <- freeze b_uary :: IO (Array (Int, Int) Int)

  forM_ pqs $ \[p, q] ->
    print $ b_ary!(q, q) - b_ary!(p-1, q) - b_ary!(q, p-1) + b_ary!(p-1, p-1)


Measured memory_bytes: 168316
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();		
		boolean f = false;
		for(int A = 1 ; A <= 9 ; ++A){
			if(N % A == 0 && N / A < 10){
				f = true;
			}
		}
		String ret = f ? "Yes" : "No";
		System.out.println(ret);
	}
}


Measured memory_bytes: 23892
#include <stdio.h>
#include <algorithm>
using namespace std;
int main(){
    int a[3];
    scanf("%d %d %d", &a[0], &a[1], &a[2]);
    sort(a, a + 3);
    if(a[0] == 5 && a[1] == 5 && a[2] == 7)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}


Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String ans="ABC";
		if (S.equals("ARC")) {
				System.out.println(ans);
		}
		else{
		ans="ARC";
				System.out.println(ans);		
		}
    }
}

Measured memory_bytes: 35684
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    ll A;
    ld B;
    cin >> A >> B;
    ld C = ld(A)*B;
    
    cout << ll(C) << endl;
    

    return 0;
}


Measured memory_bytes: 3744
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!.split(" ").map(String::toInt)
    if (n != s.size) return
    val q = readLine()!!.toInt()
    val t = readLine()!!.split(" ").map(String::toInt)
    if (q != t.size) return

    var count = 0
    t.forEach { num1 ->
        run loop@ {
            s.forEach { num2 ->
                if (num1 == num2) {
                    count++
                    return@loop
                }
            }
        }
    }

    println(count)
}


Measured memory_bytes: 35936
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
typedef int64_t ll;
typedef uint64_t ull;

constexpr ll INF = 1000000000;/* 1e+9a */

void solve(istream &cin) {
    ll N;
    if (!(cin >> N)) { return; }
    ll t;
    cin >> t;
    cout << max(N-t,ll{0}) << endl;

}

int main(int argc, char *argv[]) {
    string FileName("ABC072"), Modifier("MEPH_");
    string ExecutionName = Modifier + FileName;
    string sub(argv[0]);
    // /home/USER/.../MEPH_X -> MEPH_X
    if (sub.size() > ExecutionName.size())
        sub = sub.substr(sub.size() - ExecutionName.size(), ExecutionName.size());

    cout << setprecision(16) << scientific;
    if (sub != ExecutionName) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        while (cin) { solve(cin); }
    } else {
        cerr << sub << " test" << endl;
        string inFile = FileName + ".txt";
        auto fs = fstream(inFile, fstream::in);
        while (fs) { solve(fs); }
    }
}


Measured memory_bytes: 256
H,W = map(int,input().split())
S =[list(input().split()) for i in range(H)]
c_dict = {0:"1",1:"2",2:"3",3:"4",4:"5",5:"6",6:"7",7:"8",8:"9",9:"10",10:"11",\
11:"12",12:"13",13:"14",14:"15",15:"16",16:"17",17:"18",18:"A",19:"B",20:"C",\
21:"D",22:"E",23:"F",24:"G",25:"H"}

l_dict = {0:"A",1:"B",2:"C",3:"D",4:"E",5:"F",6:"G",7:"H",8:"I",9:"J",10:"K",\
11:"L",12:"M",13:"N",14:"O",15:"P",16:"Q",17:"R",18:"S",19:"T",20:"U",21:"V",\
22:"W",23:"X",24:"Y",25:"Z"}

for i in range(H):
    for j in range(W):
        if S[i][j]=="snuke":
            print(l_dict[j]+c_dict[i])
            exit()

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

namespace HABIT{
    #define f(a,b,c,d) for(register int a=b,c=d;a<=c;a++)
    #define g(a,b,c,d) for(register int a=b,c=d;a>=c;a--)
    #define LOCAL
    typedef int i32;
    typedef unsigned int u32;
    typedef long long int i64;
    typedef unsigned long long int u64;
    typedef pair<i32,i32> pii;
    const i32 MAXN=1e6+10;
    typedef i32 ar[MAXN];
    
    template<typename T> inline T Max(T a) { return a; }
    template<typename T,typename... Args> inline T Max(T a,Args... args){
        T b=Max(args...);
        return (a>b)?a:b;
    }
    template<typename T> inline T Min(T a) { return a; }
    template<typename T,typename... Args> inline T Min(T a,Args... args){
        T b=Min(args...);
        return (a<b)?a:b;
    }

    #ifdef LOCAL
        inline char gc() { return getchar(); }
    #else
        inline char gc() {
            static char s[1<<20|1]={0},*p1=s,*p2=s;
            return (p1==p2)&&(p2=(p1=s)+fread(s,1,1<<20,stdin),p1==p2)?EOF:*(p1++);
        }
    #endif
    inline i64 read(){
        register i64 ans=0;register char c=gc();register bool neg=0;
        while(c<48||c>57) neg^=!(c^'-'),c=gc();
        while(c>=48&&c<=57) ans=(ans<<3)+(ans<<1)+(c^48),c=gc();
        return neg?-ans:ans;
    }

    char Output_Ans[1<<20|1],*Output_Cur=Output_Ans;
    inline void output() { Output_Cur-=fwrite(Output_Ans,1,Output_Cur-Output_Ans,stdout); }
    inline void print(char c){
        if(Output_Cur-Output_Ans+1>>20) output();
        *(Output_Cur++)=c;
    }
    inline void print(char *s) { while(*s) print( *(s++) ); }
    inline void print(u64 x){
        if(!x) { print('0'); return ; }
        char buf[30]={0},*p=buf+28;
        while(x) *(p--)=x%10+48,x/=10;
        print(p+1);
    }
    inline void print(u32 x) { print( (u64)x ); }
    inline void print(i64 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
    inline void print(i32 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
}
using namespace HABIT;

ar Prime,Fc;
i32 *pPrime=Prime;

inline i64 ans(i64 N){
    if(N==1)
        return 0;
    i64 Cpy=N,Ans=0;
    for(register i32 *p=Prime;p<pPrime;p++)
        if(Cpy==1) break;
        else if(Cpy%*p==0){
            i32 Cnt=0,Sum=0;
            while(Cpy%*p==0) Cpy/=*p,Cnt++;
            for(int i=1;i<=100;i++){
                Sum+=i;
                if(Sum>Cnt){
                    Ans+=i-1;
                    break;
                }
            }
        }
    if(Cpy!=1) Ans++;
    return Ans;
}

inline void pre(){
    f(i,2,I,1e6){
        if(!Fc[i])
            Fc[i]=*(pPrime++)=i;
        for(register i32 *p=Prime;p<pPrime&&*p*i<=I&&*p<=Fc[i];p++)
            Fc[*p*i]=*p;
    }
}

int main(){
    pre();
    i64 N=read();
    print( ans(N) );
    output();
    return 0;
}

Measured memory_bytes: 7848
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

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

    int n, m;
    cin >> n >> m;
    vector<vector<int>> graph(n);
    for(int i = 0; i < n - 1; ++i){
        int x, y;
        cin >> x >> y;
        --x, --y;
        graph[x].emplace_back(y);
        graph[y].emplace_back(x);
    }

    vector<int> dp(n);
    auto dfs = [&](auto&& self, int from = 0, int par = -1) -> int {
        int res = 1;
        for(int to : graph[from]){
            if(to == par)   continue;
            res = (ll)res * (self(self, to, from) + 1) % m;
        }
        return dp[from] = res;
    };
    dfs(dfs);

    vector<int> dp2(n);
    dp2[0] = dp[0];
    vector<vector<int>> prefix(n);  // 順方向の累積積
    vector<vector<int>> suffix(n);  // 逆方向の累積積
    auto ReRooting = [&](auto&& self, int from = 0, int par = -1) -> void {
        int cur = prefix[from].size();
        for(int to : graph[from]){
            if(to == par)   continue;
            prefix[from].emplace_back(dp[to] + 1);
        }
        int sz = prefix[from].size();
        suffix[from] = prefix[from];
        for(int i = 0; i < sz; ++i){
            prefix[from][i + 1] = (ll)prefix[from][i + 1] * prefix[from][i] % m;
        }
        for(int i = sz - 1; i > 0; --i){
            suffix[from][i - 1] = (ll)suffix[from][i - 1] * suffix[from][i] % m;
        }
        
        for(int i = 0; i < (int)graph[from].size(); ++i){
            int to = graph[from][i];
            if(to == par)   continue;
            int res = 1;
            if(cur > 0){
                res = (ll)res * prefix[from][cur - 1] % m;
            }
            if(cur + 1 < sz){
                res = (ll)res * suffix[from][cur + 1] % m;
            }
            dp2[to] = (ll)dp[to] * (res + 1) % m;
            prefix[to].emplace_back(res + 1);
            ++cur;
            self(self, to, from);
        }
        
        return;
    };
    ReRooting(ReRooting);
    for(int i = 0; i < n; ++i)  cout << dp2[i] << '\n';
}

Measured memory_bytes: 26904
while True :
    a,op,b = input().split()
    a,b = map(int, [a, b])
    if op == "?":
        break
    if op == "+":
        print(a+b)
    elif op == "-":
        print(a-b)
    elif op == "*":
        print(a*b)
    elif op == "/":
        print(a//b)






Measured memory_bytes: 5600
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ x, y ] <- map head . words <$> getLine
	putStrLn $ comp2s $ compare x y

comp2s LT = "<"
comp2s EQ = "="
comp2s GT = ">"


Measured memory_bytes: 380