akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i;
    int a=0,b=0;
    int result = 0;
    double result2 = 0.0;

    scanf("%d",&a);
    
    for(i = a;i>0;i--)
    {
        result = i % 2;
        if(result != 0) b++;
        else{}
    }

    result2 = (float)b / (float)a;

    printf("%0.9f\n",result2);

    return 0;
    
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
struct FT{
  vector<int> d;
  int top = 1;
  FT(int n):d(n+1){
    top = 1;
    while(top < (int)d.size()) top <<= 1;
  }
  int sum(int i){int s{}; for(++i;i>0;i-=i&-i)s+=d[i];return s;}
  int sum(int i,int j){
    return i?sum(j)-sum(i-1):sum(j);
  }
  void add(int i, int x){
    for(++i;i<(int)d.size();i+=i&-i)d[i]+=x;
  }
};

FT primes(400000);
int main(){
  for(int i=2; i < 400000; ++i)for(int j=2; j*j <= i;j++){
    if(i%j == 0)  break;
    if((j+1)*(j+1) > i) primes.add(i,1);
  }
  primes.add(2,1); primes.add(3,1);
  //rep(i,100) cerr << i << ' ' << primes.sum(i,i) << endl;
  //cerr << "OK" << endl;
  int n;
  while(cin >>n , n){
    cout << primes.sum(n+1,2*n) << endl;
  }
}



Measured memory_bytes: 4196
n,m=map(int,input().split())
m=m+1
cnt=[0]*(m+1)
for i in range(n):
  li=input().split()
  a=int(li[0])
  for j in range(a):
    li[j+1]=int(li[j+1])
    for k in range(m):
      if li[j+1]==k:
        cnt[k]=cnt[k]+1
   
ans=0  
for l in range(m):
  if cnt[l]==n:
    ans=ans+1

print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        outside: while(true) {
            int a = sc.nextInt();
            String op = sc.next();
            int b = sc.nextInt();

            switch (op) {
                case "+":
                    System.out.println(a + b);
                    break;
                case "-":
                    System.out.println(a - b);
                        break;
                case "*":
                    System.out.println(a * b);
                    break;
                case "/":
                    System.out.println(a / b);
                    break;
                default:
                    break outside;
            }
        }
    }
}



Measured memory_bytes: 26344
n,m=map(int,input().split())
A=list(map(int,input().split()))
List=[[0]*2 for i in range(m+n)]
for i in range(m):
  List[i]=list(map(int,input().split()))
for i in range(n):
  List[i+m]=[1,A[i]]
List=sorted(List,key=lambda x:x[1],reverse=True)
a=0
b=0
i=0
while a<n:
  if a+List[i][0]<n:
    a=a+List[i][0]
    b=b+(List[i][0])*(List[i][1])
    i=i+1
  else:
    b=b+(List[i][1])*(n-a)
    a=n
print(b)

Measured memory_bytes: 47020
#include <stdio.h>
#include <stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;
}

Node treeMaximum(Node x){
  while(x->right != NIL){
    x = x->right;
  }
  return x;
}

Node treeSearch(Node u, int k){
  Node x;
  if(u == NIL || k == x->key) return u;
  if(k < x->key) return treeSearch(x->right,k);
  else return treeSearch(x->right,k);
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL) return treeMinimum(x->right);
  y = x->parent;
  while( y != NIL && x == y->right ){
    x = y;
    y = y->parent;
  }
  return y; 
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if( z->left == NIL || z->right == NIL ) y = z;
  else y = treeSuccessor(z);
  if( y->left != NIL ) x = y->left;
  else x = y->right;
  if( x != NIL ) x->parent = y->parent;
  if( y->parent == NIL ) root = x;
  else if( y == y->parent->left ) y->parent->left = x;
  else y->parent->right = x;
  if( y != z ) z->key = y->key;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while(x != NIL){
    y = x; 
    if( z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z; 
  else y->right = z;  
}

void inorder(Node u){
  if(u != NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}
void preorder(Node u){
  if(u != NIL) {
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 25140
// AtCode.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>

using namespace std;

int main() {

	int N, K;
	cin >> N >> K;
	vector<long long> inputs;
	for (int i = 0; i < N; i++) {
		long long tmp;
		cin >> tmp;
		inputs.push_back(tmp);
	}

	sort(inputs.begin(), inputs.end(), greater<int>());

	long long count = 0;
	for (int i = 0; i < inputs.size(); i++) {
		if (i >= K) count += inputs[i];
	}

	cout << count << endl;

/*	int H, A;
	cin >> H >> A;

	int ans = H / A + (H%A!=0);
	cout << ans << endl;
*/
	return 0;
}



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

#define mod (1000000007)
#define rv2 (500000004)

int N, K;
std::map<int, int> d;
std::set<int> set;

int powmod(int a, int b){
	int ret = 1;
	while(b){
		if(b & 1) ret = (1ll) * ret * a % mod;
		b >>= 1;
		a = (1ll) * a * a % mod;
	}
	return ret;
}

int get_d(int i){
	int ret = powmod(K, (i + 1) / 2);
	for(int j = 1; j * j <= i; ++ j){
		if(i % j || j == i) continue;
		ret = (ret - d[j] + mod) % mod;
		if(i / j == j || i / j == i) continue;
		ret = (ret - d[i / j] + mod) % mod;
	}
	return ret;
}

int main(){
	scanf("%d%d", &N, &K);
	int ans = 0;
	for(int i = 1; i * i <= N; ++ i){
		if(N % i) continue;
		set.insert(i);
		set.insert(N / i);
	}
	for(auto i : set){
		d[i] = get_d(i);
		if(i % 2) ans = (ans + (1ll) * d[i] * i % mod) % mod;
		else ans = (ans + (1ll) * d[i] * i % mod * rv2 % mod) % mod;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 384
#include <cstdio>

using namespace std;

int main() {
    int n, a, b;
    
    scanf("%d %d %d", &n, &a, &b);
    
    if (a > b || (n == 1 && a != b)) {
        puts("0");
    } else {
        printf("%lld\n", (a + (long long)b * (n - 1)) - (b + (long long)a * (n - 1)) + 1);
    }
    
    return 0;
}


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

using namespace std;

int main(){
    int a,b,d,r;
    double f;

    cin >> a >> b;

    d=a/b;
    r=a%b;
    f=a*1.0/b*1.0;

    cout << d << " " << r << " ";
    printf("%.8lf\n", f);
    return 0;
}

Measured memory_bytes: 3228
//kruskal tree
#include <iostream>
#include <algorithm>
using namespace std;
#define M 9999
int parent[M],a[M],b[M];
pair<int,int>node[M];
int root(int a){
	if(parent[a]==a)return a;
	return parent[a]=root(parent[a]);
}
int unite(int a,int b){
	if(root(a)==root(b))return 0;
	parent[root(a)]=root(b);
	return 1;
}
int main(){
	int i,s,n,m;
	for(;cin>>n>>m,n;cout<<s<<endl){
		for(i=0;i<m;i++)cin>>a[i]>>b[i]>>node[i].first,node[i].second=i;
		sort(node,node+m);
		for(i=0;i<n;i++)parent[i]=i;
		for(s=i=0;i<m;i++)if(unite(a[node[i].second],b[node[i].second]))s+=node[i].first;
	}
}

Measured memory_bytes: 1252
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var b = Console.ReadLine();
            var pair = "";
            switch (b)
            {
                case "A": pair = "T"; break;
                case "T": pair = "A"; break;
                case "C": pair = "G"; break;
                case "G": pair = "C"; break;
            }
            Console.WriteLine(pair);
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
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 REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
    int K;  cin >> K;
    string s;  cin >> s;
    if(s.length() <= K){  cout << s << endl;  }
    else{  cout << s.substr(0, 0+K) << "..." << endl;   }
    return 0;
}


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

//#template
template <class T> inline T min(T a, T b, T c) { return min(min(a, b), c); }
template <class T> inline T max(T a, T b, T c) { return max(max(a, b), c); }
template <class T> inline T min(T a, T b, T c, T d) { return min(min(a, b), min(c, d)); }
template <class T> inline T max(T a, T b, T c, T d) { return max(max(a, b), max(c, d)); }
//#endtemplate

//#define
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define clr(x) memset(x, 0, sizeof(x))
#define mmid ((lf + rg) >> 1)
#define lson root * 2, lf, mmid
#define rson root * 2 + 1, mmid + 1, rg
#define pb push_back
#define mp make_pair
#define fi first
#define se second
template <class T, class S> ostream &operator<<(ostream &o, const pair<T, S> &A) {
    o << "(" << A.fi << " " << A.se << ")";
    return o;
}
template <class T> ostream &operator<<(ostream &o, const vector<T> &A) {
    o << "[";
    for (auto &i : A) {
        o << " " << i;
    }
    o << " ]";
    return o;
}
//#enddefine

const int mod = int(1e9) + 7;
const double pi = acos(-1.0);
const int inf = 0x3f3f3f3f;
const int dx[] = { -1, 0, 1, 0, 1, 1, -1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };

const int N = 60005;
int mark[N], dp[56555];
vector<int> prime, ans;

void sol() {
    // Solve Function
    clr(mark);
    mark[1] = 1;
    for (int i = 2; i * 2 <= 55555; ++i) mark[i * 2] = 1;
    for (int i = 3; i * 3 <= 55555; ++i) {
        for (int j = 3; i * j <= 55555; ++j) {
            mark[i * j] = 1;
        }
    }
    for (int i = 11; i <= 55555; i += 10)
        if (!mark[i]) ans.pb(i);
    int n;
    while (cin >> n) {
        for (int i = 0; i < n; ++i) cout << (i == 0 ? "" : " ") << ans[i];
        cout << endl;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(0);
#ifdef CFENGLV
    freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    clock_t _time = clock();
#endif
    int T;
    // cin >> T;
    // for(int cas = 1; cas <= T; ++cas) {
    // cout << "Case #" << cas << ": ";
    sol();
    // }
#ifdef CFENGLV
    cerr << "Time: " << static_cast<double>(clock() - _time) / CLOCKS_PER_SEC * 1000 << "ms" << endl;
#endif
    return 0;
}


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

#define ll long long int 
ll mod=1e9+7;

// vector<int> g[200005];
// int vis[200005];
// queue<int> q;
// int level[200005];

// void dfs(int i)
// {
//     vis[i] = 1;
//     for(int j=0;j<g[i].size();j++)
//     {
//         int child = g[i][j];
//         if(vis[child] == 0)
//         {
//             dfs(child);
//         }
//     }
// }

// void bfs(int i)
// {
//     vis[i] = 1;
//     while(!q.empty())
//     {
//         int top = q.front();
//         int len_adj = g[top].size();
//         int j;
//         for(j=0;j<len_adj;j++)
//         {
//             int v = g[top][j];
//             if(vis[v]==0)
//             {
//                 vis[v]=1;
//                 q.push(v);
//                 level[v] = level[top] + 1;
//             }
//         }
//         q.pop();
// }

int main()
{
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.tie(NULL);
    
    // int t;
    // cin >> t;
    // while(t--)
    // {        
    // }

    int n,i,j;
    cin >> n;
    int arr[n];

    for(i=0;i<n;i++)
    {
        cin >> arr[i];
    }
    
    sort(arr,arr+n);

    int ans = 0;
    int half = n/2;
    int s = arr[half-1];
    int e = arr[half];
    int t2 = e;

    // cout << s << " " << e << '\n';

    while(s<e)
    {
        // cout << 
        int mid = (s+e)/2;
        // cout << "mid = " << mid << '\n';
        int count=0;
        for(j=0;j<n;j++)
        {
            if(arr[j]<mid)
            {
                count++;
            }
        }

        // cout <<"count = " <<count << '\n';

        if(count < half)
        {
            s = mid + 1;
        }
        else
        {
            e = mid;
        }
    }

    // cout << "starting = " <<s << '\n';



    ans = t2 - s + 1;

    if(ans == 1)
    {
        int cc=0;
        for(j=0;j<n;j++)
        {
            if(arr[j]<s)
            {
                cc++;
            }
        }

        if(cc == half)
        {
            ans = 1;
        }
        else
        {
            ans =0 ;
        }
    }
        
    if(ans <= 0)
    {
        ans = 0;
    }
    

    cout << ans << '\n';



}

Measured memory_bytes: 640
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    s = input()

    if len(s) == len(set(s)):
        print("yes")
    else:
        print("no")

if __name__ == '__main__':
    main()


Measured memory_bytes: 61860
import bisect
import heapq
import sys
import queue


input = sys.stdin.readline
sys.setrecursionlimit(100000)


class V:
    def __init__(self, f):
        self.f = f
        self.v = None

    def __str__(self):
        return str(self.v)

    def ud(self, n):
        if self.v is None:
            self.v = n
        else:
            self.v = self.f(self.v, n)

    def get(self):
        return self.v


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def f(x, X, VX):
    visit_node = [set(), set()]
    visit_link = set()

    q = queue.Queue()
    q.put((0, x))
    while not q.empty():
        p, s = q.get()
        if s in visit_node[p]:
            continue

        visit_node[p].add(s)
        VX[p][s] = True
        for t in X[p][s]:
            l = (s, t) if p == 0 else (t, s)
            if l in visit_link:
                continue
            visit_link.add(l)

            if t in visit_node[1 - p]:
                continue
            q.put((1 - p, t))

    return len(visit_node[0]) * len(visit_node[1]) - len(visit_link)


def main():
    N = int(input())
    X = {}
    Y = {}

    for _ in range(N):
        x, y = read_values()
        x -= 1
        y -= 1
        X.setdefault(x, set()).add(y)
        Y.setdefault(y, set()).add(x)

    VX = [False] * (10 ** 5)
    VY = [False] * (10 ** 5)

    res = 0
    for x in X.keys():
        if VX[x]:
            continue

        res += f(x, [X, Y], [VX, VY])

    for y in Y.keys():
        if VY[y]:
            continue

        res += f(y, [Y, X], [VY, VX])

    print(res)


if __name__ == "__main__":
    main()


Measured memory_bytes: 102360
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a) {
	os << '{';
	for(int i=0;i<sz(a);i++)
	{
		if(i>0&&i<sz(a)-1)
			os << ", ";
		os << a[i];
	}
	os << '}';
    return os;
}
const int N=3e3+5;
int dp[N][N];
int mod=1e9+7;
int add(int a,int b)
{
    a+=b;
    if(a>=mod)
        a-=mod;
    return a;
}
int mul(int a,int b)
{
    return ((ll)a*b)%mod;
}
int sub(int a,int b)
{
    a-=b;
    if(a<0)
        a+=mod;
    return a;
}
int main()
{
    int n;
    scanf("%i",&n);
    string s;
    cin >> s;
    s='0'+s;
    dp[0][1]=1;
    for(int i=1;i<n;i++)
    {
        vector<int> sums(N);
        sums[0]=dp[i-1][0];
        assert(sums[0]==0);
        for(int j=1;j<=n;j++)
            sums[j]=add(sums[j-1],dp[i-1][j]);
        for(int j=1;j<=i+1;j++)
        {
            if(s[i]=='>')
                dp[i][j]=sub(sums[n],sums[j-1]);
            else
                dp[i][j]=sums[j-1];
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++)
        ans=add(ans,dp[n-1][i]);
    printf("%i\n",ans);
    return 0;
}


Measured memory_bytes: 34176
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int h, w;
  cin >> h >> w;
  vector<vi> g(h + 2, vi(w + 2, 0));
  rep2(i, 1, h + 1) rep2(j, 1, w + 1) {
    char c;
    cin >> c;
    if(c == '#') g[i][j] = 1;
  }
  bool ans = true;
  rep2(i, 1, h + 1) rep2(j, 1, w + 1) {
    if(g[i][j] == 0) continue;
    bool ok = false;
    rep(k, 4) {
      int ni = i + dir[k];
      int nj = j + dir[k + 1];
      if(g[ni][nj]) ok = true;
    }
    if(!ok) ans = false;
  }
  cout << (ans ? "Yes" : "No") << endl;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)

int main(){
 ll x;
  cin >> x;
 ll m=100;
  int i=0;
  while(m<x){
    m=m+m/100 ;
    i++;
  }
  
  cout << i << endl;
}

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

using namespace std;

int main() {
    int N, A;
    cin >> N >> A;
    
    vector<long long int> x(N);
    long long int X=0;
    for(int n=0; n<N; n++) {
        cin >> x[n];
        x[n] -= A;
        X = max(abs(x[n]), X);
    }
    
    vector<vector<long long int> > memo(N+1, vector<long long int>(2*N*X+1, 0));
    memo[0][N*X]=1;
    for(int n=1; n<=N; n++) {
        for(int t=0; t<=2*N*X; t++) {
            memo[n][t] = memo[n-1][t];
            
            if(t-x[n-1]>=0 && t-x[n-1]<=2*N*X) {
                memo[n][t] += memo[n-1][t-x[n-1]];
            }
        }
    }
    
    // for(int n=0; n<=N; n++) {
    //     for(int i=0; i<memo[n].size(); i++) {
    //         cout << memo[n][i] << " ";
    //     }
    //     cout << endl;
    // }

    cout << memo[N][N*X]-1 << endl;
    

    return 0;
    
}

Measured memory_bytes: 2304
N,M = map(int,input().split())
X = sorted(list(map(int,input().split())))
L = []
if N >= M:
    print(0)
else:
    for i in range(M-1):
        L.append(X[i+1]-X[i])
        
    L.sort()
    ans = sum(L[0:M-2-(N-1)+1])
    print(ans)

Measured memory_bytes: 57640
n, m, x = map(int, input().split())

books = []
books.append(list(map(int, input().split())))
for i in range(n-1):
    item = list(map(int, input().split()))
    books.append(item)

und = [0] * m

for b in books:
    for i in range(m):
        und[i] += b[i+1]

flag = True
for i in range(m):
    if und[i] < x:
        flag = False
        break

if flag == False:
    print(-1)
else:
    b = 0
    ans = float('inf')
    for i in range(2**n-1):
        b +=1
        und = [0] * m
        tmp = format(b,'b').zfill(n)
        tmp_ans = 0
        for j in range(n):
            tmp_ans += books[j][0]*int(tmp[j])
            for k in range(m):
                und[k] += books[j][k+1]*int(tmp[j])

        flag = True
        for k in range(m):
            if und[k] < x:
                flag = False

        if flag and tmp_ans < ans:
            ans = tmp_ans

    print(ans)




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

int main(){
	int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a.begin(),a.end());
    for(int i=0;i<n-1;i++){
    	if(a[i]==a[i+1]){
          cout<<"NO";
          return 0;
        }
    }
    cout<<"YES";
    return 0;
}

Measured memory_bytes: 4052
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
signed main(){
  init_io();
  ll n,a;
  vector<ll> use;
  map<ll,ll> mp;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a;
    mp[a]++;
  }
  for(auto p: mp){
    ll cnt = p.second,v = p.first;
    for(int i=0;i<cnt/2;i++){
      use.push_back(v);
    }
  }
  use.push_back(0);
  use.push_back(0);
  sort(use.begin(),use.end(),greater<ll>());
  cout << use[0]*use[1]<<endl;
}


Measured memory_bytes: 6528
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#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()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

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


signed main(void) {
    int n;
    cin >> n;
    vi a(n);
    rep(i,n)cin >> a[i];
    vi dp(n,LINF);
    dp[0] = 0;
    rep(i,n-1){
        dp[i+1] = min(dp[i+1], dp[i] + abs(a[i]-a[i+1]));
        if(i+2 < n)dp[i+2] = min(dp[i+2], dp[i] + abs(a[i]-a[i+2]));
    }
    cout << dp[n-1] << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int k,s;
  cin>>k>>s;
  int cnt=0;
  for (int x = 0; x <= k; ++x)
  {
    for (int y = 0; y <= k; ++y)
    {
      int z=s-x-y;
      if(z>=0 && z<=k) cnt++;
    }
  }
  cout<<cnt;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

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

Measured memory_bytes: 384
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
maxvalue = 0
VmC = [V[a]-C[a] for a in range(N)]

for i in range(N):
    if VmC[i] < 0 :
        VmC[i] = 0
    
    maxvalue += VmC[i]
    
print(maxvalue)


Measured memory_bytes: 3060
n = int(input())
otoshidama = {"JPY":0, "BTC":0}
for i in range(n):
    a, b = map(str, input().split())
    a = float(a)
    if b == "JPY":
        otoshidama["JPY"] = otoshidama["JPY"] + a
    else:
        otoshidama["BTC"] = otoshidama["BTC"] + a
ans = otoshidama["JPY"] + otoshidama["BTC"] * 380000.0
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && (ch != '-')) ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

char s[10];

int main() {

#ifdef LOCAL
  FILEIO("a");
#endif

  cin >> (s + 1);
  if (s[3] == s[4] && s[5] == s[6]) puts("Yes");
  else puts("No");

  cerr << (double)(clock()) / CLOCKS_PER_SEC * 1000 << "ms" << endl;

  return 0;
}

// created by Daniel yuan

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

string S;
int K;
int dp[2][100+1][5];

signed main() {
  //https://atcoder.jp/contests/abc154/tasks/abc154_e
  cin >> S >> K;
  int n = S.size();

  dp[0][0][0] = 1;

  for(int i=0; i<n; i++) {
    int s = (int)(S[i] - '0');
    for(int k=0; k<=K; k++) {
      for(int d=0; d<=9; d++) dp[1][i+1][k + (int)(d!=0)] += dp[1][i][k];
      for(int d=0; d<s; d++)  dp[1][i+1][k + (int)(d!=0)] += dp[0][i][k];
      dp[0][i+1][k + (int)(s!=0)] += dp[0][i][k];
    }
  }
  cout << dp[1][n][K] + dp[0][n][K] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>//'三玖是天！ '.
using namespace std;

string a,b="CF"; //打表
int al,bl;

int main(){
    getline(cin,a);
    al=a.length();
    for(int i=0;i<al;i++)
        if(a[i]==b[bl]){ //当找到一个的时候加一
            bl++;
            if(bl==2)   //都找到的时候就退出
                break;
        }
    if(bl==2) cout<<"Yes"; //判断并且输出
    else cout<<"No";
    cout<<endl;//最后不要忘了打个换行
    return 0;
}

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

using namespace std;


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);

  int n, k;
  cin >> n >> k;

  vector <pair <int, int>> edges;
  for (int i = 1; i < n; i++) {
    edges.push_back({i, n});
  }
  n--;
  int now = n * (n - 1) / 2;
  vector <pair <int, int>> pos;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      pos.push_back({i, j});
    }
  }

  while (now > k && (int) pos.size() > 0) {
    edges.push_back(pos.back());
    now--;
    pos.pop_back();
  }

  if (now != k) {
    cout << "-1\n";
  } else {
    cout << (int) edges.size() << "\n";
    for (auto &it : edges) {
      cout << it.first << " " << it.second << "\n";
    }
  }

}


Measured memory_bytes: 384
N, Y = map(int, raw_input().split())
ok = False
for x in range(N+1):
  for y in range(N+1):
    z = N-x-y
    if z >= 0:
      if 10000 * x + 5000 * y + 1000 * z == Y:
        print x,y,z
        ok = True
    if ok:
      break
  if ok:
    break
if not ok:
  print "-1 -1 -1"



Measured memory_bytes: 2692
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int N;
    int A,B;

    A=0;
    B=0;

    scanf("%d\n",&N);

    if(N==1){
        puts("Hello World");
    }
    else{
        scanf("%d\n%d\n",&A,&B);

        printf("%d\n",A+B);
    }
    
    return 0;
}


Measured memory_bytes: 128
from math import ceil,pow,log2

n,k = map(int,(input().split()))

ans = 0

for i in range(1,n+1):
    coin = 0;
    if i < k:
        coin = ceil(log2(k/i))
    else:
        ans += 1.0 / n
        continue
    ans += 1.0 / n / pow(2.0,coin)

print(ans)

Measured memory_bytes: 3060
using System;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(ReadLine());

        var ans = Enumerable.Range(1, N).Where(x => (x % 3 != 0) && (x % 5 != 0)).Sum(x => (long)x);

        WriteLine(ans);
    }
}


Measured memory_bytes: 28324
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<queue>
using namespace std;

#define MIN(a,b) ((a)<(b)?(a):(b))

int main() {
	int N;
	cin >> N;
	priority_queue<long long> que;
	for (int i = 0,a; i < N*3; i++) {
		cin >> a;
		que.push(a);
	}
	long long ans = 0;
	for (int i = 0; i < N; i++) {
		que.pop();
		ans += que.top();
		que.pop();
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 6512
N , M = map(int,input().split())
H_list = list(map(int,input().split()))

ans_list = []
for i in range(M):
  A , B = map(int,input().split())
  if H_list[A - 1] > H_list[B - 1]:
      ans_list.append(B)
  elif H_list[A - 1] < H_list[B - 1]:
      ans_list.append(A)
  # 一本の道を使って辿り着ける展望台が存在しない
  else:
    ans_list.append(A)
    ans_list.append(B)
 
ans = set(ans_list)
print(N - len(ans))


Measured memory_bytes: 20100
#include <iostream>

using namespace std;

int main(){
	int m, f, r;
	while(true){
		cin >> m >> f >> r;
		if(m == -1 && f == -1 && r == -1) break;
		int mf = m + f;
		char grade;
		if(mf >= 80) grade = 'A';
		else if(mf >= 65) grade = 'B';
		else if(mf >= 50) grade = 'C';
		else if(mf >= 30){
			if(r >= 50) grade = 'C';
			else grade = 'D';
		}
		else grade = 'F';

		if(m == -1 || f == -1) grade = 'F';

		cout << grade << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
import fractions

def lcm(x, y):
    return x * y // fractions.gcd(x, y)

a, b, c, d = map(int, input().split())

cs = (a-1) // c + 1
ce = b // c
cc = ce - cs + 1

ds = (a-1) // d + 1
de = b // d
dc = de - ds + 1

cd = lcm(c, d)
cds = (a-1) // cd + 1
cde = b // cd
cdc = cde - cds + 1


ans = b - a + 1 - cc - dc + cdc

print(ans)

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

string ans;
pair<int,int> s;
pair<int,int> t;

int main() {
    cin >> s.first >> s.second >> t.first >> t.second;
    int dx = t.first - s.first;
    int dy = t.second - s.second;
    rep(i,dx) ans += "R";
    rep(i,dy) ans += "U";
    rep(i,dx) ans += "L";
    rep(i,dy) ans += "D";
    ans += "D";
    rep(i,dx+1) ans += "R";
    rep(i,dy+1) ans += "U";
    ans += "LU";
    rep(i,dx+1) ans += "L";
    rep(i,dy+1) ans += "D";
    ans += "R";
    cout << ans << endl;
    

}

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

int main(){
    int days = 0;
    string S;
    cin >> S;

    if(S[0] == 'R' && S[1] == 'R' && S[2] == 'R'){
        days = 3;
    }else if(S[0] == 'R' && S[1] == 'R'){
        days = 2;
    }else if(S[1] == 'R' && S[2] == 'R'){
        days = 2;
    }else if(S[0] == 'R'){
        days = 1;
    }else if(S[1] == 'R'){
        days = 1;
    }else if(S[2] == 'R'){
        days = 1;
    }

    cout << days << endl;
}

Measured memory_bytes: 3588
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#define LL long long
#define PP std::pair<LL,LL>
std::map<LL,LL> M;
int N;
LL A[200010];
LL ans;
int main(){
    std::cin>>N;
    for(int i=0;i<N;i++){
        std::cin>>A[i];
    }
    if(A[0]==0)ans++;
    for(int i=1;i<N;i++){
        A[i]+=A[i-1];
        if(A[i]==0){
            ans++;
        }
        auto it=M.find(A[i-1]);
        if(it==M.end()){
            M.insert({A[i-1],1});
        }else{
            it->second++;
        }
        it=M.find(A[i]);
        if(it!=M.end()){
            ans+=it->second;
        }
    }
    std::cout<<ans<<std::endl;
    return 0;
}

Measured memory_bytes: 14336
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1LL<<60;
const ll mod = 1e9 + 7;
 
int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}
 
ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

bool is_prime(long long N){
    if (N == 1) return false;
    for (long long i = 2;i * i <= N;i++){
        if (N % i == 0) return false;
    }
    return true;
}
 
ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}
 
double DegreeToRadian(double degree){
    return degree * M_PI / 180.0;
}
 
 
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
 
 
///////////////////////////////////////////////////////////////////////////////////
long long dp[110][100010];

int main(){
    int n, W;
    cin >> n >> W;
    vector<long long> w(n+1), v(n+1);
    for (int i = 1;i <= n;i++){
        cin >> w[i] >> v[i];
    }

    for (int i = 1;i <= n;i++){
        for (int j = 1;j <= W;j++){
            if (j - w[i] >= 0){
                dp[i][j] = max(dp[i-1][j], dp[i-1][j - w[i]] + v[i]);
            }
            else {
                dp[i][j] = dp[i-1][j];
            }
        }
    }

    cout << dp[n][W] << endl;
}


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

int main(){
    int A, B, C, X;
    cin >> A >> B >> C >> X;
    int ans = 0;
    for(int i = 0; i <= A; i++){
        for(int j = 0; j <= B; j++){
            for(int k = 0; k <= C; k++){
                int sum = (i*500) + (j*100) + (k*50);
                if(sum == X){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import qualified Data.List as DL

solve [] a b _ = a-b
solve (e:es) a b True = solve es (a+e) b False
solve (e:es) a b False = solve es a (b+e) True

main = do
  n <- readLn :: IO Int
  as <- map read . words <$> getLine
  let bs = reverse $ DL.sort as
    in putStrLn $ show $ solve bs 0 0 True


Measured memory_bytes: 1020
#include <iostream>			//std::cout, std::cin
#include <string>			//std::string,std::to_string(C++11)
#include <vector>			//std::vector
#include <valarray>			//std::valarray
#include <algorithm>		//std::sort
#include <ctime>			//localtime_s
#include <cstdlib>			//abs
#include <cmath>			//abs,std::pow,sqrt,sin,cos,round,floor,ceil
#include <fstream>			//std::ifstream,std::ofstream
#include <iomanip>			//std::setprecision,std::setw,std::setfill
#include <random>			//std::random(C++11)
#include <numeric>			//std::accumulate
#include <functional>		//std::greater
#include <chrono>			//std::chrono(C++11)
#include <bitset>			//std::bitset
#include <queue>			//std::queue

const static double	de_PI	= 3.14159265358979323846;
const static int	de_MOD	= 1000000007;
const static int	de_MAX	= 999999999;

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());
	//std::ofstream ofs("456.csv");
	//std::chrono::system_clock::time_point t_st = std::chrono::system_clock::now();

	int N = 0;
	std::cin >> N;
	std::vector<bool> A(N,false);

	for (int i = 0; i < N; i++) {
		std::vector<int> n(3);
		std::cin >> n[0] >> n[1] >> n[2];
		std::sort(n.begin(), n.end());
		if (n[2] * n[2] == n[0] * n[0] + n[1] * n[1]) {
			A[i] = true;
		}
	}

	for (int i = 0; i < N; i++) {
		if (A[i]) {
			std::cout << "YES" << std::endl;
		}
		else {
			std::cout << "NO" << std::endl;
		}
	}

	//std::chrono::system_clock::time_point t_ed = std::chrono::system_clock::now();
	//std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(t_ed - t_st).count() << "ms" << std::endl;

}

Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a,b;
   cin>>a>>b;
   if(a>=(2*b))
   {
       cout<<a-(2*b)<<endl;
   }
   else
   {
       cout<<"0"<<endl;
   }
return 0;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/02/28  Problem: ABC 109 B / Link: http://abc109.contest.atcoder.jp/tasks/abc109_b  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */


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

	int N; cin >> N;
	vector<string> a(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	bool valid = 1;
	map<string, int>m;
	FOR(i, 0, N) {
		if (i) {
			valid &= a[i - 1].back() == a[i].front();
		}
		valid &= m.count(a[i])==0;
		m[a[i]] = 1;
	}

	string ans = (valid ? "Yes" : "No");
	
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=100010;
inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
inline int read(){
    char ch=nc();int sum=0;
    while(!(ch>='0'&&ch<='9'))ch=nc();
    while(ch>='0'&&ch<='9')sum=sum*10+ch-48,ch=nc();
    return sum;
}
struct E{
    int t,xt;
}e[N<<1];
 
int h[N],cnt;
 
void adge(int f,int t){
    e[++cnt]=(E){t,h[f]};h[f]=cnt;
}
 
int dp[N][2],dan[N];
 
void dfs1(int u,int fa){
     
    for(int i=h[u];~i;i=e[i].xt) if(e[i].t!=fa){
        dfs1(e[i].t,u);
    //  printf("u=%d e[i].t=%d\n",u,e[i].t);
         
        if(dan[e[i].t]) dp[u][1]++;
        else dp[u][0]++;
    }
    if(dp[u][1]+dp[u][0]==0){
        dan[u]=1;
    }
    else if(dp[u][1]>1){
            puts("First");
            exit(0);
    }
    else if(dp[u][1]==1){
        dan[u]=0;
    }
    else if(dp[u][1]==0){
        dan[u]=1;
    }
}
             
void dfs2(int u,int fa){
    if(dp[u][1]!=1){
    //  printf("dp(%d,1)=%d\n",u,1);
        puts("First");
        exit(0);
    }
    for(int i=h[u];~i;i=e[i].xt) if(e[i].t!=fa){
        int t[2];
        t[0]=dp[u][0]-(!dan[e[i].t]);
        t[1]=dp[u][1]-dan[e[i].t];
        if(t[1]+t[0]==0){
            dp[e[i].t][1]++;
        }
        else if(t[1]==1){
            dp[e[i].t][0]++;
        }
        else if(t[1]==0){
            dp[e[i].t][1]++;
        }
        dfs2(e[i].t,u); 
    }
}
         
int main(){
    memset(h,cnt=-1,sizeof(h));
    int n;
    n=read();
    for(int i=1;i<n;i++){
        int a,b;
    a=read();
    b=read();
        adge(a,b);
        adge(b,a);
    }
    dfs1(1,1);
     
//  for(int i=1;i<=n;i++) printf("dp(%d)= %d %d\n",i,dp[i][1],dp[i][0]);cout<<endl;
     
    dfs2(1,1);
     
//  for(int i=1;i<=n;i++)  printf("dp(%d)= %d %d\n",i,dp[i][1],dp[i][0]);cout<<endl;
     
    puts("Second");
    return 0;
}
 
/*
11
1 2
2 6
1 3
3 4
4 5
6 7
6 8
8 10
7 9
9 11
*/

Measured memory_bytes: 3456
#include <stdio.h>
int main(){
int input;



scanf("%d", &input);
int hasil=0, klr=0;
for (int i=1;i<=9;i++){
	
	for (int j=1;j<=9;j++){
		
		if(input==i*j){
			klr++;
			break;
		}
		else{
			hasil++;
	
		}
	}
	if(klr==1){
		puts("Yes");
		break;
	}	
}
if(hasil==81){
	puts("No\n");
}

return 0;
}

Measured memory_bytes: 1628
#include <iostream>
#include <string>

using namespace std;

int main() {

    int num;

    cin >> num;

    int a[num];

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

    bool b = true;
    int cnt = 0;

    while(b) {
        for(int i = 0; i < num; i ++) {
            if (a[i] % 2) {
                b = false;
                break;
            }
            a[i] = a[i] / 2;
        }
        cnt++;
    }

    cout << cnt - 1 << endl;

    return 0;
}

Measured memory_bytes: 256
"use strict";
// inputに入力データ全体が入る
const main = (input) => {
  const [a, b] = input.trim().split("\n").map(Number);
  if (a === b) {
    return "EQUAL";
  } else if (a > b) {
    return "GREATER";
  } else {
    return "LESS";
  }
};

// ※この行以降は編集しない (標準入力から一度に読み込みMainを呼び出します)
console.log(main(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 30460
N = int(input())
A = list(map(int, input().split()))

A_dict = dict()
if N % 2 == 0:
    for i in range(1, N, 2):
        A_dict[i] = 0
else:
    for i in range(0, N, 2):
        A_dict[i] = 0

for a in A:
    if a not in A_dict:
        print(0)
        exit()
    else:
        A_dict[a] += 1

for k, v in A_dict.items():
    if k == 0:
        if v != 1:
            print(0)
            exit()
    else:
        if v != 2:
            print(0)
            exit()
            
mod = 10**9+7
print(2 ** (N // 2) % mod)

Measured memory_bytes: 14692
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,D;
  string op;
  cin >> A >> B >> C >> D;
 
  if (A+B > C+D) {
    cout << "Left" << endl;
  }
  else if (A+B == C+D){
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 3520
//\\//\\ * * * //\\// ||
#include <bits/stdc++.h> 

#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;

ll power(ll a, ll b) {
  ll res = 1;
  for (ll i = 1; i <= b; i++) {
    res *= a;
  }
  return res;
}

void solve(ll d, ll n, string& res) {
  if (d == 1) {
    res += (char) ('a' + n - 1);
    return;
  }
  ll mx = 0;
  for (ll x = 0; x <= 100; x++) {
    if (power(26, d - 1) * x + 1 <= n) {
      mx = max(mx, x);
    } else {
      break;
    }
  }
  n -= power(26, d - 1) * mx;
  res += (char) ('a' + mx);
  solve(d - 1, n, res);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  ll dig = -1;
  ll sum = 0;
  for (ll i = 1; i <= 100; i++) {
    sum += power(26, i);
    if (sum >= n) {
      sum -= power(26, i);
      n -= sum;
      dig = i;
      break;
    }
  }
  string ans = "";
  solve(dig, n, ans);
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3624
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        h: usize,
        w: usize,
    }

    let mut b: Vec<Vec<char>> = vec![vec!['0';w+2];1];
    for i in 0..h {
        let mut tmp: Vec<char> = vec!['0';1];
        input!{
            c: Chars,
        }
        tmp.extend(c);
        tmp.push('0');
        b.push(tmp);
    }
    b.push(vec!['0';w+2]);
    debug!(b);
    let mut cnt = 0;
    for i in 1..h+1 {
        for j in 1..w+1 {
            if b[i][j]=='.' {
                if b[i-1][j-1]=='#' {
                    cnt += 1;
                }
                if b[i-1][j]=='#' {
                    cnt += 1;
                }
                if b[i-1][j+1]=='#' {
                    cnt += 1;
                }
                if b[i][j-1]=='#' {
                    cnt += 1;
                }
                if b[i][j+1]=='#' {
                    cnt += 1;
                }
                if b[i+1][j-1]=='#' {
                    cnt += 1;
                }
                if b[i+1][j]=='#' {
                    cnt += 1;
                }
                if b[i+1][j+1]=='#' {
                    cnt += 1;
                }
                debug!(cnt);
                print!("{}",cnt);
            } else {
                print!("#");
            }
            cnt = 0;
        }
        print!("\n");
    }
    print!("\n");

}


Measured memory_bytes: 2216
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    string S; cin >> S;
    int out=0;
    for(int i=0;i<3;i++){
        if(S[i]=='1') out++;
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 3628
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] S = new int[n];
		for(int i=0; i<n; i++) S[i] = sc.nextInt();
		int q = sc.nextInt();
		int[] T = new int[q];
		for(int i=0; i<q; i++) T[i] = sc.nextInt();
		int ans = 0;
		for(int i=0; i<q; i++) {
			if(binarySearch(S, T[i])!=-1) {
				ans++;
			}
		}
		System.out.println(ans);
	}
	
	static int binarySearch(int[] A, int x) {
		int l = 0;
		int r = A.length;
		while(l<r) {
			int mid = (l+r)/2;
			if(A[mid] == x) return mid;
			else if(x<A[mid]) r = mid;
			else l = mid+1;
		}
		return -1;
	}

}

Measured memory_bytes: 81648
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,ans=0;
  cin>>n;
  int b[n+1];
  for(int i=1;i<n;i++){
  	cin>>b[i];
  }
  b[0]=b[1];
  b[n]=b[n-1];
  for(int i=0;i<n;i++){
  	ans+=min(b[i],b[i+1]);
  }
  cout<<ans;
}

Measured memory_bytes: 3612
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func main() {
	scanner.Split(bufio.ScanWords)

	x1, _ := nextFloat64()
	y1, _ := nextFloat64()
	x2, _ := nextFloat64()
	y2, _ := nextFloat64()

	distance := math.Sqrt(math.Pow((x2-x1), 2) + math.Pow((y2-y1), 2))
	fmt.Println(distance)
}



Measured memory_bytes: 1128
A,B,C = map(int, input().split())

ans = 0
for _ in range(10**6):
    if A%2 == 1 or B%2 == 1 or C%2 == 1:
        break
    a = (B+C)//2
    b = (C+A)//2
    c = (A+B)//2
    A = a
    B = b
    C = c
    ans += 1

if ans == 10**6:
    ans = -1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  string s; cin >> s;
  COUT(s[0] == s[2] ? "Yes" : "No");
  return 0;
}

Measured memory_bytes: 256