akhauriyash/Code-Regression huggingface dataset:
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
import math
from copy import deepcopy
import queue
import numpy as np
# sympy as syp(素因数分解とか)
Mod = 1000000007
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1] 
for i in range(2, 10**5 + 1):
    fact.append((fact[-1] * i) % Mod)
    inv.append((-inv[Mod % i] * (Mod // i)) % Mod)
    factinv.append((factinv[-1] * inv[-1]) % Mod)
    
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p
    
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[y] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)
import string
def main():  #startline-------------------------------------------
    n = int(input())
    ans = [0 for i in range(n)]
    for i in range(1, int(np.sqrt(n + 1))):
        for j in range(1, int(np.sqrt(n + 1))):
            for k in range(1,int(np.sqrt(n + 1))):
                x = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
                if x <= n:
                    ans[x - 1] += 1
    for i in range(n):
        print(ans[i])
if __name__ == "__main__":
    main() #endline===============================================

Measured memory_bytes: 38956
#include<stdio.h>

#include<math.h>

#define PI 3.14159265358979323846264338327950L

int main(void)
{
    int a,b,h,m;
    scanf("%d%d%d%d", &a, &b, &h, &m);
    long double rad=PI* 2 * ((long double)h/ 12.0 + ((long double)m/ 60.0) / 12.0 - (long double)m/ 60.0);

    long double rsq= (long double)(a*a+b*b) - (long double)(2 *a*b) *cosl(rad);

    printf("%20.20Lf\n",sqrtl(rsq));

    return 0;
}


Measured memory_bytes: 2552
///----> bismillahir rahmanir rahim <---- -- { ^ _ ^ }
///     { ^_^ }   { ^ _ ^ }



#include<bits/stdc++.h>
using namespace std;


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi; ///VECTOR<VECTOR<INT>NAME>NAME 2
typedef vector<vl> vvl;///LONG LONG
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;///VECTOR WITH PAIR
typedef vector<pll> vll;
typedef double dl;

#define endl "\n"
#define PB push_back
#define F first
#define S second
#define as(a) (a).begin(),(a).end()
#define ras(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

#define over return 0;

#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

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


///--------> YOUR JOURNEY STARTS HERE <-------



int main(){

string s;
cin>>s;
ll sum=0;
if(s=="0"){
        cout<<"Yes"<<endl;
}
else{


for(unsigned int i=0;i<s.length();i++){
    sum+=(s[i]-'0');
}
if(sum%9==0){
    cout<<"Yes"<<endl;
}
else{
    cout<<"No"<<endl;
}
}
over
}


Measured memory_bytes: 3716
n = int(input())
q = list(map(int, input().split()))

mod = 10**9+7
ans = 1
hat = [0, 0, 0]

for i in range(n):
  count = hat.count(q[i])
  ans *= count
  ans %= mod
  if ans == 0:
    break
  for j in range(3):
    if hat[j] == q[i]:
      hat[j] += 1
      break
      
print(ans)

Measured memory_bytes: 84032
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
B.append(0)


kill = 0
tmp = 0
for i in range(len(A)):
    if A[i] > tmp:
        A[i] = A[i] - tmp
        kill += tmp
    else:
        kill += A[i]
        A[i] = 0
    if B[i] > A[i]:
        tmp = B[i] - A[i]
        kill += A[i]
    else:
        tmp = 0
        kill += B[i]

print(kill)


Measured memory_bytes: 82020
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int main() {
    int N, M, Q;
    while(cin >> N >> M >> Q, N) {
        
        string prev_b = string(M, '0');
        set<int> all_sw;
        for(int i=0; i<N; ++i) {
            all_sw.insert(i);
        }
        vector<set<int>> ret(M, all_sw);

        for(int i=0; i<Q; ++i) {
            string s, b;
            cin >> s >> b;
            set<int> can_sw;
            for(int j=0; j<N; ++j) {
                if(s[j] == '1') {
                    can_sw.insert(j);
                }
            }
            for(int j=0; j<M; ++j) {
                if(prev_b[j] != b[j]) {
                    set<int> inter;
                    set_intersection(ret[j].begin(), ret[j].end(), can_sw.begin(), can_sw.end(), inserter(inter, inter.end()));
                    ret[j] = inter;
                } else {
                    set<int> dif;
                    set_difference(ret[j].begin(), ret[j].end(), can_sw.begin(), can_sw.end(), inserter(dif, dif.end()));
                    ret[j] = dif;
                }
            }
            prev_b = b;
        }

        for(int i=0; i<ret.size(); ++i) {
            if(ret[i].size() == 1) {
                int r = *ret[i].begin();
                if(0 <= r && r <= 9) {
                    cout << r;
                } else {
                    cout << static_cast<char>('A' + r-10);
                }       
            } else {
                cout << '?';
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 4928
import java.io.*;
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.util.*;
import java.math.*;
public class Main 
{ 
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader()
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next()
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine();
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
    static long[] ans=new long[100001];
     public static void main (String[] args) throws java.lang.Exception {
        FastReader sc=new FastReader();
        PrintWriter pw=new PrintWriter(System.out);
    	int t=1;//sc.nextInt();
        while (t-- > 0){
            //int n = sc.nextInt();
            List<Integer> l=new ArrayList<>();
            for(int i=0;i<5;i++) l.add(sc.nextInt());
            pw.println(l.indexOf(0)+1);
        }
    pw.close();
     }
}

  

Measured memory_bytes: 33476
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
	int n,x;
	
	cin >> n >>x;
	vector<int> a(n);

	for (int i = 0; i < n; i++) {
		cin >> a.at(i);
	}

	sort(a.begin(), a.end());

	int i;
	for (i = 0; x>=0 && i < n; i++) {
		x = x - a.at(i);
	}
	if (x != 0) {
		i = i - 1;
	}
	cout << i << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
#include <vector>
#include <set>
#include <string.h>
#include <algorithm>
#define mod 1000000007
#define inf 1LL<<61
#define ll long long
#define pr pair<int,int>
#define all vec.begin(),vec.end()
#define rep(i,a,b) for (int i = a; i < b; i++)
#define fi first
#define se second
#define pushb push_back
#define makep make_pair

using namespace std;

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	cout << min(min(a+c, b +c), a + b);
	return 0;
}



Measured memory_bytes: 3588
class UnionFind:
    def __init__(self, size):
        self.table = [i for i in range(size)]

    def find(self, x):
        return self.table[x]

    def union(self, x, y):
        x1 = self.find(x)
        y1 = self.find(y)

        if x1 == y1:
            return False

        for i in range(len(self.table)):
            if self.table[i] == y1:
                self.table[i] = x1
        return True


N, M = map(int, input().split())

edges = []
for _ in range(M):
    a, b = map(int, input().split())
    edges.append([a-1, b-1])

mat = [[0]*N for _ in range(N)]
for s, g in edges:
    mat[s][g] = 1
    mat[g][s] = 1

ans = 0

for i in range(M):
    uni = UnionFind(N)

    for j in range(M):
        if i != j:
            uni.union(edges[j][0], edges[j][1])

    if not all(uni.find(0) == uni.find(x) for x in range(N)):
        ans += 1
print(ans)


Measured memory_bytes: 3064
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($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)*}
    };
}
 
#[allow(unused_macros)]
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)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($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, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

//use std::collections::BinaryHeap;
use std::cmp;

fn main() {
    input! {
        n: usize,
        k: usize,
        v: [isize; n]
    }

    let mut vec = vec![];
    let mut max = 0;

    // take i from the queue
    for i in 0..cmp::min(k, n)+1 {
        // left j, right i-j
        for j in 0..i+1 {
            for m in 0..j {
                vec.push(v[m]);
            }
            for m in 0..i-j {
                vec.push(v[n-1 - m]);
            }
        
            vec.sort();
            //println!("{:?}", vec);
            let mut sum : isize = vec.iter().sum();
            //println!("sum: {}", sum);
            let mut index = 0;
            while index < i && index < k-i && vec[index] < 0 {
                sum = sum - vec[index];
                index = index + 1;
            }
            if max < sum {
                max = sum;
            }
            vec.clear();
        }
    } 

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


Measured memory_bytes: 4352
import sys
import numpy as np

I = np.array(sys.stdin.read().split(), dtype=np.int64)
n = I[0]
f = I[1:10*n+1].reshape(n, 10)
p = I[10*n+1:].reshape(n, 11)

def main():
    combs = np.arange(1, 1 << 10)[:, None] >> np.arange(10) & 1
    res = (combs[:, None] & f).sum(axis=2)
    res = p[np.arange(n), res[:, None]].sum(axis=2)
    print(res.max())

if __name__ ==  '__main__':
    main()

Measured memory_bytes: 21456
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

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




    
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

vector< ll > divisor(ll n) {
  vector< ll > ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool is_prime(long long _Num){
    if(_Num < 2)return false;
    if(_Num % 2 == 0){
        if(_Num == 2)return true;
        else return false;
    }
    bool prime = true;
    for(long long i = 3; i <= sqrt(_Num); i += 2){
        if(_Num % i == 0){
            prime = false;
            break;
        }
    }
    return prime;
}

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep (i, n) cin >> a[i];

	multiset<int> st;
	rep (i, n) {
		if (!i) {
			st.insert(a[i]);
			continue;
		}
		auto lb = st.lower_bound(a[i]);
		lb--;
		if (a[i] <= *st.begin()) st.insert(a[i]);
		else {
			st.erase(lb);
			st.insert(a[i]);
		}
	}

	cout << st.size() << endl;
	return 0;
}

Measured memory_bytes: 5376
N = int(input())
L = list(map(int,input().split()))

ans = 0
for i in range(0,N):
  for j in range(i,N):
    for k in range(j,N):
      if L[i] != L[j] and L[i] != L[k] and L[k] != L[j]:
        if L[i] + L[j] > L[k] and L[i] + L[k] > L[j] and L[j] + L[k] > L[i]:
          ans += 1
         

print(ans)









Measured memory_bytes: 9192
import sys, random, math
from bisect import bisect_left, bisect_right
input = sys.stdin.readline

def main():
    inf = 10 ** 20

#    t = int(input())
#    t, a, b = map(int, input().split())
    t = 1
    
    for _ in range(1, t+1):
    #    print("Case #{}: ".format(_), end = '')
        
        k = int(input())
        s = input().strip()
        if(k < len(s)):
            print(s[:k] + '...')
        else:
            print(s)
        
        
        
main()

Measured memory_bytes: 76964
/**
 *    author        : Saurav Paul 
 *    created       : August 24, 2020 11:46 AM
 *    Problem Name  : D - Wizard in Maze
 *    Problem Limit : 2000 ms , 1024 MB
 *    Problem Url   : https://atcoder.jp/contests/abc176/tasks/abc176_d
 *    @genarated by : ai-virtual-assistant
**/

#include<bits/stdc++.h>
using namespace std;

const int nax = 1e3 + 10 ;
const int INF = 1e9 + 90 ;
int H , W ;
int sx , sy , fx , fy ;
char grid[nax][nax] ;
int dist[nax][nax] ;
int dx[] = {-1,1,0,0} ;
int dy[] = {0,0,-1,1} ;

class Prop{
    public :
        int x , y , cost ;
        Prop(){
            x = y = cost = 0 ;
        }
        void update(int a, int b,int c){
            x = a , y = b , cost = c ;
        }
}temp,curr;

class Compare{
    public :
        bool operator()(Prop a , Prop b){
            return a.cost > b.cost ;
        }

};
bool legal(int x , int y){
    if(x < 0 || x >= H || y < 0 || y >= W || grid[x][y] =='#') return false ;
    return true ;
}

void solve(){

    scanf("%d%d",&H,&W) ;
    scanf("%d%d%d%d",&sx,&sy,&fx,&fy) ;
    sx -- ; sy-- ; fx-- ; fy-- ;

    for(int i = 0 ; i < H ; i++){
        scanf("%s",grid[i]) ;
    }

    priority_queue<Prop,vector<Prop>,Compare> PQ ;
    temp.update(sx,sy,0) ;
    PQ.push(temp) ;

    for(int i = 0 ; i < H ;i++){
        for(int j = 0 ; j < W ; j++){
            dist[i][j] = INF ;
        }
    }

    dist[sx][sy] = 0 ;
    while(!PQ.empty()){
        curr = PQ.top() ;
        PQ.pop() ;
        int x = curr.x ;
        int y = curr.y ;
        int cost = curr.cost ;

        for(int d = 0 ; d < 4 ; d++){
            int nx = x + dx[d] ;
            int ny = y + dy[d] ;

            if(!legal(nx,ny)) continue ;

            if(dist[nx][ny] > dist[x][y]){
                dist[nx][ny] = dist[x][y] ;
                temp.update(nx,ny,dist[nx][ny]) ;
                PQ.push(temp) ;
            }
        }

        for(int nx = x - 2 ; nx <= x + 2 ; nx ++){
            for(int ny = y - 2 ; ny <= y + 2 ; ny ++){
                if(!legal(nx,ny)) continue ;
                if(dist[nx][ny] > dist[x][y] + 1){
                    dist[nx][ny] = dist[x][y] + 1 ;
                    temp.update(nx,ny,dist[nx][ny]) ;
                    PQ.push(temp) ;
                }
            }
        }
    }
    if(dist[fx][fy] == INF) puts("-1") ;
    else printf("%d\n",dist[fx][fy]) ;

}

int main(){

    int testcases = 1;
    for(int i = 1 ; i <= testcases ; i ++){
        solve();
    }

    return 0 ;
}


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

using namespace std;

#define f first
#define s second
#define pub push_back
#define pob pop_back

typedef vector<int> vi;
typedef vector<vi> graf;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> wgraf;

typedef vector<double> vd;
typedef pair<double,double> dd;
typedef vector<dd> vdd;

typedef uint64_t ui64;

int fact(int n){

	if(n == 0)
		return 1;

	return n*fact(n-1);

}

double len(ii a, ii b){

	int dx, dy;

	dx = a.f - b.f;
	dy = a.s - b.s;

	double res = (dx*dx) + (dy*dy);

	return sqrt(res);

}

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

	int n;
	cin >> n;

	vii points(n,{0,0});

	for(auto &x: points){

		cin >> x.f;
		cin >> x.s;

	}

	double sum = 0;
	double path;

	sort(points.begin(), points.end());


	do{

		path = 0;

		for(int i = 0; i < n - 1; i++){

			path += len(points[i],points[i+1]);

		}

		sum += path;

	}while(next_permutation(points.begin(), points.end()));

	double avr = sum/fact(n);

	cout << setprecision(12);

	cout << avr << endl;

	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long;
const int maxn = 1e5+10;
int a[maxn];
int main(){
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	sort(a,a+n);
	int minn=1000000000;
	int temp;
	for(int i=k-1;i<n;i++){
		minn=min(a[i]-a[i-k+1],minn);
	}
	cout<<minn<<endl;
} 

Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
    int N;
    int K;

    scanf("%d", &N);
    scanf("%d", &K);

    while (K--){
        int a, b;

        scanf("%d %d", &a, &b);
        if (N / 2 < a) a = N - a + 1;
        if (N / 2 < b) b = N - b + 1;

        // printf("%d %d\n", a, b);
        if (a < b) printf("%d\n", (a - 1) % 3 + 1);
        else printf("%d\n", (b - 1) % 3 + 1);
    }

    return 0;
}

Measured memory_bytes: 596
import sys

if __name__ == '__main__':

    nums = []

    for line in sys.stdin:
        if line == "\n":
            break
        else :
            nums.append([int(item) for item in line.split(" ")])

    for n in nums:
        sum = n[0] + n[1]
        print(len(str(sum)))
    

Measured memory_bytes: 7684
#include <iostream>
#include <vector>
#include <algorithm>

int main(){
   int n;
   std::cin >> n;
   int vodd[n/2], veven[n/2];
   for(int i=0; i<n/2; ++i){
      std::cin >> veven[i];
      std::cin >> vodd[i];
   }

   int ans;
   std::vector<std::pair<int, int> > ceven;
   std::vector<std::pair<int, int> > codd;
   for(int i=0; i<n/2; ++i){
      bool flag = true;
      for(int j=0; j<ceven.size(); ++j){
	 if(veven[i]==ceven[j].first) {
	    ++ceven[j].second;
	    flag = false;
	    break;
	 }
      }
      if(flag) ceven.push_back(std::make_pair(veven[i],1));

      flag = true;
      for(int j=0; j<codd.size(); ++j){
	 if(vodd[i]==codd[j].first) {
	    ++codd[j].second;
	    flag = false;
	    break;
	 }
      }
      if(flag) codd.push_back(std::make_pair(vodd[i],1));
   }
   int max1 = 0;
   int maxeven = 0;
   int max2 = 0;
   int maxodd = 0;
   for(int i=0; i<ceven.size(); ++i){
      if(max1<ceven[i].second){
	 max1 = ceven[i].second;
	 maxeven = ceven[i].first;
      }
   }
   int ans1 = n/2 - max1;
   max1 = 0;
   for(int i=0; i<codd.size(); ++i){
      if(max2<codd[i].second){
	 max2 = codd[i].second;
	 maxodd = codd[i].first;
      }
      if(codd[i].first!=maxeven) max1 = std::max(max1,codd[i].second);
   }
   ans1 += n/2 - max1;
   int ans2 = n/2 - max2;
   max2 = 0;
   for(int i=0; i<ceven.size(); ++i){
      if(ceven[i].first!=maxodd) max2 = std::max(max2,ceven[i].second);
   }
   ans2 += n/2 - max2;
   std::cout << std::min(ans1,ans2) << std::endl;

   return 0;
}


Measured memory_bytes: 1660
#include <stdio.h>

int main(void){
	int A,B,K;
	int count=0;
	int i;
	scanf("%d %d %d",&A,&B,&K);
if(A>B){ i = B; }
    	else{ i = A; }
	for(i; i<=A && i<=B; i--){
		if(A%i==0 && B%i==0){
			count++;
		}
		if(count==K){
			printf("%d\n",i);
			break;
		}
	}
}

Measured memory_bytes: 128
import java.util.*;
public class Main { 
    public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
       long o=0;
       long n=sc.nextLong();
       long k=sc.nextLong();
       PriorityQueue<Long> pq = new PriorityQueue<>(Collections.reverseOrder());
       for(long i=0;i<n;i++){
           pq.offer(sc.nextLong());
       }
       if(n<=k){
           o=0;
       }else{
            for(long i=0;i<k;i++){
                pq.poll();
            }
            while(pq.size()>0){
                o+=pq.poll();
            }
       }
      System.out.println(o);
    }
}

Measured memory_bytes: 96728
/* Author - thiolhub */

#include <bits/stdc++.h>

using namespace std;

#define ll              long long int
#define ld              long double
#define db              double
#define pi              3.1415926535897932384626
#define PI              acos(-1.0)
#define endl            "\n"
#define mod             1000000007
#define mk              make_pair
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            ll t; cin>>t; while(t--)
#define sc(a)	        scanf("%lld",&a);
#define pr(a)	        printf("%lld\n",a)
#define rep(i,a,n)		for(ll i=a;i<n;i++)
#define m(a)		    memset(a,0,sizeof(a))
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define min3(a,b,c)     min(a,min(b,c))



int main(){ FastIO;

ll n;cin>>n;
string s="";
while(n){
	int r=n%26;
	n/=26;
	if(r==0) {
		r=26;n--;}
	s+=(char)(r+96);
}
for(int i=s.length()-1;i>-1;i--) cout<<s[i];
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef complex<double> xy_t;
typedef vector<lint> poly;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

const lint mod = 1e9+7;
const lint INF = mod;
const int MAX = 100010;

int main(){
    int n;
    scanf("%d", &n);
    rep(i, n+1)if((int)(1.08*i)==n){
        printf("%d\n", i);
        return 0;
    }
    printf(":(\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fr(i,a,b) for (ll i=(a); i<(b);i++)
#define frr(i,a,b) for(int i=(a-1);i>=(b);i--)
#define vi vector<int>
#define de deque<int>
#define del deque<ll>
#define vl vector<ll>
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define mp map<ll,ll>
#define rev(a) reverse(a.begin(),a.end())
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.begin(),a.end(),greater<int>())
#define ln(a) a.length()
#define sz(a) a.size()
int M=1e9+7;
int n,m;
int dp[1000][1000];
char a[1000][1000];

int solve(int i,int j)
{
   if(dp[i][j]!=-1)return dp[i][j];

   int k=0;
   if(i==0){if(a[i][j-1]=='.')k+=solve(i,j-1);}

   else if(j==0){if(a[i-1][j]=='.')k+=solve(i-1,j);}
   else 
    {   if(a[i][j-1]=='.')
        k+=solve(i,j-1);
        if(a[i-1][j]=='.')
            k+=solve(i-1,j);
    }
    k%=M;
    dp[i][j]=k;
    return k;

}



int main()
{ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#endif

cin>>n>>m;
fr(i,0,n)fr(j,0,m)cin>>a[i][j];

memset(dp,-1,sizeof dp);dp[0][0]=1;

cout<<solve(n-1,m-1)<<endl;


}

Measured memory_bytes: 5248
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
//#define int long long
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
    string S;
    cin >> S;
    int a = 0, b = 0;
    for (auto s : S) {
        if (s == '0') a++;
        else b++;
    }
    cout << min(a,b)*2 << endl;
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>

int main(void){
int i,j;
for(j=1;j<=9;j++){
i=1;
printf("%dx%d=%d\n",i,j,i*j);
}
for(j=1;j<=9;j++){
i=2;
printf("%dx%d=%d\n",i,j,i*j);
}
for(j=1;j<=9;j++){
i=3;
printf("%dx%d=%d\n",i,j,i*j);
}
for(j=1;j<=9;j++){
i=4;
printf("%dx%d=%d\n",i,j,i*j);
}
for(j=1;j<=9;j++){
i=5;
printf("%dx%d=%d\n",i,j,i*j);
}
for(j=1;j<=9;j++){
i=6;
printf("%dx%d=%d\n",i,j,i*j);
}
for(j=1;j<=9;j++){
i=7;
printf("%dx%d=%d\n",i,j,i*j);
}
for(j=1;j<=9;j++){
i=8;
printf("%dx%d=%d\n",i,j,i*j);
}
for(j=1;j<=9;j++){
i=9;
printf("%dx%d=%d\n",i,j,i*j);
}
return 0;
}

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

const ll mod = 1e9 + 7;
ll p(ll a, ll n) {  // a^n
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

ll choose(ll n, ll a) {
  ll x = 1, y = 1;
  rep(i, a) {
    x *= n - i;
    x %= mod;
    y *= i + 1;
    y %= mod;
  }
  return x * p(y, mod - 2);
}

const int MAX_N = 2e6;
ll fac[MAX_N];

int main() {
  fac[0] = 1;
  rep(i, MAX_N) fac[i + 1] = (fac[i] * (i + 1)) % mod;

  int x, y;
  cin >> x >> y;

  if ((x + y) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }

  ll n = (2 * x - y) / 3;
  ll m = (2 * y - x) / 3;
  if (n < 0 || m < 0) {
    cout << 0 << endl;
    return 0;
  }
  n %= mod;
  m %= mod;
  ll ans = choose(n + m, n) % mod;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 15872
cnt :: [Int] -> Int -> Int -> Int
cnt ls n i | n <= i = 0
           | otherwise = if all (<= ls!!i) (take (i+1) ls) then 1+ (cnt ls n (i+1)) else (cnt ls n (i+1))

main :: IO ()
main = do
  n <- readLn :: IO Int
  ls <- map read.words <$> getLine :: IO [Int]
  print $ cnt ls n 0


Measured memory_bytes: 636
import sys
input = sys.stdin.readline

n, m, l = map(int, input().split())

def warshall_floyd(dp):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                dp[i][j] = min(dp[i][j] , dp[i][k] + dp[k][j])
    return dp

dp = [[float('inf')]*n for _ in range(n)]

for _ in range(m):
    a, b, c = map(int,input().split())
    dp[a-1][b-1] = dp[b-1][a-1] = c

for i in range(n):
    dp[i][i] = 0

dp = warshall_floyd(dp)

dp2 = [[float('inf')]*n for _ in range(n)]

for i in range(n):
    for j in range(n):
        if dp[i][j] <= l:
            dp2[i][j] = 1
    dp2[i][i] = 0
dp2 = warshall_floyd(dp2)

q = int(input())

ans = [0]*q
for i in range(q):
    s, t = map(int,input().split())
    tmp = dp2[s-1][t-1]
    ans[i] = -1 if tmp == float('inf') else tmp - 1

print(*ans, sep='\n')


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

using namespace std;

int main()
{
  map<string, pair<int, int>> ma;
  int n;
  cin >> n;
  while (n--)
  {
    string s;
    cin >> s;
    ma[s].first++;
  }
  int m;
  cin >> m;
  while (m--)
  {
    string t;
    cin >> t;
    ma[t].second++;
  }
  int ans = 0;
  for (pair<string, pair<int, int>> t : ma)
    ans = max(ans, t.second.first - t.second.second);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
gets
cs = [0, 0, 0]
r = 1
gets.split.map(&:to_i).each do |a|
  m = cs.count {|c| a == c }
  r *= m
  r %= 1000000007
  break if m.zero?
  cs[cs.find_index {|c| a == c }] += 1
end
puts r


Measured memory_bytes: 10116
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - 48;}
char myitoc(int N) {return '0' + N;}

signed main()
{
  int N, K0;
  cin >> N >> K0;
  vector<vector<int>> A(N, vector<int>(50, 0));
  for (int i = 0; i < N; i++)
  {
    int a;
    cin >> a;

    for (int j = 0; j < 50; j++)
    {
      A.at(i).at(j) = a % 2;
      a /= 2;
      //if (a == 0) break;
    }
  }

  vector<int> K(50, 0);
  for (int i = 0; i < 50; i++)
  {
    K.at(i) = K0 % 2;
    K0 /= 2;
    //if (K0 == 0) break;
  }
  
  vector<vector<int>> P(50, vector<int>(2, 0));
  for (int i = 0, k = 1; i < 50; i++, k *= 2)
  {
    for (int j = 0; j < N; j++)
    {
      P.at(i).at( 1 - A.at(j).at(i) )++;
    }
    P.at(i).at(0) *= k;
    P.at(i).at(1) *= k;
  }

  vector<vector<int>> dp(51, vector<int>(2, -1));
  dp.at(50).at(0) = 0;
  for (int i = 49; i >= 0; i--)
  {
    if (dp.at(i + 1).at(1) > -1)
    {
      int p = max(P.at(i).at(0), P.at(i).at(1));
      chmax(dp.at(i).at(1), dp.at(i + 1).at(1) + p);
    }

    if (dp.at(i + 1).at(0) > -1)
    {
      if (K.at(i) == 1)
        chmax(dp.at(i).at(1), dp.at(i + 1).at(0) + P.at(i).at(0));

      chmax(dp.at(i).at(0), dp.at(i + 1).at(0) + P.at(i).at(K.at(i)));
    }
  }

  cout << max(dp.at(0).at(0), dp.at(0).at(1)) << endl;
}


Measured memory_bytes: 43264
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        int k = in.nextInt();
        Set<String> set = new HashSet<>();
        for(int i = 1; i <= Math.min(5, s.length()); i++) {
            for(int j = 0; j <= s.length() - i; j++) {
                set.add(s.substring(j, j + i));
            }
        }
        List<String> list = set.stream().sorted().collect(Collectors.toList());
        System.out.println(list.get(k - 1));
    }
}

Measured memory_bytes: 29000
#include <stdio.h>
int main(){
  int i,n,x;
  scanf("%d",&n);
  for(i=1; i<=n; i++){
    if(i%3 == 0)printf(" %d",i);
    else if(i%10 == 3) printf(" %d",i);
    else if(i/10 == 3 || i/10%10 ==3 || i/100%10 ==3 || i/1000%10 == 3) printf(" %d",i);
  }
    printf("\n");
    return 0;
}

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

use proconio::{input, fastout};
use proconio::marker::*;


#[fastout]
fn main() {
    input! {
    x: usize
    }
    for i in x.. {
        if is_p(i) {
            println!("{}", i);
            return;
        }
    }
}

fn is_p(n: usize) -> bool {
    let mut i: usize = 2;
    while i.pow(2) <= n {
        if n % i == 0 {
            return false;
        }
        i += 1;
    }
    true
}


Measured memory_bytes: 2148
//#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
    int H,W;
    cin >> H >> W;

    vector <string> pic(H);
    
    for (int i = 0; i < H; i++) {
        cin >> pic[i];
    }
   
    for (int i = 0; i <= W + 1; i++)cout << "#";
    cout << endl;
    for (int i = 0; i < H; i++) {
        cout << '#' << pic[i] << '#' << endl;
    }
    for (int i = 0; i <= W + 1; i++)cout << "#";
    cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
signed main(){
    string s; cin >> s;
    string t; cin >> t;
	
    vector<vector<int>> pos(26);
    for(int i = 0; i <  s.size(); ++i)
        pos[s[i] - 'a'].push_back(i);
	
    for(auto c : t)
        if(pos[c-'a'].empty())  return puts("-1") * 0;//-1.
	
    //vector<int>nextIndex(26,0LL);
    int ans = 0;
    int nowIndex = -1;
    int ssize = s.size();
    for(auto c : t){
        char key = c - 'a';
        auto itr = (upper_bound(pos[key].begin() /*+ nextIndex[key]*/,pos[key].end(),nowIndex));
        if(itr != pos[key].end()){
            ans +=  *itr - nowIndex;
        } else {
            itr = pos[key].begin();
            ans += ssize - nowIndex + *itr;
        }
        nowIndex = *itr;
        //nextIndex[key] = (next(itr) == pos[key].end() ? 0 :( nextIndex[key] + 1));
    }
    cout << ans << endl;
}

Measured memory_bytes: 1724
#include <bits/stdc++.h>
#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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }

template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n = 0): n(n), d(n + 1, 0) {}
  void add(int i, T x = 1) {
    for (; i <= n; i += i & -i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (; i > 0; i -= i & -i) {
      x += d[i];
    }
    return x;
  }
};

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int n, q;
  cin >> n >> q;
  vector<int> c(n + 1);
  rep(i, n) {
    cin >> c[i + 1];
    c[i + 1]--;
  }
  vector<int> l(q), r(q);
  rep(i, q) {
    cin >> l[i] >> r[i];
    l[i]--;
  }

  vector<pair<int, int>> p(q);
  rep(i, q) p[i] = {r[i], i};
  sort(p.begin(), p.end());
  BIT<int> bit(n);
  vector<int> pre(n, 0), ans(q);
  int idx = 0;
  FOR(i, 1, n + 1) {
    bit.add(i);
    if (pre[c[i]]) bit.add(pre[c[i]], -1);
    pre[c[i]] = i;
    while (idx < q && p[idx].first == i) {
      int ret = p[idx].second;
      ans[ret] = bit.sum(r[ret]) - bit.sum(l[ret]);
      idx++;
    }
  }
  rep(i, q) cout << ans[i] << '\n';
  




  
  return 0;
}

Measured memory_bytes: 19356
S = input()
mod = 10**9+7
dp = [[0]*13 for _ in range(len(S)+1)]
dp[0][0] = 1

for i, s in enumerate(S[::-1], start=1):
    m = pow(10, i-1, 13)
    if s=="?":
        for k in range(13):
            for j in range(10):
                dp[i][(j*m+k)%13] += dp[i-1][k]
    else:
        j = int(s)
        for k in range(13):
            dp[i][(j*m+k)%13] += dp[i-1][k]
    
    for j in range(13):
        dp[i][j] %= mod

print(dp[-1][5])


Measured memory_bytes: 62300
#include <iostream>
#include <map>
#
#include <algorithm>
using namespace std;

int main(void){
  int n;
  cin>>n;
  int a;
  map<int,int> m;
  for(int i=0;i<n;i++)cin>>a,m[a]++;
  int c=0;
  for(auto it=m.begin();it!=m.end();it++){
    if(it->first-it->second>0)c+=it->second; //5 2
    else c+=it->second-it->first; // 4 8
  }
  cout<<c<<endl;
  return 0;
}

Measured memory_bytes: 4736
fn solve(src: &str) -> String {
    let mut sc = Scanner::from_str(src);
    
    let n: usize = sc.read();
    let a: usize = sc.read();
    let b: usize = sc.read();
    let ans: usize = (0..n)
        .map(|_| sc.read::<usize>())
        .scan(0, |pre, x| {
            let ret = x - *pre;
            *pre = x;
            Some(ret)
        })
        .skip(1)
        .map(|d| std::cmp::min(a*d, b))
        .sum();
    
    format!("{}\n", ans)
}

fn main() {
    let mut buf = String::new();
    use std::io::{Read, Write};
    std::io::stdin().read_to_string(&mut buf).unwrap();
    std::io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}
struct Scanner<'a>(std::str::SplitWhitespace<'a>);
impl<'a> Scanner<'a> {
    fn from_str(src: &str) -> Scanner {
        Scanner(src.split_whitespace())
    }
    fn get(&mut self) -> &str {
        self.0.next().expect("No Input")
    }
    fn read<T: std::str::FromStr>(&mut self) -> T {
        self.get().parse().ok().expect("Parse Error")
    }
}

Measured memory_bytes: 4352
using System;
namespace HelloWorld
{
    class Program
    {
        static void Main()
        {
            const int MAX_X = 600;
            string line;
            while ((line = Console.ReadLine()) != null)
            {
                long result = 0;
                int d = int.Parse(line);
                for (int i = d; i < MAX_X; i += d)
                {
                    result += i * i * d;
                }
                Console.WriteLine(result);
            }
        }
    }
}


Measured memory_bytes: 13836
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(n); i++)
int main(){
    int n; cin >> n;
    int r = 0;
    int minv = INT_MAX;
    int maxv = INT_MIN;
    rep(i, n){
        cin >> r;
      	maxv = max(maxv, r-minv);
        minv = min(r, minv);
    }
  cout << maxv << endl;
}


Measured memory_bytes: 3096
n=int(input()) ; n+=1
A=list(map(int,input().split()))
if n==1:
    if A[0]==1: print(1);exit()
    print(-1);exit()
if A[0]!=0:print(-1);exit()
ANS=[0]*n ;ANS[0]=1
R=[0]*n
for i in range(n-2,-1,-1):
    R[i]=R[i+1]+A[i+1]
#print(R)
for i in range(1,n):
    ANS[i]=min(ANS[i-1]*2-A[i], R[i])
    if ANS[i]<0:print(-1);exit()
print(sum(A)+sum(ANS))


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

int main()
{
  char a[8], b[4];
  int num;
  scanf("%s %s", a, b);
  strcat(a, b);
  num = atoi(a);
  printf("%s", num % (int)sqrt(num) == 0 ? "Yes" : "No");
  return 0;
}

Measured memory_bytes: 128
import math


a, b, x = map(int, input().split())

if x >= (a**2 * b) / 2:
    t = (2 * a**2 * b - 2 * x) / a**3
else:
    t = (a * b**2) / (2 * x)

print(math.degrees(math.atan(t)))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
vector<ll>A;
using Graph=vector<vector<ll>>;
ll N,M;
int main(){
  cin>>N>>M;
  Graph G(N);
  A.resize(N,-1);
  for(ll i=0;i<M;i++){
  ll u,v;cin>>u>>v;u--;v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }bool judge=true;
  queue<ll>que;que.push(0);
  A[0]=0;
  while(!que.empty()){
  ll v=que.front();que.pop();
    for(auto u:G[v]){
    if(A[u]==A[v]){judge=false;break;}
      if(A[u]!=-1)
               continue;
               A[u]=1-A[v];
               que.push(u);
    }
  if(!judge)break;
  
  }
  if(!judge)
               cout<<((N*(N-1))/2)-M<<endl;
               else{
               ll sum=0;
                 for(ll i=0;i<N;i++)
                   if(A[i]==0)
                     sum+=1;
                 cout<<(sum*(N-sum))-M<<endl;
                }
  return 0;
}


Measured memory_bytes: 10124
n;main(r,i){
scanf("%d",&n);r=n;
for(i=2;i*i<=n;i++)if(n%i==0)for(r=1LL*r*(i-1)/i;n%i==0;n/=i);
if(--n)r=1LL*r*n/++n;
n=!printf("%d\n",r);
}

Measured memory_bytes: 592
#include<iostream>
using namespace std;
const int MAXN=101,MAXVS=100000,MAXW=1000000001;
int n,W,w[MAXN],v[MAXN],f[MAXN][MAXVS+1],ans;
int main(){
	cin>>n>>W;
	for(int i=1;i<=n;i++){
		cin>>w[i]>>v[i];
	}
	for(int j=1;j<=MAXVS;j++){
		f[0][j]=MAXW;
	}
	for(int i=1;i<=n;i++){
		for(int j=0;j<v[i];j++){
			f[i][j]=f[i-1][j];
		}
		for(int j=v[i];j<=MAXVS;j++){
			f[i][j]=min(f[i-1][j],f[i-1][j-v[i]]+w[i]);
		}
	}
	for(int j=MAXVS;j>=0;j--){
		if(f[n][j]<=W){
			cout<<j;
			break;
		}
	}
    return 0;
}

Measured memory_bytes: 39680
#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 ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

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

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

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int main() {
	string s;
	cin >> s;
	
	set<char> ss;
	REP(i, s.size()) ss.insert(s[i]);
	
	if (s.size() == ss.size()) puts("yes");
	else puts("no");
	return 0;
}


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


ll n, a[111], mn = 1e18;


int main() {
#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	/*freopen("output.txt", "w", stdout);*/
#endif

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

	for(int i = -100; i < 101; ++i) {
		ll sum = 0;
		for(int j = 0; j < n; ++j) {
			sum += (a[j] - i) * (a[j] - i);
		}
		mn = min(sum, mn);
	}
	cout << mn;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

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

typedef long long ll;

int main()
{
	/*int n, m;
	cin >> n >> m;
	if (n == m)puts("Yes");
	else puts("No");*/


	/*int a, b;
	cin >> a >> b;
	int ma = max(a, b);
	int mi = min(a, b);
	rep(i, ma) {
		cout << mi;
	}*/


	int n;
	cin >> n;
	vector<int>p(n);
	rep(i, n)cin >> p[i];
	int ans = 0;
	int mi = p[0];
	rep(i, n) {
		mi = min(p[i], mi);
		if (p[i] <= mi)ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define endl '\n'
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ull unsigned long long
#define int long long
#define iter vector<int>::iterator
using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

template<class T>
using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd1(chrono::steady_clock::now().time_since_epoch().count());

//find_by_order
//order_of_key

const int N=2e5+7;
const int inf=1e18+5;
const int mod=2520;

main ()
{
    ios;
    int k,x;
    cin>>k>>x;
    for (int i=x-k+1;i<=x+k-1;++i){
        cout<<i<<' ';
    }
}


Measured memory_bytes: 256
N=int(input())
#奇数なら0は続かない
#偶数なら続く
#2よりも5の倍数の方が多いはずだから5の個数を数えれば良い
if N%2==1:
    print(0)
else:
    ans=N//10
    for i in range(1,30):
        ans+=((N//10)//(5**i))
    print(ans)

Measured memory_bytes: 38492
#include <stdio.h>

int main(void){
	int a,b;

	scanf("%d %d",&a,&b);

	if(a>b){
		printf("a > b\n");
	}else if(a<b){
		printf("a < b\n");
	}else{
		printf("a == b\n");
	}

}


Measured memory_bytes: 2060
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

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

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

int main() {
  int N;
  cin >> N;
  vector<uint64_t> L(N+1);
  L.at(0) = 2;
  L.at(1) = 1;
  for(int i=2;i<=N;i++)L.at(i)=L.at(i-2)+L.at(i-1);
  cout << L.at(N) << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	n, q := SingleInt(), SingleInt()

	s := SingleStr()
	ss := make([]string, 0, n)
	ss = strings.Split(s, "")

	temp := make([]int, n+1, n+1)

	l := len(ss)
	var c int
	for idx := 1; idx < l; idx++ {
		if ss[idx-1] == "A" && ss[idx] == "C" {
			c++
			temp[idx] = c
			continue
		}
		temp[idx] = c
	}
	// fmt.Printf("%#v\n", ss)
	// fmt.Printf("%#v\n", temp)

	for index := 0; index < q; index++ {
		s, e := SingleInt(), SingleInt()
		fmt.Println(temp[e-1] - temp[s-1])
	}

}

func SingleInt() int {
	var n int
	fmt.Scan(&n)
	return n
}

func SingleStr() string {
	var s string
	fmt.Scan(&s)
	return s
}


Measured memory_bytes: 6272