akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

#define        optimize           ios::sync_with_stdio(0); cin.tie(0);
#define PI    acos(-1.0)
#define pb push_back
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define RESET(a, b) memset(a, b, sizeof(a))
#define pii pair <int, int>
#define gcd(a, b) __gcd(a, b)
#define min3(a, b, c) min(c, min(a, b))
#define max3(a, b, c) max(c, max(a, b))

#define        MX        200005
#define max_val 100000

void min_self(ll& a, ll b)
{
    if(a == -1) a = b;
    else a = min(a, b);
}
int main()
{
    optimize
    int N, W;
    cin>>N>>W;

    vector <ll> dp(max_val+1, -1);
    dp[0] = 0;
    for(int i = 0; i < N; i++){
        int weight, val;
        cin>>weight>>val;

        for(int val_already = max_val-val; val_already >= 0; val_already--){
            if(dp[val_already] != -1){
                if(dp[val_already]+weight <= W)
                    min_self(dp[val_already+val], dp[val_already]+weight);
            }
        }
    }
    ll ans = 0;
    for(int i = 0; i <= max_val; i++){
        if(dp[i] != -1){
            ans = i;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3972
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <list>
#include <set>
using namespace std;
#define INF 1010101010
#define MOD 1000000007
#define LL long long
using Coord = pair<int, int>;

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

    if (b - a == c - b) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

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

int main(){
    int N;
    scanf("%d", &N);

    if (N%10 == 2 || N%10 == 4 || N%10 == 5 || N%10 == 7 || N%10 == 9) printf("hon\n");
    else if (N%10 == 3) printf("bon\n");
    else printf("pon\n");
    return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll c[51][51];
void pascal(){
	c[0][0] = 1;
	rep(i,50){
		c[i+1][0] = 1;
		rep(j,i) c[i+1][j+1] = c[i][j] + c[i][j+1];
		c[i+1][i+1] = 1;
	}
}

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

	ll n,p;
	cin >> n >> p;

	ll a[n];
	rep(i,n) cin >> a[i];

	pascal();

	ll odcnt = 0;
	ll evcnt = 0;

	rep(i,n){
		if(a[i] % 2 == 0) evcnt++;
		else odcnt++;
	}

	ll odval = 0;
	rep(i,odcnt+1) if(i % 2 == p) odval += c[odcnt][i];

	ll evval = 0;
	rep(i,evcnt+1) evval += c[evcnt][i];

	cout << (odval * evval) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>

using namespace std;
using ll = long long;


int main() {
	ll sum = 0;
	ll minimum = 0;
	ll N;
	cin >> N;
	vector<ll> s(N);
	for (ll i = 0; i < N; i++) {
		cin >> s[i];
		sum += s[i];
		if (s[i] % 10 != 0) {
			minimum = minimum == 0 ? s[i] : min(s[i], minimum);
		}
	}
	if (sum % 10 != 0) {
		cout << sum << endl;
		return 0;
	}
	else if (minimum == 0) {
		cout << 0 << endl;
		return 0;
	}
	else {
		cout << sum - minimum << endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>

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

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;


void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}



int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(all(a));
	int ans = 0;
	rep(i, n - 2)
	{
		rep2(j,i+1,n-1){
			int l = a[j] - a[i];
			int r = a[j] + a[i];
			int num = lower_bound(a.begin()+j+1,a.end(),r) - upper_bound(a.begin()+j+1,a.end(), l);
			ans += num;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <set>
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
#define ms(a, b) memset(a, b, sizeof(a))
#define pb push_back
#define mp make_pair
#define eps 0.0000000001
#define IOS ios::sync_with_stdio(0);cin.tie(0);
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const int maxn = 1000000+10;
int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
//        freopen("output.txt", "w", stdout);
#endif
//    IOS

    int n;
    cin >> n;
    int ans = 1;
    while(ans*2<=n){
        ans*=2;
    }
    cout << ans << endl;

    return 0;
}


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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 10000000000000007ll;

const double eps = 1e-10;

// #include "segtree_push.h"

// del

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    string s;
    cin >> s;

    bool f = true;
    for (i64 i = 0; i < s.size() - 1; i++) {
        if (s[i] == s[i + 1]) {
            f = false;
        }
    }

    if (f) {
        cout << "Good" << endl;
    }
    else {
        cout << "Bad" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
INF = 10 ** 20
 
N = int(input())
coin_list = [1] + [6**i for i in range(1, 7)] + [9**i for i in range(1, 6)]
dp = [INF]*(N+1)
dp[0] = 0
 
for amount in range(1,N+1):
	for coin in coin_list:
	    if amount-coin >= 0: dp[amount] = min(dp[amount], dp[amount-coin]+1)
 
print(dp[N])

Measured memory_bytes: 42844
#include<bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define print(x) cout << (x) << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";}
using namespace std;
using ll = long long;

bool d[10];

int main(void) {
    int n, k;
    cin >> n >> k;
    
    rep (i, k) {
        int tmp;
        cin >> tmp;
        d[tmp] = true;
    }

    for (int i = 1; i <= 100000; i++) {
        if (i < n) continue;
        string tmp = to_string(i);
        bool conti = false;
        rep (j, tmp.size()) if (d[tmp[j] - '0']) conti = true;
        if (conti) continue;
        cout << i << endl;
        break;
    }

    return 0;
}

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

int main() {
int N, K;
int T = 0;
cin >> N >> K;
vector<int> S(N);
for (int i = 0; i < N; i++){
cin >> S.at(i);
}
sort(S.begin(), S.end());
reverse(S.begin(),S.end());
for(int i = 0; i < K; i++){
    T = S.at(i) + T;
}
cout << T;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
bool isPrime(int n){
	if(n<=1 || n!=2&&(n&1)==0)return false;
	for(int i=3;i*i<=n;i+=2)
		if(n%i==0)return false;
	return true;
}
int main(){
	int a[10001];
	int n,m=1;
	a[0]=0;a[1]=2;
	for(int i=3;m<10000;i+=2){
		if(isPrime(i)){
			a[m+1]=i+a[m];
			m++;
		}
	}
	while(cin>>n&&n)cout<<a[n]<<endl;
	return 0;
}

Measured memory_bytes: 1196
using System;
using System.Collections.Generic;

namespace Aizu0521
{
    class Problem
    {

        public static List<string[]> getinputdata()
        {

            List<string[]> list_temp = new List<string[]>();
            string strdata = Console.ReadLine();

            while (strdata != null)
            {

                string[] s_temp = strdata.Split(' ');

                list_temp.Add(s_temp);

                strdata = Console.ReadLine();

            }

            return list_temp;
        }


        public static void Main(string[] args)
        {

            List<string[]> list_result = new List<string[]>();
            list_result = getinputdata();
            int i = 0;
            while (true)
            {

                if (int.Parse(list_result[i][0])== 0){
                    break;
                }

                int cnt = 0;

                //??£???
                int oturi = 1000 - int.Parse(list_result[i][0]);
                 cnt += oturi / 500;
                 oturi -=  (oturi / 500)*500 ;
                cnt += oturi / 100;
                oturi -= (oturi / 100)*100;
                cnt += oturi / 50;
                oturi -= (oturi / 50)*50;
                cnt += oturi / 10;
                oturi -= (oturi / 10)*10;
                cnt += oturi / 5;
                oturi -= (oturi / 5)*5;
                cnt += oturi / 1;
                oturi -= (oturi / 5) * 1;
                Console.WriteLine(cnt);

                i++;

            }



        }
    }
}

Measured memory_bytes: 9096
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;
class Main{


	static final int MOD = 1000000007;


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		long a = sc.nextLong();
		long b = sc.nextLong();



		long ab = gcd(a, b);
		long c = 0;
		for(long i = 2;i*i <= ab;i++){
			if(ab%i != 0){
				continue;
			}
			c++;
			while(ab % i == 0){
				ab /= i;
			}
		}
		if( ab > 1){
			c++;
		}
		System.out.println(c+1);




	}

	static void sieve(ArrayList<Long> list){
		int n = 50000000;
		boolean[] is_prime = new boolean[n+1];
		int[] prime = new int[n];
		for(int i= 0;i <=n;i++){
			is_prime[i] = true;
		}
		list.add((long) 1);
		for(int i = 2;i <= n;i++){
			if(is_prime[i]){
				list.add((long)i);
				for(int j = 2*i;j <= n;j+=i){
					is_prime[j] = false;
				}
			}
		}



	}




	static int upperbond(int k,int min,int[] data){		//kより小さい最大の値をdataの中から探し、返す二分探索
		int max = data.length;
		//		if(min == data.length-1){
		//			if(data[min] > k){
		//				return min;
		//			}
		//		}

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}

		return max;
	}

	static int lowerbond(int k,int min,int[] data){		//kより大きい最小の値をdataの中から探し、返す二分探索
		int max = data.length;

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}
		return min;
	}



	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	static long gcd(long a,long b){
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}



	static long lcm (long a, long b) {
		long g = gcd(a,b);
		return a/g*b;
	}




}


class Edge extends ArrayList<P>{

}

class P{
	int to;
	long cost;
	P(int to,long cost){
		this.to = to;
		this.cost = cost;
	}
}


class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return   from- otherpair.from;
	}








}






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

int comp(const void* a, const void* b) 
{ return *(int*)a > *(int*)b ; } 

int findNumberOfTriangles(int arr[], int n) 
{  
	qsort(arr, n, sizeof( arr[0] ), comp); 

	int count = 0; 

	for (int i = 0; i < n - 2; ++i) 
	{ 
		
		int k = i + 2; 
		for (int j = i + 1; j < n; ++j) 
		{ 
			while (k < n && arr[i] + arr[j] > arr[k]) 
			++k; 

			if(k > j) 
			count += k - j - 1; 
		} 
	} 

	return count; 
} 
int main() 
{ 
	int n;
	cin>>n;
	int arr[n];
	
	for(int i=0;i<n;i++) cin>>arr[i];
	
	cout<<findNumberOfTriangles( arr,n ); 

	return 0; 
} 

// This code is contributed by rathbhupendra 


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int arr[5][5],n;
	bool okay = false;
	for(int i = 0 ; i < 3 ; i++){
		for(int j = 0 ; j < 3 ; j++){
			scanf("%d" , &arr[i][j]);
		}
	}
	scanf("%d" , &n);
	for(int i = 0 ; i < n ; i++){
		int bingo;
		scanf("%d" , &bingo);
		for(int j = 0 ; j < 3 ; j++){
			for(int k = 0 ; k < 3 ; k++){
				if(bingo == arr[j][k]){
					arr[j][k] = -1;
				}
			}
		}		
	}
	for(int i = 0 ; i < 3 ; i++){	
		if(arr[i][0]==-1&&arr[i][1]==-1&&arr[i][2]==-1){
			okay = true;
		}
	}
	for(int i=0;i<3;++i){
    if(arr[0][i]==-1&&arr[1][i]==-1&&arr[2][i]==-1){
    	 okay=true;
		}
	}
	if(arr[0][0]==-1&&arr[1][1]==-1&&arr[2][2]==-1){
		okay=true;
	}
	if(arr[0][2]==-1&&arr[1][1]==-1&&arr[2][0]==-1){
		okay=true;
	}
	if(okay == true){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 1636
void main(){
  import std.stdio, std.algorithm;
  
  long n, a, b, k; rd(n, a, b, k);

  const long mod=998244353;
  const int M=1_000_00*4;

  auto fact=genFact(M, mod);
  auto invFact=genInv(fact, mod);

  long comb(long nn, long rr){
    if(nn<rr) return 0;
    long ret=fact[nn]%mod;
    (ret*=invFact[rr])%=mod;
    (ret*=invFact[nn-rr])%=mod;
    return ret;
  }

  long tot=0;
  for(long x=0; x<=n; x++)if(k-a*x>=0){
    if((k-a*x)%b==0){
      long y=(k-a*x)/b;
      if(y>n) continue;
      (tot+=comb(n, x)*comb(n, y)%mod)%=mod;
    }
  }
  writeln(tot);
}

long[] genFact(int n, long mod){
  auto fact=new long[](n);
  fact[0]=fact[1]=1;
  foreach(i; 2..n) fact[i]=i*fact[i-1]%mod;
  return fact;
}

long[] genInv(long[] arr, long mod){
  auto inv=new long[](arr.length);
  inv[0]=inv[1]=1;
  foreach(i, elem; arr[1..$]) inv[i]=powmod(arr[i], mod-2, mod);
  return inv;
}

long powmod(long a, long x, long mod){
  if(x==0) return 1;
  else if(x==1) return a;
  else if(x&1) return a*powmod(a, x-1, mod)%mod;
  else return powmod(a*a%mod, x/2, mod);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}


Measured memory_bytes: 9596
from sys import stdin,stdout


def solve(S,N):
    color = [[] for _ in range(3)]

    for i in range(N):
        if S[i] == 'R': color[0].append(i)
        elif S[i] == 'G': color[1].append(i)
        else: color[2].append(i)
    
    
    #Exclusion 
    total = len(color[0])*len(color[1])*len(color[2])

    remain = 0
    for i in range(N - 2):
        for j in range(i + 1,N - 1):
            k = j + j - i
            if k >= N: break
            
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                remain += 1
    return total - remain


    


if __name__ == "__main__": 
    #Input 
    N = int(stdin.readline().rstrip())
    S = stdin.readline().rstrip()
    stdout.write(str(solve(S,N)))
    





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

signed main() {
  int N, L;
  cin >> N >> L;
  vector<string> s(N);
  for (int i = 0; i < N; i++) {
    cin >> s[i];
  }

  sort(s.begin(), s.end());

  string ans = "";
  for (auto x : s) {
    ans += x;
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn=200005;
const int inf=0x3f3f3f3f;
int n,m,l,r;
vector<int> v[maxn];
struct node {
    int l,r,lz,mmax;
    inline void update(int v) {
        lz+=v;
        mmax+=v;
    }
} seg[maxn<<2];
inline void pushup(int x) {
    seg[x].mmax=max(seg[x<<1].mmax,seg[x<<1|1].mmax);
}
inline void pushdown(int x) {
    int lz=seg[x].lz;
    if (lz) {
        seg[x<<1].update(lz);
        seg[x<<1|1].update(lz);
        seg[x].lz=0;
    }
}
void build(int x,int l,int r) {
    seg[x].l=l,seg[x].r=r;
    if (l==r) {
        seg[x].mmax=l;
        return;
    }
    int m=(l+r)>>1;
    build(x<<1,l,m);
    build(x<<1|1,m+1,r);
    pushup(x);
}
void update(int x,int l,int r,int v) {
    int L=seg[x].l,R=seg[x].r;
    if (l<=L&&r>=R) {
        seg[x].update(v);
        return;
    }
    pushdown(x);
    int m=(L+R)>>1;
    if (m>=l)
        update(x<<1,l,r,v);
    if (m<r)
        update(x<<1|1,l,r,v);
    pushup(x);
}
int query(int x,int l,int r) {
    int L=seg[x].l,R=seg[x].r;
    if (l<=L&&r>=R)
        return seg[x].mmax;
    pushdown(x);
    int ret=-inf,m=(L+R)>>1;
    if (m>=l)
        ret=max(ret,query(x<<1,l,r));
    if (m<r)
        ret=max(ret,query(x<<1|1,l,r));
    pushup(x);
    return ret;
}
int main()
{
    scanf("%d%d",&n,&m);
    for (int i=0;i<n;++i) {
        scanf("%d%d",&l,&r);
        v[l].push_back(r);
    }
    build(1,0,m+1);
    int res=max(0,n-m);
    for (int i=0;i<=m;++i) {
        for (auto x:v[i])
            update(1,0,x,1);
        res=max(res,query(1,i+2,m+1)-m-i-1);
    }
    printf("%d\n",res);
    return 0;
}


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

int main() {
    int m, k;
    cin >> m >> k;
    if (k >= (1 << m)) {
        puts("-1");
        return 0;
    }
    if (m == 0) {
        printf("0 0\n");
        return 0;
    }
    if (m == 1) {
        if (k == 0)
            printf("0 0 1 1\n");
        else
            puts("-1");
        return 0;
    }
    vector<int> half;
    for (int i = 0; i < (1 << m); i++) {
        if (i == k) continue;
        cout << i << " ";
        half.push_back(i);
    }
    cout << k << " ";
    reverse(half.begin(), half.end());
    for (int i : half) {
        cout << i << " ";
    }
    cout << k << endl;
}

Measured memory_bytes: 2424
package main

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

func main() {
	N := readi()
	X := readi()
	x := make([]int, N)
	for i := 0; i < N; i++ {
		x[i] = readi()
	}
	sort.Ints(x)

	ans := abs(X - x[0])
	for i := 1; i < N; i++ {
		ans = gcd(ans, abs(x[i]-x[i-1]))
	}

	fmt.Println(ans)
}

/*-------------------utilities-------------------*/

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

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func chmin(x *int, y int) bool {
	if *x > y {
		*x = y
		return true
	}
	return false
}

func chmax(x *int, y int) bool {
	if *x < y {
		*x = y
		return true
	}
	return false
}

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

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

func permutations(arr []int) [][]int {
	var helper func([]int, int)
	res := [][]int{}

	helper = func(arr []int, n int) {
		if n == 1 {
			tmp := make([]int, len(arr))
			copy(tmp, arr)
			res = append(res, tmp)
		} else {
			for i := 0; i < n; i++ {
				helper(arr, n-1)
				if n%2 == 1 {
					tmp := arr[i]
					arr[i] = arr[n-1]
					arr[n-1] = tmp
				} else {
					tmp := arr[0]
					arr[0] = arr[n-1]
					arr[n-1] = tmp
				}
			}
		}
	}
	helper(arr, len(arr))
	return res
}

func isPrime(n int) bool {
	if n == 1 {
		return false
	}
	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			return false
		}
	}
	return true
}

func divisor(n int) (res []int) {
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			res = append(res, i)
			if i*i != n {
				res = append(res, n/i)
			}
		}
	}
	sort.Ints(res)
	return
}

/*-------------------init-------------------*/

const (
	INF = 1000000000000000000
	MOD = 1e9 + 7
)

var (
	readString func() string
)

func init() {
	readString = newReadString(os.Stdin)
}

/*-------------------inputs-------------------*/

func readi() int {
	return int(readi64())
}

func readi64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readf() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
	scanf("%d%d",&a,&b);
	if(a<=0&&b>=0){
		printf("Zero");
	}else if(a>0&&b>0){
		printf("Positive");
	}else{
		if((b-a)%2==0){
			printf("Negative");
		}else printf("Positive");
	}
}

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

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

        public static void Solve()
        {
            var abc = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            Console.WriteLine(Math.Min((abc[1] / abc[0]), abc[2]));
        }
    }
}


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

int main() {
  int H, W, K;
  cin >> H >> W >> K;
  vector<string> c(H);
  rep(i, H) cin >> c[i];
  int ans = 0;
  for (int hi = 0; hi < (1 << H); hi++) {
    for (int wi = 0; wi < (1 << W); wi++) {
      // 文字列を探索していく
      int cnt = 0;
      for (int h = 0; h < H; h++) {
        if ((hi >> h) & 1 == 1) continue;
        for (int w = 0; w < W; w++) {
          if ((wi >> w) & 1 == 1) continue;
          if (c[h][w] == '#') cnt++;
        }
      }
      if (cnt == K) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n;
  cin>>n;
  vector<long long> a(n);
  for(int i=0;i<n;i++) cin>>a[i];
  sort(a.begin(),a.end());
  
  long long ans=0;
  for(int i=0;i<n;i++) ans+=abs(a[i]-a[n/2])*2;
  
  if(n&1){
    ans-=min(a[n/2+1]-a[n/2],a[n/2]-a[n/2-1]);
  }else{
    ans-=a[n/2]-a[n/2-1];
  }
  
  cout<<ans<<endl;
}


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

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let a = read::<i64>();
  let b = read::<i64>();

  if a <= 8 && b <= 8 {
    println!("Yay!");
  } else {
    println!(":(");
  }
}

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

int main(void){
	long long n, a, b, c, x;
	while(true){
		cin >> n >> a >> b >> c >> x;
		if(!n&&!a&&!b&&!c&&!x) break;
		vector<int> y(n);
		for(int i = 0; i < n; ++i){
			cin >> y[i];
		}
		int i, j;
		for(i = 0, j = 0; i <= 10000; ++i){
			if(y[j] == x) j++;
			if(j == y.size()) break;
			x = (a * x + b) % c;
		}
		if(j == y.size()){
			cout << i << endl;
		}else{
			cout << -1 << endl;
		}
	}
	return 0;
}


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

using namespace std;
using ll = long long;
#define int ll
using PII = pair<int, int>;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<V<T>>;
template <typename T> using VVV = vector<VV<T>>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll INF = (1LL<<60);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

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

  int a, b;
  cin >> a >> b;

  double PI = acos(-1);
  cout << fixed << setprecision(15) << PI*b*b*b*4.0/3.0 << endl;

  return 0;
}



Measured memory_bytes: 3288
prime = list(range(3, 2000, 2))
for p in prime:
    prime = [pp for pp in prime if (pp % p != 0) | (pp == p)]
n = int(input())
ans = 0
ans_list = []
for p in prime:
    if p % 5 == 1:
        ans += 1
        ans_list.append(p)
    if ans == n:
        break
print(*ans_list)

Measured memory_bytes: 3060
#include <stdio.h>

int main(void){
	int N,T,A,i;
	
	scanf("%d",&N);
	scanf("%d %d",&T,&A);
	
	int H[N];
	for(i=0;i<N;++i){
	scanf("%d",&H[i]);
	}
	
	/*for(i=0;i<N;i++){
		printf("H[%d]=%d ",i+1,H[i]);
	}
	puts("");
	*/
	double I[N];
	for(i=0;i<N;++i){
		I[i]=(double)T-(double)H[i]*0.006;
		if(I[i]>A) I[i]=I[i]-(double)A;
		else I[i]=A-(double)I[i];
	}
	
	/*for(i=0;i<N;i++){
		printf("I[%d]=%f ",i+1,I[i]);
	}
	puts("");
	*/
	
	double min=I[0];
	int no=1;
	for(i=1;i<N;++i){
		if(I[i]<min) {
			min=I[i];
			no=i+1;
		}
	}
		
	printf("%d\n",no);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define intpair pair<int,int>
using namespace std;
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int pow(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline bool sortinrev(const pair<int,int> &a,const pair<int,int> &b){return (a.first > b.first);} //sort pair in descending order
int main(){
		ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;//h,s
    bool chance = true,win=true; //tak
    while(true){
			if(chance){
				 c -= b;
				 chance = false;
				 if(c<=0) {win = true;break;}
			}
			else{
					a -= d;
					chance = true;
					if(a<=0){win = false;break;}
			}
		}
		if(win)cout<<"Yes\n";
		else cout<<"No\n";
}
 


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);
#define mp make_pair
#define pb push_back

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

constexpr int MOD = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template< typename S, typename T >
inline void chmax(S &a, const T &b) { if(a < b) a = b; }
 
template< typename S, typename T >
inline void chmin(S &a, const T &b) { if(a > b) a = b; }
 

//lcm//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
	if(n==0) return (ll)1;
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
ll modinv(ll a, ll m) {
	if(m==0)return (ll)1;
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];
// 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}

//radP
ll rad(ll u, ll p){
ll cnt=0;
	while(u%p==0){
		u/=p;
		cnt++;
	}
	return cnt;
}


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

int main() {
 ios::sync_with_stdio(false);
ll n;
cin>>n;
for(int i=1;i<=10;i++){
	ll k=1000*i;
	if(n<=k){cout<<k-n<<endl;
	return 0;}
}

return 0;
}




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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB emplace_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





//int dx[]={-1,1,0,0};
//int dy[]={0,0,-1,1};
//int dx[]= {-1,0,1,-1,1,-1,0,1};
//int dy[]= {1,1,1,0,0,-1,-1,-1};




int a[4][4];
bool mark[4][4];

int main()
{
    FAST();

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

    int i,j,n,x;
    for(i=1;i<=3;i++)
    {
        for(j=1;j<=3;j++)cin >> a[i][j];
    }
    cin >> n;
    while(n--)
    {
        cin >> x;
        for(i=1;i<=3;i++)
        {
            for(j=1;j<=3;j++)
            {
                if(a[i][j] == x)mark[i][j]=true;
            }
        }
    }
    if(mark[1][1]  &&  mark[1][2]  &&  mark[1][3])cout << "Yes";
    else if(mark[2][1]  &&  mark[2][2]  &&  mark[2][3])cout << "Yes";
    else if(mark[3][1]  &&  mark[3][2]  &&  mark[3][3])cout << "Yes";
    else if(mark[1][1]  &&  mark[2][1]  &&  mark[3][1])cout << "Yes";
    else if(mark[1][2]  &&  mark[2][2]  &&  mark[3][2])cout << "Yes";
    else if(mark[1][3]  &&  mark[2][3]  &&  mark[3][3])cout << "Yes";
    else if(mark[1][1]  &&  mark[2][2]  &&  mark[3][3])cout << "Yes";
    else if(mark[3][1]  &&  mark[2][2]  &&  mark[1][3])cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
/*
    ThunderClap and Flash.
    Raunaq Singh
*/
#include "bits/stdc++.h" 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define ThunderClap ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define debugg(something)   cout<<#something<<" - "<<something<<"\n";
#define vi vector
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define pb push_back
#define in insert
#define s second
#define f first
#define pQueue priority_queue
#define maxElement *max_element
#define minElement *min_element
#define MAX 100000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod)*(b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

void Flash(){
    ll n,k;
    cin>>n>>k;
    ll x=(n%k);
    ll y=(k-(n%k));
    cout<<min(x,y)<<"\n";
}

int main(int argc, char const *argv[]){
    ThunderClap;
    ll t=1;
    //cin>>t;
    for(ll i=1;i<=t;i++){
        //cout<<"Case #"<<i<<": ";
        Flash();
    }
    return 0;
}

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

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

vector<int> ans(100001, -1);
vector<vector<pair<int, int>>> tree(100001); // to, cost

int dfs(int id)
{
    for(auto itr = tree[id].begin(); itr != tree[id].end(); itr++) {
        if(ans[itr->first] < 0) {
            IFD cout << id << ": " << itr->first << endl;
            ans[itr->first] = ans[id] ^ itr->second;
            dfs(itr->first);
        }
    }
}

int main()
{
    int N;
    cin >> N;

    for(int i = 1; i <= N - 1; i++) {
        int u, v, w;
        cin >> u >> v >> w;
        tree[u].push_back(make_pair(v, w % 2));
        tree[v].push_back(make_pair(u, w % 2));
    }
    ans[1] = 0; // 1 は必ず白に決める
    dfs(1);

    for(int i = 1; i <= N; i++) {
        cout << ans[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 7680
using System;

class DisjointSetofCommonnDivisors
{
    public static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(' ');
        long a = long.Parse(str[0]);
        long b = long.Parse(str[1]);

        int count = 1;
        long gcd = Gcd(a,b);
        long tmp = gcd;
        long i = 2;

        while(i * i <= tmp)
        {
            if (gcd % i == 0)
            {
                count++;
                while (gcd % i == 0) gcd /= i;
            }

            i++;
            
        }

        if (gcd != 1) count++;
        

        Console.WriteLine(count);
    }

    static long Gcd(long a, long b)
    {
        if (a > b) return Gcd(b, a);

        long r = b % a;

        while (r != 0)
        {
            b = a;
            a = r;
            r = b % a;
        }

        return a;
    }


}

Measured memory_bytes: 11092
import java.util.Scanner;

/**
 *
 * @author lenovo
 */
public class Main {

    public static void main(String[] args) {
        int count = 0;
        Scanner scanner = new Scanner(System.in);

        while (true) {
            int x = scanner.nextInt();
            count++;
            if (x >= 1 && x <= 10000) {

                System.out.println("Case " + count + ": " + x);
            } else {
                break;
            }

        }

    }
}

Measured memory_bytes: 41092
#include <iostream>

using namespace std;

int main() {
  int H, W;

  for ( ; ; ) {
    cin >> H >> W;
    if ((H == 0) && (W == 0)) break;
    for (int i = 0; i < H; ++i) {
      for (int j = 0; j < W; ++j) {
        cout << (((i + j) & 1) ? '.' : '#');
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
} 



Measured memory_bytes: 3084
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;
const LL MOD = 1000000007LL;
using namespace std;

int main() {
	int cnt[11] = { 0 };
	rep(i, 3) {
		int A;
		cin >> A;
		cnt[A]++;
	}
	if (cnt[5] == 2 && cnt[7] == 1) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();

        long countA = b / c;
        long countB = b / d;
        long countC = (a - 1) / c;
        long countD = (a - 1) / d;
        long cd = lcm(c, d);
        long countE = b / cd;
        long countF = (a - 1) / cd;
        
        long ans = countA + countB - countC - countD - (countE - countF);
        ans = b - a + 1 - ans;
        System.out.println(ans);
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
    
    private static long gcd(long m, long n) {
        if(m < n) {
            long tmp = m;
            m = n;
            n = tmp;
        }
        long reminder = 0;
        while((reminder = m % n) != 0) {
            m = n;
            n = reminder;
        }
        return n;
    }
}

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

#define int long long int
#define double long double
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define pq priority_queue<int>
#define test int tcase; cin>>tcase; for(int tc = 1; tc <= tcase; tc++)
#define inp(a,n,f) int a[n+f];for(int hh=f;hh<n+f;hh++)cin>>a[hh];
#define prdec(k) cout<<fixed<<setprecision(k);
#define ub upper_bound
#define lb lower_bound
#define mii map<int,int>
#define all(v) v.begin(),v.end()
#define qi queue<int>
#define si set<int>
#define inf LLONG_MAX


main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n,k,l,r;
	cin>>n>>k;
	inp(a,n,0);
	for(r=k,l=0;r<n;++r,++l)
	{
		if(a[r]<=a[l])
			cout<<"No\n";
		else
			cout<<"Yes\n";
	}
	return 0;
}


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

using namespace std;

#define int long long
#define double long double

int cnt[80][80];

double eps = 1e-10;
const int INF = 1e9;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; ++i)
    {
        double a;
        cin >> a;
        a += eps;
        a *= INF;
        int b = (int)a;
        int cnt1 = 0;
        int cnt2 = 0;
        while (b % 2ll == 0)
        {
            b /= 2ll;
            cnt1++;
        }
        while (b % 5ll == 0)
        {
            b /= 5ll;
            cnt2++;
        }
        for (int p = 0; p < 80; ++p)
        {
            for (int q = 0; q < 80; ++q)
            {
                if (p + cnt1 >= 18 && q + cnt2 >= 18)
                {
                    ans += cnt[p][q];
                }
            }
        }
        ++cnt[cnt1][cnt2];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3764
int compare_int(const void *a, const void *b){
    return *(int*)a - *(int*)b;
}
int dif(int a, int b){return a<b?b-a:a-b;}
int n, a[200000], m, i;
long long int ans;
int main(){
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d", a+i);
    a[i]-=i+1;
  }
  qsort(a, n, sizeof(int), compare_int);
  m=a[n/2];
  for(i=0; i<n; i++){
    ans+=dif(a[i],m);
  }
  printf("%lld\n", ans);
}


Measured memory_bytes: 3104
mod=(10**9)+7
a=[0]*200005
dp=[0]*200005
s=[0]*200005
cnt=0

n=int(input())+1
for i in range (1, n):
	x=int(input())
	if x!=a[cnt]:
		cnt=cnt+1
		a[cnt]=x

cnt+=1

dp[0]=1
for i in range (1, cnt):
	dp[i]=dp[i-1]
	dp[i]=(dp[i]+s[a[i]])%mod
	s[a[i]]=(s[a[i]]+dp[i-1])%mod

print(dp[cnt-1])

Measured memory_bytes: 24252
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	string s, t;
	cin >> s >> t;
	int i, j,k;
	int cnt = 0, ma = 0;
	for (i = 0; i <= s.length() - t.length(); i++)
	{
		k = i;
		for (j = 0; j < t.length(); j++)
		{
			if (s.at(k) == t.at(j))
			{
				cnt++;
			}
			k++;
			
			
		}
		//cout << cnt << endl;
		ma = max(ma, cnt);
		cnt = 0;
	}
	cout << t.length() - ma << endl;
}

Measured memory_bytes: 3600
v={}
a={}
s=t=0
N,X,M=gets.split.map &:to_i
(v[X]=t
t+=1
a[X]=s
s+=X
v[X=X*X%M]&&(b=t-v[X]
s+=N/b*(s-a[X])
N%=b))until 0>N-=1
p s

Measured memory_bytes: 37084
#include<bits/stdc++.h>
using namespace std;
 
signed main(){
 int a,b,c;
 while(scanf("%d%d%d",&a,&b,&c),(a+1)||(b+1)||(c+1)){
     if((a+1)&&(b+1)&&a+b>=30){
	 if(a+b>79)printf("A\n");
	 else if(a+b>64)printf("B\n");
	 else if(a+b>49)printf("C\n");
	 else if(c>49)printf("C\n");
	 else printf("D\n");}
	 else printf("F\n");
     }
}

Measured memory_bytes: 3112
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}
func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0
	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 4
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}
	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt64(scanner)
	x := n
	m := map[int64]int{}
	for x > 1 {
		d := div(x)
		m[d]++
		x /= d
	}
	ans := 0
	for _, c := range m {
		for i := 1; i <= c; i++ {
			ans++
			c -= i
		}
	}
	fmt.Fprintln(writer, ans)
}

func div(x int64) int64 {
	var i int64
	for i = 2; i*i <= x; i++ {
		if x%i == 0 {
			return i
		}
	}
	return x
}


Measured memory_bytes: 1832
#include<bits/stdc++.h>
#define ll long long
#define modu int(1e9+7)
#define mp make_pair
#define pb push_back
using namespace std;

bool comp(pair<string,int>& a,pair<string,int>& b)
{
    if(a.second==b.second) return a.first<b.first;
    return a.second>b.second;
}

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

    int n;
    cin>>n;
    map<string,int> m;
    vector<pair<string,int>> p;

    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        m[s]++;
    }
    for(auto& i:m) p.pb(mp(i.first,i.second));
    sort(p.begin(),p.end(),comp);

    cout<<p[0].first<<"\n";
    for(int i=1;i<p.size()&&p[i].second==p[0].second;i++) cout<<p[i].first<<"\n";
    return 0;
}


Measured memory_bytes: 28144
import itertools
def main():
  s = list(map(int,input().split()))
 # m = itertools.combinations(s,2)
  ans = float("inf")
#  print(m)
  for m in itertools.combinations(s,2):
    ans = min(ans,sum(m))
  print(ans)
if __name__ == '__main__':
  main()

Measured memory_bytes: 3060
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("You can win")
    else:print("You will lose")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
n = ip()                                     #入力整数1つ
#a,b,c= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#k = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
righte = 0
rightw = 0
leftw = 0
lefte = 0
for i in range(n):
    if a[i] == 'E':
        righte+=1
    else: rightw+=1
s = n
for i in range(n):
    if a[i] == 'E':
        righte-=1
    else:
        rightw-=1
    s = min(s,leftw+righte)
    if a[i] == 'E':
        lefte+=1
    else:
        leftw+=1
print(s)


Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;

vector<ii> adj[100005];
int res[100005], maxi;

void dfs(int u, int last, int p){
    for(ii par : adj[u]){
        int v = par.first, idx = par.second;
        if(v == p) continue;
        last = (last + 1)%maxi;
        res[idx] = last;
        dfs(v, last, u);
    }
}

int main(){
    int n; cin >> n;
    for(int i = 0; i < n-1; i++){
        int u, v; cin >> u >> v;
        adj[u].emplace_back(v, i);
        adj[v].emplace_back(u, i);
    }
    for(int i = 1; i <= n; i++)
        maxi = max(maxi, int(adj[i].size()));
    dfs(1, -1, -1);
    cout << maxi << endl;
    for(int i = 0; i < n-1; i++)
        cout << res[i]+1 << endl;

	return 0;
}


Measured memory_bytes: 7424
#include <iostream>
using namespace std;
int main() {
    int a,b,c,i,j=0;
    cin >> a >> b >> c;
    for (i=a; i<=b && i<=c; i++) {
        if (c%i == 0) j++;
    }
    cout << j << endl;
    return 0;
}

Measured memory_bytes: 3128
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdio.h>

using namespace std;

int main(void)
{
    int n;cin>>n;
    int ans=0,temp=0;
    vector<int> v(n+1);
    v[0]=0;
    for(int i=1;i<n+1;i++){
        cin>>v[i];
        if((v[i])<=v[i-1]) temp++;
        else temp=0;
        ans=max(ans,temp);
    }
    cout<<ans;
    return 0;
}



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

class Triangle{
public:
	int roop, a, b, c;
	void get();
	int triangle(int, int, int);
};

void Triangle::get(){
	cin >> a >> b >> c;
}

int Triangle::triangle(const int, const int, const int){
	if ((a*a + b*b == c*c) || (a*a + c*c == b*b) || (b*b + c*c == a*a)){
		return (1);
	}
	else{
		return (2);
	}
}

int main(){
	Triangle TR;

	int i, *flag;
	cin >> TR.roop;
	flag = new int[TR.roop];
	for (i = 0; i < TR.roop; i++){
		TR.get();
		flag[i] = TR.triangle(TR.a, TR.b, TR.c);
	}
	for (i = 0; i < TR.roop; i++){
		if (flag[i] == 1){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}

	return (0);
}


Measured memory_bytes: 1180
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
long long int power(long long int x, unsigned int y, long long int p)  
{  
    int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
int main()
{
    long long int a,b,c,d;
  	cin>>a>>b>>c>>d;
  	long long int i=0;
  	while(a>0&&c>0)
    {
      if(i%2==0)
      {
        c-=b;
      }
      else
      {
        a-=d;
      }
      i++;
    }
  if(a<=0) cout<<"No"<<"\n";
  else cout<<"Yes"<<"\n";
}

Measured memory_bytes: 3636