akhauriyash/Code-Regression huggingface dataset:
package main

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

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	N := sc.nextInt()
	L := sc.nextIntSlice(N)
	sort.Ints(L)
	count := 0
	for i := 0; i < N-2; i++ {
		for j := i + 1; j < N-1; j++ {
			sum := L[i] + L[j]
			isOk := func(m int) bool {
				if sum > L[m] {
					return true
				}
				return false
			}
			ng, ok := len(L), j
			for abs(ok-ng) > 1 {
				mid := (ok + ng) / 2
				if isOk(mid) {
					ok = mid
				} else {
					ng = mid
				}
			}
			count += ok - (j + 1) + 1
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll a;
  string b;
  cin >> a >> b;
  ll x=100*(b[0]-'0')+10*(b[2]-'0')+b[3]-'0';
  a*=x;
  a/=100;
  cout << a << endl;
return 0;}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807int
#define I64_MAX2 1223372036854775807int
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define Aint(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


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

int gcd(int a,int b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(a%b,b);
}
//solve

void solve(void)
{
  int A,B;
  cin>>A>>B;
  int X = gcd(A,B);
  map<int,int> P = prime_factor(X);
  cout<<P.size()+1<<endl;
  
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1LL << 60;
constexpr int INF = 1000000007;
const double INFD = 1e100;
const int mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i=0; i<N; i++){
    cin >> a[i];
  }
  int cnt=1;
  for(int i=0; i<N; i++){
    if(a[i] == cnt){
      cnt++;
    }
  }
  if(cnt == 1){
    cout << -1 << endl;
  }else{
    cout << N-(cnt-1) << endl;
  }
  return 0;
}


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

N, K = map(int, input().split())
a = [0] * N
b = [0] * N

for i in range(N):
    a[i], b[i] = map(int, input().split())

a, b = zip(*sorted(zip(a, b)))

for i in range(N):
    K -= b[i]
    if K <= 0:
        print(a[i])
        exit()

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

using namespace std;
#define ll long long
#define pb push_back

int main()
{
	int n, m, x;
	cin >> n >> m >> x;
	int arr[n];
	memset(arr, 0, sizeof(arr));
	for(int i=0; i<m; i++) {
		int x;
		cin >> x;
		arr[x-1]++;
	}
	int cnt1 = 0, cnt2 = 0;
	for(int i=0; i<x; i++) {
		cnt1 += arr[i];
	}
	for(int i=x; i<n; i++) {
		cnt2 += arr[i];
	}
	cout << min(cnt1, cnt2) << endl;
	return 0;
}



Measured memory_bytes: 3588
using System;
using System.Linq;

namespace _0583
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Array.Sort(x);
            if (n == 2)
            {
                for (int i = 1; i <= x[0]; i++)
                {
                    if (x[0] % i == 0 && x[1] % i == 0)
                    {
                        Console.WriteLine(i);
                    }
                }
            }
            else
            {
                for (int i = 1; i <= x[0]; i++)
                {
                    if (x[0] % i == 0 && x[1] % i == 0 && x[2] % i == 0)
                    {
                        Console.WriteLine(i);
                    }
                }
            }
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9604
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char x;
  cin >> x;
  
  if (x=='a' || x=='e' || x=='i' || x=='o' || x=='u')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int c,p;
int main()
{ cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin>>c>>p;
  if(p%2==1 || 2*c>p || p>4*c)
     cout<<"No\n";
  else
     cout<<"Yes\n";
  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,n) for(int (i)=0;(i) < (n); (i)++)

int main(){
    long long int h,w; cin >> h >> w;
    long long int mul = (long long) h * w;
    if((mul % 3) == 0){cout << 0 << endl; return 0;}
    long long int ans = 10000000000;
    for(int i=1;i<h;i++){
        long long a = i * w;
        long long int hh = h - i;
        long long b = w*(hh/2);
        long long t = max(abs(a - b), (long long)w*(hh%2));
        t = max(abs(a - (mul - a - b)), t);
        ans = min(ans,  t);
        b = (w/2)*hh;
        t = max(abs(a - b), (long long)hh*(w%2));
        t = max(abs(a - (mul - a - b)), t);
        ans = min(ans,t);
    }
    swap(h,w);
    for(int i=1;i<h;i++){
        long long a = i * w;
        long long hh = h - i;
        long long b = w*(hh/2);
        long long t = max(abs(a - b), (long long)w*(hh%2));
        t = max(abs(a - (mul - a - b)), t);
        ans = min(ans,  t);
        b = (w/2)*hh;
        t = max(abs(a - b), (long long)hh*(w%2));
        t = max(abs(a - (mul - a - b)), t);
        ans = min(ans,t);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int d[100];
int main()
{
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());
	printf((s < t) ? "Yes\n" : "No\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
   
  int N, a;
  cin >> N >> a;
  
	int sum = 0;
  for(int i = 0; i < N; i ++){
    
    int x;
    cin >> x;
    
    int y = x * 2;
    int z = (a - x) * 2;
    
    sum += min(y,z);
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
import numpy as np

W, H, N = map(int, input().split())

ze = np.ones((W, H))

for i in range(N):
    x, y, a = map(int, input().split())

    if a == 1:
        ze[:x, :] = 0
    elif a == 2:
        ze[x:, :] = 0
    elif a == 3:
        ze[:, :y] = 0
    elif a == 4:
        ze[:, y:] = 0

print(np.sum(ze))

Measured memory_bytes: 12540
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;



template<class T>
struct StarrySkyTree {
    using int_type = T;
    vector<T> data1;
    vector<T> data2;
    vector<T> lazy;
    int N;
    StarrySkyTree(int n) {
        N=1;
        while(N<n) N<<=1;
        data1.assign(2*N-1, 0);
        data2.assign(2*N-1, 0);
        lazy.assign(2*N-1, 0);
    }
    // [a,b)
    void add(int a,int b, int_type val) {
        //printf("add: [%d,%d) + %lld\n",a,b,val);
        add(a,b,val,0,0,N);
    }
    int_type getMax(int a,int b) {
        return getMax(a,b,0,0,N);
    }
    int_type getMin(int a,int b) {
        return getMin(a,b,0,0,N);
    }

    void add(int a,int b,int_type val, int k,int l,int r) {
        if(r<=a || b<=l) return;
        if(a<=l && r<=b) {
            lazy[k]+=val;
            return;
        }
        add(a,b,val,k*2+1,l,(l+r)/2);
        add(a,b,val,k*2+2,(l+r)/2,r);
        data1[k]=max(data1[k*2+1]+lazy[k*2+1], data1[k*2+2]+lazy[k*2+2]);
        data2[k]=min(data2[k*2+1]+lazy[k*2+1], data2[k*2+2]+lazy[k*2+2]);
    }

    int_type getMax(int a,int b, int k,int l, int r) {
        if(r<=a || b<=l) return -INF;
        if(a<=l && r<=b) return data1[k]+lazy[k];
        int_type lval = getMax(a,b,k*2+1,l,(l+r)/2);
        int_type rval = getMax(a,b,k*2+2,(l+r)/2,r);
        return max(lval, rval)+lazy[k];
    }
    int_type getMin(int a,int b, int k,int l, int r) {
        if(r<=a || b<=l) return INF;
        if(a<=l && r<=b) return data2[k]+lazy[k];
        int_type lval = getMin(a,b,k*2+1,l,(l+r)/2);
        int_type rval = getMin(a,b,k*2+2,(l+r)/2,r);
        return min(lval, rval)+lazy[k];
    }
};


int N;
int S[500005];
int Q;
int main() {
    StarrySkyTree<ll> sst(500005);
    cin>>N;
    rep(i,N) cin>>S[i];
    rep(i,N/2) sst.add(i,i+1,S[i]-S[N-i-1]);
    cin>>Q;
    while(Q--) {
        int x,y,z;
        cin>>x>>y>>z;
        x--,y--;
        if(y<N/2) {
            sst.add(x,y+1,z);
        }
        else if(N/2<x) {
            int a=N-y-1;
            int b=N-x-1;
            sst.add(a,b+1,-z);
        }
        else {
            sst.add(x,N/2,z);
            sst.add(N-y-1,N/2,-z);
        }
        auto a=sst.getMin(0,N/2);
        auto b=sst.getMax(0,N/2);
        if(!a&&!b) cout<<"1"<<endl;
        else cout<<"0"<<endl;
    }
    return 0;
}

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

int main(){
  string p, s;
  cin >> s;
  cin >> p;
  while(s.size() <= 100) s += s;
  if(s.find(p) != string::npos) cout << "Yes" << endl;
  else cout << "No" << endl;
}



Measured memory_bytes: 3212
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeSet;

import javax.swing.*;


import static java.util.Arrays.binarySearch;
import static java.util.Arrays.copyOfRange;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    private static int mod = 998244353;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        //String s = in.next();
        //out.println(s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5) ? "Yes" : "No");
        int k = in.nextInt();
        int n = in.nextInt();
        int[] a = new int[n];
        int ans = k;
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        for (int i = 1; i < n; i++) {
            ans = Math.min(ans, k - a[i] + a[i - 1]);
        }
        ans = Math.min(ans, a[n - 1] - a[0]);
        out.println(ans);
    }


}



class InputReader {

    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

}


Measured memory_bytes: 47316
//
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define speed ios::sync_with_stdio(false)
using namespace std;

string gs(char x){
    string s(1,x);
    return s;
}

int main()
{
	speed;
	
	string s;
	cin>>s;
	ll l=s.length();

	if(s[0]=='A'){
		ll cnt=0;
		for(ll i=2;i<(l-1);i++)
		{
			if(s[i]=='C')
				cnt++;
		}
		if(cnt==1){
			cnt=0;
			for(ll i=0;i<l;i++){
				if(s[i]<97)
					cnt++;
			}
			if(cnt==2){
				cout<<"AC";
			}
			else{
				cout<<"WA";
			}
		}
		else{
			cout<<"WA";
		}
	}else{
		cout<<"WA";
	}


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main ()
{
    ll n,d,c=0;
    cin>>n>>d;
    while(n--)
    {
        ll x,y;
        cin>>x>>y;
        double d1=sqrt(x*x + y*y);
        if(d1<=d)
        {c++;}
    }
    cout<<c<<endl;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 1; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;

int main(){
   int n;
   scanf("%d",&n);
   n = n*n*n;
   printf("%d",n);
}
   

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int N;
    cin >> N;
    REP(i, N / 4 + 1) {
        if ((N - 4 * i) % 7 == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
/* 
 * Project: AtCoder Beginners Contest 168 A - ∴ (Therefore)
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/05/17
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cmath>
#include <string>
#include <iostream>
using namespace std;

string n;

void solve() {

    switch (n[n.size()-1]) {
        case '2':
        case '4':
        case '5':
        case '7':
        case '9':
            printf("hon\n");
            break;
        case '0':
        case '1':
        case '6':
        case '8':
            printf("pon\n");
            break;
        case '3':
            printf("bon\n");
            break;
        default:
            break;
    }
    return;
}

int main() {

    cin >> n;

    solve();

}

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

int main()
{
    int a, b;
    cin >> a >> b;
    int num = 1;
    int cnt = 0;
    while(num<b){
        cnt++;
        num += a - 1;
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

ll N, M;
vector< vector<pll> > E;
vector<bool> used;
vector<ll> X;

bool dfs(ll v, ll x) {
  if(used[v]) return X[v] == x;
  used[v] = true;
  X[v] = x;

  bool ret = true;
  for(pll p : E[v]) {
    ll u = p.first, d = p.second;
    ret = ret && dfs(u, x + d);
  }
  return ret;
}

int main(void) {
  cin >> N >> M;
  E.resize(N);
  REP(i, 0, M) {
    ll L, R, D;
    cin >> L >> R >> D;
    L--;
    R--;
    E[L].push_back(pll(R, +D));
    E[R].push_back(pll(L, -D));
  }

  bool ans = true;
  used.resize(N, false);
  X.resize(N);
  REP(i, 0, N) if(!used[i]) ans = ans && dfs(i, 0);
  cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 15616
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      final int numMax = 999_999;
      String line;
      int num;
      int result;

      List<Integer> prime = new ArrayList<>(100_000);
      prime.add(2);
      for ( int i = 3; i != numMax; i+=2 ) {
        if( isPrime(i,prime) ) {
          prime.add(i);
        }
      }

      while(true) {

        if( ((line = br.readLine()) == null) || line.isEmpty() ) break;

        num = Integer.parseInt(line);
        if( num == 0 || num == 1) {
          result = 0;
          System.out.println(result);
          continue;
        }
        
        result = 1;
        for ( int i = 3; i <= num; i+=2 ) {
          if( isPrime(i,prime) ) {
            result += 1;
          }
        }
        System.out.println(result);
      }
    }
  }

  public static boolean isPrime(int num,List<Integer> prime) {
    int k = Double.valueOf( Math.sqrt(num) ).intValue();
    for(Integer i: prime) {
      if ( num % i == 0 ) return false;
      if ( i > k ) return true;
    }
    return true;
  }
}


Measured memory_bytes: 38480
N=int(input())
li=[0,0,0,0,0]
for i in range(N):
    S=input()
    if S[0]=="M":
        li[0]+=1
    if S[0]=="A":
        li[1]+=1
    if S[0]=="R":
        li[2]+=1
    if S[0]=="C":
        li[3]+=1
    if S[0]=="H":
        li[4]+=1
lim=0
for j in range(5):
    if li[j]!=0:
        lim+=1
temp=1   
li.sort(reverse=True)
ans=0
if lim==3:
    ans=li[0]*li[1]*li[2]
elif lim==4:
    lis=[[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
    for l in range(4):
        for m in range(3):
            temp*=li[lis[l][m]-1]
        ans+=temp
        temp=1
        
elif lim==5:
    lis=[[1,2,3],[1,2,4],[1,2,5],[1,3,4],[1,3,5],[1,4,5],[2,3,4],[2,3,5],[2,4,5],[3,4,5]]
    for l in range(10):
        for m in range(3):
            temp*=li[lis[l][m]-1]
        ans+=temp
        temp=1
        
else:
    ans=0

print(ans)


Measured memory_bytes: 9332
SA,SB,SC = input(),input(),input()
a = b = c = 0
last = 'a'
while True:
    if last == 'a':
        if a >= len(SA):
            print('A')
            exit()
        last = SA[a]
        a += 1
    elif last == 'b':
        if b >= len(SB):
            print('B')
            exit()
        last = SB[b]
        b += 1
    else:
        if c >= len(SC):
            print('C')
            exit()
        last = SC[c]
        c += 1

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int64_t a,f=0;
  cin >> a;
  while(1){
    for(int i=2; i<=sqrt(a);i++){
      if(a%i==0){
        f=1;
        break;
      }
    }
    if(f==0){
      cout << a << endl;
      break;
    }
    f=0;
    a = a + 1;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;
 
void solve()
{
	int k;
	string s,g="";
	cin>>k;
	cin>>s;
	for(int i=0;i<min(k,(int)s.length());i++)
	{
		g+=s[i];
	}
	if((int)s.length()>k)
		g+="...";
	cout<<g;
}
 
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
    NFS
 	int t=1;
 	//cin>>t;
 	while(t--)
 	{
 		solve();
 	}
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
int main(){
    string s;
    cin>>s;
    int ans=0,n=s.length();
    REP(i,n/2){
        if(s[i]-s[n-1-i]!=0) ans++;
    }
    cout<<ans<<endl;
}

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

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll n;
  cin >> n;
  ll mx = inf;
  ll ans = 0 ;
  for(ll i = 0; i < n; i++) {
    ll tp;
    cin >> tp;
    if(mx >= tp) ans++;
    mx = min(mx, tp);
  }
  cout << ans << endl;
  return 0;
} //good night.

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

int main()
{
    long long n,m;
    cin>>n>>m;
    long long a[n];
    priority_queue<long long> pq;
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        pq.push(a[i]);
    }
    while(m>0)
    {
        long long x=pq.top();
        pq.pop();
        x/=2; m--;
        pq.push(x);
    }
    long long ans=0;
    while(!pq.empty())
    {
        ans+=pq.top();
        pq.pop();
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1912
import sys
from collections import Counter
N = int(input())

A = list(map(int,input().split()))
L = []
R = []
for i in range(N):
  L.append(A[i]+i+1)
  R.append(i+1 - A[i])
L.sort()
R.sort()
R = Counter(R)

cnt = 0
for i in range(N):
  cnt += R[L[i]]

print(cnt)

Measured memory_bytes: 50732
n, m, q = gets.split.map(&:to_i)
set = q.times.map {gets.split.map(&:to_i)}

maximum = 0

[*1..m].repeated_combination(n) do |seq|
  score = set.select {|a, b, c, d| seq[b - 1] - seq[a - 1] == c}.sum {_4}
  maximum = [maximum, score].max
end

puts maximum

Measured memory_bytes: 15480
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using lnt = long long int;
using Graph = vector<vector<int>>;
using Wgraph = vector<vector<pair<int, long long int>>>;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;
long long int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
long long int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

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;}
inline void yes(){ cout << "yes" << endl; }
inline void Yes(){ cout << "Yes" << endl; }
inline void YES(){ cout << "YES" << endl; }
inline void no(){ cout << "no" << endl; }
inline void No(){ cout << "No" << endl; }
inline void NO(){ cout << "NO" << endl; }
inline void possible(){ cout << "possible" << endl; }
inline void Possible(){ cout << "Possible" << endl; }
inline void POSSIBLE(){ cout << "POSSIBLE" << endl; }
inline void impossible(){ cout << "impossible" << endl; }
inline void Impossible(){ cout << "Impossible" << endl; }
inline void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = 1; i <= (n); i++)
#define DREP(i,n) for(int i = (n)-1; i >= 0; i--)
#define SREP(i,s,t) for(int i = s; i < t; i++)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define PB push_back



/* do your best */

int main() {
  
  int a, b; cin >> a >> b;
  cout << (a ^ b) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s;
  ll k;
  cin >> s >> k;
  rep(i,s.size()) {
    k--;
    if(!k||s[i]!='1') {
      pr(s[i]);
      return;
    }
  }
}

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


Measured memory_bytes: 256
# 入力
S = str(input())
T = str(input())

ans = len(T)

for i in range(len(S) - len(T) + 1):
    count = 0
    for j in range(len(T)):
        if (S[i + j] != T[j]):
            count += 1
    if (ans > count):
        ans = count

print(ans)

Measured memory_bytes: 9116
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	N, A, B := sc.nextInt(), sc.nextInt(), sc.nextInt()
	q := N / (A + B)
	r := N % (A + B)

	fmt.Fprintln(wtr, q*A+min(r, A))
}


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

int main() {
  string S, T;
  int A, B;
  string U;
  cin >> S >> T >> A >> B >> U;
  if(U==S) {cout << A-1 << " " << B << endl;}
  if(U==T) {cout << A << " " << B-1 << endl;}
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(map(int, input().split()))
counter = {}
for a in A:
    if a in counter:
        counter[a] += 1
    else:
        counter[a] = 1
for _ in range(M):
    B, C = map(int, input().split())
    if C in counter:
        counter[C] += B
    else:
        counter[C] = B
sortedCounter = sorted(counter.items(), reverse=True)
sumResult = 0
for count in sortedCounter:
    if count[1] >= N:
        sumResult += count[0] * N
        break
    else:
        sumResult += count[0] * count[1]
        N -= count[1]
print(sumResult)

Measured memory_bytes: 40736
R, G, B, N = map(int,input().split())

cnt = 0
for r in range(0,N//R+1):
    for g in range(0,(N-R*r)//G+1):
        if (N - R*r - G*g) % B == 0 :
            #print(r,g,(N-r-g))
            cnt += 1

print(cnt)

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

int main(){
  int n,f=0,f1=0;
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='C'&&!f)f=1;
    if(s[i]=='F'&&f&&!f1)f1=1;
  }
  if(f1)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n;
	vector<int> v(n);
	for( auto &k : v ) cin >> k;
	sort( v.begin(), v.end() );
	double prev = (double)v[0];
	for( int i = 1; i < n; ++i ) prev = (prev+(double)v[i])/2.0;
	cout << fixed << setprecision(10) << prev << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
#define ll long long
inline int d(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll lld(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}//#########################################

int main(){
    int n=d();
    int a[n];
    int x[n];
    for(int i=0;i<n;i++){
        a[i]=d();
        x[i]=a[i]-(i+1);
    }
    sort(x,x+n);
    int b=x[n/2];
    ll sum=0;
    for(int i=0;i<n;i++){
        sum+=abs((1ll*x[i]-1ll*b));
    }
    cout<<sum;

}



Measured memory_bytes: 1920
def main():
    while True:
        N = input()    
        if N == 0:
            break
        points = [Vector(map(int, raw_input().split())) for _ in xrange(N)]
        seq = [Vector([0, -1]), Vector([0, 0])]
        while len(points) != 0:
            pre = seq[-1] - seq[-2]
            points.sort(key=lambda x: abs(x-seq[-1]), reverse=True)
            points.sort(key=lambda x: (x-seq[-1]).norm() * pre.norm())
            seq += [points.pop()]
        print round(sum(abs(v2 - v1) for v1, v2 in zip(seq[1:], seq[2:])), 1)

class Vector(tuple):

    def __neg__(self):
        return Vector([-x for x in self])

    def __abs__(self):
        return sum(x ** 2 for x in self) ** 0.5

    def __add__(self, v):
        if len(self) != len(v):
            raise ValueError, "Same dimension is required."
        return Vector([x1 + x2 for x1, x2 in zip(self, v)])

    def __sub__(self, v):
        return self.__add__(-v)
    
    def norm(self):
        a = self.__abs__()
        return Vector([x / a for x in self])

    def __mul__(self,  v):
        """dot product"""
        if len(self) != len(v):
            raise ValueError, "Same dimension is required."
        return round(sum(x1 * x2 for x1, x2 in zip(self, v)), 14)

if __name__ == "__main__":
    main()

Measured memory_bytes: 4440
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a[100], n;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=n-1;i>=0;i--){
        cout << a[i];
        if(i == 0){
            cout << endl;
        }
        else{
            cout << " ";
        }
    }
    return 0;
}


Measured memory_bytes: 3108
N, K, Q = map(int, input().split())
#print(N, K, Q)
listq = [0]*N
for i in range(Q):
    ai = int(input())
    listq[ai-1] += 1
#print(listq)    
for n in range(N):
    num = listq[n]
    ansn = K - Q + num
    if ansn>0:
        print('Yes')
    else:
        print('No')    

Measured memory_bytes: 4680
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

string s;
bool vis[30],vis2[30][30];

int main()
{
	cin>>s;
	if(s.size()<26)
	{
		rep(i,s.size()) vis[s[i]-'a']=true;
		rep(i,26)
		{
			if(!vis[i])
			{
				cout<<s<<(char)(i+'a')<<endl;
				rt0;
			}
		}
	}
	else
	{
		rep(i,s.size())
		{
			if(i>0) rep(j,28) vis2[i][j]=vis2[i-1][j];
			vis2[i][s[i]-'a']=true;
		}
		for(int i=s.size()-1;i>=0;i--)
		{
			if(s[i]=='z') continue;
			for(int j=1;s[i]-'a'+j<=25;j++)
			if(!vis2[i][s[i]-'a'+j])
			{
				s[i]+=j;
				cout<<s.substr(0,i+1)<<endl;
				rt0;
			}
		}
		puts("-1");
	}
	rt0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,i=0,r,l,k,ans[100010]={};
  char c='L';
  string s;
  cin >> s;
  n=s.size();
  while (i<n)
  {
    r=0;
    while (s[i]=='R')
	{
      i++;
      r++;
    }
    k=i;
    l=0;
    while (s[i]=='L' && i<n)
	{
      i++;
      l++;
    }
    ans[k-1]=(r+1)/2+l/2;
    ans[k]=r/2+(l+1)/2;
  }
  for (i=0;i<n;i++)
  {
    cout << ans[i];
    if (i==n-1) cout << endl;
    else cout << ' '; 
  }
  return 0;
}

Measured memory_bytes: 1024
N, M = map(int, input().split())
anses = [0] * M
pre = [0] * N
 
for idx in range(M):
    p, y = (int(x) for x in input().split())
    anses[idx] = [idx, p, y, 0]

anses = sorted(anses, key=lambda x: x[2])

for ans in anses:
    pre[ans[1]-1] += 1
    ans[3] = pre[ans[1]-1]

anses = sorted(anses, key=lambda x: x[0])

for ans in anses:
    print('{:0=6}{:0=6}'.format(ans[1], ans[3]))

Measured memory_bytes: 30620
import math
n=int(input())
l=math.floor(math.sqrt(n))
k=math.floor(math.log10(n))+1
#print(k)
#print(math.log10(n))
for i in range(2,l+1):
    if n%i==0:
        a,b=i,n//i
        x=max(math.floor(math.log10(a))+1,math.floor(math.log10(b))+1)
        k=min(x,k)
print(k)


Measured memory_bytes: 3060
#include <stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    int x=1;
    int y;
    int z;
    int ans=0;
    scanf("%d",&z);
    for(int i=1;i<n;i++){
        scanf("%d",&y);
        if(y==z)x++;
        if(y!=z){
            ans+=x/2;
            x=1;
            z=y;
        }
    }
    ans+=x/2;
    printf("%d\n",ans);
}


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

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main() {
    let mut ans = 0;
    let mut min = 10;

    for _ in 0..5 {
        let dish: i32 = read();
        let mod_num = dish % 10;
        let div_num = dish / 10;
        if mod_num != 0 {
            min = std::cmp::min(min, mod_num);
            ans += (div_num + 1) * 10;
        }else{
            ans += div_num * 10;
        }
    }

    println!("{}", ans - (10 - min));
}


Measured memory_bytes: 2108
/*
    Reference :-
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forn1(i, n) for (int i = 1; i < int(n); i++)
#define PI pair<int,int>
#define all(vec) vec.begin(),vec.end()
ll mod=1e9+7;
ll fac[100001];
ll power(ll n,ll k){
    ll ans=1;
    while(k){
        if(k&1)ans=(ans*n)%mod;
        k/=2;
        n=(n*n)%mod;
    }
    //ans=(ans-1+mod)%mod;
    return ans;
}
bool comp(PI a,PI b){
    return b.F<a.F;
}

int main(){
    //std::ios::sync_with_stdio(false);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    int ar[n];
    forn(i,n){
        cin>>ar[i];
    }
    int dp[n];
    dp[0]=ar[0];
    forn1(i,n){
        if(ar[i]<dp[i-1])dp[i]=ar[i];
        else dp[i]=dp[i-1];
    }
    int ans=0;
    forn(i,n)if(ar[i]<=dp[i])ans++;
    cout<<ans;

	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>
 
 
int main()
{
    int n; std::cin >> n;
    bool flag = false;
    for(int i=1; i<10; i++)
    {
        for(int j=1; j<10; j++)
        {
            if(i*j==n) flag = true;
        }
    }
    std::cout << ((flag)?"Yes\n":"No\n");
    return 0;
}

Measured memory_bytes: 256
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var K = int.Parse(Console.ReadLine());
            var AB = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var result = false;
            for (int i = AB[0]; i <= AB[1]; i++)
            {
                if ((i % K) == 0)
                {
                    result = true;
                    break;
                }
            }
            Console.WriteLine(result ? "OK" : "NG");
        }
    }
}


Measured memory_bytes: 27480
package main

import (
	"fmt"
)

func main() {
	var r, g, b int
	var ans string
	fmt.Scan(&r, &g, &b)

	if (100*r+10*g+b)%4 == 0 {
		ans = "YES"
	} else {
		ans = "NO"
	}

	fmt.Println(ans)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  int n,l;
  cin >> n >> l;
  int nowA,nextA;
  cin >> nextA;
  for(int i=1;i<n;i++){
    nowA = nextA;
    cin >> nextA;
    if(nowA+nextA>=l){
      cout << "Possible" << endl;
      for(int j=1;j<i;j++) cout << j << endl;
      for(int j=n-1;j>i;j--) cout << j << endl;
      cout << i << endl;
      return 0;
    }
  }
  cout << "Impossible" << endl;
  return 0;
}


Measured memory_bytes: 768
n = raw_input()
s = raw_input()
stack = []
for l in s:
    stack.append(l)
    if stack[-2:] == ["(", ")"]:
        stack.pop()
        stack.pop()
for l in stack:
    if l == ")":
        s = "(" + s
    if l == "(":
        s += ")"

print s


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

using namespace std;

int main(void) {
	int n;
	long long int total = 0;
	long long int p, q;

	cin >> n;

	vector<int> a(n), b(n), c(n);

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

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

	for (int i = 0; i < n; i++) {
		p = upper_bound(a.begin(), a.end(), b[i] - 1) - a.begin();
		q = c.end() - upper_bound(c.begin(), c.end(), b[i]);
		

		//cout << i << " " << p << " " << q << endl;
		total += p * q;

	}

	cout << total << endl;

	return 0;
}

Measured memory_bytes: 1408
'use strict';
(function(stdin) {
    var inputs = stdin.toString();
    var params = inputs.split('\n')[0].split(' ').map(Number);
    (function(a, b, c) {
        var result = params.sort(function(a, b) {
            if (a < b) return -1;
            if (a > b) return 1;

            return 0;

        })
        console.log(result.join(' '));


        //????????????????????????

    }(params[0], params[1], params[2]));
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 7640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#define INF 1000000009
#define LINF 1000000000000000009
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
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; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

int main() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	vector<ll> b(n + 1);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[a[i]] = i;
	}
	set<int> st;
	st.insert(-1);
	st.insert(n);
	ll ans = 0;
	for (ll i = 1; i <= n; i++) {
		ll k = b[i];
		auto itr = st.lower_bound(k);
		ll r = *itr;
		itr--;
		ll l = *itr;
		ans += (r - k)*(k - l)*i;
		st.insert(k);
	}
	cout << ans << endl;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

bool hantei(string S){
    string Sr = S;
    reverse(Sr.begin(), Sr.end());
    if(S == Sr) return true;
    else return false;
}
int main()
{
    string S;
    cin >> S;
    int N = S.size();
    string Sr = S;
    reverse(Sr.begin(), Sr.end());
    string S3 = S.substr(0,(N-1)/2);
    string S3r = S3;
    reverse(S3r.begin(), S3r.end());
    string S6 = S.substr((N+3)/2-1);
    string S6r = S6;
    reverse(S6r.begin(), S6r.end());
    //cout << S3 << " " << S3r << " " << S6 << " " << S6r << endl;
    if(S == Sr && S3 == S3r && S6 == S6r){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] a = new int[m];
		int[] b = new int[m];
		for(int i = 0 ; i < m ; i++) {
			a[i] = sc.nextInt() - 1;
			b[i] = sc.nextInt() - 1;
		}
		boolean[] bool1 = new boolean[n];
		boolean[] bool2 = new boolean[n];
		for(int i = 0 ; i < m ; i++) {
			if(a[i] == 0) bool1[b[i]] = true;
			if(b[i] == n - 1) bool2[a[i]] = true;
		}
		for(int i = 0 ; i < n ; i++) {
			if(bool1[i] && bool2[i]) {
				System.out.println("POSSIBLE");
				return;
			}
		}
		System.out.println("IMPOSSIBLE");
	}
}


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

int main()
{
	int N;
	scanf("%d", &N);
	std::vector<int> a(N + 1);
	for (int i{1}; i <= N; i++) scanf("%d", &a[i]);
	std::vector<bool> isIn(N + 1);
	for (int i{N}; i > 0; i--)
	{
		int count{};
		for (int j{2 * i}; j <= N; j += i)
			if (isIn[j])
				count++;
		if (count % 2 != a[i])
			isIn[i] = true;
	}
	std::vector<int> ans;
	for (int i{1}; i <= N; i++)
		if (isIn[i])
			ans.push_back(i);
	printf("%d\n", ans.size());
	for (auto& e: ans) printf("%d\n", e);

	return 0;
}

Measured memory_bytes: 2428
fn main() {
    let mut line = String::new();
    let _ = std::io::stdin().read_line(&mut line);
    let x = line.trim().parse::<i32>().unwrap();
    'outer: for i in 0.. {
        for a in -i..(i+1) {
            for b in -i..(i+1) {
                if a*a*a*a*a - b*b*b*b*b == x {
                    println!("{} {}", a, b);
                    break 'outer;
                }
            }
        }
    }
}


Measured memory_bytes: 2120