akhauriyash/Code-Regression huggingface dataset:
package main

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

func exec(stdin *Stdin, stdout *Stdout) {
	t1 := stdin.ReadInt()
	t2 := stdin.ReadInt()
	a1 := stdin.ReadInt()
	a2 := stdin.ReadInt()
	b1 := stdin.ReadInt()
	b2 := stdin.ReadInt()

	v1 := a1 - b1
	v2 := a2 - b2

	if (v1 > 0 && v2 > 0) || (v1 < 0 && v2 < 0) {
		stdout.Println(0)
		return
	}
	if v1*t1+v2*t2 == 0 {
		stdout.Println("infinity")
		return
	}

	w1 := v1 * t1
	w2 := v1*t1 + v2*t2
	if (w1 > 0 && w2 > 0) || (w1 < 0 && w2 < 0) {
		stdout.Println(0)
		return
	}

	s := Abs(w1) / Abs(w2)
	t := Abs(w1) % Abs(w2)
	if t == 0 {
		stdout.Println(s * 2)
	} else {
		stdout.Println(s*2 + 1)
	}
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), int(math.MaxInt32))
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

func Abs(x int) int {
	if x > 0 {
		return x
	} else {
		return x * -1
	}
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

typedef pair<int,int> P;
typedef long long ll;

const int INF = 1e9;


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

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

	bool isSecond = false;
	int ans=0;
	for(int i=0;i<n;i++){
		if(p[i] == i+1) {
			if(!isSecond){
				ans++;
				isSecond=true;
			}
			else isSecond=false;
		}
		else if(isSecond) isSecond = false;
	}
	cout << ans << "\n";
				
	return 0;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;
const ll 	N 		= 	2*1e6;

vpll adj[MAXN];ll visit[MAXN]={};

// <------------- Declare Variables Here ------------> //

ll T=1;
ll n,x,y,m;
string s,t;
vll a;
// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	for(ll i=0;i<n;i++) {
		cin>>m;
		for(ll j=0;j<m;j++) {
			cin>>x>>y;
			x--;
			adj[i].pb({x,y});
		}
	}

	ll maxi = 0;
	for(ll k=1;k<pow(2,n);k++) {
		bool mark = true;
		for(ll i=0;i<n;i++) {
			if((k & (1<<i))) {
				for(ll j=0;j<adj[i].size();j++) {
					if(adj[i][j].s == 1) {
						if((k & (1<<adj[i][j].f)) == 0) 
							mark = false;
					}
					else {
						if((k & (1<<adj[i][j].f))) 
							mark = false;	
					}

					if(mark == false) break; 
				}
			}
			if(mark == false) break;
		}
		if(mark) {
			maxi = max(maxi,(ll) __builtin_popcount(k));
		}
	}
	cout<<maxi;newl;
}

int main() {
	fastio;randomINT;
	//cin>>T;
	while(T--) {
		MAIN();
	}
	return 0;
}



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


#define ll long long
#define ld long double
#define ull unsigned long long
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long ,long long>
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x,0,sizeof(x))
#define mod 1000000007LL
#define INF 1000000000007


 
//     long long power(long long x, long long y, long long p) 
// { 
//     long long res = 1;      
  
//     x = x % p;  
  
//     while (y > 0) 
//     { 
      
//         if (y & 1) 
//             res = (res*x) % p; 

//         y = y>>1; 
//         x = (x*x) % p; 
//     } 
//     return res; 
// } 
  

// long long modInverse(long long n, long long p) 
// { 
//     return power(n, p-2, p); 
// }  

// long long ncrp(long long n, long long r, long long p) 
// { 
   
//    if (r==0) 
//       return 1; 
  
    
//     long long fac[n+1]; 
//     fac[0] = 1; 
//     // for (long long i=1 ; i<=n; i++) 
//     //     fac[i] = fac[i-1]*i%p; 
  
//     return (fac[n]* modInverse(fac[r], p) % p * 
//             modInverse(fac[n-r], p) % p) % p; 
// }




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


   if (fopen("input.txt", "r")) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }

   ll h,w;
   cin>>h>>w;

   vector <char> v[h];

   vll dp[h];

   ll i,j;
   
   for(i=0;i<h;i++)
   {
     
    //  v[i].pb(s);

    for(j=0;j<w;j++)
    {
      char c;
      cin>>c;
      v[i].pb(c);
    }

   

     
   }

   for(i=0;i<h;i++)
   {
     for(j=0;j<w;j++)
     {
       dp[i].pb(0);
     }
   }


   if(v[0][0]=='.')
   {
     dp[0][0]=1;
   }


   for(i=0;i<h;i++)
   {
     for(j=0;j<w;j++)
     {
       if(i==0&&j==0)
       {
         continue;
       }
       else if(i==0)
       {
         if(v[i][j]=='.')
         {
         dp[i][j]=dp[i][j-1]%mod;
         }
       }
       else if(j==0)
       {
          if(v[i][j]=='.')
         {
         dp[i][j]=(dp[i-1][j])%mod;
         }
      
       }
       else {
         if(v[i][j]=='.')
         {
           dp[i][j]=(dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
         }
       }
     }

   }

   cout<<dp[h-1][w-1]%mod<<endl;





   


 
   


  

    return 0;
}

Measured memory_bytes: 9344
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000

using vi = vector<int>;


int main() {

	int a, b;

	cin >> a >> b;

	cout << (b%a ==0?a+b:b-a) << endl;

	return 0;
}

Measured memory_bytes: 256
//! Framework <https://github.com/vain0x/procon>

#![allow(non_snake_case)]
#![allow(unused_imports)]

use std::{cmp::Reverse, collections::*};

pub struct Scan(Box<dyn Iterator<Item = &'static str>>); // '

impl Scan {
    fn new() -> Self {
        let mut buf = String::new();
        let read_line = move || {
            std::io::stdin().read_line(&mut buf).unwrap();
            Box::leak(buf.split_off(0).into_boxed_str()).split_whitespace()
        };
        Scan(Box::new(std::iter::repeat_with(read_line).flatten()))
    }

    pub fn word<T: std::str::FromStr>(&mut self) -> T {
        self.0.next().unwrap().parse().ok().unwrap()
    }

    pub fn list<T: std::str::FromStr>(&mut self, len: usize) -> Vec<T> {
        std::iter::repeat_with(|| self.word()).take(len).collect()
    }
}

fn main() {
    let mut scan = Scan::new();

    let T = scan.word::<usize>();

    for _ in 0..T {
        let N = scan.word::<i64>();
        let A = scan.word::<i64>();
        let B = scan.word::<i64>();
        let C = scan.word::<i64>();
        let D = scan.word::<i64>();

        let mut q = BinaryHeap::new();
        let mut dist = HashMap::new();

        q.push((Reverse(0), N));
        dist.insert(N, 0);

        let mut update = |cost, v, q: &mut BinaryHeap<_>| {
            if let Some(&old_cost) = dist.get(&v) {
                if old_cost <= cost {
                    return;
                }
            }

            dist.insert(v, cost);
            q.push((Reverse(cost), v));
        };

        while let Some((Reverse(cost), u)) = q.pop() {
            if u >= 1 {
                if let Some(cost) = u.checked_mul(D).and_then(|n| n.checked_add(cost)) {
                    update(cost, 0, &mut q);
                }
            }

            if u >= 2 {
                update(cost + (u % 2) * D + A, u / 2, &mut q);
                update(cost + (2 - u % 2) * D + A, u / 2 + 1, &mut q);
            }

            if u >= 3 {
                update(cost + (u % 3) * D + B, u / 3, &mut q);
                update(cost + (3 - u % 3) * D + B, u / 3 + 1, &mut q);
            }

            if u >= 5 {
                update(cost + (u % 5) * D + C, u / 5, &mut q);
                update(cost + (5 - u % 5) * D + C, u / 5 + 1, &mut q);
            }
        }

        println!("{}", dist[&0]);
    }
}


Measured memory_bytes: 3108
#include <stdio.h>

int main(void)
{
	int a;
	int b;
	int sum;
	int i;
	
	while (scanf("%d %d", &a, &b) != EOF){
		
		if (a < 0 || b < 0) break;
		sum = a + b;
		
		for (i = 0; sum != 0; i++){
			sum /= 10;
		}
		
		printf("%d\n", i);
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <iostream>

using namespace std;

int main(){
	int N,M;
  cin>>N;
  cin>>M;
  int *sum;
  sum = new int[M];
  for(int i = 0;i < M;i++){sum[i] = 0;}
  for(int i = 0;i < N;i++){
    int K;
    cin>>K;
    int food;
    for(int j = 0;j < K;j++){
      cin>>food;
      sum[food-1]++;
    }
  }
  int ans = 0;
  for(int i = 0;i < M;i++){
    if(sum[i] == N)ans++;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
import math
n = int(input())
count_p = 1
count_q = 1
p_list = [i+1 for i in range(n)]
q_list = [i+1 for i in range(n)]
p = list(map(int, input().split()))
q = list(map(int, input().split()))
for i in range(n):
    count_p += p_list.index(p[i])*math.factorial(n-i-1)
    p_list.remove(p[i])
    count_q += q_list.index(q[i])*math.factorial(n-i-1)
    q_list.remove(q[i])
print(abs(count_p-count_q))

Measured memory_bytes: 3064
#if 0
date +%Y.%m.%d

题解先咕着。
#endif
#include <cstdio>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

const int maxn = 100005;
int head[maxn], nxt[maxn << 1], to[maxn << 1], hp = 1;
int color[maxn];

inline void add(int u, int v) {
	nxt[++ hp] = head[u];
	head[u] = hp;
	to[hp] = v;
}

bool fuck;
int tot[4];
void dfs(int u, int c) {
	if(c > 3) c -= 3;
	if(color[u] and color[u] != c) return fuck = 1, void();
	if(color[u]) return;

	++ tot[color[u] = c];
	for(int i = head[u]; i; i = nxt[i]) {
		if(i & 1)
			dfs(to[i], c + 2);
		else {
			dfs(to[i], c + 1);
			++ tot[0];
		}
	}
}

inline ll sq(ll x) { return x * x; }

int main() {
	int n = read, m = read;

	for(int i = 1; i <= m; i ++) {
		int u = read, v = read;
		add(u, v);
		add(v, u);
	}

	ll ans = 0;
	for(int i = 1; i <= n; i ++)
		if(!color[i]) {
			fuck = tot[0] = tot[1] = tot[2] = tot[3] = 0;
			dfs(i, 1);
			/* debug("%d %d %d %d %d\n", fuck, tot[0], tot[1], tot[2], tot[3]); */
			if(fuck)
				ans += sq(tot[1] + tot[2] + tot[3]);
			else if(!tot[1] or !tot[2] or !tot[3])
				ans += tot[0];
			else
				ans += 1ll * tot[1] * tot[2] + 1ll * tot[2] * tot[3] + 1ll * tot[3] * tot[1];
		}

	printf("%lld\n", ans);
}


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

using namespace std;

using ll = long long;

const long long MOD = 1e9 + 7;
const int INF = 1e9 + 7;

vector<int> koho;

void dfs(int n, const string& nums, string s) {
    if (n == 0) {
        if (s.size() > 0) koho.push_back(stoi(s));
        return;
    }
    dfs(n - 1, nums, s);
    for (char c : nums) dfs(n - 1, nums, s + c);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<bool> num(10, true);
    for (int i = 0; i < K; ++i) {
        int d;
        cin >> d;
        num[d] = false;
    }
    string nums;
    for (int i = 0; i < 10; ++i) {
        if (num[i]) nums += to_string(i);
    }
    dfs(6, nums, "");
    int ans = 0;
    for (int i : koho) {
        if (i >= N) {
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 5872
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<int> vec;

void solve(){
	int a, b, c, d; cin >> a >> b >> c >> d;
	if (abs(a - c) <= d) {
		cout << "Yes" << endl; return;
	}
	if (abs(a - b) <= d && abs(b - c) <= d) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(6);
	//init();
	solve();
	stop
		return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    int i,x,a,b;
    cin >>x>>a >>b;
    if(b-a>x){
        cout << "dangerous";
    }
    else if(b<=a){
        cout << "delicious";
    }
    else if(b-a<=x){
        cout << "safe";
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
/*
#include <map>
#include <functional>
#include <set>
#include <queue>
#include <cstdio>
#include <cmath>
*/
using namespace std;
typedef long long ll;
//typedef pair<ll, ll> P;

/* Union-find
int par[100010];
int trank[100010];

void init(int n) {
   for (int i=0;i<n;i++) {
      par[i] = i;
      trank[i] = 0;
   }
}
int find(int x) {
   if (par[x] == x) {
      return x;
   } else {
      return par[x] = find(par[x]);
   }
}
void unite(int x, int y) {
   x = find(x);
   y = find(y);
   if (x == y) return;
   if (trank[x] < trank[y]) {
      par[x] = y;
   } else {
      par[y] = x;
      if (trank[x] == trank[y]) trank[x]++;
   }
}
bool same(int x, int y) {
   return find(x) == find(y);
}
*/

int N, K;
vector<int> h;

int main() {
   cin >> N >> K;
   for (int i=0;i<N;i++) {
      int j;
      scanf("%d", &j);
      h.push_back(j);
   }
   sort(h.begin(), h.end());
   int minval = 1000000001;
   /*
   for (int i=0;i<N;i++) {
      cout << h[i] << endl;
   }
   */
   for (int i=K-1;i<N;i++) {
      //cout << h[i] << " - " << h[i-K+1] << endl;
      minval = min(minval, h[i] - h[i-K+1]);
   }
   cout << minval << endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<ll> v(3); cin >> v[0] >> v[1] >> v[2];
    ll ans = (v[0]==v[1] && v[1]==v[2] && v[0]%2==0 ? -1 : 0);
    if(ans==0) {
        vector<ll> d(3,0);
        REP(i,3) {
            while(v[i]%2==0) {
                ++ d[i];
                v[i]/=2;
            }
        }
        ans = *min_element(ALL(d));
        if(d[0]==d[1] && d[1]==d[2] && d[0]>0) ++ans;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
long long GCD(long long a, long long b) {
    if (a % b == 0) return b;
    return GCD(b, a%b);
}
int main() {
    int N; cin >> N;
    long long A[100100];
    for (int i = 0; i < N; ++i) cin >> A[i];
    long long res = A[0];
    for (int i = 1; i < N; ++i) {
        res = GCD(res, A[i]);
    }
    cout << res << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define ll long long
int main(){
  ll N,H;
  cin>>N>>H;
  vector<ll> A(N),B(N);
  rep(i,N) cin>>A[i]>>B[i];
  sort(all(A));
  sort(all(B));
  int ans=0;
  for(int i=N-1;i>=0;i--){
    if(B[i]>=A[N-1]&&H>0){
      H-=B[i];
      ans++;
    }else break;
  }
  if(H>0) ans+=(H+A[N-1]-1)/A[N-1];
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;

# define mp make_pair
# define pb push_back
# define PI acos(-1)
# define ff first 
# define ss second 
# define endl '\n'
# define vt vector
# define all(c) (c).begin(), (c).end()
# define rep(i,a,b) for(int i = a ; i < b ; ++i)

typedef long long ll ; 
typedef long double ld ; 
typedef pair<int,int> pii ; 
typedef pair<ll,ll> pll ;

template<class T> bool umin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool umax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

const int MOD = 1e9+9 ;
const ll inf = 1e18 ;  
const ll mod = 1e9+7 ;  

ll nCr(ll n,ll r){ll t=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){t*=(n-i);t/=(i+1);}return t;}
ll power(ll a, ll n) { ll r=1;while(n){if(n&1)r=(r*a)%MOD;n>>=1;a=(a*a)%MOD;}return r%MOD;}



vt<pii> dir =  {{-1,0} , {1, 0} , {0,-1} , {0,1}} ; 

// ==========Start Here==============

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL) ; 
 		
 	int n ; 
 	cin >> n ; 
 	map<int,int> present ;
 	bool ok = 1 ; 
 	vt<int> a(n) ; 
 	rep(i,0,n) {
 		cin >> a[i] ; 
 		if(present[a[i]]) 
 			ok = 0 ; 
 		present[a[i]]++; 
 	}
 	if(ok) {
 		cout << "YES" ; 
 	} else {
 		cout << "NO" ; 
 	}


	return 0 ; 
}

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

typedef long l;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(t, c) for (auto&& t : c)
#define ALL(c) begin(c), end(c)
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define mp make_pair

const int DX[] = {1, 0, -1, 0, 1, 1, -1, -1}, DY[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

  int a, b;
  cin >> a >> b;
  if (a <= 8 && b <= 8) {
    cout << "Yay!" << endl;
  } else {
    cout << ":(" << endl;
  }

}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<algorithm>
#include<time.h>
#include<string.h>
#include<cstring>
#include<string>
#define ll long long
using namespace std;
const int maxn=1e2+10;
int n,m;
int a[maxn],b[maxn];
int main() {
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		b[i]=a[i];
	}
	sort(b+1,b+1+n);
	int tot=0;
	for(int i=1;i<=n;i++){
		b[i]-=a[i];
		if(b[i])tot++;
	}
	if(tot==2||tot==0){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
	return 0;
}


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

int main() {
  int n,a;
  cin >> n >> a;
  if(n%500<=a)
  cout<< "Yes" <<endl;
  else
  cout<< "No" <<endl;
}

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

void solve(int N, std::vector<int> H)
{
  bool is_increasing = true;
  int highest = H[1]-1;
  for (int i = 1; i < N; i++)
  {
    if(H[i]-H[i-1] < -1 || H[i]<highest)
    {
      is_increasing = false;
      break;
    }

    int current = H[i]-1;
    if(current> highest)
    {
      highest = current;
    }
  }
  if(is_increasing)
  {
    std::cout << "Yes" << std::endl;
  }
  else
  {
    std::cout << "No" << std::endl;
  }
}

int main(void)
{
  int N;
  std::cin >> N;
  std::vector<int> H(N);
  for(auto i0 = 0; i0 < N; ++i0)
  {
    std::cin >> H[i0];
  }
  solve(N,H);
  return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <map>
#include <vector>
#include <cstring>
#include <algorithm>
//

using namespace std;
int a[3];
int main()
{
    scanf("%d%d%d",&a[0],&a[1],&a[2]);
    sort(a,a+3);
    printf("%d",a[1]-a[0]+a[2]-a[1]);
    return 0;
}


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

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

int main() {
  vector<char> A(4);
  rep(i,4) cin >> A.at(i);
  rep(i,4) A.at(i) -= '0';
  int ans = 7 - A.at(0);
  if (ans ==  A.at(1) + A.at(2) + A.at(3)) printf("%d+%d+%d+%d=7", A.at(0), A.at(1), A.at(2), A.at(3));
  else if (ans ==  A.at(1) + A.at(2) - A.at(3)) printf("%d+%d+%d-%d=7", A.at(0), A.at(1), A.at(2), A.at(3));
  else if (ans ==  A.at(1) - A.at(2) + A.at(3)) printf("%d+%d-%d+%d=7", A.at(0), A.at(1), A.at(2), A.at(3));
  else if (ans ==  A.at(1) - A.at(2) - A.at(3)) printf("%d+%d-%d-%d=7", A.at(0), A.at(1), A.at(2), A.at(3));
  else if (ans == -A.at(1) + A.at(2) + A.at(3)) printf("%d-%d+%d+%d=7", A.at(0), A.at(1), A.at(2), A.at(3));
  else if (ans == -A.at(1) + A.at(2) - A.at(3)) printf("%d-%d+%d-%d=7", A.at(0), A.at(1), A.at(2), A.at(3));
  else if (ans == -A.at(1) - A.at(2) + A.at(3)) printf("%d-%d-%d+%d=7", A.at(0), A.at(1), A.at(2), A.at(3));
  else if (ans == -A.at(1) - A.at(2) - A.at(3)) printf("%d-%d-%d-%d=7", A.at(0), A.at(1), A.at(2), A.at(3));
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
#include<stack>
#include <sstream> 
#include <limits>
#include <numeric>
#include<string.h>
#include<set>
using namespace std;
#define ll long long int
#define all(v) begin(v), end(v)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
//typedef vector<int> V;
//typedef vector<V> VV;
//typedef vector<VV> VVV;
using namespace std;




int Par[1000000];//親
int Rank[1000000];//深さ
int sum[1000000];//要素数

			  //n要素で初期化
void init(int n) {
	for (int i = 0; i < n; i++) {
		Par[i] = i;
		Rank[i] = 0;
		sum[i] = 1;
	}
}
//xの木の根を求める
int find(int x) {
	if (Par[x] == x) {
		return x;
	}
	else {
		return Par[x] = find(Par[x]);
	}
}
//xとyの属性を併合
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y) return;

	if (Rank[x] < Rank[y]) {
		Par[x] = y;
		sum[y] += sum[x];
	}
	else {
		Par[y] = x;
		sum[x] += sum[y];
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}
//xとyが同じ集合かどうか
bool same(int x, int y) {
	return find(x) == find(y);
}

struct edge { ll u, v, cost; };

bool comp(const edge& e1, const edge& e2) {
	return e1.cost < e2.cost;
}


edge es[1000000];//max辺数
ll V, E;//頂点数、辺数


ll kruskal() {
	sort(es, es + E, comp);
	init(V);
	int res = 0;

	for (int i = 0; i < E; i++) {
		edge e = es[i];
		if (!same(e.u, e.v)) {
			unite(e.u, e.v);
			res += e.cost;
		}
	}
	return res;
}

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

	vector<pair<ll,ll >> pairsx(V), pairsy(V);
	E = 2 * (V - 1);

	for (int i = 0; i < V; i++) {
		cin >> x >> y;
		pairsx[i] = make_pair(x,i);
		pairsy[i] = make_pair(y,i);
	}
	sort(pairsx.begin(), pairsx.end());
	sort(pairsy.begin(), pairsy.end());
	ll c=0,xx=pairsx[0].first, xn= pairsx[0].second, yy= pairsy[0].first, yn= pairsy[0].second;
	for (int i = 1; i < V; i++) {
		es[c].u = xn, es[c].v = pairsx[i].second, es[c].cost = pairsx[i].first - xx;
		c++;
		xx = pairsx[i].first, xn = pairsx[i].second;
		es[c].u = yn, es[c].v = pairsy[i].second, es[c].cost = pairsy[i].first - yy;
		c++;
		yy = pairsy[i].first, yn = pairsy[i].second;
	}

	cout << kruskal() << endl;
}

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

string s, key = "keyence";
bool t, ans;

int main(){
	cin >> s;
	string::size_type pos = s.find(key);
	if(pos == string::npos){
		int i = 0, j = 1;
		for(;s[i] == key[i]; i++);
		for(;s[s.length() - j] == key[key.length() - j]; j++);
		if(i + j > 7) ans = true;
	}else if(pos == 0){
		ans = true;
	}else{
		string::size_type pos2 = s.rfind(key);
		if(pos == s.length() - key.length()) ans = true;
	}
	puts(ans ? "YES" : "NO");
}

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

int main() {
  uint32_t n = 0;
  std::cin >> n;
  std::cout << n << ":";

  uint32_t remain = n;
  while (remain % 2 == 0) {
    std::cout << " " << 2;
    remain /= 2;
  }

  for (size_t i = 3; i * i <= remain; i += 2) {
    while (remain % i == 0) {
      std::cout << " " << i;
      remain /= i;
    }
  }

  if (remain != 1) std::cout << " " << remain;
  std::cout << std::endl;

  return 0;
}


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

#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define forn(i,N) for(int i=0;i<N;i++)

using namespace std;
using ll=long long int;
using ld=long double;
using vi=vector<int>;

//https://codeforces.com/problemset/problem/1343/C
//https://codeforces.com/problemset/problem/1154/B

int main() {
//freopen("input.txt","rt",stdin);
ios::sync_with_stdio(false);
cin.tie(nullptr);

ll N,sum=0;
cin>>N;
vector<ll> a(N);
map<ll,int> mapa;
for(ll& x: a) {
  cin>>x;
  sum+=x;
  mapa[x]++;
}
vector<ll> r;
int Q;
cin>>Q;
while(Q--) {
  int b,c;
  cin>>b>>c;
  sum-=((ll)mapa[b]*b);
  sum+=((ll)mapa[b]*c);
  mapa[c]+=mapa[b];
  mapa[b]=0;
  r.pb(sum);
}
for(auto& x: r)
  cout<<x<<endl;

return 0;
}


Measured memory_bytes: 10796
//#pragma comment(linker, "/STACK:36777216")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <sstream>
#include <vector>
#include <complex>
#include <ctime>
#include <stack>

//#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 long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector< VI > VVI;
typedef pair<int, int> PII;
typedef vector<PII> VPII;

#define REP(i, n) for(int i = 0; i < (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
#define FOR(i, x, y) for(int i = (x); i <= (y); ++i)
#define RFOR(i, y, x) for(int i = (x); i >= (y); --i)
#define SZ(a) (int)(a).size()
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a)) 
#define CLEAR(x) memset(x, 0, sizeof x);
#define COPY(FROM, TO) memcpy(TO, FROM, sizeof TO);
#define UNIQUE(c) SORT(c),(c).resize(unique(ALL(c))-(c).begin())
#define pb push_back
#define mk make_pair
#define sqr(x) ((x)*(x))
#define X first
#define Y second
//typedef tree<int, null_type, less<int>, 
//  rb_tree_tag, tree_order_statistics_node_update> order_set;

const long double PI = acos(-1.0);
const double EPS = 1E-6;
const int INF = 2 * (1e+9) + 1;
const int MAXN = 3 * 100000001;
const int MOD = (1e+9) + 7;


ll n, m, k;
string s;
int main() {
    m = 0;
    //freopen("a.txt", "r", stdin);
    cin >> n;
    REP(i, n) {
        k = i + 1;
        if ((k % 3) && (k % 5)) {
            m += k;
        }
    }
    cout << m;
    return 0;
}

Measured memory_bytes: 3160
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
a = readInts()

turn = []
t = [a[0]]
for i in range(1,len(a)):
	if t[-1]<=a[i]:
		t.append(a[i])
	else:
		turn.append(t)
		t = [a[i]]
turn.append(t)


money = 1000
kabu = 0
for i in turn:
	if len(i)>=2:
		t = money//min(i)
		money-=t*min(i)
		money+=t*max(i)

print(money)

Measured memory_bytes: 9480
#include <iostream>
#include <string>
#include <cmath>
#include <ctime>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;

int main(){
    int K, S;
    cin >> K >> S;
    int count = 0;

    for(int x = 0; x <= K; x++){
        for(int y = 0; y <= K; y++){
                if(S - K <= x + y && x + y <= S){
                    count = count + 1;
                }
        
        }
    
    }

    cout << count << endl;

} 

Measured memory_bytes: 256
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

import math
import numpy as np
a,b,x = mi()

l,r = 0,90

for i in range(100):

    c = (r+l)/2
    cr = np.deg2rad(c)

    if b*np.sin(np.pi/2 - cr) >= a*np.sin(cr):
        capa = a*a /np.cos(cr)*np.sin(cr)/2 + a/np.cos(cr) * (b*np.sin(np.pi/2 - cr) - a*np.sin(cr))
        capa *= a
    else:
        capa = b*b/2/np.tan(cr) * a

    # print(r,l,c)
    # print(capa)
    # print('------')

    if capa <= x:
        r = c
    else:
        l = c

print(l)

Measured memory_bytes: 12496
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
	string s;
	cin>>s;
	int len=s.length();
	bool flag=0;
	for(int i=0;i<len;i++){
		if(s[i]=='C')flag=1;
		if(s[i]=='F'&&flag){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
import sys


def solve(A: int, B: int, N: int):
    def f(x: int) -> int:
        return int(A*x/B) - A*int(x/B)
    print(f(min(B-1, N)))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61860
#include <iostream>
#define N_MAX 1000
#include <string>
using namespace std;

int N,A,B,i,j,k;
string S,Sa;
int l[N_MAX];
int r[N_MAX];
int num[N_MAX] = {0};
int ans=0;

int main(){
  cin >> S;
  for (i=0;i<S.size();i+=2){
    Sa+=S[i];
  }
  cout << Sa << endl;
}

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

int main()
{
    int s;
    scanf("%d", &s);
    if (0 < s % 100 && s % 100 < 13)
    {
        if (0 < s / 100 && s / 100 < 13)
            printf("AMBIGUOUS");
        else
            printf("YYMM");
    }
    else
    {
        if (0 < s / 100 && s / 100 < 13)
            printf("MMYY");
        else
            printf("NA");
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <deque>
#include <string>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    string S;
    cin >> S;
    const ll N = S.size();
    ll result = 1 + (N * (N - 1)) / 2;
    unordered_map<char, ll> count;
    for (auto& c : S){
        ++(count[c]);
    }
    for (auto& elem : count){
        auto& m = elem.second;
        result -= (m * (m - 1)) / 2;
    }
    printf("%lld\n", result);
}


Measured memory_bytes: 640
#![allow(unused_imports)]

use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::{i32, i64, i128, u32, u64, u128, f64};
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};
use proconio::marker::{Isize1, Usize1, Bytes, Chars};

#[proconio::fastout]
fn main() {
    proconio::input!(
        n: i32,
    );
    let mut ans = 0;
    for a in 1..=n {
        ans += {
            if n % a == 0 { n / a - 1 }
            else { n / a }
        };
    }
    println!("{}", ans);
}



Measured memory_bytes: 2200
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif
template<class T> ostream& operator<<(ostream& os, vector<T> const& v){
    rep(i,v.size()) os << v[i] << (i+1==v.size()?"":" ");
    return os;
}

int main(){
    int N,Q;
    while(cin >> N >> Q && N){
        vi a(1000);
        rep(i,N){
            int m; cin >> m;
            rep(j,m){
                int d; cin >> d;
                a[d]++;
            }
        }

        int ans = max_element(all(a))-a.begin();
        ans = a[ans] >= Q ? ans : 0;
        cout << ans << endl;
    }
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

signed main(){
	int n;
	cin >> n;
	vector<ll> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a.begin(), a.end(), greater<ll>());
    ll ans = a[0];
	for(int i = 1; i <= (n - 2) / 2; i++) ans += a[i] * 2;
	if(n & 1) ans += a[n / 2];
	cout << ans << endl;
}

Measured memory_bytes: 4848
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<typeinfo>
#include<complex>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a;i < b; i++)
const long double PI = (acos(-1));

int main() {

	string s, t;
	cin >> s >> t;

	int n = s.size(), ans = 0;

	rep(i, 0, n) {
		if (s[i] != t[i]) ans = 1;
	}

	if (ans == 0) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3628
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

x = ni()
max = 1
a = [2,3,4,5,6,7,8,9]

for i in range(1, x+1):
    for j in a:
        if i**j <= x and i**j > max:
            max = i**j
print(max)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using ll = long long;
using namespace std;

int main()
{
  int X;
  cin >> X;
  vector<bool> expo(X + 1);
  expo[1] = 1;
  for (int b = 2; b <= X; b++)
  {
    int v = b * b;
    while (v <= X)
    {
      expo[v] = 1;
      v *= b;
    }
  }
  for (int i = X; i >= 1; i--)
    if (expo[i])
    {
      cout << i << endl;
      return 0;
    }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,k,ans=0;cin>>n>>k;
  while(n>0) {n/=k;ans++;}
  print(ans);
  return 0;
}

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

using namespace std;
typedef long long ll;

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

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

  //1-9:9
  //100-999:900
  //10000-99999:90000

  int base = (int)log10(N);

  int ans = 0;
  
  for(int i=0; i<base; i++)
    {
      if(i==0)
	{
	  ans += 9;
	}      
      if(i==2)
	{
	  ans += 900;
	}
      if(i==4)
	{
	  ans += 90000;	  
	}
    }

  if(base%2==0)
    {
      if(base==0)
	ans += N;
      if(base==2)
	ans += N-99;
      if(base==4)
	ans += N-9999;
    }
  cout << ans << endl;


  
  return 0;
}


//cout << setprecision(13);
//next_permutation(v.begin(), v.end());



Measured memory_bytes: 384
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	ans := 0
	c := map[pair]int{}

	for i := 0; i < n; i++ {
		a := int(scanFloat64()*1e9 + 0.5)

		c2, c5 := 0, 0
		for a%2 == 0 && c2 < 18 {
			a /= 2
			c2++
		}
		for a%5 == 0 && c5 < 18 {
			a /= 5
			c5++
		}
		for i := 0; i < 19; i++ {
			if c2+i < 18 {
				continue
			}
			for j := 0; j < 19; j++ {
				if c5+j < 18 {
					continue
				}
				ans += c[pair{i, j}]
			}
		}

		c[pair{c2, c5}]++
	}
	fmt.Fprintln(wr, ans)

}

type pair struct{ a, b int }


Measured memory_bytes: 5116
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;

int main() {
  int h, w, n, mx = 0, Mx, my = 0, My;
  cin >> h >> w >> n;
  vector<int> x(n), y(n), a(n);
  rep(i, n) cin >> x[i] >> y[i] >> a[i];
  Mx = h; My = w;
  rep(i, n){
    if(a[i] == 1 && x[i] > mx) mx = x[i];
    else if(a[i] == 2 && x[i] < Mx) Mx = x[i];
    else if(a[i] == 3 && y[i] > my) my = y[i];
    else if(a[i] == 4 && y[i] < My) My = y[i];
  }
  cout << max(0, Mx-mx) * max(0, My-my) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1<<20;
int a[N],b[N];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",a+i);
		b[--a[i]]=i;
	}
	int ans=1,last=0;
	for(int i=1;i<=n;i++)
	{
		ans=max(ans,i-last);
		if(i<n && b[i-1]>b[i])last=i;
	}
	printf("%d\n",n-ans);
	return 0;
}

Measured memory_bytes: 3072
import java.util.Scanner;

public class Main implements Runnable {

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

    public static void main(String[] args) {
        new Thread(null, new Main(), "", 128 * 1024 * 1024).start();
    }

    public void run() {
        int x = sc.nextInt();
        if (x == 7 || x == 5 || x == 3) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 23764
import bisect

N = int(input())

A = [0] * N
for i in range(N):
    A[i] = - int(input())

B = [A[0]]

for j in range(1,N):
    if B[-1] <= A[j]:
        B.append(A[j])
    else:
        B[bisect.bisect_right(B,A[j])] = A[j]
    #print(B)

print(len(B))

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

int main() {
  int N;
  cin >> N;
  long long ans = 1;
  bool ngFlg = false;
  for(int index = 0 ;index < N; index++ ) {
  	long long A;
 	cin >> A;
    if(A == 0) {
      cout << 0 << endl;
      return 0;
    }
    if(ngFlg || 1000000000000000000/ans < A) {
	  ngFlg = true;
    }
  	ans *= A;
  }
  if(ngFlg) cout << -1 << endl;
  else cout << ans << endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define ff first
#define pb push_back
#define ss second
#define maxn 100005
using namespace std;


int main(){

    int n;
    cin >> n;
    for(int i=0;i<=n;i++){
        double x;
        x = ((double)i * 1.08);
        x = floor(x);
        if(x == n){
            cout << i << endl;
            return 0;
        }

    }
    cout << ":("<< endl;


    return 0;
}


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

using namespace std;

typedef pair<int,int> P;
typedef long long ll; 

#define int ll

const ll mod = 1e9 + 7;

main(){
	int l,r,d;
	cin >> l >> r >> d;

	int ans = 0;
	for(int i=l;i<=r;i++){
		if(i%d==0) ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>

using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a;
  for(int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }

  cout << accumulate(a.begin(), a.end(), 0) -n << endl;
  return 0;
}



Measured memory_bytes: 3656
import time
startTimeProblem=time.time()

import fileinput, sys, itertools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

N, M = In.ints()

bulbcons = [0]*M

for i in range(M):
    bulbcons[i] = In.ints()[1::]

p = In.ints()
ans = 0

# print(bulbcons)
# print(p)
for comb in itertools.product(range(2), repeat=N):
    # print(comb)
    problem = False

    for i in range(M):
        res = sum([comb[bulbcons[i][j]-1] for j in range(len(bulbcons[i]))])

        if res%2 != p[i]:
            problem=True
            break
            
    if not problem:
        # print(comb)
        ans+=1

print(ans)


######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Measured memory_bytes: 41196
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int[]penki = new int[101];
		
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		int c = stdIn.nextInt();
		
		penki[a] = a;
		penki[b] = b;
		penki[c] = c;
		
		int cnt = 0;
		
		for(int i = 0; i <=100; i++) {
			if(penki[i]!= 0) {
				cnt++;
			}
		}
		
		System.out.println(cnt);
		
		
	}

}


Measured memory_bytes: 21844
#include"bits/stdc++.h"
using namespace std;

typedef long long ll;
#define FOR(i, a, n) for (ll i=(ll)a;i<(ll)n;i++)
#define REP(i, n) FOR(i, 0, n)

int main(){
    vector<int> a; a.resize(5);
    REP(i, 5){
        cin >> a[i];
    }
    int k; cin >> k;


    int flag = 1;
    REP(i, 5){
        REP(j,i){
            if (a[i]-a[j]>k){
                flag = 0;
                break;
            }
        }
    }

    string ans = (flag) ? "Yay!" : ":(";
    cout << ans <<endl;
}

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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010, M = 13, mod = 1e9 + 7;

int n, f[N][M];
char s[N];

int main()
{
	cin >> (s + 1);
	n = strlen(s + 1);
	
	f[0][0] = 1;
	for (int i = 1; i <= n; i ++ )
		if (s[i] == '?')
		{
			for (int j = 0; j < 10; j ++ )
				for (int k = 0; k < M; k ++ )
				{
					int t = (k * 10 + j) % M;
					f[i][t] = (f[i][t] + f[i - 1][k]) % mod;
				}
		}
		else
		{
			for (int k = 0; k < M; k ++ )
			{
				int t = (k * 10 + s[i] - '0') % M;
				f[i][t] = (f[i][t] + f[i - 1][k]) % mod;
			}
		}
	cout << f[n][5] << endl;
	return 0;
}

Measured memory_bytes: 5376