akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll n;
  cin >> n;
  vi a(n);
  rep(i,n){
    cin >> a[i];
  }
  vi b(n);
  vi c(n);
  b[0] = a[0];
  c[n - 1] = a[n - 1];
  for (ll i = 1; i < n; i++){
    b[i] = gcd(a[i], b[i - 1]);
  }
  for (ll i = n - 2; i >= 0; i--){
    c[i] = gcd(a[i], c[i + 1]);
  }
  ll ans = 0;
  chmax(ans, c[1]);
  chmax(ans, b[n - 2]);
  for (ll i = 1; i < n - 1;i++){
    ll tmp = gcd(b[i - 1], c[i + 1]);
    chmax(ans, tmp);
  }
  print(ans);
}

Measured memory_bytes: 2560
#include <iostream>
#include <fstream>
#include <climits>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <list>

#define FOR(i,n)	for(int i = 0 ; i < n ; i++)
#define FORrev(i,n)	for(int i = n - 1 ; i >= 0 ; i--)
#define ALL(a)		a.begin(),a.end()
#define pii			pair<int , int>
#define mp(a , b)	make_pair(a , b)


typedef long long int ll; 

using namespace std;

int main() {
	int n;
	cin>>n;
	int count = 0;
	double ans = 0.0;
	for(int i = 1 ; i <= n ; i++) {
		if(i % 2 == 1)
			count++;
	}
	ans = (double)count /(double) n;
	cout<<ans;
}

Measured memory_bytes: 256
from fractions import gcd

N = int(input())
A = list(map(int, input().split()))

# 左側の0番目からi番目までの整数のgcd
gcd_left = [0]*N
# 右側のN-1番目からi番目までの整数のgcd
gcd_right = [0]*N

for i in range(N):
  gcd_left[i] = gcd(gcd_left[i-1], A[i]) if i>0 else A[i]
  gcd_right[N-(i+1)] = gcd(gcd_right[N-i], A[N-(i+1)]) if i > 0 else A[N-1]

ans = 0
# i番目の数字を変えたときのgcd
for i in range(N):
  kouho = gcd(gcd_left[i-1] if i>0 else gcd_right[i+1], gcd_right[i+1] if i < N-1 else gcd_left[i-1])
  if ans < kouho:
    ans = kouho
    
print(ans)

Measured memory_bytes: 16124
### subroutines

# <mol> := <atom> | <atom> <num> | '(' <mol> ')' <num> | <mol> <mol>
# <atom> := [A-Z] | [A-Z][a-z]
# <num> := [0-9]+

def mol(str)
  #p "mol"
  m = 0

  while str[$pos] && str[$pos] != ')'
    if str[$pos] >= 'A' && str[$pos] <= 'Z'
      a = atom(str)
      return nil if a.nil?
      if str[$pos] && str[$pos] >= '0' && str[$pos] <= '9'
        n = num(str)
        a *= n
      end
      m += a
    elsif str[$pos] == '('
      $pos += 1
      m0 = mol(str)
      return nil if m0.nil?
      $pos += 1
      n = num(str)
      m += m0 * n
    end
  end

  m
end

def atom(str)
  #p "atom"
  at = str[$pos]
  $pos += 1
  if str[$pos] && str[$pos] >= 'a' && str[$pos] <= 'z'
    at += str[$pos]
    $pos += 1
  end
  $atbl[at]
end

def num(str)
  #p "num"
  n = 0
  while str[$pos] && str[$pos] >= '0' && str[$pos] <= '9'
    n = n * 10 + str[$pos].to_i
    $pos += 1
  end
  n
end

### main

$atbl = {}
loop do
  line = gets.strip
  break if line == 'END_OF_FIRST_PART'

  ai, wi = line.split
  $atbl[ai] = wi.to_i
end
#p $atbl

loop do
  str = gets.strip
  break if str == '0'

  $pos = 0
  m = mol(str)
  puts (m || 'UNKNOWN')
end

Measured memory_bytes: 6104
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  vector<int> v(4);
  int A, B;
  cin >> A >> B;

  v[A]++;
  v[B]++;

  if (v[1] == 0) {
    cout << 1 << endl;
  } else if (v[2] == 0) {
    cout << 2 << endl;
  } else {
    cout << 3 << endl;
  }

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <map>
#include <set>

using namespace std;

#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

typedef long long ll;
typedef long double ld;

const ll SIZE = 1e5 * 3 + 10;
vector <ll> vec;
ll q;

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

int main() {
	fastInp;

	ll n;
	cin >> n;
	
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < n; k++) {
				sum += gcd(i + 1, gcd(j + 1, k + 1));
			}
		}
	}

	cout << sum;
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + (ll)b) % mod
#define MUL(a, b) a = (a * (ll)b) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rer(i, a, b) for(int i = a - 1; i >= b; i--)
#define all(a) (a).begin(), (a).end()
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef pair<int, pi> ppi;
typedef vector<ll> vec;

const int MAX_N = 200010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;

void Debug() {cout << '\n'; }

template<class FIRST, class... REST> 
void Debug(FIRST arg, REST... rest) { cout << arg << " "; Debug(rest...); }

template<class T>
ostream& operator<< (ostream& out, const vector<T>& v) {
	out << "[";
	if(!v.empty()) {
		rep(i, 0, (int)v.size() - 1) out << v[i] << ", ";
		out << v.back();
	}
	out << "]";
  return out;
}

template<class S, class T>
ostream& operator<< (ostream& out, const pair<S, T>& v) {
	out << "(" << v.first << ", " << v.second << ")";
	return out;
}

///g++ -g3 -std=c++0x -DLOCAL -Wall -ftrapv -D_GLIBCXX_DEBUG -Wl,-stack,268435456 -o
///g++ -O2 -std=c++0x -DLOCAL -Wall -Wl,-stack,268435456 -o

////////////////////////////////////////////////////////////////////////

int N;

void solve() {
	cin >> N;
	int a = 114514, b = -1;
	rep(i, 0, N) {
		int c; cin >> c;
		MIN(a, c);
		MAX(b, c);
	}
	cout << b - a << '\n';
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(0);	
    cout << fixed;
	cout.precision(20);
#ifdef LOCAL
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <ctime>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()

typedef long double LD;
typedef long long LL;
typedef pair<LL, LL> pll;
typedef pair<int32_t, int32_t> pii;
typedef vector<int32_t> vi;

const int32_t M = 1000000007;

template <class T>
string sprint_arr(const vector<T> &arr) {
  stringstream ss;
  for (auto t : arr) {
    ss << t << " ";
  }
  return ss.str();
}

struct node_info {
  int64_t white;
  int64_t black;
  vector<int32_t> children;
  bool visited;

  node_info() : white(0), black(0), visited(false) {}
  friend ostream &operator<<(ostream &out, const node_info &c);
};

ostream &operator<<(ostream &out, const node_info &c) {
  out << c.white << ":" << c.black;
  return out;
}

vector<node_info> tree;

void calculate(int32_t node) {
  node_info& tree_node = tree[node];
  tree_node.visited = true;

  tree_node.white = 1;
  tree_node.black = 1;
  for (int32_t child : tree_node.children) {
    node_info& tree_child = tree[child];
    if (!tree_child.visited) {
      calculate(child);

      tree_node.black = (tree_node.black * tree_child.white) % M;
      tree_node.white =
          (tree_node.white * ((tree_child.white + tree_child.black) % M)) % M;
    }
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  cout << fixed;

  int32_t n;
  cin >> n;
  tree.resize(n);

  rep(i, n - 1) {
    int32_t a, b;
    cin >> a >> b;
    a--;
    b--;
    tree[a].children.push_back(b);
    tree[b].children.push_back(a);
  }

  calculate(0);

  //cerr << sprint_arr(tree) << endl;
  cout << (tree[0].white + tree[0].black) % M;
}

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

int main(void){
	int n, x;
	cin >> n >> x;
	int ans = 1;
	int now = 0;
	for(int i = 0; i < n; ++i){
		int tmp;
		cin >> tmp;
		now += tmp;
		if(now <= x) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int A=scan.nextInt(),B=scan.nextInt(),C=scan.nextInt(),D=scan.nextInt();
        int minAB;
        int minCD;
        if(A <= B){
            minAB = A;
        }else{
            minAB = B;
        }
        if(C <= D){
            minCD = C;
        }else{
            minCD = D;
        }
        System.out.println(minAB + minCD);
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 233;
int main()
{
	ll a,b;cin>>a>>b;
	cout<< a*b/__gcd(a,b) << endl; 
}


Measured memory_bytes: 256
def d_integer_cards(N, M, A, Operation_info):
    # Aの要素は1回選ぶことができるとみなす
    # 値C_iはB_i回選ぶことができるとみなす
    selected_num = [[1, a] for a in A] + Operation_info
    selected_num.sort(key=lambda x: x[1], reverse=True)

    # 値yをx回選ぶことを、選んだ値の個数がNになるまで繰り返す
    select = 0
    ans = 0
    for x, y in selected_num:
        select += x
        ans += x * y
        if select >= N:
            ans -= (select - N) * y
            break
    return ans

N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
Operation_info = [[int(i) for i in input().split()] for j in range(M)]
print(d_integer_cards(N, M, A, Operation_info))

Measured memory_bytes: 40512
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2020 Bjarni Dagur Thor Karason

#include <bits/stdc++.h>

using namespace std;

#define rep(i,a,b) for (__typeof(a) i=(a); i<(b); i++)
#define MP make_pair
#define PB push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define INF 1000000000
#define PI 3.14159265359

int main()
{
    ios_base::sync_with_stdio(false);
    int n, r;
    cin >> n >> r;
    cout << r + (100 * (10 - min(10, n))) << endl;

    return 0;
}

Measured memory_bytes: 256
const input = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n').map(Number);
console.log(function(i, n) {
  return i <= n ? ((i % 3 == 0 || include3(i)) ? ' ' + i : '') + arguments.callee(i + 1, n) : '';
}(1, input[0]));

function include3(i) {
  if (i == 0) return false;
  return i % 10 == 3 ? true : include3(Math.floor(i / 10));
}

Measured memory_bytes: 20384
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Arrays;
import java.util.Collections;
 
 
class Main
{
    public static void main(String[] args)
    {
        int ans = 0;
        int count = 0;
        int a;
        
        Scanner scanner = new Scanner(System.in);
        String n = scanner.next();
        //int m = scanner.nextInt();
        String[] ar = n.split("");
        a = n.length();
        for(int i = 0; i < a;i++){
            switch (ar[i]){
                case "+":
                    ans = ans + 1;
                    break;
                case "-":
                    ans = ans - 1;
                    break;
            }
        }
        
        System.out.println(ans);
        scanner.close();
    }
}

Measured memory_bytes: 20052
#include<stdio.h>
long long zMIN(long long a,long long b){
  if(b==0)return a;
  if(a==0||a>b)return b;
  return a;
}
int main(){
  int n,m,i,j,k,s[20],a,nj;
  while(scanf("%d %d",&n,&m),n||m){
    long long min,d[2][256]={0};	      
    for(i=0;i<m;i++)scanf("%d",&s[i]);
    d[0][128]=1;
    for(i=0;i<n;i++){
      scanf("%d",&a);
      for(j=0;j<256;j++)d[1-i%2][j]=0;
      for(j=0;j<256;j++){
	if(d[i%2][j]==0)continue;//printf("%d %d\n",j,d[i%2][j]);
	for(k=0;k<m;k++){
	  nj=j+s[k];
	  if(nj<0)nj=0;
	  if(nj>255)nj=255;
	  d[1-i%2][nj]=zMIN(d[1-i%2][nj],d[i%2][j]+(a-nj)*(a-nj));
	  //printf("%d %d\n",d[1-i%2][nj],nj);
	}//printf("\n");
      }
    }
    for(j=min=0;j<256;j++)min=zMIN(d[i%2][j],min);
    printf("%lld\n",min-1);
  }
  return 0;
}

Measured memory_bytes: 604
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD 998244353
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N, A[303030], len;
int cnt[303030];
vector<int> seq;

vector<int> locs[303030];

int jmps[303030];
int sums = 0;

int &get(int p)
{
	if (p < 0) return jmps[p + N];
	if (p >= N) return jmps[p - N];
	return jmps[p];
}
void updsums(int l, int md)
{
	sums += md * max(l - len + 1, 0);
}
void activate(int p)
{
	//printf("ac %d\n", p);
	if (get(p) == (N - 1)) {
		sums = N;
		return;
	}

	int llen = get(p), rlen = get(p + 1);
	updsums(llen, -1);
	updsums(rlen, -1);
	int totlen = 1 + llen + rlen;
	updsums(totlen, 1);
	get(p) = 0;
	get(p + 1) = 0;
	get(p - llen) = totlen;
	get(p + 1 + rlen) = totlen;
}
int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) scanf("%d", A + i);

	len = 0;
	for (int i = 0; i < N; ++i) cnt[A[i]]++;
	for (int i = 1; i <= N; ++i) len = max(len, cnt[i]);

	if (len == N) {
		if (cnt[1] != N) {
			puts("0"); return 0;
		}
		i64 ret = 1;
		for (int i = 1; i <= N; ++i) ret = ret * i % MOD;
		printf("%lld\n", ret);
		return 0;
	}
	if (cnt[1] != len) {
		puts("0"); return 0;
	}
	int sep = 0;
	for (int i = 0; i < N; ++i) {
		if (A[i] != A[(i + 1) % N]) sep = (i + 1) % N;
	}
	for (int i = 0; i < N; ++i) seq.push_back(A[(sep + i) % N]);
	for (int i = 0; i < N; ++i) A[i] = seq[i];

	vector<bool> app(N + 1, false);
	for (int i = 0; i < N; ++i) {
		if (i > 0 && A[i] != A[i - 1] && app[A[i]]) {
			puts("0"); return 0;
		}
		//printf("%d\n", A[i]);
		app[A[i]] = true;
	}

	for (int i = 0; i < N; ++i) locs[A[i]].push_back(i);

	for (int i = 0; i < N; ++i) jmps[i] = 0;

	i64 ret = 1;
	for (int i = 1; i <= N; ++i) {
		if (i == N) {
			// do nothing
			continue;
		}
		int cur = sums;
		int cur2 = sums;
		//printf("%d %d %d\n", sums, len, locs[i].size());

		//for (int i = 0; i < N; ++i) printf("%d ", jmps[i]); puts("");
		if (locs[i].size() != 0) {
			int lf = locs[i][0], rg = locs[i].back();
			//printf("a %d %d\n", lf, rg);
			if (get(lf) == 0 && get(rg + 1) == 0) {
				if (rg - lf != len - 1) {
					puts("0");
					return 0;
				}
			} else if (get(lf) == 0 || get(rg + 1) == 0) {
				ret = ret;
			} else {
				ret = ret * (len - (rg - lf)) % MOD;
			}
		} else {
			ret = ret * (sums - i + 1) % MOD;
		}
		for (int l : locs[i]) activate(l);
	}
	printf("%lld\n", ret);

	return 0;
}


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

int main(){
  int H,W,D;cin >> H >> W >> D;
  vector<int> X(H*W+1);
  vector<int> Y(H*W+1);
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      int a;cin >> a;
      X[a] = i;
      Y[a] = j;
    }
  }
  vector<vector<ll>> C(D,vector<ll>(0));
  for(int d=0;d<D;d++){
    C[d].push_back(0);
    for(int i=1;i*D+d<=H*W;i++){
      int curcost = C[d][i-1] + abs(X[i*D+d]-X[(i-1)*D+d]) + abs(Y[i*D+d]-Y[(i-1)*D+d]);
      C[d].push_back(curcost);
    }
  }
  int Q;cin >> Q;
  for(int q=0;q<Q;q++){
    int L,R;cin >> L >> R;
    int x = L%D;
    L = (L-x)/D;
    R = (R-x)/D;
    cout << C[x][R] - C[x][L] << endl;
  }
}

Measured memory_bytes: 8608
import java.io.*;
import java.nio.CharBuffer;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        int n = scanner.nextInt();
        System.out.println(n % 2 == 0 ? n / 2 - 1 : n / 2);

        writer.close();
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        private void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        private char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        private String next() {
            char b;
            do {
                b = read();
                checkEof();
            } while (Character.isWhitespace(b));
            StringBuilder sb = new StringBuilder();
            do {
                sb.append(b);
                b = read();
            } while (!eof && !Character.isWhitespace(b));
            return sb.toString();
        }

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

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

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

Measured memory_bytes: 21076
import heapq
def main():
    N, M = map(int, input().split())
    l = []
    for _ in range(N):
        a, b = map(int, input().split())
        if a > M:
            continue
        l.append((a,b))
    l.sort(key=lambda x: x[0])
    t = []
    i = 0
    r = 0
    for d in range(1, M+1):
        while i < len(l):
            a, b = l[i]
            if a <= d:
                heapq.heappush(t, -b)
            else:
                break
            i += 1
        if not t:
            continue
        r -= heapq.heappop(t)
    return r
print(main())


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

signed main() {
  int n;
  cin >> n;
  vector<int> city(n + 1);
  for (int i = 0; i < n + 1; i++) {
    cin >> city.at(i);
  }
  vector<int> sol(n);
  for (int i = 0; i < n; i++) {
    cin >> sol.at(i);
  }
  
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (sol.at(i) < city.at(i)) {
      ans += sol.at(i);
      continue;
    }
    
    if (sol.at(i) >= city.at(i)) {
      ans += city.at(i);
      sol.at(i) -= city.at(i);
      
      if (sol.at(i) < city.at(i+1)) {
        ans += sol.at(i);
        city.at(i+1) -= sol.at(i);
        continue;
      }
      
      if (sol.at(i) >= city.at(i+1)) {
        ans += city.at(i+1);
        city.at(i+1) = 0;
        continue;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>
int main(){
  int S;
  int h, m, s;

  scanf ("%d", &S);

  h = S/( 60*60 );
  m = ( S%( 60*60 ) )/60;
  s = ( S%( 60*60 ) )%60;

  printf ("%d:%d:%d\n", h, m, s);

  return 0;
}

Measured memory_bytes: 592
// 全探索
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>

using namespace std;

const int MAX_N = 20;
const int MAX_N_2 = 10000000;
const int MAX_Q = 200;

// 入力値を保持するバッファ
int input_buffer[MAX_N + 1];
// 組み合わせの管理用バッファ
int comb_buffer[MAX_N + 1];
// 組み合わせから求めた和を格納する配列
int pos = 0;
int add_buffer[MAX_N_2];

void combinations(int n, int r);
void comb_sub(int n, int r, int m);
void add_combination(int m);

int main(void)
{
    int n, q, Q[MAX_Q + 1];

    scanf("%d", &n);

    for(int i = 0; i < n; i++)
    {
        scanf("%d", &input_buffer[i]);
    }

    scanf("%d", &q);

    for(int i = 0; i < q; i++)
    {
        scanf("%d", &Q[i]);
    }

    for(int i = 0; i < n; i++)
    {
        combinations(n, i);
    }

    for(int i = 0; i < q; i++)
    {
        bool judge = false;

        for(int j = 0; j < pos; j++)
        {
            if( add_buffer[j] == Q[i] )
            {
                judge = true;
                break;
            }
        }

        if( judge )
        {
            printf("yes\n");
        }
        else
        {
            printf("no\n");
        }
    }

    return 0;
}

// 組み合わせを生成する関数の入り口
void combinations(int n, int r)
{
	if (r > 0 && r <= MAX_N)
	{
		comb_sub(n, r, 0);
	}
}

// 組み合わせを生成する関数
// n : 選択する数値の範囲 ( 1〜 n )
// r : 選ぶ数値の個数
// m : 選んだ数値の個数
void comb_sub(int n, int r, int m)
{
	if ( r == 0 )
	{
        // r が 0 になったので、組み合わせを一つ生成できた
		add_combination(m);
	}
	else if ( n == r )
	{
		for (int i = r; i > 0; i--)
		{
			// n が r と等しくなったならば、残りの数字 (1 から r まで) を全て選択
			comb_buffer[m++] = i;
		}

		add_combination(m);
	}
	else
	{
		// nを選ばない場合
		// 残りの数字の中から r 個の数字を選びます。
		comb_sub(n - 1, r, m);

		// nを選ぶ場合
		// 数字 n を comb_buffer に追加して、残りの数字の中から r - 1 個を選びます。
		comb_buffer[m] = n;
		comb_sub(n - 1, r - 1, m + 1);
	}

    return;
}

// 入力数値の和を求める
void add_combination(int m)
{
    // 配列の初期化
    add_buffer[pos] = 0;

    for(int i = 0; i < m; i++)
    {
    	// 入力された数列の和を順番に求める
        add_buffer[pos] += input_buffer[comb_buffer[i] - 1];
    }

    // 要素を進める
    pos++;

    return;
}



Measured memory_bytes: 7212
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll N;
    cin >> N;
    vector<double> x(N), y(N);
    for (ll i = 0; i < N; i++) {
        cin >> x[i] >> y[i];
    }

    vector<ll> a(N);
    iota(a.begin(), a.end(), 0);

    double ans = 0.0;
    ll num = 0;
    do {
        double tmp = 0.0;
        for (ll i = 0; i < N - 1; i++) {
            tmp += sqrt(pow(x[a[i]] - x[a[i + 1]], 2) +  pow(y[a[i]] - y[a[i + 1]], 2));
        }
        ans += tmp;
        num++;
    } while (next_permutation(a.begin(), a.end()));

    cout << setprecision(15) << ans / num << endl;
}

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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

class UnionFind {
private:
    int n;
    vector<int> uni;
public:
    UnionFind(int _n) {
        n = _n;
        uni.clear();
        uni.resize(n, -1);
    }
    int root(int x) {
        if (uni[x] < 0) return x;
        return uni[x] = root(uni[x]);
    }
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (uni[x] > uni[y]) swap(x, y);
        uni[x] += uni[y];
        uni[y] = x;
    }
    void print() {
        for (auto x : uni) cout << x << " ";
        cout << endl;
    }
};

template <typename T>
struct edge {
    int from, to;
    T cost;
    edge(){}
    edge(T _from, T _to, T _cost) : from(_from), to(_to), cost(_cost) {}
    bool operator< (const edge& e) const {
        return cost == e.cost ? (from == e.from ? to < e.to : from < e.from) : cost < e.cost;
    }
};

template <typename T>
class Kruskal {
private:
    int n;
    vector<edge<T>> edges;
    UnionFind uf;
public:
    Kruskal(int _n) : n(_n), uf(UnionFind(n)) {}
    void addEdge(int _from, int _to, T _cost) {
        edges.emplace_back(_from, _to, _cost);
    }
    T calc() {
        sort(all(edges));
        T res = 0;
        for (auto &e : edges) {
            if (!uf.same(e.from, e.to)) {
                uf.unite(e.from, e.to);
                res += e.cost;
            }
        }
        return res;
    }
};

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

    int n;
    cin >> n;
    Kruskal<double> kr(n);
    rep(i, n) {
        rep(j, n) {
            double c;
            cin >> c;
            if (c == -1) c = 1e9;
            kr.addEdge(i, j, c);
        }
    }
    cout << (int)kr.calc() << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;

int N;

int main() {
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    
    // 累積和と連想配列
    vector<ll> s(N+1, 0);
    map<ll, ll> nums;
    for (int i = 0; i < N; i++) s[i+1] = s[i] + A[i];
    // sの中のそれぞれの数を数え上げる。（その数があったら1を足すという単純なアルゴリズム）
    for (int i = 0; i < N+1; i++) nums[s[i]]++;
    
    // 集計処理
    ll res = 0;
    for (auto it : nums) {
        ll  num = it.second;  // it.firstがit.second個ある
        res += num * (num - 1) / 2;
    }
    cout << res << endl;
}

Measured memory_bytes: 15872
H, W, M = map(int, input().split())
h_list = [0 for _ in range(H + 1)]
w_list = [0 for _ in range(W + 1)]
bomb = set([])
for _ in range(M):
    h, w = map(int, input().split())
    h_list[h] += 1
    w_list[w] += 1
    bomb.add((h, w))
h_max = max(h_list)
w_max = max(w_list)
h_index = []
w_index = []
for i in range(H + 1):
    if h_list[i] == h_max:
        h_index.append(i)
for i in range(W + 1):
    if w_list[i] == w_max:
        w_index.append(i)
tmp = -1        
for h in h_index:
    for w in w_index:
        if (h, w) not in bomb:
            tmp = 0
            break
print(h_max + w_max + tmp)

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

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


Measured memory_bytes: 256
import java.util.Scanner;
import java.io.*;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int l = sc.nextInt();
		int r = sc.nextInt();
		int d = sc.nextInt();
		System.out.println(r/d - (l-1)/d);
	}
}


Measured memory_bytes: 26988
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class D
{
    static void Main()
    {
        int[] intRecord = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();

        var n = intRecord[0];
        var k = intRecord[1];

        int[] a_i = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
        var a_iList = new List<int>();

        for (int i = 0; i < n; i++)
        {
            a_iList.Add(a_i[i]);
        }
        a_iList.Sort((a, b) => b - a);

        long attackCount = 0;
        foreach (var item in a_iList)
        {
            if(k > 0)
            {
                k--;
                continue;
            }
            attackCount += item;
        }
        Console.WriteLine(attackCount.ToString());
    }

}

Measured memory_bytes: 37820
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <limits.h>
#include <cstring>
#include <tuple>
#include <cassert>
#include <numeric>
#include <iomanip>
using namespace std;
// type alias
typedef long long LL;
typedef pair< int , int > II;
typedef tuple< int, int, int > III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))

// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');

// debug cerr
#define TRACE true
#define dump(x) if(TRACE) { cerr << #x << " = " << (x) << endl; }
#define dump2(x,y) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << endl; }
#define dump3(x,y,z) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << endl; }
#define dump4(x,y,z,a) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << ", " << #a << " = " << (a) << endl; }
#define dumpf(args...) if(TRACE) { fprintf(stderr, ##args); putchar('\n'); }
#define dumpAR(ar) if(TRACE) { FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
template<class Iter> void dumpc(Iter begin, Iter end) { if (TRACE) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; } }

// $ cp-batch TemplateMatching | diff TemplateMatching.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address TemplateMatching.cpp && ./a.out

/*
 
 1/16/2019
 
 18:37-
 
 */

const int MAX_N=51;
string A[MAX_N],B[MAX_N];
int N,M;

const string yes="Yes",no="No";
void solve() {
  bool res=false;
  REP(i,N-M+1)REP(j,N-M+1) {
    bool ok=true;
    REP(di,M)REP(dj,M) {
      if(A[i+di][j+dj]!=B[di][dj]) {
        ok=false;
        goto out1;
      }
    }
  out1:
    if(ok) {
      res=true;
      goto out2;
    }
  }
out2:
  cout<<(res?yes:no)<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N>>M;
  REP(i,N) cin>>A[i];
  REP(i,M) cin>>B[i];
  solve();
  
  return 0;
}


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

using namespace std;

typedef long long ll;

const int MAXN = 3005;

ll C[MAXN][MAXN], S[MAXN][MAXN], ways[MAXN], pow2[MAXN * MAXN][2];

ll n, m;

ll qpow(ll a, ll b, ll c)
{
	if (b <= n * n)
		return pow2[b][(c == m - 1 ? 0 : 1)];
	ll ret = 1;
	for (; b; b >>= 1, a = a * a % c)
		if (b & 1)
			ret = ret * a % c;
	return ret;
}

void init()
{
	C[0][0] = 1;
	for (int i = 1; i <= n; i++)
		C[i][0] = C[i][i] = 1;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j < i; j++)
			C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % m;
	for (int i = 0; i <= n; i++)
		S[i][0] = 1;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= i; j++)
			S[i][j] = (S[i - 1][j - 1] + (j + 1) * S[i - 1][j] % m) % m;
	pow2[0][0] = pow2[0][1] = 1;
	for (int i = 1; i <= n * n; i++)
		(pow2[i][0] = pow2[i - 1][0] * 2) %= (m - 1), (pow2[i][1] = pow2[i - 1][1] * 2) %= m;
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	init();
	for (int i = 0; i <= n; i++)
		for (int j = 0; j <= i; j++)
			(ways[i] += S[i][j] * qpow(2, (n - i) * j, m) % m * qpow(2, qpow(2, n - i, m - 1), m) % m) %= m;
	ll A = 0;
	for (int i = 0; i <= n; i++)
		(A += (i & 1 ? -1 : 1) * C[n][i] * ways[i] % m) %= m;
	if (A < 0)
		A += m;
	cout << A << endl;
	return 0;	
}


Measured memory_bytes: 282368
#include<iostream>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
#include<memory>
using namespace std;
using ll=long long;

const ll INF=1e16;

void cmin(ll &lhs,ll rhs){
    lhs=min(lhs,rhs);
}
int main(){
    int n;
    int k;
    cin>>n>>k;
    vector<ll> h(n+1);
    h[0]=0;
    for(int i=0;i<n;i++) cin>>h[i+1];

    vector<vector<vector<ll>>> dp(n+1,vector<vector<ll>>(n+1,vector<ll>(k+1,INF)));
    dp[0][0][0]=0;

    for(int i=0;i<n;i++){
        for(int j=0;j<=n;j++){
            for(int r=0;r<=k;r++){
                if(r+1<=k) cmin(dp[i+1][j][r+1],dp[i][j][r]);
                cmin(dp[i+1][i+1][r],dp[i][j][r]+max(0LL,h[i+1]-h[j]));
            }
        }
    }

    ll res=INF;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=k;j++){
            cmin(res,dp[n][i][j]);
        }
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 216832
N=int(input());r=[0]
def s(n,p=1,a=1,k=0):
 if n<0:p,a,k=-2,-2,1
 while abs(n)>abs(a):p*=4;a+=p;k+=2
 r[0]|=1<<k
 if n-p:s(n-p)
if N:s(N)
print(bin(r[0])[2:])


Measured memory_bytes: 3060
#include "bits/stdc++.h"

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;


void solve(){
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif
	vector<string > hand(3);
	VI numhand(3);
	
	ll ans = 0;
	string str;
	cin >> str;
	int len = str.size();
	for (int i = 0, num = int(pow(2, len - 1)); i < num; i++){
		int cur = -1;
		ll tmp = 0;
		for (int j = 0; j < len - 1; j++){
			if ((i >> j) % 2 == 1){
				tmp += atoll(str.substr(cur + 1, j - cur).c_str());
				cur = j;
			}
		}
		tmp += atoll(str.substr(cur + 1, len - cur).c_str());
		ans += tmp;
	}

	cout << ans << endl;
}


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


	solve();
	system("PAUSE");
	return 0;
}

Measured memory_bytes: 504
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

n = int(arr_data[0][0])
a = int(arr_data[0][1])
b = int(arr_data[0][2])

#print(n,a,b)

arr=[]

for i in range(1,1+n):
    
    arr.append(int(arr_data[i][0]))
    
#print(arr)

print(len(list(filter(lambda x : not (a <= x <b), arr))))

#print(arr2)

Measured memory_bytes: 3064
import math
N, M = list(map(int, input().split()))
if N == 1:
  print(M)
  exit()
X = int(math.sqrt(M))+1
for i in range(N, X):
  if M % i == 0:
      print(int(M/i))
      exit()
X = int(M / N)
for i in range(X, 0, -1):
  if M % i == 0:
      print(i)
      exit()
print(1)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,a,b;

  cin >> n >> m >> a >> b;
  vector<int> d(n);
  int c=0;
  for(int i=0;i<n;i++){
    cin >> d[i];
  }
  for(int i=0;i<n;i++){
    if(d[i]>=a){
      c++;
    }
    else break;
  }
  if(n-c<m){
    for(int i=c-1;i>=0;i--){
      if(d[i]<=b){
	c--;
      }
      else break;
    }
  }
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
int main(){
	stack<int> s; 
	char temp[7];
	int tmp;
	while(cin>>temp){
	if(temp[0]=='+'){
		//如果为操作符号的话
		int a=s.top();
		s.pop();
		int b=s.top();
		s.pop();
		tmp=b+a;
	}
	else if(temp[0]=='-'){
		int a=s.top();
		s.pop();
		int b=s.top();
		s.pop();
		tmp=b-a;
	}
	else if(temp[0]=='*'){
		int a=s.top();
		s.pop();
		int b=s.top();
		s.pop();
		tmp=b*a;
	}
	else if(temp[0]=='/'){
		int a=s.top();
		s.pop();
		int b=s.top();
		s.pop();
		tmp=b/a;
	}
	else{
		stringstream ss;
		ss<<temp;
		ss>>tmp;
	}
	s.push(tmp);
	}
	cout<<s.top()<<'\n';
	return 0;
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC098_B();
        }

        static void ABC098_B()
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            var max = 0;
            for (var n = 1; n < N; n++)
                max = Math.Max(max, S.Substring(0, n).Intersect(S.Substring(n)).Count());

            Console.WriteLine(max);
        }
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <math.h>
using namespace std;
long long dp[100010][110];
main(){
	int n,m,v[1500],w[1500];
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	cin>>w[i]>>v[i];
	
	dp[0][0]=0;
	for(int i=1;i<=m;i++)
	{
		for(int k=1;k<=n;k++)
		{
			dp[i][k]=dp[i][k-1];
			if(w[k]<=i)
			dp[i][k]=max(dp[i][k],dp[i-w[k]][k-1]+v[k]);
		}
	}
	cout<<dp[m][n];
}

Measured memory_bytes: 86144
#include <stdio.h>

double rounding(double x);

int main(void) {
    double ave;
    int sum = 0, count = 0, sum_quan = 0;
    int uni_cost, sell_quantity;
    int sell_amount;
    
    while(scanf("%d,%d", &uni_cost, &sell_quantity) != EOF) {
        sell_amount = uni_cost * sell_quantity;
        sum += sell_amount;
        sum_quan += sell_quantity;
        count++;
    }
    
    ave = rounding((double)sum_quan / count);
    
    printf("%d\n%d\n", sum, (int)ave);
    
    return(0);
}

double rounding(double x) {
    int num, float_point;
    double d_num;
    
    num = x;
    d_num = x - num;
    float_point = 10 * d_num;
    
    if(float_point > 4) {
        return(num + 1);
    } else {
        return(num);
    }
}

Measured memory_bytes: 592
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    s=chomp(readline())
    n=length(s)
    l,r=1,n
    ans=0
    for i in 1:n
        if s[l]==s[r]
            l+=1
            r-=1
        elseif s[l]=='x'!=s[r]
            l+=1
            ans+=1
        elseif s[l]!='x'==s[r]
            r-=1
            ans+=1
        else
            ans=-1
            break
        end
        if l>r
            break
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 120160
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <list>
#include <stack>

using namespace std;

int main()
{
    string S;
    cin >> S;

    int count = 0;
    stack<char> s;
    for (int i = 0; i < S.length(); i++) {
        if (s.empty()) {
            s.push(S[i]);
        }
        else {

            int x = s.top();
            if (x == S[i]) {
                s.push(S[i]);
            }
            else {
                s.pop();
                count+=2;
            }
        }
    }

    cout << count;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(0);
#define rep(i, init, n) for (int i = init; i < n; i++)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define gcd __gcd
# define M_PI 3.14159265358979323846
using namespace std;
const ll mod = 1e9 + 7;
const int N = 2e5 + 4;
const ll MOD = 998244353;
bool visited[N];
vector<int> edge[N];
vector<int> conc[N];
int c = 0, f = 1;

ll POW(ll base, ll exponent){
    ll result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base) % MOD;
        exponent = exponent >> 1;
        base = (base * base) % MOD;
    }
    return result;
}

ll Inv(ll x){
    return POW(x, MOD - 2);
}

void DFS(int src){
    visited[src] = 1;
    conc[c].pb(src);
    for(auto i : edge[src]){
        if(!visited[i]) DFS(i);
    }
}

int main(){
    string s;
    cin>>s;
    if(s == "ABC") cout<<"ARC";
    else cout<<"ABC";
    return 0;
}


Measured memory_bytes: 12932
//https://gist.github.com/drmalex07/3e6695025a1788e669cec7f8d93d98dc
//を参考にUnionFindクラスを作成
fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(" ").map(String::toInt)
    val p = readLine()!!.split(" ").map(String::toInt)
    val graph = UnionFind(n)

    for (i in 0..(m - 1)) {
        val (x, y) = readLine()!!.split(" ").map(String::toInt)
        graph.union(x - 1, y - 1)
    }

    var count = 0
    for (i in 0..(n - 1)) {
        val find1 = graph.root(i)
        val find2 = graph.root(p[i] - 1)
        if (find1 == find2) count++
    }
    println(count)
}


class UnionFind(private var num: Int) {
    private val parent: IntArray = IntArray(num)
    private val rank: IntArray = IntArray(num)

    init {
        for (i in 0 until num) {
            parent[i] = i
            rank[i] = 1
        }
    }

    fun union(u: Int, v: Int): Int {
        var u = u
        var v = v
        u = root(u)
        v = root(v)
        if (u == v)
            return u
        if (rank[v] < rank[u]) {
            val t = v
            v = u
            u = t
        }
        parent[u] = v
        rank[v] += rank[u]
        rank[u] = -1
        num--

        return v
    }

    fun root(u: Int): Int {
        var u = u
        while (parent[u] != u)
            u = parent[u]
        return u
    }
}

Measured memory_bytes: 74932
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    REP(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    REP(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

int main()
{
    int A = inputValue();
    int B = inputValue();
    int M = inputValue();
    int a[100000];
    int amin = INT32_MAX;
    REP(i, A){
        int v = inputValue();
        a[i] = v;
        amin = min(v,amin);
    }
    int b[100000];
    int bmin = INT32_MAX;
    REP(i, B){
        int v = inputValue();
        b[i] = v;
        bmin = min(v,bmin);
    }
    int ans = amin + bmin;
    REP(i, M){
        int x = inputValue();
        int y = inputValue();
        int c = inputValue();
        int v = a[x-1] + b[y-1] - c;
        ans = min(ans, v);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include "stdio.h"


int main()
{
	int E869120, square1001;
	scanf("%d %d", &E869120, &square1001);
	if ((E869120 <= 8) && (square1001 <= 8)) {
		printf("Yay!\n");
	}else {
		printf(":(\n");
	}
    return 0;
}
 



Measured memory_bytes: 128
import collections
def resolve_c():
    n = input()
    s_l = [input() for i in range(int(n))]
    c = collections.Counter(s_l)
    values, counts = zip(*c.most_common())
    results = sorted(list(values[:collections.Counter(counts)[max(counts)]]))
    fin = [print(r) for r in results]
resolve_c()

Measured memory_bytes: 59500
#include<stdio.h>
int main(){
	int N, K, p[200000];
	int i;
	double E[200000], temp, output;

	scanf("%d %d", &N, &K);
	for (i = 0; i < N; i++){
		scanf("%d", &p[i]);
	}

	for (i = 0; i < N; i++){
		E[i] = (p[i] + 1) * 0.5;
	}

	for (i = 0; i < K; i++){
		output += E[i];
	}
	temp = output;

	if(K >= 2){
		for (i = 0; i <= N - K; i++){
			temp = temp - E[i] + E[i + K];
			if(temp > output) output = temp;
		}
	} else {
		for (i = 0; i < N; i++){
			if(E[i] > output) output = E[i];
		}
	}

	printf("%f\n", output);
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
using namespace std;
int main(){
   int N;
   cin>>N;
   if(N==1){
       cout<<"1"<<endl;
       return 0;
       
   }
   int s=1;
   while(true){
       s=s*2;
       if(s*2>N){
           break;
       }
   }
   
   cout<<s<<endl;
   return 0;
}

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

typedef long long ll;
#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define REPM(i,n) for(ll i=(n-1); 0=<i; i--)
#define VI vector<int>
#define VL vector<ll>
#define VD vector<double>
#define VS vector<string>
#define V_SORT_U(x) sort(x.begin(), x.end());
#define V_SORT_D(x) sort(x.begin(), x.end(),greater<int>());
#define V_SUM(x) accumulate(x.begin(), x.end(), 0)
#define STR_TRANS_UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define STR_TRANS_LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);

int main(void){
    ll N, K;
    cin >> N >> K;

    VL A_i(N+1);

    //K,K+1,...,i,...,.,N個まで試す
    //0,1,2,...,i,...,N個までの和
    //n個選ぶ場合の最小値：小さい方からn個
    //n個選ぶ場合の最大値：大きい方からn個

    ll count = 0;

    REP(i,N+1)
    {
        A_i.at(i) = i;
    }

    for(ll i=K; i<N+2; i++)
    {
        double count_tmp = 0;
        double max = 0;
        double min = 0;

        min = ((A_i.at(0) + A_i.at(i-1))/2)*i;
        max = ((A_i.at(N+1-i) + A_i.at(N))/2)*i;
        
        count_tmp = max - min + 1;
        //cout << "count_tmp:" << count_tmp << endl; 
        count += count_tmp;
    }

    cout << (count % 1000000007) << endl;

    return 0;
}

Measured memory_bytes: 4844
/*g++ file.cpp -o file.out*/
/*./file.out*/

#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
#define Mod 1000000007
#define L_Mod 17100000013

char str[100001];

int main()
{
    scanf("%s",str);
    if(str[0] == str[strlen(str)-1])
        if(strlen(str)%2==1)
            printf("Second\n");
        else
            printf("First\n");
    else if(strlen(str)%2==1)
        printf("First\n");
    else
        printf("Second\n");
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define INF (ll)1e18+4
#define md (ll)1e9+7
#define mx 10000000
#define mk make_pair
#define __builtin_popcountll(x) one(x)
#define pi pair<int,int>
#define ss second
#define ff first
#define pb emplace_back 
#define all(s) s.begin(),s.end()
#define rall(x) (x).rbegin(), (x).rend()
#define trav(x, a) for (auto& x: a)
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define rf(i,a,b) for(int i=a;i>=b;i--)
#define sz(x) ((long long)x.size())
#define mez(s) memset(s,0,sizeof s)
#define mex(s) memset(s,-1,sizeof s)
#define metr(s) memset(s,true, sizeof s)
typedef vector<int> vi; 
typedef vector<ll>vl;
typedef map<int,int> mp;
typedef queue<int> que;
typedef vector<pi> vp;

int k;
void solve(){
	cin>>k;
	if(k%2==0){
		cout<<-1;
		return;
	}
	if(k%10==5){
		cout<<-1;
		return;
	}
	int t=k;int d=0;
   ll res=0; bool b=0;
	while(t--){
		res=res*10+7;
		d++;
	    int r=res%k;
		if(r==0){
			b=1;
			break;
		}
		res=r;
	}
	if(b)cout<<d;
	else cout<<-1;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t=1;
   //cin>>t;
  while(t--){
  	solve();
  }
  return 0;
}

Measured memory_bytes: 3640