akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
	static final int INF = Integer.MAX_VALUE / 3;
	static final long LINF = Long.MAX_VALUE / 3;

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		int n = fs.nextInt();
		int a[] = fs.nextIntArray(n);
		int cnt = 0;
		for(int i=0;i<n;i++) {
			while(a[i]%2==0) {
				a[i]>>=1;
				cnt++;
			}
		}
		System.out.println(cnt);
	}

	//MOD culculations
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}

	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

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

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

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

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

Measured memory_bytes: 25172
A, B, C, D, E, F = map(int, input().split())

# 可能な水の総量
water_list = []
A_max = F // (100 * A)
B_max = F // (100 * B)
for i in range(A_max + 1):
    for j in range(B_max + 1):
        temp = 100 * A * i + 100 * B * j
        if temp <= F:
            water_list.append(temp)
water_list = list(set(water_list))

# 可能な砂糖の総量
sugar_list = []
C_max = F // (C)
D_max = F // (D)
for i in range(C_max + 1):
    for j in range(D_max + 1):
        temp = C * i + D * j
        if temp <= F:
            sugar_list.append(temp)
sugar_list = list(set(sugar_list))

max_conc = 0
max_conc_water = 0
max_conc_sugar = 0
for water in water_list:
    for sugar in sugar_list:
        # 水があるか and 溶解度を超えていないか and 容器に入るか
        if water != 0 and sugar <= ((E * water) / 100) and water + sugar <= F:
            conc = (100 * sugar) / (water + sugar)
            if conc >= max_conc:
                max_conc = conc
                max_conc_water = water
                max_conc_sugar = sugar

print(max_conc_water + max_conc_sugar, max_conc_sugar)
# print(max_conc)


Measured memory_bytes: 18188
n = int(input())
v = list(map(int, input().split()))
v.sort(reverse=True)
i = n - 1
while i > 0:
    x = (v[i] + v[i - 1])/2
    v.pop()
    v.pop()
    v.append(x)
    i -= 1
print(v[0])

Measured memory_bytes: 38384
fun f(n: Int) = if (n and 1 == 0) n shr 1 else n + n + n + 1

fun main(args: Array<String>) {
    val a1 = readLine()!!.toInt()
    var pre = a1
    val a = mutableSetOf(pre)
    for (i in 2..1000000) {
        pre = f(pre)
        if (pre in a) {
            println(i)
            break
        }
        a += pre
    }
}


Measured memory_bytes: 34216
import java.util.Scanner;

public class Main{
 public static void main(String[] args) {
   Scanner kbd =new Scanner(System.in);
   String T=kbd.next();
   String[] t = T.split("");

   for(int i=0;i<T.length()-1;i++){
   if(t[i].equals("P")&&t[i+1].equals("?"))
   t[i+1]="D";
   if(t[i].equals("?")&&t[i+1].equals("D"))
   t[i]="P";
 }
 for(int i=0;i<T.length();i++){
   if(t[i].equals("?"))
     t[i]="D";
 }
 for(int i=0;i<T.length();i++)
 System.out.print(t[i]);
 }
}


Measured memory_bytes: 68572
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

int main()
{
    int n, q; cin>>n>>q;
    string s; cin>>s;
    int ct[100001]={};
    for(int i=0; i<n-1; i++){
        if(s[i]=='A' && s[i+1]=='C'){
            ct[i+1]=1;
        }
    }
    int cts[100001]; cts[0]=0;
    for(int i=1; i<n; i++){
        cts[i]=cts[i-1]+ct[i];
    }
    for(int i=0; i<q; i++){
        int l, r; cin>>l>>r;
        cout<<cts[r-1]-cts[l-1]<<endl;
    }
    return 0;
}

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

int main(){
	int H, W;
	
	while(1){
		cin >> H >> W;
		if ( H == 0 && W == 0 ) break;
		
		for ( int i = 0; i < H; i++ ){
			for ( int j = 0; j < W; j++ ){
				if ( i == 0 || j == 0 || i == H-1 || j == W-1 ) cout << "#";
				else cout << ".";
			}
			cout << endl;
		}
		cout << "\n";
	}
	
	return 0;
}


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

using i64 = long long int;

int d, n, m;
vector<int> v;

int bsearch(int ok, int ng, function<bool(int)> check){
    while(abs(ok - ng) > 1){
        int mid = (ok + ng) / 2;
        if(check(v[mid]))ok = mid;
        else ng = mid;
    }
    return ok;
}

int main(){
    while(cin >> d, d != 0){
        v.clear();
        cin >> n >> m;
        v.push_back(0);
        for(int i=1;i<n;++i){
            int tmp;
            cin >> tmp;
            v.push_back(tmp);
        }
        sort(v.begin(), v.end());
        v.push_back(d);

        int ans = 0;
        for(int i=0;i<m;++i){
            int k;
            cin >> k;
            int lb = bsearch(0, n+1, [&](int a){return k >= a;});
            int ub = bsearch(n, -1, [&](int a){return k <= a;});
            ans += min(abs(v[lb]-k), abs(v[ub]-k));
        }

        cout << ans << endl;
    }

    return 0;
}



Measured memory_bytes: 3480
X,N = map(int,input().split())

p = list(map(int,input().split()))

#print(p)


D =[]

for j in range(100):
    xx = X + j
    if xx not in p:
        D.append(xx)
        break

for k in range(100):
    yy = X - k
    if yy not in p:
        D.append(yy)
        break

#print(D)

pura =abs(D[0]- X)
mai = abs(D[1]- X)

if mai <= pura:
    print(D[1])

else:
    print(D[0])


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

using namespace std;
using ll = long long;

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> p(n);
    for (auto &i : p) cin >> i;
    // input

    double ans{k};
    vector<ll> cusum(n), sum(n - k + 1);
    cusum[0] = p[0];
    for (int i = 1; i < n; ++i) cusum[i] = cusum[i - 1] + p[i];
    //preprocess

    for (int i = 0; i < n - k; ++i) sum[i] = cusum[i + k] - cusum[i];
    if (n == k) sum[0] = cusum[k - 1];
    ans = *max_element(sum.begin(), sum.end()) + k;
    ans /= 2;
    // solve

    cout << fixed << setprecision(12) << ans << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>
 
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
 
#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;
 
template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

int main() {
  int n;
  while (cin >> n) {
    vector<pair<int,int>> v(n);
    REP(i,n) cin >> v[i].second >> v[i].first;
    sort(ALL(v));

    ll sum = 0;
    bool ok = true;
    REP(i,n) {
      sum += v[i].second;
      if (sum > v[i].first) ok = false;
    }
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
                      cerr << "\n\n" << "Time elapsed: " << \
                      (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
                      return 0
#define ll long long int
#define ull unsigned long long int
#define db long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define pii pair<int , int>
#define pdd pair<db , db>
#define pll pair<ll , ll>
#define vpl vector<pll >
#define vll vector<ll >
#define mod 1000000007
#define mod1 998244353 
#define inf 1000000000000000007
#define eps 0.000001
#define stp fixed<<setprecision(20)
#define endl '\n'




int main()
{
    fastio;
    #ifdef APNA_IO
        start_routine();
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);    
    #endif

    ll x,a;cin>>x>>a;
    if(x<a) cout<<0;
    else cout<<10;

    #ifdef APNA_IO
        end_routine();  
    #endif
}

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

using namespace std;

constexpr int N = 100000;
constexpr int MAX = 10;

string s[N + 1];
char ans[N + 1];
char aux[MAX + 2];

int main() {
	int n, a, b, c, i;

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

	for (i = 1; i <= n; i++) {
		scanf(" %s", aux);
		s[i] = string(aux);
	}

	for (i = 1; i <= n; i++) {
		if (s[i] == "AB") {
			if (a < b) {
				ans[i] = 'A';
				a++;
				b--;
			}
			else if (a > b) {
				ans[i] = 'B';
				a--;
				b++;
			}
			else {
				if (i == n or s[i + 1][0] == 'A') {
					ans[i] = 'A';
					a++;
					b--;
				}
				else {
					ans[i] = 'B';
					a--;
					b++;
				}
			}
		}
		else if (s[i] == "AC") {
			if (a < c) {
				ans[i] = 'A';
				a++;
				c--;
			}
			else if (a > c) {
				ans[i] = 'C';
				a--;
				c++;
			}
			else {
				if (i == n or s[i + 1][0] == 'A') {
					ans[i] = 'A';
					a++;
					c--;
				}
				else {
					ans[i] = 'C';
					a--;
					c++;
				}
			}
		}
		else if (s[i] == "BC") {
			if (b < c) {
				ans[i] = 'B';
				b++;
				c--;
			}
			else if (b > c) {
				ans[i] = 'C';
				b--;
				c++;
			}
			else {
				if (i == n or s[i + 1][1] == 'C') {
					ans[i] = 'C';
					b--;
					c++;
				}
				else {
					ans[i] = 'B';
					b++;
					c--;
				}
			}
		}

		if (a < 0 or b < 0 or c < 0) {
			break;
		}
	}


	if (i <= n) {
		printf("No\n");
	}
	else {
		printf("Yes\n");

		for (i = 1; i <= n; i++) {
			printf("%c\n", ans[i]);
		}
	}

	return 0;
}

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

namespace ConsoleApp3
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var dts = Console.ReadLine().Split(" ").Select(long.Parse).ToArray();
            var d = dts[0];
            var t = dts[1];
            var s = dts[2];
            if (t * s >= d)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 28240
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }
        String arr01[] = mylist.get(0).split(" ");
        int n = Integer.valueOf(arr01[0]);

        ArrayList<Integer> list01 = new ArrayList<Integer>();

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

            list01.add(Integer.valueOf(mylist.get(i)));

        }

        ArrayList<Integer> list02 = new ArrayList<Integer>(list01);

        //昇順でソート
        Collections.sort(list02);
        //降順でソート
        Collections.reverse(list02);

        int maxdata = list02.get(0);
        int seconddata = list02.get(1);

        for (int i = 0; i < list01.size(); i++) {

            int temp = list01.get(i);

            //            System.out.println(temp);
            if (temp == maxdata) {
                System.out.println(seconddata);
            } else {
                System.out.println(maxdata);

            }

        }
    }

}


Measured memory_bytes: 67116
#h,w=map(int,input().split())
import string
al=string.ascii_lowercase
n=int(input())
ss=[]
for i in range(n):
    s=input()
    t=[]
    for i in al:
        t.append(s.count(i))
    ss.append(t)

ans=[]
for i in range(26):
    mi=10**10
    for j in ss:
        mi=min(j[i],mi)
    ans+=[mi]

t=''
for i in range(26):
    t+=al[i]*ans[i]
print(t)


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

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

using namespace std;

#define INF 1e13
void floydWarshall(vector < vector < long long > > &distances){
	int n = distances.size();
	for(int i = 0; i < n; i++)
		distances[i][i] = 0;
	for(int k = 0; k < n; k++){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				long long dt = distances[i][k] + distances[k][j];
				if(distances[i][j] > dt){
					distances[i][j] = dt;
				}
			}
		}
	}
}

int main(){
	optimizar_io;
	int N, M, L;
	cin >> N >> M >> L;
	vector < vector < long long > > distances(N, vector<long long>(N, INF));
	for (int i = 0; i < M; i++){
		int Ai, Bi;
		long long Ci;
		cin >> Ai >> Bi >> Ci;
		Ai--;
		Bi--;
		distances[Ai][Bi] = min(Ci, distances[Ai][Bi]);
		distances[Bi][Ai] = min(Ci, distances[Bi][Ai]);
	}
	floydWarshall(distances);
	vector < vector < long long > > distances2(N, vector<long long>(N, INF));
	for (int i = 0; i < N; i++){
		for (int j = 0; j < N; j++){
			if (distances[i][j] <= L){
				distances2[i][j] = 1;
			}
		}
	}
	floydWarshall(distances2);
	int Q;
	cin >> Q;
	for (int i = 0; i < Q; i++){
		int Ai, Bi;
		cin >> Ai >> Bi;
		Ai--;
		Bi--;
		if (distances2[Ai][Bi] >= INF){
			cout << -1 << endl;
		} else {
			cout << distances2[Ai][Bi] - 1 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <map>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <set>
#include <queue>
#include <list>

using namespace std;
int main()
{
    int n,k,co=0;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%d",&k);
        if(k&1) ++co;
    }
    if((co&1)==0)
        printf("YES");
    else
        printf("NO");
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL
 
struct node{
  struct node *l;
  struct node *r;
  struct node *p;
  int key;
};
 
typedef struct node * Node;
Node root;

main(){
  int n, i, x;
  char str[20];

  scanf("%d",&n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s",str);
 
    if (str[0]=='i'){
      scanf("%d",&x);
      insert(x);
    } 
    else if (str[0]=='p'){
      Inorder(root);
      printf("\n");
       
      Preorder(root);
      printf("\n");
    }
  }
  return 0;
}

void insert(int k){
  Node a=NIL;
  Node b=root;
  Node new;
 
  new = malloc(sizeof(struct node));
  new->key=k;
  new->l=NIL;
  new->r=NIL;
   
  while(b!=NIL){
    a=b;
    if(new->key < b->key) b=b->l;
    else b=b->r;
  }
  new->p=a;
   
  if(a==NIL) root=new;
  else if(new->key < a->key) a->l=new;
  else a->r=new;
}

void Preorder(Node t){
  printf(" %d",t->key);
  if(t != NIL){
    if(t->l != NIL)Preorder(t->l);
    if(t->r != NIL)Preorder(t->r);
  }
}
 
void Inorder(Node t){
   
  if(t != NIL){
    if(t->l != NIL){
      Inorder(t->l);
      }
    printf(" %d",t->key);
     
    if(t->r != NIL){
      Inorder(t->r);
      }
  }
}
 

Measured memory_bytes: 24040
s = gets.chomp

loop do
    if s == ''
        puts 'YES'
        exit
    end
    if s.start_with?('dreamera')
        s = s[5, s.length-1]
    elsif s.start_with?('dreamer')
        s = s[7, s.length-1]
    elsif s.start_with?('dream')
        s = s[5, s.length-1]
    elsif s.start_with?('eraser')
        s = s[6, s.length-1]
    elsif s.start_with?('erase')
        s = s[5, s.length-1]
    else
        puts 'NO'
        exit
    end
end

Measured memory_bytes: 4348
#include<bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;   
const int inf = (int) 1e9+7;
const long long INF = -1000000000000;
int main(){
	fastIO;
	int n,m;
	long long p;
	cin>>n>>m>>p;
	vector< vector< pair<int,long long> > > v1(5003);
	vector< vector<int> > v2(5003);
	for(int i=0;i<m;i++){
		int a,b;
		long long c;
		cin>>a>>b>>c;
		--a;--b;c-=p;
		v1[a].push_back(make_pair(b,c));
		v2[b].push_back(a); 	
	}        
	queue<int> q;
	bool alg[5003];
	for(int i=0;i<n;i++)alg[i]=false;                 
	q.push(n-1);
	alg[n-1]=1;
	while(!q.empty()){
		int x=q.front();
		q.pop();
		for(int i=0;i<(int)v2[x].size();i++){
			int nxt=v2[x][i];
			//cout<<nxt<<" "<<x<<'\n';
			if(alg[nxt] == 0){
				alg[nxt]=1;
				//cout<<nxt<<'\n';
				q.push(nxt);
			}
		}
	}
	
	long long d[5003];
	for(int i=0;i<n;i++)d[i]=-1000000000000;
	d[0]=0ll;              
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(d[j] != -1000000000000){
				for(int k=0;k<(int)v1[j].size();k++){
					int nxt = v1[j][k].first;
					if(d[j] + v1[j][k].second > d[nxt]){
		      	d[nxt] = d[j] + v1[j][k].second;
					}               
				}                 			
			}		
		}
	}

	/*for(int i=0;i<n;i++){
		cout<<d[i]<<" ";
	}
	cout<<'\n';*/
	for(int i=0;i<n;i++){
		for(int j=0;j<(int)v1[i].size();j++){
			int nxt=v1[i][j].first;	
			if(d[i] == -1000000000000 || d[nxt] == -1000000000000)continue;
			if(d[i] + v1[i][j].second > d[nxt] && alg[nxt]){
				//cout<<nxt<<" "<<d[nxt]<<" "<<alg[nxt]<<'\n';
				cout<<-1<<'\n';
				return 0;
			}
		}
	}	
	cout<<max(0ll,d[n-1])<<'\n';
	return 0;
}

Measured memory_bytes: 768
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	ans := 0
	for i := 1; i <= n; i++ {
		x := n / i
		ans += x * (x + 1) / 2 * i
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std ;
int main()
{
    ios_base::sync_with_stdio(false) ;
    cin.tie(0);
    cout.tie(0);
    int x ;
    cin >> x ;
    int c = 8 ;
    int s = 400 ;
    int e = 599 ;
    if(x >= s && x <= e) cout << c << endl ;
    if(x >= (s+200) && x <= (e+200)) cout << c-1 << endl ;
    if(x >= s+400 && x <= e+400) cout << c-2 << endl ;
    if(x >= s+600 && x <= e+600) cout << c-3 << endl ;
    if(x >= s+800 && x <= e+800) cout << c-4 << endl ;
    if(x >= s+1000 && x <= e+1000) cout << c-5 << endl ;
    if(x >= s+1200 && x <= e+1200) cout << c-6 << endl ;
    if(x >= s+1400 && x <= (e+1400)) cout << c-7 << endl ;
}


Measured memory_bytes: 3648
import java.util.*;

public class Main {
	static int N=26;
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		String S=sc.next();
		if(N>=3200) {
			System.out.println(S);
		}else {
			System.out.println("red");
		}

	

}
}

Measured memory_bytes: 24020
## 1. データの読込
n, x = input().split()
n = int(n)  # ドーナツの種類
x = int(x)  # 粉の全量
m = []      # 入力を格納するリスト
i_min = 0   # 最少粉量ドーナツのインデックス
result = 0  # 解答

# n 個の入力に対するループ
for i in range(n):
  # 問題からの入力を int に変換してリストへ格納
  m.append(int(input()))
# ループはここまで

## 2. 全種類ひとつずつ作る
for i in range(len(m)):
  x = x - m[i]
  result = result + 1

## 3. i_min を特定する
for i in range(len(m)):
  if m[i_min] > m[i]:
    i_min = i

## 4. i_min を作れるだけ作る
for i in range(x):
  if x >= m[i_min]:
    result = result + 1
    x = x - m[i_min]
  else:
    break

## 結果の出力
print(result)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    cin>>n;
    int a[n];
    int l=1;
    for(int i=3;i<=n;i++)a[l]=i,l++;
    l--;
    int sum=n;
    int dp[sum+2]={0};
    dp[0]=1;
    for(int i=1;i<=sum;i++){
        for(int j=1;j<=l;j++){
            if(i>=a[j]){
                dp[i]+=dp[i-a[j]];
                dp[i]%=1000000007;
            }
        }
    }
    cout<<dp[sum]<<endl;
}


Measured memory_bytes: 3612
#include<stdio.h>

int main()
{
    int a,b,c;
    scanf("%d%d",&a,&b);
    if(a<6 && a>=0)
        printf("0");
    else if(a>=6 && a<=12)
        printf("%d",b/2);
    else
        printf("%d",b);
    return 0;
}


Measured memory_bytes: 128
a, b, c, k = map(int, input().split())

sum_value = 0
count = k

if count >= a:
    sum_value += (1 * a)
    count -= a
else:
    sum_value += (1 * count)
    count -= count
    
if count >= b:
    sum_value += (0 * b)
    count -= b
else:
    sum_value += (0 * count)
    count -= count
    
if count >= c:
    sum_value += (-1 * c)
    count -= c
else:
    sum_value += (-1 * count)
    count -= count
    
print(sum_value)

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


 int judge(int i){
   int sum=0;
   for(int j=1;j<=i;j++)
   {
     if(i%j==0)
       sum++;
   }
     if(sum==8)return 1;
     else return 0;
 }
   int main(){
     int n;cin>>n;
     int ans=0;
     for(int i=1;i<=n;i+=2)
       ans+=judge(i);
     cout<<ans<<endl;
   }
     


Measured memory_bytes: 256
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
#define sc(x) scanf("%lld",&x)
#define scs(x) scanf("%s",x)
#define pr(x) printf("%lld\n",x)
#define prs(x) printf("%s\n",x)
using namespace std;
const int maxn=1e5+5;
const int mod=1e9;
const double pi=acos(-1.0);
ll n,m,x,s[15],f,ans,mi=0x3f3f3f3f,vis[15],ss[15],cs;
struct node{
    ll v,b[15];
}a[15];

void dfs(ll sta,ll cs){
    f=0;
    if(cs>=n+1) return;
    for(int i=1;i<=m;i++){
        if(s[i]<x){
            f=1;
            break;
        }
    }
    if(f==0){
        mi=min(mi,ans);
        return;
    }
    for(int i=sta;i<=n;i++){
        if(vis[i]==0){
            vis[i]=1;
            ans+=a[i].v;
            for(int j=1;j<=m;j++){
                s[j]+=a[i].b[j];
            }
            dfs(sta+1,cs+1);
            vis[i]=0;
            ans-=a[i].v;
            for(int j=1;j<=m;j++){
                s[j]-=a[i].b[j];
            }
        }
        
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    sc(n),sc(m),sc(x);
    for(int i=1;i<=n;i++){
        sc(a[i].v);
        for(int j=1;j<=m;j++){
            sc(a[i].b[j]);
            ss[j]+=a[i].b[j];
        }
    }
    for(int i=1;i<=m;i++){
        if(ss[i]<x) {
            printf("-1\n");
            return 0;
        }
    }
    dfs(1,0);
    pr(mi);
    return 0;
}

Measured memory_bytes: 3852
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP2(i,x,n) for(int i=x; i<n; i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    string w;
    cin >> w;
    map<char,int>cnt;
    rep(i,w.size()){
        cnt[w[i]]++;
    }
    bool ok=true;
    rep(i,w.size()){
        if(cnt[w[i]]%2!=0)ok = false;
    }

    cout << (ok?"Yes":"No");
    return 0;
}


Measured memory_bytes: 3612
#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let w = get!(String);
    if w == "Sunny" {
        println!("Cloudy");
    } else if w == "Cloudy" {
        println!("Rainy");
    } else {
        println!("Sunny");
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using bs = bitset<32>;
using bss = bitset<64>;

int main(){
	LL N, K;
	cin >> N >> K;
	vector<LL>  a(N);
	for(int i = 0;i < N;i++)    cin >> a[i];
	K++;
	LL mx = 0;
	for(int i = 0;i <= 40;i++){
		LL cnt = 0;
		for(int j = 0;j < N;j++)    if(a[j]&(1LL<<i)) cnt++;
		if(2*cnt < N)   mx |= 1LL<<i;
	}
	LL ans = 0;
	for(int i = 40;i >= 0;i--){
		if(K&(1LL<<i)){
			LL res = 0;
			LL x = K^(1LL<<i);
			x = (x>>i<<i)+mx-(mx>>i<<i);
			for(int j = 0;j < N;j++)	res += a[j]^x;
			ans = max(ans, res);
		}
	}
	cout << ans << endl;
	// LL s = (1<<10)+(1<<5)+(1<<3);
	// s <<= 100;
	// cout << bss(s) << endl;
	// LL e = (1LL<<60)-1;
	// cout << bss(e) << endl;
	// cout << (unsigned(1<<31)-1) << endl;
	// cout << (1<<30) << endl;
	// cout << (1<<31) << endl;
}

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

int main (void){
  long long int n,k;

  cin >> n >> k;

  vector<long long int> a(n,0);

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

  for(int i = k;i < n;i++){
    if(a[i] > a[i - k] ){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }

  return 0;

}

Measured memory_bytes: 4840
fun main(args: Array<String>) {
    val N: Int = readLine()!!.toInt()
    val s = Array<String>(N, { readLine()!! })
    val M: Int = readLine()!!.toInt()
    val t = Array<String>(M, { readLine()!! })
    val alls = s.toSet() + t.toSet()
    var max = 0
    for (word in alls) {
        val now = s.count { it == word } - t.count { it == word }
        max = if (now > max) now else max
    }
    println(max)
}


Measured memory_bytes: 35880
#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>
#include<complex>
#include <cassert>

using namespace std;

#define ll long long
#define ld long double
#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 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

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

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) {
	string s,t;
    int n;
    cin >> n;
	cout << n + n*n + n*n*n << endl;
}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
using ll = long long;
#define what(x) cerr << #x << " is " << x << endl;

int main(){
    int N;
    cin >> N;
    set<int> a;
    for(int i = 0; i < N; ++i) {
        int temp;
        cin >> temp;
        if(a.count(temp) == 0)
            a.insert(temp);
        else
            a.erase(temp);
    }
    cout << a.size() << endl;

    return 0;
}

Measured memory_bytes: 4864
// code author: Dhruva Mahajan
 
// Ideas are cheap, execution is everything.
 
#include<bits/stdc++.h> 
using namespace std;
 
#define ll long long  
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define tr(container, it) for(auto it = container.begin(); it != container.end(); it++)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define testcase(t) int t;cin>>t;while(t--)
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))

int main(){
	
	fastio;

	ll h,n;
	cin>>h>>n;
	ll a[n];
	for(ll i=0;i<n;i++){
		cin>>a[i];
		h-=a[i];
	}

	if(h>0){
		cout<<"No"<<endl;
	}
	else cout<<"Yes"<<endl;


	
	
	return 0;
}

Measured memory_bytes: 1024
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::input;
use std::collections::*;

fn main() {
    input! {
        n:usize,
        k:usize,
        a:[usize;n]
    }
    let a = a.into_iter().map(|x| x - 1).collect::<Vec<usize>>();
    let doubling = itertools::iterate(a, |v| v.iter().map(|&x| v[x]).collect())
        .take(65)
        .collect::<Vec<Vec<_>>>();
    let ans = (0..).take_while(|&i| k >> i != 0).fold(0, |x, i| {
        if (k >> i) & 1 == 1 {
            doubling[i][x]
        } else {
            x
        }
    }) + 1;
    println!("{}", ans);
}

Measured memory_bytes: 106440
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  
  int ans = 1000000;
  int i = -100;
  while(i <= 100){
    int b = 0;
    REP(j,n){
      b += (a[j] - i) * (a[j] - i);
    }
    ans = min(ans,b);
    i++;
  }
  
  cout << ans << endl;
}


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

int main(){
  int n[4],i,m,k;
  m=0;
  k=0;
  
    for(i=0;i<4;i++){
    scanf("%d",&n[i]);
  }
  
    for(i=0;i<4;i++){
      if(n[i]==1)
        m=m+1;
      else if(n[i]==9)
        m=m+1;
      else if(n[i]==7)
        m=m+1;
      else if(n[i]==4)
        m=m+1;
      else m=0;
      k=k+n[i];

  }
  
  if(k==21 && m==4)
    printf("YES");
  else 
    printf("NO");
  
}


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

int main(){
    string a;
    cin>> a;
    if(a.at(0)=='1')a.at(0)='9';
    else if(a.at(0)=='9')a.at(0)='1';
    if(a.at(1)=='1')a.at(1)='9';
    else if(a.at(1)=='9')a.at(1)='1';
    if(a.at(2)=='1')a.at(2)='9';
    else if(a.at(2)=='9')a.at(2)='1';
    cout<< a <<endl;
}

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

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

  vector<vector<char> > field(H + 2);
  for (int i = 0; i < H + 2; i++) {
    field[i].resize(W + 2, '0');
  }

  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      cin >> field[i][j];
      field[i][j] = field[i][j] == '.' ? '0' : '#';
    }
  }

  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      if (field[i][j] != '#') {
	continue;
      }

      for (int k = -1; k <= 1; k++) {
	for (int l = -1; l <= 1; l++) {
	  if (field[i + k][j + l] == '#') {
	    continue;
	  }

	  field[i + k][j + l]++;
	}
      }
    }
  }

  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      cout << field[i][j];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String num_scan = scan.nextLine();
    String box_scan = scan.nextLine();
    int ans = 0;
    int chk_num = 0;
    int chk_box = 0;

    var num = Integer.parseInt(num_scan);
    var box = box_scan.split(" ");

    for (var i = 1; i <= num; i++){
      chk_num = i % 2;
      chk_box = Integer.parseInt(box[i-1]) % 2;
      if ((chk_num == 1) && (chk_box == 1)) {
        ans++;
      }
    }

    System.out.println(ans);
    scan.close();
  }
}

Measured memory_bytes: 35664
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)
def lcm(a,b):
    return a*b/gcd(a,b)
n=int(raw_input())
ans=-1
while n>0:
    n-=1
    if ans==-1:
        ans=int(raw_input())
    else:
        x=int(raw_input())
        ans=lcm(ans,x)
print ans


Measured memory_bytes: 2568
import * as fs from "fs";
const input = (fs.readFileSync("/dev/stdin", "utf8") as string)
  .split("\n")
  .map(Number);
let remainingMoney: number = input[0];
remainingMoney -= input[1];
const donutsCount: number = Math.floor(remainingMoney / input[2]);
remainingMoney -= input[2] * donutsCount;

console.log(remainingMoney);

Measured memory_bytes: 7372
n,k = gets.chomp.split(" ").map(&:to_i)
p = gets.chomp.split(" ").map(&:to_i)
c = gets.chomp.split(" ").map(&:to_i)
ans = -10000000000
visited = Hash.new([-1,0])
1.upto(n) do |i|
  now = i # next = p[now]
  arr = []
  point = 0
  cnt = 0
  while visited[p[now-1]] == [-1,0]
    visited[p[now-1]] = [0,0]
    arr << now
    point += c[p[now-1]-1]
    now = p[now-1]
    cnt += 1
  end
  arr.each do |x|
    visited[x] = [cnt,point]
  end
end
1.upto(n) do |i|
  point = 0
  now = i
  max = -10000000000
  cnt = k
  if visited[now][1] > 0
    cycle = ((cnt - 1) / visited[now][0])
    if cycle >= 0
      point += cycle * visited[now][1]
      cnt -= cycle * visited[now][0]
    end
  else
    cnt = visited[i][0] if cnt > visited[i][0]
  end
  cnt.times do
    point += c[p[now-1]-1]
    now = p[now-1]
    max = point if max < point
  end
  ans = max if ans < max
end
puts ans

Measured memory_bytes: 15352
#include <iostream>
using namespace std;
int main(){
        int n;
        cin >> n;
        int sum = 0;
        int tmp = n;
        while(tmp > 0) {
                sum += tmp % 10;
                tmp /=10;
        }
        if(n%sum == 0) cout << "Yes" << endl;
        else cout<< "No" << endl;

        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int h, w, n;
char ss[305][305];
int s[305][305];
int i, j, k, q;
int sum[305][305], an[305][305];
int ma;
int zuo,you,shang,xia,tot;
int main() {
	cin>>h>>w>>n;
	for(i=1;i<=h;++i)
		for(j=1;j<=w;++j)
			cin>>ss[i][j];
	for(i=1;i<=h;++i)
		for(j=1;j<=w;++j)
			if(ss[i][j]=='#')	s[i][j]=1;
	for(i=1;i<=w;++i) 
		for(j=1;j<=h;++j){
			sum[i][j]=sum[i][j-1]+s[j][i];
			if(sum[i][j]) ma=max(ma,i);
		}
	zuo=1;
	for(i=1;i<ma;++i){
		if(!sum[i][h]) continue; 
		shang=1;
		for(j=1;j<=h;++j){
			if(!s[j][i]) continue;
			++tot;
			xia=j;
			if(sum[i][j]==sum[i][h]) xia=h;
			for(k=shang;k<=xia;++k){
				for(q=zuo;q<=i;++q){
					an[k][q]=tot;
				}
			}
			shang=j+1;
			if(xia==h) break;
		}
		zuo=i+1;
	}
	shang=1;
	you=w;
	for(j=1;j<=h;++j) {
		if(!s[j][i]) continue;
		++tot;
		xia = j;
		if(sum[i][j] == sum[i][h]) xia = h;
		for(k = shang; k <= xia; ++k) {
			for(q = zuo; q <= you; ++q) {
				an[k][q] = tot;
			}
		}
		shang = j + 1;
		if(xia == h) break;
	}	
	for(i = 1; i <= h; ++i) {
		for(j = 1; j <= w; ++j)
			cout << an[i][j] << " ";
		cout << endl;	
	}
	return 0;
}


Measured memory_bytes: 1920
#include<stdio.h>

#define N 1000000

int A[N], n;
 
int binSearch(int key) {
  int first = 0, last = n, middle;

  while (first < last) {
    middle = (first + last) / 2;
    if (key == A[middle]) return 1;
    if (key > A[middle]) first = middle+1;
    else if (key < A[middle]) last=middle;
  }
  
  return 0;
}
 
int main() {
    int i, q, num, cnt=0;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
      scanf("%d", &A[i]);
    }

    scanf("%d", &q);

    for (i = 0; i < q; i++) {
      scanf("%d", &num);
      if (binSearch(num)) cnt++;
    }

    printf("%d\n", cnt);
    return 0;
}



Measured memory_bytes: 3036
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<string>
#include<numeric>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    vector<ll> c(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n) cin >> c[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    ll ans = 0;
    rep(i, n) {
        ll x = b[i];
        ans += 1LL*(distance(a.begin(), lower_bound(a.begin(), a.end(), x)))*(n-distance(c.begin(), upper_bound(c.begin(), c.end(), x)));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
#define pb push_back

int main()
{
    int n, a, b, c, d;
    cin >> n;


    d = n%10;
    n /= 10;
    c = n%10;
    n /= 10;
    b = n%10;
    n /= 10;
    a = n%10;
    n /= 10;

    if(a+b+c+d == 7)
    {
        cout << a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7" << '\n';
    }
    else if(a+b+c-d == 7)
    {
        cout << a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7" << '\n';
    }
    else if(a+b-c+d == 7)
    {
        cout << a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7" << '\n';
    }
    else if(a+b-c-d == 7)
    {
        cout << a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7" << '\n';
    }
    else if(a-b+c+d == 7)
    {
        cout << a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7" << '\n';
    }
    else if(a-b+c-d == 7)
    {
        cout << a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7" << '\n';
    }
    else if(a-b-c+d == 7)
    {
        cout << a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7" << '\n';
    }
    else if(a-b-c-d == 7)
    {
        cout << a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7" << '\n';
    }






    return 0;
}




Measured memory_bytes: 256
use std::cmp;
use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).ok();
    let n = line.trim().parse::<i32>().unwrap();

    let mut score_taro = 0;
    let mut score_hanako = 0;
    for _ in 0..n {
        let mut line = String::new();
        io::stdin().read_line(&mut line).ok();
        let mut iter = line.split_whitespace();
        let taro = iter.next().unwrap();
        let hanako = iter.next().unwrap();

        match taro.cmp(hanako) {
            cmp::Ordering::Less => score_hanako += 3,
            cmp::Ordering::Equal => {
                score_taro += 1;
                score_hanako += 1;
            },
            cmp::Ordering::Greater => score_taro += 3,
        };
    }
    println!("{} {}", score_taro, score_hanako);
}



Measured memory_bytes: 5036
//Pablo Squarson's Headache
#include<bits/stdc++.h>
using namespace std;

int nx[4]={-1,0,1,0}, ny[4]={0,-1,0,1};//左・下・右・上
vector<pair<int, int> > v;

int main(){
  while(true){
    int N;
    cin>>N;
    if(N==0)break;
    v.clear();
    v.push_back(pair<int, int>(0, 0));
    for(int i=0; i<N-1; i++){
      int n, d;
      cin>>n>>d;
      v.push_back(pair<int, int>(v[n].first+nx[d], v[n].second+ny[d]));
    }
    int l=0, r=0, u=0, d=0;
    for(int i=0; i<N; i++){
      if(v[i].first<l)l=v[i].first;
      if(r<v[i].first)r=v[i].first;
      if(v[i].second<d)d=v[i].second;
      if(u<v[i].second)u=v[i].second;
    }
    cout<<r-l+1<<" "<<u-d+1<<endl;
  }
  return 0;
}

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

int main(void) {
  ll N;
  string S;
  cin >> N >> S;

  vector<pair<ll, string>> vec;
  REP(blue, 0, 1LL << N) {
    ll cnt = 0;
    REP(i, 0, N) if(blue & (1LL << i)) cnt++;
    string s = "";
    for(ll i = N - 1; i >= 0; i--) if(blue & (1LL << i)) s += S[i + N];
    REP(i, 0, N) if(!(blue & (1LL << i))) s += S[i + N];
    vec.push_back(make_pair(cnt, s));
  }
  sort(vec.begin(), vec.end());

  ll ans = 0;
  REP(red, 0, 1LL << N) {
    ll cnt = 0;
    REP(i, 0, N) if(red & (1LL << i)) cnt++;
    string s = "";
    REP(i, 0, N) if(red & (1LL << i)) s += S[i];
    for(ll i = N - 1; i >= 0; i--) if(!(red & (1LL << i))) s += S[i];
    auto p = make_pair(cnt, s);
    ans += upper_bound(vec.begin(), vec.end(), p) - lower_bound(vec.begin(), vec.end(), p);
  }
  cout << ans << endl;
}

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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define INFTY 999999


int main(void){
    double T,X;
    scanf("%lf %lf", &T, &X);


    double ans;
    ans=T/X;
    printf("%lf\n",ans);
    
    return 0;
    
}


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

int main() 
{
	ll n,s=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
	    for(int j=1;j<=n;j++)
	    {
	        for(int k=1;k<=n;k++)
	        {
	            s+=(__gcd(i,__gcd(j,k)));
	        }
	    }
	}
	cout<<s<<"\n";
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 2000000000
typedef long long ll;
bool compare(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}
// 入力



int main() {
    ll N,cnt=0;
    
    cin >>N;
    vector<ll>L(N);
    rep(i,N){
        cin >> L[i];
    }
    sort(L.begin(), L.end());

    rep(i,N){
        for(int j = i+1;j<N; j++ ){
            for(int k = j+1; k < N; k++){
                if(L[i]+L[j] >L[k]){
                    cnt++;
                }else{
                    break;
                }
            }
        }
    }




    cout << cnt << endl;
    
    
    return 0;
    

}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define sh cin.tie(0); cin.sync_with_stdio(0); cout.tie(0);
#define FILE freopen("test.in", "r", stdin);
#define vprint(v) for (int ii = 0; ii < v.size(); ii++){cout << v[ii] << " ";}
#define debugv(v) if (v.size() != 0) {cout << "[ "; for (int __ = 0; __ < (int)(v.size()) - 1; __++){cout << v[__] << ", ";} cout << v[(int)(v.size()) - 1] << " ]" << endl;} else {cout << "[]" << endl;}
#define debug cout << "-----------------------------------------------" << endl;
#define print1(a) cout << "{ " << a << " }" << endl;
#define print2(a, b) cout << "{ " << a << ", " << b << " }" << endl;
#define print3(a, b, c) cout << "{ " << a << ", " << b << ", " << c << " }" << endl;
#define print4(a, b, c, d) cout << "{ " << a << ", " << b << ", " << c << ", " << d << " }" << endl;
using namespace std;
#define double long double
const int INF = 1e9 + 228;
const int MAXN = 1e5 + 228;

double calc(pair<int, int> a, pair<int, int> b, long long k){ 
	//cout << k * k * ((a.F - b.F) * (a.F - b.F) + (a.S - b.S) * (a.S - b.S)) << endl;
	return sqrt(k * k * ((a.F - b.F) * (a.F - b.F) + (a.S - b.S) * (a.S - b.S)));
}
long long dp[10][10];
signed main()
{
#ifdef LOCAL
    FILE;
#endif
    sh;
    int n;
    cin >> n;
    vector<pair<int, pair<double, double>>> v;
    int cn = 1;
    for (int i = 2; i <= n; i++) {
    	cn *= i;
    }
    for (int i = 0; i < n; i++) {
    	int x, y;
    	cin >> x >> y;
    	v.pb({i, {x, y}});
    }
    double sm = 0;
    int cnt = 0;
    do {
    	double now = 0;
    	for (int i = 1; i < n; i++) {
    		dp[v[i].F][v[i - 1].F]++;
    		dp[v[i - 1].F][v[i].F]++;
    	}
    	cnt++;
    	//cout << now << ' ' << now / cn <<  endl;
    	//sm += now;
    } while (next_permutation(all(v)));
    for (int i = 0; i < n; i++) {
    	for (int j = 0; j < i; j++) {
    		sm += calc(v[i].S, v[j].S, dp[i][j]);
    	}
    }
    //cout << cnt << endl;
    cout << fixed << setprecision(7) << sm / cnt << endl;
    return 0;
}


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

int main(){
    int n,k;
    cin >> n >> k;
    int ans = 1;
    while(n >= k){
        ans++;
        n /= k;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+50;
ll t,n,m,k;
ll rec[maxn];
const int mod=1e9+7;
ll qk(ll a,ll b,ll p)
{
	ll ans=1%p;
	while(b)
	{
		if(b&1) ans=(ans*a)%p;
		a=(a*a)%p;
		b=b>>1;
	}
	return ans;
}
int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>k;
	ll fin=0;
	for(ll i=k;i>=1;i--)
	{
		ll z=k/i;
		ll zz=qk(z,n,mod);
		zz=zz%mod;
		rec[i]=zz;
		for(ll j=2;;j++)
		{
			ll zzz=i*j;
			if(zzz>k) break;
			rec[i]=(rec[i]-rec[zzz]+mod)%mod;
		}
	}
	for(int i=1;i<=k;i++)
	{
		fin=(fin+(i*rec[i])%mod)%mod;
	}
	cout<<fin<<endl;
	return 0;
}

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

int main(){
	string s;
	char first, end;
	int p;

	cin >> s;
	p = s.size();
	first = s[0];
	end = s[p - 1];
	cout << first << p-2 << end << endl;
	return 0;
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/agc001/tasks/agc001_a
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    ll N; cin>>N;
    vector<ll> l2n(2*N);
    for(auto&& l:l2n){
        cin>>l;
    }
    sort(l2n.begin(),l2n.end());
    ll ans=0;
    for(ll i=0;i<l2n.size();i+=2){
        ans+=min(l2n[i],l2n[i+1]);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
    int a[3][3],n,b;

    rep(i, 3) {
        rep(j, 3) {
            cin >> a[i][j];
        }
    }

    cin >> n;
    bool flag = false;

    vector<vector<bool>> aa(3, vector<bool>(3, false));

    rep(k, n) {
        cin >> b;
        rep(i,3) {
            rep(j,3) {
                if (b == a[i][j]) aa[i][j] = true;
            }
        }
    }

    rep(i,3) {
        if (aa[i][0] == true && aa[i][1] == true && aa[i][2] == true) {
            flag = true;
            break;
        }
    }

    rep(i,3) {
        if (aa[0][i] == true && aa[1][i] == true && aa[2][i] == true) {
            flag = true;
            break;
        }
    }

    if (aa[0][0] == true && aa[1][1] == true && aa[2][2] == true) {
        flag = true;
    }

    if (aa[2][0] == true && aa[1][1] == true && aa[2][0] == true) {
        flag = true;
    }

    if (flag == true) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256