akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

int main(void) {
	int sum, num, i, mi = 0;
	cin >> sum >> num;
	vector<int> d(num);
	rep(i, num)
		cin >> d[i];
	rep(i, num - 1)
		chmax(mi, d[i + 1] - d[i]);
	chmax(mi, d[0] + sum - d[num - 1]);
	cout << sum - mi << "\n";
	return 0;
}

Measured memory_bytes: 1024
S = input()

if S[0] =="R" and S[1] == "R" and S[2] == "R":
  print(3)
  
elif (S[0] =="R" and S[1] == "R") or (S[1] == "R" and S[2] == "R"):
  print(2)
  
elif S[0] =="R" or S[1] == "R" or S[2] == "R":
  print(1)
  
else:
  print(0)

Measured memory_bytes: 8736
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
using namespace std;

typedef long long ll;

int cnt[100003];

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; ++i) {
		int a; cin >> a;
		++cnt[a];
	}
	int one = 0, two = 0;
	for (int i = 1; i <= 100000; ++i) {
		if (cnt[i] == 0) continue;
		cnt[i] = ((cnt[i] + 1) % 2) + 1;
		if (cnt[i] == 1) ++one;
		else ++two;
	}
	if (two % 2 == 0) cout << one + two << endl;
	else cout << one + two - 1 << endl;
	return 0;
}

Measured memory_bytes: 640
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 10 ** 9 + 7
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rf(): return float(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
def rf_(): return [float(_) for _ in rs().split()]
def divisors(n, sortedresult=True):
    div = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div.append(i)
            if i != n // i:
                div.append(n//i)
    if sortedresult:
        div.sort()
    return div
# endregion
h1, m1, h2, m2, k = ri_()
a1 = h1 * 60 + m1
a2 = h2 * 60 + m2
print(a2 - a1 - k)

Measured memory_bytes: 72612
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
double a[105];
int main()
{
    int n;
    double ave=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%lf",&a[i]);
        ave+=a[i];
    }
    ave/=n;
    //printf("%lf\n",ave);
    int ans=0;
    for(int i=1;i<n;i++)
        if(fabs(a[i]-ave)<fabs(a[ans]-ave))
            ans=i;
        printf("%d\n",ans);
}


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

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

	string S;

	cin >> S;
	
	int a[4];
	
	rep(i,4){
		a[i]=S[i]-'0';
		//cout << a[i]+1 << endl;
	}
	
	char op[3];
	
	rep(bit,(1<<4)){
		int sum=a[0];
		rep(i,3){
			if(bit & (1<<i)){
				sum+=a[i+1];
				op[i]='+';
			}
			else{
				sum-=a[i+1];
				op[i]='-';
			}
		}
		//cout << sum << endl;
		if(sum==7){
			
			rep(i,3){
				cout << a[i] << op[i];
			}
			cout << a[3] << "=7" << endl;
			bit=1<<4;//終了処理
			
		}
	}
				

	//cout << "\n";

    }

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

ll GCD(ll a, ll b) { if(b==0) return a; else return GCD(b, a%b); }
ll LCM(ll a, ll b) { return a/GCD(a,b)*b; }

class AShikAndStone {
public:
	void solve(std::istream& in, std::ostream& out) {
        int h,w;in>>h>>w;
        int cnt = 0;
        rep(i,h){
            string s;in>>s;
            rep(j,w){
                if(s.at(j)=='#') ++cnt;
            }
        }
        if(h+w-1==cnt) out<<"Possible"<<endl;
        else out<<"Impossible"<<endl;
	}
};


int main() {
	AShikAndStone solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
N=int(input())

C=[0]*4

for i in range(N):
  S=input()
  if(S=="AC"):
    C[0]+=1
  if(S=="WA"):
    C[1]+=1
  if(S=="TLE"):
    C[2]+=1
  if(S=="RE"):
    C[3]+=1    

print("AC x",C[0])
print("WA x",C[1])
print("TLE x",C[2])
print("RE x",C[3])


Measured memory_bytes: 9216
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main(){
  string s;
  cin >>s;
  ll ans=0;
  for(int i=0;i<s.size()-1;i++){
    if(s[i]!=s[i+1]) ans++;
  }
  cout <<ans<<endl;
}


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

namespace ABC045B_CardGameforThreeABCEdit
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<string, List<char>> dic = new Dictionary<string, List<char>>();
            dic.Add("a",Console.ReadLine().ToCharArray().ToList());
            dic.Add("b", Console.ReadLine().ToCharArray().ToList());
            dic.Add("c", Console.ReadLine().ToCharArray().ToList());

            string target = "a";
            
            while (dic[target].Count != 0)
            {
                string nextTarget = dic[target].First().ToString();

                dic[target].RemoveAt(0);

                target = nextTarget;
            }

            Console.WriteLine(target.ToUpper());

        }
    }
}


Measured memory_bytes: 11232
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
//#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
int32_t main(){
	boost;
	//freopen(".in","r",stdin);
	int X,Y;
	cin>>X>>Y;
	if(!((4*X-Y)&1)){
		int C=(4*X-Y)/2;
		if((C>=0)&&(C<=X)&&(((X-C)*4+2*C)==Y)){
			cout<<"Yes\n";
			return 0;
		}
	}
	cout<<"No\n";
	return 0;
}

//do smth instead of nothing and stay organized
//long long
//array bounds
//special cases
//binary search

Measured memory_bytes: 3636
A1=list(map(int, input().split()))
A2=list(map(int, input().split()))
A3=list(map(int, input().split()))
N=int(input())
b=[0]*N
for i in range(N):
    b[i]=int(input())
C=[0]*9
#print(b)
for i in range(3):
    #print(A1[i] in b)
    if A1[i] in b:
        C[i]=1
    if A2[i] in b:
        C[i+3]=1
    if A3[i] in b:
        C[i+6]=1
#print(C)
if C[0]==C[1]==C[2]==1:
    print('Yes')
elif C[3]==C[4]==C[5]==1:
    print('Yes')
elif C[6]==C[7]==C[8]==1:
    print('Yes')
elif C[0]==C[3]==C[6]==1:
    print('Yes')
elif C[1]==C[4]==C[7]==1:
    print('Yes')
elif C[2]==C[5]==C[8]==1:
    print('Yes')
elif C[0]==C[4]==C[8]==1:
    print('Yes')
elif C[2]==C[4]==C[6]==1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void){
    unsigned long long X, cash;
    int count;
    cin >> X;
    cash = 100;
    count = 0;
    do
    {
        cash *= 1.01;
        count++;
    } while (cash < X);
    
    cout << count << endl;

    
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

const int MAXN = 1e5 + 10;
int size[MAXN];
bool c[MAXN];
int n , m;
int main(){
	cin >> n >> m;
	for(int i = 1 ; i <= n ; ++ i)
		size[i] = 1;
	c[1] = 1;
	for(int i = 1 ; i <= m ; ++ i){
		int x , y;
		cin >> x >> y;
		if(c[x]){
			if(size[x] == 1)
				c[x] = 0;
			c[y] = 1;
		}
		size[x] --;
		size[y] ++;
	}
	int ans = 0;
	for(int i = 1 ; i <= n ; ++ i)
		ans += c[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 768
n = int(input())
a = list(map(int, input().split( )))
###連続区間に分ける

tmp = a[0]
tmp2 = 1
ans = 0
for i in range(1,n):
    if a[i]==tmp:
        tmp2 += 1
    else:
        tmp = a[i]
        ans += tmp2//2
        tmp2 = 1
ans += tmp2//2
print(ans)

Measured memory_bytes: 38456
n,q=map(int,input().split())
stack=[]
for i in range(n):
    stack.append([])
for i in range(q):
    query=list(map(int,input().split()))
    if query[0]==0:
        stack[query[1]].append(query[2])
    elif query[0]==1:
        if len(stack[query[1]])!=0:
            print(stack[query[1]][-1])
    else:
        if len(stack[query[1]])!=0:
            stack[query[1]].pop(-1)



Measured memory_bytes: 13692
import java.util.Scanner;

/**
 * Created by atsushi_takayasu on 2017/08/08.
 */
public class Main {

    public static void main(String[] args){

        Scanner scan = new Scanner(System.in);

        int x = scan.nextInt();

        System.out.println((int)Math.pow(x,3));

    }


}

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

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N; i++) {
  	cin >> d[i];
  }
  sort(d.begin(), d.end());
  int half = d.size() / 2;
  int before = d[half - 1];
  int after = d[half];
  int result = after - before;
  cout << result << endl;
}


Measured memory_bytes: 640
n = int(input())
p = list(map(int,input().split()))
ans = 0
for i in range(1,n-1):
    if max(p[i-1],p[i],p[i+1]) > p[i] > min(p[i-1],p[i],p[i+1]):
        ans += 1
print(ans)

Measured memory_bytes: 38384
#include<iostream>
#include<string>
#include<set>
#include<cstring>
using namespace std;
int main()
{
	string str;
	int n;
	cin>>n;
	int flag=1;
	set<string> s;
	char c;
	cin>>str;
	c=str[str.length()-1];
	s.insert(str);
	for(int i=1;i<n;i++)
		{
			cin>>str;
			if(c!=str[0]||s.count(str))
				flag=0;
			s.insert(str);
			c=str[str.length()-1];
		}
	if(flag) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
from sys import stdin
from itertools import repeat
def main():
    n = int(stdin.readline())
    dat = map(int, stdin.read().split(), repeat(10, 2 * n))
    c = 0
    for i in xrange(n - 1, -1, -1):
        a, b = dat[i*2], dat[i*2+1]
        a += c
        t = b - a % b
        if t == b:
            t = 0
        c += t 
    print c
main()


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

using namespace std;

#define mp make_pair
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forlr(i, l, r) for (int i = int(l); i <= int(r); i++)
#define repeat(n) for (int hjfjke = 0; hjfjke < int(n); hjfjke++)
#define all(c) c.begin(), c.end()
#define ll long long

int mod = 1000000007;

inline int add(int a, int b);
inline int mult(int a, int b);
inline int sub(int a, int b);

int l[200500];
int r[200500];
int a[200500];

long long mx[800500];
long long ad[800500];

void add(int v, int l, int r, int a, int b, long long c) {
    if (r <= a || b <= l)
        return;

    if (a <= l && r <= b) {
        ad[v] += c;
        mx[v] += c;
        return;
    }

    int m = (l + r) >> 1;

    add(v + v + 1, l, m, a, b, c);
    add(v + v + 2, m, r, a, b, c);

    mx[v] = max(mx[v + v + 1], mx[v + v + 2]) + ad[v];
}

long long get(int v, int l, int r, int a, int b) {
    if (r <= a || b <= l)
        return -1e18;

    if (a <= l && r <= b) {
        return mx[v];
    }

    int m = (l + r) >> 1;
    return max(get(v + v + 1, l, m, a, b), get(v + v + 2, m, r, a ,b));
}

struct block {
    int w, s, v;

    bool operator<(block &other) {
        return s + w < other.s + other.w;
    }
};


block b[1005];

int32_t main() {
    std::iostream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        block a;
        cin >> a.w >> a.s >> a.v;
        b[i] = a;
    }

    sort(b, b + n);

    vector<long long> dp(20005);

    forn(j, 20005)
    dp[j] = -1e18;

    dp[0] = 0;

    forn(i, n) {
        vector<long long> new_dp(20005, -1e18);

        forn (j, 20005) {
            new_dp[j] = max(new_dp[j], dp[j]);

            if (j <= b[i].s && dp[j] > -1e17)
                new_dp[j + b[i].w] = max(new_dp[j + b[i].w], dp[j] + b[i].v);
        }

        dp = std::move(new_dp);

        /*forn(j, 7)
            cout << dp[j] << " ";
        cout << "\n";*/
    }

    long long ans = 0;

    forn(j, 20005)
        ans = max(ans, dp[j]);

    cout << ans;

    return 0;
}

int add(int a, int b) {
    int result = a + b;
    if (result >= mod)
        result -= mod;
    return result;
}

int sub(int a, int b) {
    int result = a - b;
    if (result < 0)
        result += mod;
    return result;
}

int mult(int a, int b) {
    return (a * 1ll * b) % mod;
}

Measured memory_bytes: 1148
#include<stdio.h>

int selectionSort(int A[],int N) {
	int i, j, t, sw=0, minj;
	for(i=0; i<N-1; i++) {
		minj = i;
		for(j=i; j<N; j++) {
			if(A[j] < A[minj]) minj = j;
		}
		t = A[minj]; A[minj] = A[i]; A[i] = t;
		if(i != minj) sw++;
	}
	return sw;
}

int main() {
	int A[100],N,i,sw;
	
	scanf("%d", &N);
	for(i=0; i<N; i++) scanf("%d", &A[i]);
	
	sw = selectionSort(A, N);
	
	for(i=0; i<N; i++) {
		if(i!=0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
	printf("%d\n", sw);
	
	return 0;	
}

Measured memory_bytes: 2716
using System;
class ans0630
{
    static void Main()
    {
        var a = int.Parse(Console.ReadLine());
        var b = int.Parse(Console.ReadLine());
        var c = int.Parse(Console.ReadLine());
        var d = int.Parse(Console.ReadLine());
        var e = int.Parse(Console.ReadLine());
        if (a > 0) {
            Console.WriteLine((b - a) * e);
        } else {
            Console.WriteLine((Math.Abs(0 - a) * c) + (b - 0) * e + d);
        }
    }
}


Measured memory_bytes: 15928
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <unordered_set>
#include <utility>
#include <fstream>
#include <bitset>
#include <unordered_map>
#include <set>
using namespace std;
 
#define ll long long
#define ldb long double
 
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int a, b, c;
	cin >> a >> b >> c;
	swap(a, b);
	swap(a, c);
	cout << a << " " << b << " " << c;
	
	return 0;
}

Measured memory_bytes: 256
N,S = open(0).read().split()
o = 0
c = 0
pre = 0
temp_o = 0
for b in S:
    if b == '(':
        o += 1
        temp_o += 1
    else:
        c += 1
        if temp_o == 0:
            pre += 1
        else:
            temp_o -= 1
suf = max(0,pre+o-c)
ans = ('('*pre) + S + (')'*suf)
print(ans)

Measured memory_bytes: 8984
l, r = gets.split.map(&:to_i)
i_list = Array.new
z_list = Array.new

#print(i_list, "\n")
res = 2019
for i in l..r-1
  for j in l+1..r
    z = (i*j)%2019
    if z < res
      res = z
    end
    if res == 0
      puts z
      exit
    end
  end
end

p res


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

struct p{
  long long first;
  int w;

  bool operator<(const p & right) const {
    return first == right.first ? w < right.w : first < right.first;
  }
};

int main(){
  long long n, l, t; cin >> n >> l >> t;
  vector< p > x(n);
  for(int i = 0 ; i < n; i++){
    cin >> x[i].first >> x[i].w;
  }
  long long stand = 0;
  for(long long i = 0 ; i < n ; i++){
    if(x[i].w == 1){
      stand += (x[i].first + t) / l;
      x[i].first = (x[i].first + t)%l;
    }
    else if(x[i].w == 2){
      stand -= (l - x[i].first  + t - 1) / l;
      x[i].first = (x[i].first + l - t%l) % l;
    }
  }
  sort(x.begin(), x.end());
  //for(long long i = 0 ; i < n ; i++) cout << stand << x[i].first << endl;
  for(long long i = 0 ; i < n ; i++){
    if(stand >= 0) cout << x[(i + stand%n)%n].first << endl;
    if(stand < 0)cout << x[(i + n - (-1*stand)%n) % n].first << endl;
  }
}


Measured memory_bytes: 2816
#include <cstdio>
#include <vector>
#include <algorithm>

int main(int argc, char *argv[]) {
	using namespace std;
	
	int vertNum, horiNum;
	fscanf(stdin, "%d", &vertNum);
	fscanf(stdin, "%d", &horiNum);
	
	vector<int> list(vertNum);
	for (int i = 0; i < vertNum; i++) {
		list[i] = i+1;
	}
	
	int tmp1, tmp2;
	for (int i = 0; i < horiNum; i++) {
		fscanf(stdin, "%d,%d", &tmp1, &tmp2);
		swap(list[tmp1-1], list[tmp2-1]);
	}
	
	for (int i = 0; i < vertNum; i++) {
		printf("%d\n", list[i]);
	}
	return 0;
}

Measured memory_bytes: 0
# -*- coding: utf-8 -*-
###########　入力
# 整数の入力
A, B, C = list(map(int, input().split()))

output = "No"
if (A==B and A!=C) or (A==C and A!=B) or (B==C and A!=B):
    output = "Yes"

###########　出力
print(output)

Measured memory_bytes: 2940
use proconio::input;
use proconio::marker::Usize1;
use std::collections::BinaryHeap;
use std::cmp::Reverse;

fn main()
{
    input! {
    n:usize,
    m:usize,
    l:i64,
    edge:[(Usize1,Usize1,i64);m],
    q:usize,
    query:[(Usize1,Usize1);q],
    }

    let mut v = vec![vec![]; n];
    for (a, b, c) in edge {
        v[a].push((b, c));
        v[b].push((a, c));
    }

    let inf = 1i64 << 60;
    let mut ans = vec![vec![inf; n]; n];
    for s in 0..n {
        let mut q = BinaryHeap::new();
        q.push(Reverse((0, 0, s)));

        let mut dist = vec![(inf, inf); n];
        dist[s] = (0, 0);
        while let Some(Reverse((num, dst, idx))) = q.pop() {
            if dist[idx] < (num, dst) {
                continue;
            }
            for &(nxt, cost) in v[idx].iter() {
                let (num, dst) = if dst + cost <= l {
                    (num, dst + cost)
                } else if cost <= l {
                    (num + 1, cost)
                } else {
                    (inf, inf)
                };

                if dist[nxt] <= (num, dst) {
                    continue;
                }
                dist[nxt] = (num, dst);
                q.push(Reverse((num, dst, nxt)));
            }
        };

        for i in 0..n {
            let dst = if dist[i].0 == inf {
                -1
            } else {
                dist[i].0
            };
            ans[s][i] = dst;
        }
    }

    for (s, t) in query {
        println!("{}", ans[s][t]);
    }
}

Measured memory_bytes: 8484
from sys import stdin

S = stdin.readline().rstrip()

count = 0
count_list = []
N = len(S)
for i in range(0,N):
    while S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
        count += 1
        if i == N - 1:
            break
        i += 1
    count_list.append(count)
    count = 0

count_list.sort()
print(count_list[-1])

Measured memory_bytes: 3064
import java.util.*;

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

		int a[] = new int[21];
		int b[] = new int[21];
		int c[] = new int[21];

		for(int i = 1 ; i <= n ; i++){
			a[i] = sc.nextInt();
		}
		for(int i = 1 ; i <= n ; i++){
			b[i] = sc.nextInt();
		}
		for(int i = 1 ; i < n ; i++){
			c[i] = sc.nextInt();
		}

		int ans = 0;
		ans += b[a[1]];
		int pre = a[1];
		for(int i = 2 ; i <= n ; i++){
			ans += b[a[i]];
			if(a[i] == pre+1){
				ans += c[pre];
			}
			pre = a[i];
		}
		if(a[n] == pre+1){
			ans += c[pre];
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 22740
import java.awt.AWTError;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] in = Stream.of(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
		
		int diff = in[0] + in[1];
		if (diff >= 24)
			diff %= 24;
		
		System.out.println(diff);		
	}
}


Measured memory_bytes: 28756
//ΔAGC033A
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 1111;
char c[N];
int n,m,a[N][N];
int main()
{
	int i,j,x;
	scanf("%d%d",&n,&m);
	for(i=0;i<=n+1;i=i+1)
		for(j=0;j<=m+1;j=j+1)
			a[i][j]=1e9;
	for(i=1;i<=n;i=i+1){
		scanf("%s",c+1);
		for(j=1;j<=m;j=j+1)
			if(c[j]=='#')
				a[i][j]=0;
	}
	for(i=1;i<=n;i=i+1)
		for(j=1;j<=m;j=j+1)
			a[i][j]=min(a[i][j],min(a[i-1][j],a[i][j-1])+1);
	for(i=n;i;i=i-1)
		for(j=1;j<=m;j=j+1)
			a[i][j]=min(a[i][j],min(a[i+1][j],a[i][j-1])+1);
	for(i=1;i<=n;i=i+1)
		for(j=m;j;j=j-1)
			a[i][j]=min(a[i][j],min(a[i-1][j],a[i][j+1])+1);
	for(i=n;i;i=i-1)
		for(j=m;j;j=j-1)
			a[i][j]=min(a[i][j],min(a[i+1][j],a[i][j+1])+1);
	x=0;
	for(i=1;i<=n;i=i+1)
		for(j=1;j<=m;j=j+1)
			x=max(x,a[i][j]);
	cout<<x;
	return 0;
}

Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	string s; cin>>s;
	int n=s.size();
	ll ans=MOD;
	rep(i,0,n-2){
		string t;
		t.push_back(s[i]);
		t.push_back(s[i+1]);
		t.push_back(s[i+2]);
		ll j=stol(t);
		ans=min(ans,abs(753-j));
	}
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  ABC124
//
//  Created by hiroaki on 2019/05/07.
//  Copyright © 2019年 hiroaki. All rights reserved.
//

#include <iostream>
#include <vector>
#include <map>
#include <iterator>
#include <set>
#include <cmath>
#include <algorithm>
#include <locale>

//pair sort firstに揃う

#define int long long
#define pb(n) push_back(n)
#define Rap(n,i) for(int (i)=0;(i)<(n);(i)++)
#define Pr(n) cout<<n<<endl;
#define F first
#define S second
#define vector2 vector<vector<int> >
#define index(v,x) find((v).begin(), (v).end(), (x))-(v).begin()
#define ctoi(c) (int)(c-'0')
#define incin(n) int (n); cin>>(n);
#define ELM 100001 //問題によっては1000000001に変更

//限定
using namespace std;

signed  main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k,x;
    cin >> k >> x;
    int min;
    min = x-(k-1);
    string s;
    Rap(2*k-1, i){
        s+=to_string(min+i);
        if (i==2*k-2) {
            break;
        }
        s+=' ';
    }
    Pr(s);
    return 0;
}


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

/* #pragma */
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/*alias*/
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const double EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right

//#define int long long

//g++ -std=c++14 -Wall --pedantic-errors -fsanitize=signed-integer-overflow -fno-sanitize-recover=all -o template template.cpp

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

signed main()
{
	string s; cin >> s;

	//s is reversed
	reverse(s.begin(), s.end());
	//"dream" to "maerd"
	for(int i = 0, i_len = 4; i < i_len; ++i){
		reverse(divide[i].begin(), divide[i].end());
	}

	bool can = true;
	for(int i = 0, i_len = s.size(); i < i_len;){
		bool can2 = false;
		for(int j = 0, j_len = 4; j < j_len; ++j){
			string d = divide[j];
			if(s.substr(i,d.size()) == d){
				can2 =true;
				i += d.size();
			}
		}
		if(!can2){
			can = false;
			break;
		}
	}
	if(can) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll inf = (ll)1e15;
bool vis[1005][1005] ,vis1[1000005];
char arr[1005][1005];
ll dist[1000005] , parent[1005][1005] ,cnt =0;
ll px[]={1,-1,0,0} ;
ll py[]={0,0,1,-1} ;

bool valid(ll x,ll y,ll n,ll m){
    if(x<=0 || y<=0 || x>n || y>m || arr[x][y]!='.')return false;
    return true;
}

void dfs(ll x,ll y,ll n,ll m,ll d){
    vis[x][y] = true; parent[x][y] = d;
    for(ll i=0;i<4;i++)
     if(valid(x+px[i],y+py[i],n,m) && !vis[x+px[i]][y+py[i]])
       dfs(x+px[i] ,y+py[i], n, m, d);    
}

int main(){
  ll n,m,i,j,sx,sy,dx,dy,k,l;
  cin>>n>>m>>sx>>sy>>dx>>dy;
  for(i=1;i<=n;i++)
   for(j=1;j<=m;j++)
    cin>>arr[i][j];

  for(i=1;i<=n;i++)
   for(j=1;j<=m;j++)
    if(!vis[i][j] && arr[i][j]=='.'){
        dfs( i , j , n , m,++cnt);
        dist[cnt] = inf;
    }
  
  set<pair<ll,ll>> s;

  for(i=1;i<=n;i++)
   for(j=1;j<=m;j++){
      if(arr[i][j]=='#')continue;
      for(k=-2;k<=2;k++)
       for(l=-2;l<=2;l++){
           if(valid(i+k,j+l,n,m)){
               ll x = parent[i][j] , y = parent[i+k][j+l];
               if(x>y)swap(x,y);
               if(x!=y)s.insert({x,y});
           }
       }  
   }
   
   vector<vector<ll>> v(cnt+5); 
   for(auto kk:s){
       ll x = kk.first , y = kk.second;
       v[x].push_back(y);
       v[y].push_back(x);
    //    cout<<x<<" "<<y<<"\n";
   }
   queue<ll> q; vis1[parent[sx][sy]] = true; dist[parent[sx][sy]] = 0; q.push({parent[sx][sy]});
   while(!q.empty()){
       ll x = q.front(); q.pop();
       for(auto kk:v[x]){
           if(!vis1[kk]){
               vis1[kk]=true; dist[kk] = 1+dist[x]; q.push(kk);
           }
       }
   }

   if(!vis1[parent[dx][dy]])cout<<"-1";
   else cout<<dist[parent[dx][dy]];
   
//    cout<<parent[sx][sy]<<" "<<parent[dx][dy];
}

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

int main(){
    int N;

    scanf("%d", &N);

    int *a = (int *) malloc(sizeof(int) * N);

    for(int i = 0; i < N; i ++){
        scanf("%d", a + i);
    }
    int K = 1;
    int count = 0;

    for(int i = 0; i < N; i ++){
        if(a[i] == K){
            K ++;
        }else{
            count ++;
        }
    }
    if(K == 1){
        printf("-1\n");
    }else{
        printf("%d\n", count);
    }
}

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

int main(){
    ll a, b, x;
    cin >> a >> b >> x;
    ll ans = b/x - a/x;
    if (a%x==0) {
        ans++;
    }    

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
nn = (gets).to_i
inputs = (gets)

r = 0
b = 0
nn.times do |n|
  if (inputs[n] == 'R') then
    r = r + 1
  else
    b = b + 1
  end
end
  
if (r > b) then
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 3836
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
const ll mod=1000000007;
ll gcd(ll a,ll b){if(a<b)swap(a,b);while((a%b)!=0){a=b;b=a%b;}return b;}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};


int main(){
  set<int> s;
  int n; cin>>n;
  bool f=0;
  rep(i,n){
    int a; cin>>a;
    if(s.count(a)) f=1;
    else s.insert(a);
  }
  if(f)
  puts("NO");
  else
  puts("YES");


  return 0;
}


Measured memory_bytes: 9600
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>

int work(std::istream &in) {
    int r = 0;
    int N;
    in >> N;
    for (int i = 1; i <= N; i += 2) {
        int c = 0;
        for (int j = 1; j <= i; ++j) {
            if (i % j == 0) ++c;
        }
        if (c == 8) ++r;
    }
    return r;
}

struct testdata {
    const char *input;
    int expected;
};

int test() {
    int ret = 0;

    struct testdata testset[] {
        {"105", 1},
        {"7", 0},
    };

    const int TESTLEN = sizeof(testset) / sizeof(testset[0]);
    for (int i = 0; i < TESTLEN; ++i) {
        std::stringstream sin(testset[i].input);
        int actual = work(sin);
        if (actual != testset[i].expected) {
            fprintf(stderr, "ERROR: expected: %d, but actual %d\n", testset[i].expected, actual);
            ret = 1;
        }
    }

    return ret;
}

int main(int argc, char *argv[]) {
    if (argc == 2 && strcmp("--test", argv[1]) == 0) {
        exit(test());
    }
    printf("%d\n", work(std::cin));
}


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

int main() {
	int A, B;
	cin >> A >> B;
	cout << (A - 1) * (B - 1);
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

そのまま計算するだけ
*/

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    ll d = c - a - b;

    int f;
    if (d < 0) {
        f = 0;
    } else {
        f = 4 * a * b < d * d;
    }

    cout << (f ? "Yes" : "No") << endl;

    return 0;
}

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

int main() {
  int N;
  int A = 1;
  cin >> N;
  vector<int> mochi(N + 10); 
  for (int i = 0; i < N; i++) cin >> mochi.at(i);
  
  sort(mochi.begin(), mochi.end());
  reverse(mochi.begin(), mochi.end());
  
  for (int i = 1; i < N; i++) {
    if (mochi.at(i - 1) > mochi.at(i)) A++;
  }
  
  cout << A << endl;
}

Measured memory_bytes: 256
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n, m; readV(n, m);
  int[] x; readA(m, x);

  if (m <= n) {
    writeln(0);
    return;
  }

  x.sort();
  auto y = new int[](m-1);
  foreach (i; 0..m-1) y[i] = x[i+1] - x[i];

  y.sort();
  writeln(y[0..m-n].sum);
}


Measured memory_bytes: 3324
import bisect
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
biSet = set()


for i in range(n):
    for j in range(i+1, n):
        length = l[i] + l[j]

        index = bisect.bisect_left(l[j+1:], length)
        #print(index)
        if index > 0:
            ans += index


print(ans)

Measured memory_bytes: 52956
#include <stdio.h>

int main(void)
{
	int card[4][13];
	char suit[] = {'S', 'H', 'C', 'D'};
	int data_in, rank, i, j;
	char suit_c;


	for(i = 0;i < 4;i++)
		for(j = 0;j < 13;j++)
			card[i][j] = 0;
	scanf("%d", &data_in);		
	for(i = 0;i < data_in;i++)
	{
		scanf(" %c %d", &suit_c, &rank);
		switch(suit_c)
		{
			case 'S':
				card[0][rank - 1] = 1;
				break;
			case 'H':
				card[1][rank - 1] = 1;
				break;
			case 'C':
				card[2][rank - 1] = 1;
				break;
			case 'D':
				card[3][rank - 1] = 1;
				break;
		}
	}
	for(i = 0;i < 4;i++)
		for(j = 0;j < 13;j++)
			if(card[i][j] == 0)
				printf("%c %d\n", suit[i], j + 1);

	return 0;
}

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

int main(){
	int k, l, a[11][11] = {};
	string in[8], mm;
	while (true)
	{
		for (int i=0;i<8;i++){
			cin >> in[i];
		}
		if (cin.eof()) { break; }

		for (k = 0; k<8; k++) {
			for (l = 0; l<8; l++) {
				mm = in[k][l];
				a[k][l] = stoi(mm);
			}
		}
		for (k = 0; k<8; k++) {
			int z = false;
			for (l = 0; l<8; l++) {
				if(1 ==a[k][l]){
					z = true;
					break;
				}
			}
			if (z) { break; }
		}
		if (a[k + 3][l] == 1) { cout << "B" << endl; }
		else if (a[k][l+3] == 1) { cout << "C" << endl; }
		else if (a[k+1][l + 2] == 1) { cout << "E" << endl; }
		else if (a[k+2][l + 1] == 1) { cout << "F" << endl; }
		else if (a[k+1][l + 1] == 1) { cout << "A" << endl; }
		else if (a[k+2][l - 1] == 1) { cout << "D" << endl; }
		else { cout << "G" << endl; }
	}
	return 0;
}

Measured memory_bytes: 3012
import sys
import math
import collections
from collections import deque
from functools import reduce
import heapq
k = int(input())
#n, k = map(int, sys.stdin.readline().split())
#s = input()
#a = list(map(int, sys.stdin.readline().split()))

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def main():
    ans = 0
    for i in range(1, k+1):
        for j in range(1, k+1):
            if gcd(i, j) == 1:
                ans += k
                continue
            for l in range(1, k+1):
                ans += gcd(i, j, l)
    print(ans)

main()




    


Measured memory_bytes: 9636
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int n,m;
  cin >> n >> m;
  cout << (n*(n-1)/2+m*(m-1)/2) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <iostream>
#include <string>

#include <algorithm>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define PB push_back
#define MP make_pair

#define FOR(i, b, e) for(int i=(b);i<(e);i++)
#define REP(i, n) FOR(i,0,n)

#define ALL(v) (v).begin(),(v).end()

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VPII;

const int MOD = 1000000007;
const int INF = 1e9;

const double EPS = 1e-9;
const double PI = acos(-1.0);

const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};

LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }

int main() {
    int X, Y, Z;
    cin >> X >> Y >> Z;
    cout << Z << ' ' << X << ' ' << Y << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 3e5 + 1;
int n, m, k;
long long int A[N], B[N], cs[N], sum; 
int main(){
    cin >> n >> m >> k;
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }
    for(int i = 0; i < m; i++){
        cin >> B[i];
        cs[i + 1] = cs[i] + B[i];
    }
    int answer = upper_bound(cs, cs + m + 1, k) - cs - 1;
    for(int i = 0; i < n; i++){
        sum += A[i];
        if(sum > k)break;
        int value = upper_bound(cs, cs + m + 1, k - sum) - cs - 1;
        answer = max(answer, (i + 1) + value);
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 8276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  string ans="Yes";
  int a, b, c, d; cin >> a >> b >> c >> d;
  while(1){
    c -= b;
    if(c<=0) break;
    a -= d;
    if(a<=0){
      ans="No"; break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 100005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<ll,ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
using namespace std;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}




    
void test_case() {

   int n;
   cin>>n;

   ll ans  =0;
   

   for(int i=1; i<=n; i++) {
       if(i%3 !=0 && i%5 !=0  ) {
           ans+= i;
       }
   }

   cout<<ans<<endl;



}


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

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);


    int t = 1;
    // cin >> t;
    while (t--)
    {
        test_case();
    }
}

Measured memory_bytes: 3580
def main():
    from sys import stdin
    def input():
        return stdin.readline().strip()
    
    n = int(input())
    red = [tuple(map(int, input().split())) for _ in range(n)]
    blue = [tuple(map(int, input().split())) for _ in range(n)]

    red.sort()
    blue.sort()

    now = 0
    for i in blue:
        while now < len(red) and red[now] < i:
            now += 1
        
        l = red[:now]
        if l == []:
            continue

        l = sorted(l, key=lambda x: x[1])
        if l[0][1] > i[1]:
            continue
        
        # binary search
        left = 0
        right = len(l) - 1
        while left < right:
            center = (left + right + 1) // 2
            if l[center][1] < i[1]:
                left = center
            else:
                right = center - 1

        red.remove(l[left])
        now -= 1

    print(n - len(red))

main()

Measured memory_bytes: 63100
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	n := nextInt()

	for i := 1; i < 10; i++ {
		for j := 1; j < 10; j++ {
			if i*j == n {
				fmt.Println("Yes")
				return
			}
		}
	}

	fmt.Println("No")

}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1784
N = int(input())
a_ls = [int(i) for i in input().split()]

for i in range(N-1):
    if a_ls[i] < 0:
        a_ls[i] = - a_ls[i]
        a_ls[i+1] = - a_ls[i+1]

abs_ls = [abs(a) for a in a_ls]
if any([a < 0 for a in a_ls]):
    print(sum(abs_ls) - min(abs_ls) * 2)
else:
    print(sum(abs_ls))

Measured memory_bytes: 14412
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;

/**
 * Equal Sum Sets
 */
public class Main {

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

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			StringTokenizer st = new StringTokenizer(line);

			int n, k, s;
			n = parseInt(st.nextToken());
			k = parseInt(st.nextToken());
			s = parseInt(st.nextToken());
			if ((n | k | s) == 0) break;

			System.out.println(solve(n, k, s));

		} //end while
	} //end main

	public static int solve(int n, int c, int r) {

		int ret = 0;

		if (c == 0 && r == 0) {
			ret = 1;
		} else if (n != 0) {
			ret = solve(n - 1, c - 1, r - n)
					+ solve(n - 1, c, r);
		}
		return ret;
	}
}

Measured memory_bytes: 24508
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long
const ll MOD = 1000000007;

short dp[20][51][262144];
short bcs[262144];

void chmin(short& a, short b) {
	a = min(a, b);
}

int main() {
	int N, n;
	cin >> N;
	n = N / 2;
	vector<int> A(N), B(N);
	for (int i = 0;i < N;i++) {
		cin >> A[i];
	}
	for (int i = 0;i < N;i++) {
		cin >> B[i];
	}
	for (int i = 0;i < 20;i++) {
		for (int k = 0;k < 51;k++) {
			for (int j = 0;j < 262144;j++) {
				dp[i][k][j] = 9999;
			}
		}
	}
	
	dp[0][0][0] = 0;

	int bc = 0;
	for (int i = 0;i < 262144;i++) {
		bc = 0;
		for (int k = 0;k < 18;k++) {
			if (i & (1 << k))bc++;
		}
		bcs[i] = bc;
	}

	int obs[18], al = (1 << N);
	
	for (int i = 0;i < N;i++) {
		for (int mx = 0;mx <= 50;mx++) {
			for (int j = 0;j < al;j++) {
				if (bcs[j] != i)continue;

				if (dp[i][mx][j] > 9928)continue;

				obs[0] = 0;
				for (int k = 0;k < N;k++) {
					if (j & (1 << k))obs[k + 1] = obs[k];
					else obs[k + 1] = obs[k] + 1;
				}

				for (int k = 0;k < N;k++) {
					if (j & (1 << k))continue;
					//cout << A[i] << " " << B[i] << " " << mx << " " << obs[k] << endl;
					if (abs(k - i) & 1) {
						if (B[k] >= mx) {
							chmin(dp[i + 1][B[k]][j | (1 << k)], dp[i][mx][j] + obs[k]);
						}
					}
					else {
						if (A[k] >= mx) {
							chmin(dp[i + 1][A[k]][j | (1 << k)], dp[i][mx][j] + obs[k]);
						}
					}
				}
			}
		}
	}
	int ans = INT32_MAX;
	for (int j = 0;j < (1 << N);j++) {
		for (int i = 0;i < 51;i++) {
			ans = min((int)dp[N][i][j], ans);
		}
	}
	if (ans > 9811)cout << -1 << endl;
	else cout << ans << endl;
}

Measured memory_bytes: 523136
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

#素因数分解
def factorization(n):
	arr = []
	tmp = n
	for i in range(2, int(-(-n**0.5//1))+1):
		if tmp%i == 0:
			cnt = 0
			while tmp%i == 0:
				cnt += 1
				tmp //= i
			arr.append([i, cnt])
	if tmp != 1:
		arr.append([tmp, 1])
	if arr == []:
		arr.append([n, 1])
	return arr
	

N = INT()

n = [0]*101  #100以内の数でN!の素因数としての数

for i in range(1, N+1):
	arr = factorization(i)
	for s, t in arr:
		n[s] += t

n[1] = 0  # 1の約数は無視

C = Counter(n)
#print(C)
#print(C.items())

cnt_2_4 = 0
cnt_4_14 = 0
cnt_14_24 = 0
cnt_24_74 = 0
cnt_74 = 0
for p, q in C.items():
	if 2 <= p < 4:
		cnt_2_4 += q
	elif 4 <= p < 14:
		cnt_4_14 += q
	elif 14 <= p < 24:
		cnt_14_24 += q
	elif 24 <= p < 74:
		cnt_24_74 += q
	elif 74 <= p:
		cnt_74 += 1

cnt_24 = cnt_24_74 + cnt_74
cnt_14 = cnt_14_24 + cnt_24
cnt_4 = cnt_4_14 + cnt_14
cnt_2 = cnt_2_4 + cnt_4

ans = 0
ans += cnt_4*(cnt_4-1)//2 * (cnt_2-2)   # 5*5*3
ans += cnt_14 * (cnt_4-1)  #15*5
ans += cnt_24 * (cnt_2-1)  #25*3
ans += cnt_74  #75

print(ans)


Measured memory_bytes: 10684
n = int(input())
def yakusu(a):
    b = 1
    num = 0
    if a == 1:
        return 1
    while b<=a:
        if a%b == 0 and b%2 ==1:
            num += 1
        b += 1
    return num
    
li = []
for i in range(1,n+1):
    li.append(yakusu(i))

print(li.count(8))

Measured memory_bytes: 3060
/**
 * author:    Ziel
 * created:   16.04.2020 13:54:22
**/

// ~zaletaet~

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>

#define fi first
#define se second
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define pb push_back

using namespace std;

using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

const ll N = 1e5 + 123, MOD = 1e9 + 7, oo = 1e9 + 9, INF = 1e18 + 9;
const double EPS = 1e-9, PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1}, dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

int c[10][10];

main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	
	int n;
	cin >> n;
	
	int d = 1;
	for (int i = 1; i <= n; i++) {
		int ld = i % 10;
		int fd = i;
		while (fd / 10 > 0) {
			fd /= 10;
		}
		
		c[fd][ld]++;
	}
	
	ll ans = 0;
	for (int i = 0; i <= 9; i++) for (int j = 0; j <= 9; j++) {
		ans += c[i][j] * c[j][i];
	}
	
	cout << ans;
	return 0;
}



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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int N; cin >> N;
  int ans=INF;
  vector<int> a(N); rep(i, 0, N){ cin >> a[i];int c=0;while(a[i]%2==0)a[i]/=2,c++;chmin(ans,c); }
  cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 256