akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, [graph1; $len:expr]) => {{
        let mut g = vec![vec![]; $len];
        let ab = read_value!($next, [(usize1, usize1)]);
        for (a, b) in ab {
            g[a].push(b);
            g[b].push(a);
        }
        g
    }};
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => (read_value!($next, usize) - 1);
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        read_value!($next, [$t; len])
    }};
    ($next:expr, $t:ty) => ($next().parse::<$t>().expect("Parse error"));
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        n: usize, k: usize,
        p: [usize1; n],
        c: [i64; n],
    }
    const INF: i64 = 1 << 40;
    let mut ma = -INF;
    for i in 0..n {
        let mut len: usize = 1;
        let mut v = p[i];
        let mut sum = c[i];
        let mut acc = vec![c[i]];
        while v != i {
            sum += c[v];
            acc.push(sum);
            v = p[v];
            len += 1;
        }
        let q = (k / len) as i64;
        for j in 0..k % len {
            ma = max(ma, max(0, sum) * q + acc[j]);
        }
        if q > 0 {
            for j in k % len..len {
                ma = max(ma, max(0, sum) * (q - 1) + acc[j]);
            }
        }
    }
    puts!("{}\n", ma);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 2416
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

int dp[60][2510];

signed main(){
	int N, A;
	cin >> N >> A;
	vector<int> x(N);
	for(int i = 0; i < N; ++i) {
		cin >> x[i];
	}
	dp[0][0] = 1;
	for(int i = 0; i < N; ++i) {
		for(int j = N; j > 0; --j) {
			for(int k = 2500; k >= x[i]; --k) {
				dp[j][k] += dp[j-1][k - x[i]];
			}
		}
	}
	int res = 0;
	for(int i = 1; i <= N; ++i) {
		res += dp[i][A * i];
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>
 
int main() {
 
  int n,m,i,j;
  int a,b;
  int A[100][100] = {0};
  int B[100] = {0};
  int c[100] = {0};
 
  scanf("%d %d " ,&n,&m);
 
  for(j=0; j<n; j++) {
  for(i=0; i < m; i++) {
    scanf("%d",&a);
    A[j][i] = a;
  }
}
 
  for(j=0; j<m; j++) {
    scanf("%d",&b);
    B[j] = b;
  }
 
  for(j=0;j<n ; j++){ 
  for(i = 0; i<m; i++){
     c[j] = c[j] + A[j][i]*B[i];
    }
  }
 
  for(i=0;i<n;i++) {
    printf("%d\n",c[i]);
  }
  return 0;
}


Measured memory_bytes: 2144
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  int n;
  cin>>n;
  vector<string> s(n);
  map<char,int> mp;
  REP(i,n){
    cin>>s[i];
    map<char,int> temp;
    if(i==0){
      for(char c:s[i]){
        mp[c]++;
      }
    }else{
      for(char c:s[i]){
        temp[c]++;
      }
      for(char c='a';c<='z';c++){
        mp[c]=min(mp[c],temp[c]);
      }
    }
  }
  for(char c='a';c<='z';c++){
    REP(i,mp[c]){
      cout<<c;
    }
  }
  cout<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN
#define INF         100000000000000000
#define PI          3.1415926535897932384626433832795l



#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"


// ll mod = 1000000007;
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)






// struct mycomp {
//     bool operator() (const pair<int,int> &a, const pair<int,int> &b) const{
//         if (a.second-a.first != b.second-b.first)
//         return (a.second-a.first > b.second-b.first);
//         return a.first < b.first;
//     }
// };



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


ll extended_gcd(ll a, ll b, ll& x, ll& y)
{
	if(b==0)
	{
		x=1;
		y=0;
		return a;
	}
	ll x1, y1;
	ll d = extended_gcd(b, a%b, x1, y1);
	x=y1;
	y=x1-y1*(a/b);
	return d;
}

////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}	
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}

////////////////////BINARY EXPONENTIATION///////////////////////
ll bin_exp(ll a, ll b, ll mod)
{
	ll ans = 1;
	while(b)
	{
		if(b%2)
		{
			b--;
			ans = (ans%mod*a%mod)%mod;
		}
		b/=2;
		a = (a%mod*a%mod)%mod;
	}
	return ans;
}


///////////////////////////BFS//////////////////////////////////
void bfs(vector<int>& distance, vector<int> a[], vector<bool>& visited, int u, vector<int>& parent)
{
	visited[u]=true;
	parent[u]=-1;
	distance[u]=0;
	queue<int> q;

	q.push(u); 
    while (!q.empty()) { 
  
        int f = q.front(); 
        q.pop(); 
  		for(int i =0; i < a[f].size(); i++)
  		{
  			if(visited[a[f][i]]==false)
  			{
  				distance[a[f][i]]=distance[f]+1;
  				parent[a[f][i]]=f;
  				visited[a[f][i]]=true;
  				q.push(a[f][i]);
  			}
  		}
    } 

}

void solve()
{

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

	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	
	// int n;
	// cin>>n;
	string s;
	cin>>s;
	for(int i = 0; i < s.size(); i++)
	{
		if(s[i]==',')
		{
			cout<<" ";
		}
		else cout<<s[i];
	}
	

	return 0;
}	

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	string s;
	cin>>s;
	if((s[0]==s[1]&&s[1]==s[2])||(s[1]==s[2]&&s[2]==s[3]))cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
    return 0;
}

Measured memory_bytes: 764
s = input().split() #s_1 s_2を分割して取得し、sに値を入れる

a = int(s[0])
b = int(s[1])
m = 2019

while b-a >= 2019*2:
    b-=2019

for i in range(a,b+1):
    for j in range(i+1,b+1):
        m = min((i*j)%2019 ,m)
        if m == 0: 
            break
    if m == 0:
        break

print(m)



Measured memory_bytes: 3064
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		String n = scan.next();
		long a = 0;
		
		for(int i=0;i<n.length();i++) {
			a += n.charAt(i)-48;
		}
		
		if(a%9 == 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
		
		
	}
	
	
	public static int gcd(int x,int y) {
		if(x%y == 0) {
			return y;
		}else {
			return gcd(y,x%y);
		}
	}
}
 







Measured memory_bytes: 40188
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int v = sc.nextInt();
		int b = sc.nextInt();
		int w = sc.nextInt();
		int t = sc.nextInt();
		sc.close();

		int d = Math.abs(a - b);
		if ((long) (v - w) * t >= d) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 35540
s = list(input())
q = int(input())

rev = False
head = []
tail = []

for i in range(q):
    query = input()
    if query == "1":
        rev = not rev
    else:
        _, f, c = query.split()
        if (not rev and f == "1") or (rev and f == "2"):
            head.append(c)
        else:
            tail.append(c)

if not rev:
    res = head[::-1] + s + tail
else:
    res = tail[::-1] + s[::-1] + head

print(*res, sep="")


Measured memory_bytes: 14048
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n, k;
  cin >> n >> k;
  int best = (n - 1) * (n - 2) / 2;
  if (k > best) {
    cout << -1 << endl;
    return 0;
  }
  int rem = best - k;
  vector<ii> ret;
  for (int i = 1; i < n; ++i) {
    ret.emplace_back(1, i + 1);
  }
  for (int i = 1; i < n && rem; ++i) {
    for (int j = i + 1; j < n && rem; ++j) {
      ret.emplace_back(i + 1, j + 1);
      --rem;
    }
  }
  cout << ret.size() << endl;
  for (auto& it : ret) {
    cout << it.first << " " << it.second << endl;
  }
  return 0;
}


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

int main() {
  string s;
  int k;
  cin>>k>>s;
  int n=s.size();
  if(n<=k) cout<<s<<endl;
  else{
    for(int i=0;i<k;i++){
      cout<<s[i];
    }
    cout<<"..."<<endl;
  }
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define LL long long  
using namespace std;
const int MAXN = 20001, base = 20009;
inline int read() {
	char c = getchar(); int x = 0, f = 1;
	while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * f;
}
int N, a[MAXN], b[MAXN];
int main() {
	N = read();
	for(int i = 1; i <= N; i++) a[i] = base * i;
	for(int i = 1; i <= N; i++) b[i] = base * (N - i + 1);
	for(int i = 1; i <= N; i++) {
		int x = read();
		a[x] -= (N - i + 1);
	}
	for(int i = 1; i <= N; i++) printf("%d ", a[i]); puts("");
	for(int i = 1; i <= N; i++) printf("%d ", b[i]);
	return 0;
}
/*
1
2 21
*/


Measured memory_bytes: 768
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int a, b;
long long int ans;

int main() {
	ios::sync_with_stdio(false);
	cin >> a >> b;
	if (a % 3 == 0 || b % 3 == 0) {
		cout << "0\n";
		return 0;
	}
	ans = min(a, b);
	for (int i = 1; i < a; i++) {
		if (b*i >= (a - i)*((b + 1) / 2))ans = min(ans, b*i - (a - i)*(b / 2));
		else if (b*i <= (a - i)*(b / 2))ans = min(ans, (a - i)*((b + 1) / 2) - b*i);
		else ans = min(ans, (a - i)*((b + 1) / 2) - (a - i)*(b / 2));
	}
	for (int i = 1; i < b; i++) {
		if (a*i >= (b - i)*((a + 1) / 2))ans = min(ans, a*i - (b - i)*(a / 2));
		else if (a*i <= (b - i)*(a / 2))ans = min(ans, (b - i)*((a + 1) / 2) - a*i);
		else ans = min(ans, (b - i)*((a + 1) / 2) - (b - i)*(a / 2));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
hp_a,at_a, hp_b, at_b = list(map(int, input().split()))
while True:
  hp_b = hp_b - at_a
  if hp_b <= 0:
    print("Yes")
    exit()
  hp_a = hp_a - at_b
  if hp_a <= 0:
    print("No")
    exit()


Measured memory_bytes: 9076
/*#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <array>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
*/
 
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
 
typedef long long ll;
const ll INF = LLONG_MAX - 100;
const ll mod = 1e9 + 7;
const int MAX_N = 5e5 + 5;
int dx[] = { -1LL,0,1LL,0 }, dy[] = { 0,1LL,0,-1LL };
vector<ll> prime;
 
ll inv[MAX_N], fac[MAX_N];
 
template <class T = ll> T in() { T x; cin >> x; return (x); }
inline ll GCD(ll a, ll b) { ll c; while (b != 0) { c = a % b; a = b; b = c; }return a; }
inline ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
inline ll POW(ll a, ll b) { ll c = 1LL; while (b > 0) { if (b & 1LL) { c = a * c%mod; }a = a * a%mod; b >>= 1LL; }return c; }
inline void _nCr() { fac[0] = 1LL; for (int i = 1LL; i < MAX_N; i++) { fac[i] = fac[i - 1LL] * i%mod; }for (int i = 0; i < MAX_N; i++) { inv[i] = POW(fac[i], mod - 2); } }
inline ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod)*inv[n - r] % mod; }
inline void PRI(ll n) { bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) { a[i] = 1LL; }for (int i = 2; i < n + 1LL; i++) { if (a[i]) { prime.pb(i); ll b = i; while (b <= n) { a[b] = 0; b += i; } } } }
 
typedef pair<int, pair<int, int>> edge;
 
class UnionFind {
private:
    vector<int> par;
public:
    vector<int> hen;
    UnionFind(int N) { par = vector<int>(N, -1LL); hen = vector<int>(N,0);}
    int find(int x);
    ll size(int x);
    void unite(int x, int y);
    bool same(int x, int y);
};

 
 
 
//----UnionFind-------------------------------
int UnionFind::find(int x) {
    if (par[x] < 0) return x;
    else return par[x] = find(par[x]);
}
 
ll UnionFind::size(int x) {
    return -par[find(x)];
}
 
void UnionFind::unite(int x, int y) {
    x = find(x);
    y = find(y);
    //大きい方に小さい方をくっ付ける
    if (size(x) < size(y)) swap(x, y);
    if (x == y) hen[x]++;
    else hen[x] += hen[y]+1;
    if (x == y) return;
    par[x] += par[y];
    par[y] = x;
}
 
bool UnionFind::same(int x, int y) {
    x = find(x);
    y = find(y);
    return x == y;
}

int cnt[26];

signed main() {
    int h,w; cin >> h >> w;
    REP (i,h) {
        REP (j,w) {
            char x; cin >> x;
            cnt[x-'a']++;
        }
    }
    int g1,g2,g4;
    g1 = (h%2)*(w%2);
    g2 = (h/2)*(w%2)+(h%2)*(w/2);
    g4 = (h/2)*(w/2);
    REP (i,26) {
    	while (cnt[i] >= 4 && g4 > 0) {
    		cnt[i] -= 4;
    		g4--;
    	}
    	while (cnt[i] >= 2 && g2 > 0) {
    		cnt[i] -= 2;
    		g2--;
    	}
    	while (cnt[i] > 0 && g1 > 0) {
    		cnt[i]--;
    		g1--;
    	}
    }
    bool ok = true;
    REP (i,26) if (cnt[i] != 0) ok = false;
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void run(){
		for(;;){
			int n = sc.nextInt();
			if(n==0){
				break;
			}
			
			int map[] = new int[10];
			
			for(int i =0; i < n; i++)
			{
				map[sc.nextInt()]++;
			}
			
			
			for(int i =0 ; i< 10;i++){
				String ans = "-";
				if(map[i]!=0){
					char[] ch = new char[map[i]];
					Arrays.fill(ch,'*');
					ans = new String(ch);
				}
				System.out.println(ans);
			}
			
		}
		
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 12000
#include<stdio.h>

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a>b){
        for(int i=0;i<a;i++){
            printf("%d",b);
        }
    }else if(a==b){
        for(int i=0;i<a;i++){
            printf("%d",b);
        }
    }else{
        for(int i=0;i<b;i++){
            printf("%d",a);
        }
    }
    return 0;
}

Measured memory_bytes: 128
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
while(true){
   var BR=Arr.shift();
   if(BR=="0 0 0 0 0 0")break;
   var br=BR.split(" ").map(Number);
   var b=br[0];
   var r=br[1];
   var g=br[2];
   var c=br[3];
   var s=br[4];
   var t=br[5];
   var sum=100;
   sum+=b*15;
   sum+=r*15;
   sum+=(b*5+r*3)*15;
   sum+=g*7;
   sum+=c*2;
   sum-=(b*5+r*3)*2;
   sum-=(t-s-(b*5+r*3))*3;
   console.log(sum);
}

Measured memory_bytes: 8964
l = int(input())
a = [int(input()) for _ in range(l)]

dp = [[0]*5 for _ in range(l)]

if a[0] == 0:
    dp[0] = [a[0],2,1,2,a[0]]
elif a[0]%2 == 0:
    dp[0] = [a[0],0,1,0,a[0]]
else:
    dp[0] = [a[0],1,0,1,a[0]]

for i in range(1,l):
    dp[i][0] = dp[i-1][0]+a[i]
    dp[i][2] = min(dp[i-1][0:3])+1-a[i]%2
    dp[i][4] = min(dp[i-1][0:5])+a[i]
    if a[i]!=0:
        dp[i][3] = min(dp[i-1][0:4])+a[i]%2
        dp[i][1] = min(dp[i-1][0], dp[i-1][1])+a[i]%2
    else:
        dp[i][3] = min(dp[i-1][0:4])+2
        dp[i][1] = min(dp[i-1][0], dp[i-1][1])+2

print(min(dp[l-1]))

Measured memory_bytes: 67752
n = int(input())
mlist = []
plist = [2]
for i in range(3,10000):
    count = 0
    for k in plist:
        if (i%k != 0):
            count += 1
        else:
            break
    if (count == len(plist)):
        plist.append(i)
def check(m):
    for p in plist:
        if (m <= p):
            return True
        if m%p == 0:
            return False
    return True
count = 0
for i in range(n):
    m = int(input())
    if check(m):
        count += 1
        
print(count)  


Measured memory_bytes: 5620
def main():
    L, R = map(int, input().split())
    if R - L + 1 >= 2019:
        print(0)
        exit()
    vals = []
    for i in range(L, R):
        for j in range(i+1, R+1):
            vals.append(((i % 2019) * (j % 2019)) % 2019)
    print(min(vals))


if __name__ == '__main__':
    main()


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

int main() {
    string a;
    string b;
    string c;
    
    cin >> a;
    cin >> b;
    cin >> c;
    
    cout << a.at(0);
    cout << b.at(0);
    cout << c.at(0) << endl;
}

Measured memory_bytes: 256
program main

  implicit none
  integer(8) :: a, b !911
  integer(8) :: nl, ns, tmp
 
  read(*,*) a, b
  
  if ( a >= b ) then
    nl = a
    ns = b
  else
    nl = b
    ns = a
  end if
  
  do
    tmp = mod( nl, ns )
    nl = ns
    ns = tmp
    if ( ns == 0 ) exit
  end do
  
  print*, a*b/nl 
   

end program main


Measured memory_bytes: 384
#include<bits/stdc++.h> 
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
ll gcd(ll a,ll b) 
{ 
	if (a == 0) 
		return b; 
	return gcd(b % a, a); 
} 
bool isprime(ll n)
{
    for(ll i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
            return false;
    }
    return true;
}
int main()
{
	ll n;
	cin>>n;
	ll p[n],i,ctr=0;
	for(i=0;i<n;i++)
	{
		cin>>p[i];
	}
	for(i=1;i<n-1;i++)
	{
		if((p[i]>p[i-1]&&p[i]<p[i+1])||(p[i]<p[i-1]&&p[i]>p[i+1]))
		{
			ctr++;
		}
	}
	cout<<ctr;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

int main() {
    int N;
    cin >> N;
    vector<string> S(N);
    string X;

    for(int i=0; i<N; i++) {
        cin >> S[i];
    }

    for(char c = 'a'; c <= 'z'; c++) {
        int n = count(S[0].begin(),S[0].end(), c);
        for(int i=1; i<N; i++) {
            int x = count(S[i].begin(), S[i].end(), c);
            if (x < n) n = x;
        }
        for(int i=0; i<n; i++) X.push_back(c);
    }
    cout << X << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s, t;cin>>s>>t;
    int ans = t.size();
    for(int i = 0; i<=s.size()-t.size(); i++){
        int cnt = 0;
        for(int j =0; j<t.size(); j++){
            if(t[j]!=s[i+j]) cnt++;
        }
        ans = min(cnt, ans);
    }
    cout<<ans;
}


Measured memory_bytes: 3596
def GCD(x, y):
    if x < y:
        return GCD(y, x)
    if y == 0:
        return x
    return GCD(y, x % y)

N = int(input())
A = list(map(int, input().split()))
ans = A[0]
for i in A[1:]:
    ans = GCD(ans, i)
print(ans)

Measured memory_bytes: 62704
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main()
{
        //input->compute->output//
        int A, B, C, D;
        cin >> A >> B >> C >> D;
        if (A + B > C + D)
        {
                cout << "Left" << endl;
        }
        else if (A + B < C + D)
        {
                cout << "Right" << endl;
        }
        else
        {
                cout << "Balanced" << endl;
        }

        

        return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);
    
    int[] a =new int[3];
    int b = scan.nextInt();
        for (int j=0; j<b;j++){
            for (int i=0; i<3; i++){
                a[i]= scan.nextInt();
            }
            Arrays.sort(a);
            if((Math.pow(a[0],2)+ Math.pow(a[1],2)) == (Math.pow(a[2],2))){
                System.out.println("YES");
            }
            else System.out.println("NO");
        }
    }
}

Measured memory_bytes: 33644
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    # x,y = list(map(int, input().split()))
    inf=10**10
    n = int(input())
    ans = -inf
    min_r=inf
    for _ in range(n):
        r=int(input())
        ans=max(ans,r-min_r)
        min_r=min(min_r,r)
    print(ans)

main()



Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std;
#define int long long
int INF = 1e9 +7;
signed main(){
    int a[5],n;
    cin>>n;
   for(int i=0;i<5;i++)cin>>a[i];
    sort(a,a+5);
    cout<<5+(n-1)/a[0];
   


    
   return 0;
}

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

using namespace std;

char dp1[1000001],dp2[1000001];

int main(){
    int t[181];
    
    for(int i = 1;i <= 180;++i)
        t[i] = i * (i + 1) * (i + 2) / 6;
    
    dp1[0] = dp2[0] = 0;
    
    for(int i = 1;i <= 1000000;++i)
        dp1[i] = dp2[i] = 40;
    
    for(int i = 1;i <= 180;++i){
        int x = t[i];
        
        for(int j = x;j <= 1000000;++j)
            if(1 + dp1[j - x] < dp1[j]) dp1[j] = 1 + dp1[j - x];
    }
    
    for(int i = 1;i <= 180;++i){
        int x = t[i];
        
        if(x & 1)
            for(int j = x;j <= 1000000;++j)
                if(1 + dp2[j - x] < dp2[j]) dp2[j] = 1 + dp2[j - x];
    }
    
    int n;
    
    while(true){
        scanf("%d",&n);
        
        if(n == 0) break;
        
        printf("%d %d\n",dp1[n],dp2[n]);
    }
    
    return 0;
}

Measured memory_bytes: 2588
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
#define INF 100000000
#define IINF 9999999999999;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

bool earth[51][51];
ofstream outputfile("output.txt");
int depth = 0;
int inputw, inputh;

void erase_island(int h, int w) {
    //++depth;
    //outputfile << depth << endl;
    earth[h][w] = false;
    if(h != 0 && w != 0) {
        if (earth[h - 1][w - 1]) erase_island(h - 1, w - 1);
    }
    if(h != 0 && w != inputw - 1) {
        if (earth[h - 1][w]) erase_island(h - 1, w);
    }
    if(h != 0) {
        if(earth[h - 1][w + 1]) erase_island(h - 1, w + 1);
    }
    if(w != 0 && h != inputh - 1) {
        if(earth[h + 1][w - 1]) erase_island(h + 1, w - 1);
    }
    if(w != 0) {
        if(earth[h][w - 1]) erase_island(h, w - 1);
    }
    if(h != inputh - 1 && w != inputw - 1) {
        if(earth[h + 1][w + 1]) erase_island(h + 1, w + 1);
    }
    if(h != inputh - 1) {
        if(earth[h + 1][w]) erase_island(h + 1, w);
    }
    if(w != inputw - 1) {
        if(earth[h][w + 1]) erase_island(h, w + 1);
    }
    //cout << "# " << h << " " << w << endl;
    depth = 0;
}

int main() {
    while(cin >> inputw >> inputh, inputw + inputh) {
        int temp;
        rep(i, inputh) {
            rep(j, inputw) {
                cin >> temp;
                if(temp == 0) earth[i][j] = false;
                else earth[i][j] = true;
            }
        }

        int ans = 0;
        rep(i, inputh) {
            rep(j, inputw) {
                if(earth[i][j]) {
                    erase_island(i, j);
                    ++ans;
                }
            }
        }

        cout << ans << endl;
    }

    return 0;
}


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


int main(){
    int N,count;
    cin >> N;
    count=0;
    for (int i = 1; i <= N; i++)
    {
        if(i>=1 && 9>=i){
            count++;
        }
        else if(i>=100 && 999>=i){
            count++;
        }    
        else if(i>=10000 && 99999>=i){
            count++;
        }            
    }
    cout << count << endl;
    

}

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

using namespace std;

int main(){
    string s;
    int zero_count;
    int one_count;
    int ans;
    cin >> s;
    int n = s.size();
    zero_count = count(s.begin(), s.end(), '0');
    one_count  = count(s.begin(), s.end(), '1');
    ans = min(zero_count, one_count);
    cout << ans * 2 << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
using namespace std;
struct Queue{
    vector<int> time;//timeを記憶する配列
    vector<int> idx;//nameとtimeを一致させるための配列
    void push(Queue &q){
        int len=q.time.size();
        if(q.time.size()==len){
            int tmp1=q.time[0];
            int tmp2=q.idx[0];
            for(int i=0;i<len-1;i++){
                q.time[i]=q.time[i+1];
                q.idx[i]=q.idx[i+1];
            }
            q.time[len-1]=tmp1;
            q.idx[len-1]=tmp2;
        }
    }
    void popnum(Queue &q,int num){//配列の添え字がnumの値を配列から削除
        q.time.erase(q.time.begin()+num);
        q.idx.erase(q.idx.begin()+num);
        // cout<<"length:"<<q.time.size()<<"\n";
    }
};

int main(){
    Queue queue;
    vector<string> name;
    int n;
    cin>>n;
    int q;
    cin>>q;
    int sum=0;
    for(int i=0;i<n;i++){
        string str;
        int t;
        cin>>str;
        cin>>t;
        queue.time.push_back(t);
        queue.idx.push_back(i);
        name.push_back(str);
    }
    // for(int i=0;i<queue.time.size();i++){
    //     cout<<queue.time[i]<<" ";
    // }
    // cout<<"\n";
    // for(int i=0;i<queue.time.size();i++){
    //     cout<<queue.idx[i]<<" ";
    // }
    // cout<<"\n";
    // for(int i=0;i<queue.time.size();i++){
    //     cout<<name[i]<<" ";
    // }
    // cout<<"\n";
    while(queue.time.size()>0){
        int t=queue.time[0];
        int num=queue.idx[0];
        // cout<<"t:"<<t<<" num:"<<num<<"\n";
        if(t<=q){
            sum+=t;
            cout<<name[num]<<" "<<sum<<"\n";
            queue.popnum(queue,0);
            // queue.popnum(queue,num);
        }else{
            sum+=q;
            queue.time[0]-=q;
            queue.push(queue);
            // queue.push(queue);
        }
    }
}


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

using namespace std;

long long hmtd(long long a, long long b){
    int ans=0;
    while(true) {
        if(a%b==0){a=a/b;++ans;}
        else break;
    }
    return ans;
}

int main() {
    int n;
    long long ans=0;
    cin>>n;
    for (int i = 0; i < n; ++i) {
        long long a;
        cin>>a;
        ans+=hmtd(a,2);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
//  ROAD TO GREEN
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <iomanip>

using namespace std;
typedef long long ll;
const ll MAXN = 1e5;
vector<bool> used(MAXN,false);

int cnt[1000];

int main(){
    int n; cin >> n;
    vector<int> v(n+2,0);
    int sum = 0;
    for(int i = 1; i <= n-1; i++){
        int x; cin >> x;
        v[i] = x;
    }
    sum += (v[1]+v[n-1]);
    for(int i = 1; i <= n-2; i++){
        sum += min(v[i],v[i+1]);
    }
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 256
fn main() {
    let _n = read::<usize>();
    let ts = read_vec::<u32>();
    let m = read::<u32>();
    let pxs = read_vec2::<usize>(m);

    let tssum = ts.iter().sum::<u32>();
    for px in pxs {
        println!("{}", tssum - ts[px[0] - 1] + px[1] as u32);
    }
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N = I()
a = LI()

s,t = 0,0
for i in range(N):
    if a[i] % 4 == 0:
        s += 1
    elif a[i] % 2 == 0:
        t += 1

if s >= N//2 or t >= N-2*s:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 86340
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

template<class T>
bool UpdateMax(T &a, const T &b){
  if(a<b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template<class T>
bool UpdateMin(T &a, const T &b){
  if(a>b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  lint x;
  cin>>x;
  lint money=100;
  for(int i=0;i<=INT32_MAX;i++){
    money+=floor((double)money*0.01);
    if(x<=money){
      cout<<i+1<<endl;
      return 0;
    }
  }


  return 0;
}




Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>
#include<list>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
typedef long long ll;

int main() {
	int n;
	cin >> n;
	int a[100], c = 0;
	REP(i, n) {
		cin >> a[i];
		if (a[i] >= 3200) c++;
	}
	bool f[8] = {};
	REP(i, n) {
		REP(j, 8) {
			if (f[j]) continue;
			if (400 * j <= a[i] && a[i] < 400 * (j + 1)) f[j] = true;
		}
	}
	int k = count(f, f + 8, true);
	if (n == c) {
		cout << 1 << " " << c << endl;
	}
	else {
		cout << k << " " << k + c << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define P pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
int n,ans=0;
string s;
signed main(){
    cin>>n>>s;
    for(int i=0;i<1000;i++){
        char a='0'+(i/100),b='0'+((i/10)%10),c='0'+(i%10);
        bool x=false,y=false,z=false;
        rep(j,n){
            if(!x&&s[j]==a)x=true;
            else if(x&&!y&&s[j]==b)y=true;
            else if(x&&y&&!z&&s[j]==c)z=true;
        }
        if(z)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int x;
	int y;
	int temp;

	while(1){
		scanf("%d %d", &x, &y);
		if(x == 0 && y == 0){
			break;
		}
		if(y < x){
			temp = x;
			x = y;
			y = temp;
		}
		printf("%d %d\n", x, y);
	}
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
using namespace std;
int main()
{
    int n, k, h, ans = 0;
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        scanf("%d", &h);
        if(h >= k) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;

#define MAX 1400

int dp[MAX][MAX], C[MAX][MAX];

int getLargestSquare(int H, int W)
{
  int maxWidth = 0;
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      dp[i][j] = (C[i][j] + 1) % 2;
      maxWidth |= dp[i][j];
    }
  }

  for (int i = 1; i < H; i++)
  {
    for (int j = 1; j < W; j++)
    {
      if (C[i][j] == 1)
      {
        dp[i][j] = 0;
      }
      else
      {
        dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
        maxWidth = max(maxWidth, dp[i][j]);
      }
    }
  }

  return maxWidth * maxWidth;
}

int main()
{
  int H, W;
  scanf("%d %d", &H, &W);

  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      scanf("%d", &C[i][j]);
    }
  }

  printf("%d\n", getLargestSquare(H, W));

  return 0;
}


Measured memory_bytes: 17992
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include<vector>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef pair<int, int> P;

const int INF = -1;
int N, M, S, T;
int main() {

	cin >> N >> M;
	vector<vector<int> >graph(N);
	rep(i, M) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		graph[u].push_back(v);
	}
	cin >> S >> T;
	S--; T--;

	int dist[100000][3];
	rep(i, N) rep(j, 3) dist[i][j] = INF;
	queue<P> que;
	que.push(P(S, 0));
	dist[S][0] = 0;
	while (que.size()) {
		int now = que.front().first;
		int step = que.front().second;
		que.pop();
		for (int to : graph[now]) {
			int next_step = (step + 1) % 3;
			if (dist[to][next_step] != INF) continue;
			que.push(P(to, next_step));
			dist[to][next_step] = dist[now][step] + 1;
		}
	}

	int ans = dist[T][0];
	if (ans != INF) ans /= 3;
	cout << ans << endl;
}

Measured memory_bytes: 6912
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;

#define rep(i,n)  for(int i = 0; i < (int)(n);    i++)
#define sz(x)     ((int)(x).size())
#define all(x)    (x).begin(),(x).end()

using ll = long long;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  std::string S; std::cin >> S;
  std::cout << S.substr(0,3) << std::endl;
  return 0;
}



Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Linq;

class Program{

  static char[] s;
  static int ans = 0;
  static int cnt = 0;

  static int Main() {

    string nyu = Console.ReadLine();
    // ここまで入力

    s = nyu.ToCharArray();

    for (int i = 0; i < s.Length; i++) {
      if (s[i] == 'A' || s[i] == 'T' || s[i] == 'C' |s[i] == 'G') {
        cnt++;
        if (ans < cnt) {
          ans = cnt;
        }
      } else {
        cnt = 0;
      }
    }

    Console.WriteLine("{0}", ans);

    return 0;
  }

}


Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] divisorList = new int[N];
        int mod = (int) (Math.pow(10, 9) + 7);
        long result = 1;
        for (int i = N; i >= 2; i--) {
            calcNumOfDivisor(i, divisorList);
        }
        for (int i = 0; i < divisorList.length; i++) {
            result = result * (divisorList[i] + 1) % mod;
        }

        System.out.println(result);
    }
    public static void calcNumOfDivisor(int num, int[]divisorList) {
        for (int i = 2; i <= num; i++) {
            while (num % i == 0) {
                divisorList[i - 1]++;
                num /= i;
            }
        }
    }
}

Measured memory_bytes: 21844
# C
N=int(input())
ans=0
A=[[] for _ in range(N)]
for i in range(N):
    a=int(input())
    for j in range(a):
        A[i].append(tuple(int(i) for i in input().split()))
for i in range(2**N):
    flag=True
    tmp=0
    S=bin(i)[2:][::-1]
    TF=list(S)+['0' for _ in range(N-len(S))]
    # print(TF)
    for j,s in enumerate(list(S)):
        if s=='1':
            tmp+=1
            for x,y in A[j]:
                if TF[x-1]!=str(y):
                    # print(x,y)
                    flag=False
    if flag:
        ans=max(ans,tmp)
print(ans)

Measured memory_bytes: 3064
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
 
#include<bits/stdc++.h>
 
using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0); 
#define nl "\n"
#define sz(a) (int)(a).size() 
#define all(a) (a).begin(),(a).end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;  
#define mt make_tuple 
#define vec vector
 
#define int long long 
 
const int mod = (int) 1e9 + 7 ;
const int MOD = (int) 998244353 ;
const int INF = (int) 1e18 ;
 
typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;
 
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
 
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

const int N = 1e3 + 5;
int dp[N][N];
char a[N][N] ;

void solve(int test) {
	int h,w; cin >> h >> w;
	rep(i,1,h+1) rep(j,1,w+1) cin >> a[i][j] ;



	rep(i,1,h+1) {
		rep(j,1,w+1) {
			if(a[i][j] == '.') dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % mod ;
			dp[1][1] = 1 ; 
		}
	}

	cout << dp[h][w] ;
}
 
int32_t main() {


    fast;
	int t=1;
	// cin>>t;
	rep(i,1,t+1) {
		solve(i) ;
	}
 
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

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

int main() {
  int a,b,c,d,e,time;
  vector<int> vec(5);
  cin >> a >> b >> c >> d >> e;
  time = (a / 10 + b / 10 + c / 10 + d / 10 + e / 10) * 10;
  vec.at(0) = a % 10;
  vec.at(1) = b % 10;
  vec.at(2) = c % 10;
  vec.at(3) = d % 10;
  vec.at(4) = e % 10;
  sort(vec.begin(), vec.end());
    for (int j = 1; j < 5 && vec.at(0) == 0; j++)
      swap (vec.at(0),vec.at(j));
  for(int i = 1; i < 5; i++){
    if(vec.at(i) != 0)
      time += 10;
  }
  cout << time + vec.at(0) << endl;
}

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

void countDivisibles(int A, int B, int M)
{
    bool check=false;

    for (int i = A; i <= B; i++){
        if (i % M == 0)
            check=true;
    }
    if(check)
        cout<<"OK"<<endl;
    else{
        cout<<"NG"<<endl;
    }
}
int main()
{
    int A,B,M;
  cin>>M;
  cin>>A>>B;
 countDivisibles(A, B, M);



    return 0;
}


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

int main()
{
	int n, l, sumaTotal=0, sumaParcial=100000;
	cin>>n>>l;
	int array[n+1];
	for (int i=1; i<=n; i++)
	{
		array[i]=l+i-1;
		sumaTotal+=array[i];
		sumaParcial=min( abs(array[i]) , abs(sumaParcial));
	}
	if ((sumaTotal<0)and(sumaParcial>0))
	{
		cout<<sumaTotal+sumaParcial;	
	}
	else
	{
		cout<<sumaTotal-sumaParcial;	
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
  #include "_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

signed main(){

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

  auto f = [&](double x){
    int cnt = 0;
    for(int i = 0; i < n; i++){
      if(a[i] % (int)(x+0.5) == 0) cnt += a[i] / (int)(x+0.5) - 1;
      else cnt += a[i] / (int)(x+0.5);
    }
    return cnt;
  };
  
  int ans = INF;
  double left = 1, right = 1e9;
  while(right - left > 1e-2){
    double mid = (left + right) / 2;
    int cnt = f(mid);
    (cnt <= k ? right : left) = mid;
    if(cnt <= k) ans = min(ans, (int)(mid+0.5));
  }
  if(ans == INF) ans = 1;
  cout << ans << endl;

  return 0;
}

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

int main(void){
   string s;
   cin>>s;
   for(int i=0;i<s.size();i++){
      if(s[i]=='9'){
         cout<<"Yes"<<endl;
         return 0;
      }
   }
   cout<<"No"<<endl;
   return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  string S;
  cin >> S;
  if (S == "ABC") {
    cout << "ARC" << "\n";
  }
  else {
    cout << "ABC" << "\n";
  }
}


Measured memory_bytes: 3592
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
        self._size = [1] * (n+1)

    # return root of x
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 木の併合、入力は併合したい各ノード
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        self._size[x] = self._size[y] = self._size[x] + self._size[y]
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return self._size[self.find(x)]
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
p = []
for _ in range(m):
    p.append(list(map(int, input().split())))

u = UnionFind(n)
ans = []
for pp in p[::-1]:
    a = pp[0]
    b = pp[1]
    if u.find(a) != u.find(b):
        ans.append(u.size(a) * u.size(b))
        u.unite(a,b)
    else:
        ans.append(0)
tmp = 0
for aa in ans[::-1]:
    tmp += aa
    print(tmp)

Measured memory_bytes: 109916
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

a = [(x, y) for x in range(-1, 2) for y in range(-1, 2) if not (x == 0 and y == 0)]
def dfs(g, i, j):
    g[i][j] = 0
    for dx, dy in a:
        nx = i + dx
        ny = j + dy
        if 0 <= nx < h and 0 <= ny < w and g[nx][ny] == 1:
            dfs(g, nx, ny)

while True:
    w, h = na()
    if w == 0 and h == 0:
        break
    g = [na() for _ in range(h)]
    #seen = [[False] * w for _ in range(h)]
    ans = 0
    for i in range(h):
        for j in range(w):
            if g[i][j] == 1:
                dfs(g, i, j)
                ans += 1
    print(ans)




Measured memory_bytes: 11268