akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    long long k, l, ans = 0, rem = 0;
    cin >> k;
    if(k % 7 == 0 ) l = 9 * k / 7;
    else l = 9 * k;
    if(k % 2 == 0 || k % 5 == 0) ans = -1;
    else{
        while(rem != 1){
            if(ans == 0) rem = 1;
            rem = (rem * 10) % l; 
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3656
# ABC121D - XOR World
def main():
    a, b = list(map(int, input().rstrip().split()))
    c = a if a % 2 == 0 else a + 1
    n = b - c + 1
    pairs = n // 2
    if n % 2 == 0:
        ans = pairs % 2
        ans ^= 0 if c == a else a
        print(ans)
    else:
        ans = (pairs % 2) ^ b
        ans ^= 0 if c == a else a
        print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(a == b && b != c) cout <<"Yes";
  else if(a == c && b != c) cout << "Yes";
  else if(c == b && b != a) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 256
S = input()
count = 0
ans = "WA"
L = []
for k in range(len(S)):
    L.append(S[k])

if L[0] == "A":
    for i in range(2,len(L)-1):
        if L[i] == "C":
            count += 1
            c = i
    if count == 1:
        count2 = 0
        for j in range(len(L)):
            if L[j].islower():
                count2 += 1
        if count2 == len(L)-2:
            ans = "AC"
print(ans)

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

int main()
{
	long long x;
	cin >> x;
	if (x % 11 == 0)
		cout << (x / 11 * 2) << endl;
	else if (x % 11 > 6)
		cout << (x / 11 * 2 + 2) << endl;
	else
		cout << (x / 11 * 2 + 1) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,c=0,d=0,sum=0;
	char s[100];
	cin>>s;
	n = strlen(s);
	for(i=0; i<n; i++)
	{
		if(s[i]=='A')
        {
            c++;
        }
        else
        {
            d++;
        }
	}
	if(c>0 && d>0)
    {
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}


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

void input_int2(int &a, int &b) {
	cin >> a >> b;
	cin.ignore();
}

void input_int3(int &a, int &b, int &c) {
	cin >> a >> b >> c;	
	cin.ignore();
}

void input_int_array(int n,vector<int> &vec) {
	for (int i=0,tmp=0; i<n && cin >> tmp; i++) vec[i]=tmp;
}

void input_int_matrix(int n, int m, vector<vector<int>> &matrix) {
	int tmp;
	for(int i=0; i<n; i++) {
		for (int j=0; j<m; j++) {
			cin >> tmp;
			matrix[i][j] = tmp;
		}
	}
}

void input_int_var_array(int n,vector<int> &vec) {
	for (int tmp=0; cin >> tmp;) {
		vec.push_back(tmp);
	}
}

void input_int_var_matrix(int n, int m, vector<vector<int>> &matrix) {
	int tmp;
	for(int i=0; i<n; i++) {
		for (int j=0; j<m; j++) {
			cin >> tmp;
			matrix[i][j] = tmp;
		}
	}
}

void input_var_str(vector<string> & array) {
	string s;
	getline(cin, s);
	
	stringstream ss{s};
	while(getline(ss, s, ' ')) {
		array.push_back(s);
	}
}

void input_var_int(vector<int> &array) {
	string s;
	getline(cin, s);
	
	stringstream ss{s};
	while(getline(ss, s, ' ')) {
		array.push_back(stoi(s));
	}
}

void input_var_int(set<int> &array) {
	string s;
	getline(cin, s);
	
	stringstream ss{s};
	while(getline(ss, s, ' ')) {
		array.insert(stoi(s));
	}
}

template <typename T> void print_var_vector(vector<T> vec) {
	for(typename vector<T>::iterator i=begin(vec); i!=end(vec); i++) {
		cout << *i;
	}
	cout << endl;
}

void print_vector(int N, vector<int> vec) {
	for(int i=0; i<N; i++){
		cout << vec[i] << " ";
	}
	cout << endl;
}

int get_max_index(vector<int> vec) {
	vector<int>::iterator it = max_element(vec.begin(), vec.end());
	return distance(vec.begin(), it);
}

const int MAX_N = 10;
int N;
vector<int> a(MAX_N);

void input() {
	cin >> N;
	cin.ignore();
	input_int_array(N, a);
}

string solve() {
	vector<int>::iterator it = max_element(a.begin(), a.end());
	int max_value = *it;
	a.erase(it);
	return accumulate(a.begin(), a.end(), 0) > max_value ? "Yes" : "No" ;
}

int main() {
	input();
	cout << solve() << endl;
}


Measured memory_bytes: 504
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long A = sc.nextInt();
        long B = sc.nextInt();
        long ans=0;
        long Xb=sc.nextInt();;
        for(int i=1; i<N; i++){
            long X = sc.nextInt();
            long d = X-Xb;
            Xb=X;
            long t = Math.min(d*A,B);
            ans+=t;
        }
        System.out.println(ans);
    }
}

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

t = [[0]*2 for i in range(N)]

for i in range(N):
    t[i][1],t[i][0] = map(int,input().split())

t.sort()

#print(t)

res = 0
for i in range(N):
    res+=t[i][1]
    if res > t[i][0]:
        print("No")
        exit()

print("Yes")


Measured memory_bytes: 35616
n,a,b,c=map(int,input().split())
L=[int(input()) for i in range(n)]

F=[]
ans=100000000
for i in range(4**n):
    ii=i
    f=""
    for j in range(n-1,-1,-1):
        f+=str(ii//(4**j))
        ii%=(4**j)
    F.append(f)

#print(F)

for i in range(len(F)):
    p=F[i].count("1")
    q=F[i].count("2")
    r=F[i].count("3")
    if p*q*r>0 :
        aa=[0,0,0,0]
        for j in range(n):
            aa[int(F[i][j])]+=L[j]
        ans2=abs(aa[1]-a)+abs(aa[2]-b)+abs(aa[3]-c)+10*(p+q+r-3)
        ans=min(ans,ans2)
print(ans)


Measured memory_bytes: 7832
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln =  '\n';

const int mx=200010;
const ll mod=1e9+7;


int main(){
  int n;
  cin >> n;
  vector<ll> a(n+3,0);
  rep(i,n){
    cin >> a[i];
  }
  vector<ll> dp(mx,longinf);
  dp[0]=0;
  rep(i,n){
    dp[i+1] = min(dp[i+1], dp[i]+abs(a[i]-a[i+1]));
    dp[i+2] = min(dp[i+2], dp[i]+abs(a[i]-a[i+2]));
  }
  ll ans = dp[n-1];
  cout << ans << ln;
  return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;

int main(){
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    vector<int> a(n), b(m);
    REP(i,n)cin >> a[i];
    REP(i,m)cin >> b[i];
    a.push_back(x), b.push_back(y);
 
    int nax = *max_element(a.begin(), a.end());
    int niy = *min_element(b.begin(), b.end());
 
    cout << (niy > nax ? "No War" : "War") << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <cctype>

using namespace std;

#define Int int64_t

void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

int vector_finder(std::vector<string> vec, string number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

#include <sstream> 
std::vector<std::string> StringSplit(const std::string& str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}



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

	int line = str.size();
	int ok = 0;
	
	if (line % 2 == 1) {
		str.pop_back();
		line = str.size();
		ok = 1;
	}

	for (int i = line / 2; i >0; i--) {
		if (str.substr(0, i) == str.substr(i, i)&&ok==1) break;
		else {
			str.pop_back(); 
			str.pop_back(); 
			ok = 1;
		}
	}
	//cout << str.substr(3, 3);
	cout << str.size();
	
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
int main() {
    string N;
    cin >> N;
    int tmp=0;
 	for(int i=0;i<N.size();i++)
 		tmp+=N[i]-'0';
 	if(tmp%9==0)
 		cout<<"Yes";
 	else
 		cout<<"No";
 		
    return 0;
}

Measured memory_bytes: 3680
#include<stdio.h>
#include<string.h>

int main(void){
        int ls[26], n;
        for(int i=0; i<26; i++) ls[i] = 2e9;
        scanf("%d", &n);

        for(int i=0; i<n; i++){
                char s[64];
                scanf("%s", s);
                int tmp[26], j=0;
                memset(tmp, 0, 104);
                while(s[j]!='\0') tmp[s[j++]-'a']++;

                for(int j=0; j<26; j++){
                        if(ls[j]>tmp[j]) ls[j] = tmp[j];
                }
        }

        for(int i=0; i<26; i++){
                while(ls[i]--) putchar('a'+i);
        }
        puts("");
        return 0;
}

Measured memory_bytes: 128
def main():
    N, A, B = input().split()
    A = int(A)
    B = int(B)

    if A+1 == B:
        print("Borys")
    elif (B-A)%2 == 1:
        print("Borys")
    else:
        print("Alice")


if __name__ == "__main__":
    main()


Measured memory_bytes: 38588
#include<iostream>
using namespace std;
  
int main(){
int w, h, x, y, r;
cin >> w >> h >> x >> y >> r;
if ( x < 0 || y < 0) {
cout << "No" << endl;
return 0;
}
if ((x + r) <= w && (y + r) <= h) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}

Measured memory_bytes: 1160
#include <iostream>

int dp[100000];
int main() {
	int n;
	int k;
	int h[100000];
	std::cin >> n;
	std::cin >> k;
	for (int i = 0; i < n; i++) {
		std::cin >> h[i];
	}
	for (int i = 0; i < n; i++) {
		dp[i] = 2147483640;
	}
	dp[0] = 0;
	/*dp[1] = h[1]-h[0];
	if (dp[1]<0) {
		dp[1] = -dp[1];
	}*/
	for (int i = 0; i < n; i++) {
		for (int j = 1; j <= k&&i+j<n; j++) {
			int a = h[i+j] - h[i];
			if (a < 0) {
				a = -a;
			}
			if (a + dp[i] < dp[i + j]) {
				dp[i + j] = a + dp[i];
			}
		}
	}
	std::cout << dp[n - 1] << std::endl;
	/*for (int i = 0; i < n; i++) {
		std::cout << dp[i] << std::endl;
	}*/
}


Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> a(N);
    REP(i, N) cin >> a[i];

    ll ans = INF;
    for(int bit = 0; bit < (1<<N); ++bit) {
        if(__builtin_popcount(bit) != K) continue;
        ll cur_highest = 0;
        ll tmp = 0;
        for(int i=0; i<N; ++i) {
            if((bit & (1<<i)) && i == 0) {
                cur_highest = a[i];
            } else if((bit & (1<<i))) {
                tmp += max(0ll, cur_highest + 1 - a[i]);
                if(cur_highest + 1 >= a[i])
                    cur_highest = cur_highest + 1;
                else
                    cur_highest = a[i];
            } else {
                cur_highest = max(cur_highest, a[i]);
            }
        }
        ans = min(tmp, ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    h = list(map(int, input().split()))
    
    pre = h[0]
    for hh in h:
        if hh < pre-1:
            print('No')
            return
        pre = max(pre, hh)
        
    print('Yes')
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 14252
import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

void main() {
    int n, m;
    scan(n);
    scan(m);

    auto rank = new int[](n + 1);
    auto rank_rev = new int[](n + 1);
    auto lose = new int[](n + 1);
    auto fix = new int[][](n + 1, 0);

    foreach (i ; 0 .. m) {
        int a, b;
        scan(a, b); // a ??? b ????????£???
        fix[a] ~= b;
        fix[b] ~= a;
        lose[b]++;
    }

    bool prob = false;

    foreach (i ; 0 .. n) {
        int x = -1;

        foreach (j ; 1 .. n + 1) {
            if (lose[j] == i) {
                if (x != -1) {
                    prob = true;
                }
                x = j;
            }
        }

        rank[x] = i + 1;
        rank_rev[i + 1] = x;

        bool[] update = new bool[](n + 1);
        update[] = true;

        foreach (y ; fix[x]) {
            update[y] = false;
        }

        foreach (y ; 1 .. n + 1) {
            if (update[y] && !rank[y]) {
                lose[y]++;
            }
        }
    }

    writefln("%(%s\n%)", rank_rev[1 .. $]);
    writeln(prob ? 1 : 0);

}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 14808
//ΔAGC 018 A
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
int gcd(int x,int y)
{
	if(x<y)
		swap(x,y);
	int r;
	r=x%y;
	while(r){
		x=y;
		y=r;
		r=x%y;
	}
	return y;
}
int main()
{
	int n,k,i,m,x,t;
	cin>>n>>k;
	cin>>t;
	m=t;
	for(i=2;i<=n;i=i+1){
		cin>>x;
		m=max(m,x);
		t=gcd(t,x);
	}
	if(k<=m&&k%t==0)
		cout<<"POSSIBLE\n";
	else
		cout<<"IMPOSSIBLE\n";
	return 0;
}

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

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var count = Enumerable.Range(1,n).Select(i => i.ToString()).Count(i => i.Length % 2 != 0);

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13396
/*
THE BEST IS YET TO COME
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define r(i, s, l) for (int i = s; i < l; i++)
#define mod 1000000007
#define INT_BITS 32
#define ld long double
#define pp pair<long long, long long>
#define ss second
#define ff first
#define N 2000005
#define all(a) a.begin(), a.end()
#define pb push_back
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
int main()
{
    fast();
    int x;
    cin >> x;

    // x = 172

    int unit_place = x % 10;
    x = x / 10;
    int ten_place = x % 10;
    x = x / 10;
    int hundred_place = x % 10;

    if (unit_place == 7 || ten_place == 7 || hundred_place == 7)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 3604
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#define pb push_back
using namespace std;

int main(void){
  int x;
  cin>>x;
  int i=1,sum=0;

  while(sum<x){
    sum+=i;
    i++;
  }
  cout<<i-1<<endl;
  return 0;
}

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

int main(){
    
    int n, k, r;
    scanf("%d%d",&n,&k);
    
    int i=0;
    
    while( n >= k ){
        
        n = n/k;
        r = n%k;
        i++;
        
    }
    
    i++;
    printf("%d\n",i);
    
    return 0;
}


Measured memory_bytes: 128
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

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

        int[] skewers = new int[n * 2];
        for (int i = 0; i < n * 2; i++) {
            skewers[i] = sc.nextInt();
        }
        Arrays.sort(skewers);

        int sum = 0;
        for (int j = 0; j < n; j++) {
            sum += skewers[j * 2];
        }
        System.out.println(sum);

    }
}


Measured memory_bytes: 23764
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

public class Main {

	public static final int INF = Integer.MAX_VALUE / 2 - 1;
	
	public static int[] readInts(String cad) {
		String read[] = cad.split(" ");
		int res[] = new int[read.length];
		for (int i = 0; i < read.length; i++) {
			res[i] = Integer.parseInt(read[i]);
		}
		return res;
	}
	
	static void printArrayInt(long[] array) {
		if (array == null || array.length == 0)
			return;
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				System.out.print(" ");
			System.out.print(array[i]);
		}
		System.out.println();
	}
	
	static void printMatrixInt(long[][] array) {
		if (array == null || array.length == 0)
			return;
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[0].length; j++) {
				if (j > 0)
					System.out.print(" ");
				System.out.print(array[i][j]);
			}
			System.out.println();
		}

	}
	
	public static class Item {
		
	}
	
	public static void main(String[] args) throws IOException {
		StringBuilder out = new StringBuilder();
		BufferedReader in;
		
			in = new BufferedReader(new InputStreamReader(System.in));

		int values[] = readInts(in.readLine());
		int n = values[0];
		int w = values[1];
		
		int items[][] = new int[n][];
		
		for( int i =0; i < n; i++ )
			items[i] = readInts(in.readLine());
		
		Arrays.sort(items, new Comparator<int[]>() {
			@Override
			public int compare(int[] o1, int[] o2) {
				return o1[0] - o2[0];
			}
		} );
		int m = n* 1000 + 1;
		long dp[][] = new long[n][m];
		
		
		for( int i =0; i < n ; i++ ) {
			Arrays.fill(dp[i], INF);
		}
		
		for( int i = 0; i < m; i++ )
			if( i <= items[0][1])
				dp[0][i] = items[0][0];

		for( int i = 1; i < n; i++ ) {
			for( int j = 0; j < m; j++ ) {
				if(j >= items[i][1]) 
					dp[i][j] = Math.min(dp[i-1][j], dp[i-1][j - items[i][1]] + items[i][0]);
				else
					dp[i][j] = dp[i-1][j];
			}
		}
		long min = INF;
		for( int i = 0; i < m; i++ ) {
			if( dp[n-1][i] <= w) {
				min = i;
			}
		}
		
		//printMatrixInt(dp);
		System.out.println(min);
	}
	
}


Measured memory_bytes: 128340
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll n;
  string s;
  cin >> n;
  cin >> s;
  ll ans=inf;
  ll w[n]={};
  ll b[n]={};
  if(s[0]=='#')b[0]=1;
  else w[0]=1;
  for(int i=1;i<n;i++){
    b[i]=b[i-1];
    w[i]=w[i-1];
    if(s[i]=='#')b[i]++;
    else w[i]++;
  }
  
  for(int i=0;i<n;i++){
    ll sub=0;
    sub+=b[i]+(w[n-1]-w[i]);
    ans=min(ans,sub);
  }
  ans=min(ans,w[n-1]);
  ans=min(ans,b[n-1]);
  cout << ans << endl;
return 0;}

Measured memory_bytes: 3716
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    int ret = -1;
    int mi = 1145141919;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (mi > a) {
            mi = a;
            ret = i + 1;
        }
    }
    cout << ret << endl;
    return 0;
}



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

# 街iを訪れたらvis[i-1]を0から1にする
visited = [0] * N
# １からスタートして、訪れる街を順に記録
a = []
# １からスタート
town = 1

# 街pをまだ訪れていない場合
while visited[town - 1] == 0:
    # pを訪れたことを記録
    visited[town - 1] = 1
    # pを訪れた順番を記録
    a.append(town)
    # テレポート先はA[p-1]
    town = A[town - 1]

# ここでtownはループの先頭の町の番号
loop_head = a.index(town)

# K==len(a)-1だとちょうどaの最後で止まる
# Kがlen(a)以上だとループに入る
if K < len(a):
    print(a[K])
else:
    # ループに入る前までに移動回数をloop_head消費する
    # ループの長さはlen(a) - loop_head
    K -= loop_head
    print(a[loop_head + K % (len(a) - loop_head)])


Measured memory_bytes: 32000
'''
Created on 2020/08/29

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  W,H,x,y=map(int,pin().split())
  ans=W*H/2
  pout(f"{ans} ")
  if W-x==x and H-y==y:
    print(1)
  else:
    print(0)
  return 
main()

Measured memory_bytes: 9164
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int sum = 0;
	int n; cin >> n;
	VE l(n); rep(i, n)cin >> l[i];
	rep(i, n)sum += l[i];
	int MAX = 0;
	rep(i, n)chmax(MAX, l[i]);
	sum -= MAX;
	if (MAX < sum) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
	return 0;
}

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

int main(){
  int E,Y;
  cin >> E >> Y;

  if(E==0){
    if(Y<1912)
      cout << "M" << Y-1867 << endl;
    else if(Y<1926)
      cout << "T" << Y-1911 << endl;
    else if(Y<1989)
      cout << "S" << Y-1925 << endl;
    else
      cout << "H" << Y-1988 << endl;
  }

  if(E==1)
    cout << Y+1867 << endl;

  if(E==2)
    cout << Y+1911 << endl;

  if(E==3)
    cout << Y+1925 << endl;

  if(E==4)
    cout << Y+1988 << endl;

  return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <cmath>
#include <map>
#include <utility>
#include <list>
#include <string>

using namespace std;

int main() {
    int x;
    cin >> x;
    if (x == 7 || x == 5 || x == 3){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
// tokiomarine2020_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF (ll)(1e9)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    ll A, V;
    cin >> A >> V;
    ll B, W;
    cin >> B >> W;
    ll T;
    cin >> T;
    if (T * (V - W) >= abs(A - B)){
        print("YES");
    } else {
        print("NO");
    }

    return 0;
}


Measured memory_bytes: 3656
def calc_mp(C, d):
    for k in range(10):
        for i in range(10):
            for j in range(10):
                if k == 0:
                    d[i][j][k] = min(C[i][j], C[i][k] + C[k][j])
                else:
                    d[i][j][k] = min(d[i][j][k-1], d[i][k][k-1] + d[k][j][k-1])

def main():
    H, W = map(int, input().split())
    C = [0]*10
    for i in range(10):
        C[i] = list(map(int, input().split()))
    A = [0]*H
    for i in range(H):
        A[i] = list(map(int, input().split()))
    # print(H, W, C, A)

    d = [[[0 for i in range(10)] for i in range(10)] for i in range(10)]
    calc_mp(C, d)

    # print(d)
    ans = 0
    for h in range(H):
        for w in range(W):
            a = A[h][w]
            if a != -1 and a != 1:
                ans += d[a][1][9]
    print(ans)

if __name__ == '__main__':
    main()


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


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

class AAC {
public:
	void solve(std::istream& in, std::ostream& out) {
        string s;
        in >> s;
        if(s=="ABC"){
            out << "ARC" << endl;
        }else{
            out << "ABC" << endl;
        }
	}
};


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


Measured memory_bytes: 3608
n,l = list(map(int,input().split()))
apple = []
for i in range(n):        apple.append(l+i)
if 0 in apple:
        print(sum(apple))
elif apple[n-1] < 0:
        print(sum(apple)-apple[len(apple)-1])
else:
        print(sum(apple[1:len(apple)+1]))

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

using namespace std;

#define db(a) cout<<#a<<" = "<<a<<endl
#define db2(a,b) cout<<#a<<" = "<<a<<", "<<#b<<" = "<<b<<endl
#define db3(a,b,c) cout<<#a<<" = "<<a<<", "<<#b<<" = "<<b<<", "<<#c<<" = "<<c<<endl
#define db4(a,b,c,d) cout<<#a<<" = "<<a<<", "<<#b<<" = "<<b<<", "<<#c<<" = "<<c<<", "<<#d<<" = "<<d<<endl

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
const ll mod=1000000007;

ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

/*
Sample input/outputs


*/

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
    int ar[50];
    
    
    int n;
    cin>>n;
    for(int i = 0; i< n; i++)
    {
    	cin>>ar[i];
	}
	
	int sum = 0;
	for(int i = 0; i< n; i++)
	{
		for(int j = i+1; j< n; j++)
		{
			sum += ar[i]*ar[j];
		}
	}
     
     
    cout<<sum<<endl;
	return 0;
}


















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

ll N, W, w[105], c[105], dp[105][100005];

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >> N >> W;
    for (int i = 1; i <= N; ++i) cin >> w[i] >> c[i];
    for (ll i = 1; i <= N; ++i) {
    	for (ll j = 1; j <= W; ++j) {
    		if (j >= w[i]) {
    			dp[i][j] = max(dp[i - 1][j - w[i]] + c[i], dp[i - 1][j]);
    		} else {
    			dp[i][j] = dp[i - 1][j];
    		}
    	}
    }
    cout << *max_element(dp[N] + 1, dp[N] + W + 1) << '\n';
    return 0;
}



Measured memory_bytes: 79360
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    a, b = map(int, readline().split())

    print((a + b + 1) // 2)

    return


if __name__ == '__main__':
    main()


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

int main() {
  ll N; cin >> N;
  ll ans = 0;
  for (ll i = 1; i * i <= N && 1<N; i++) {
    if (N % i == 0) {
      if (N / ((N-i)/i) == N % ((N-i)/i)) {
        ans += (N-i)/i;
      }
    }
  }
  
  cout << ans << endl;  
} 

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Info{
	int weight,value,limit;
};

Info info[100];


int main(){

	int N,W;
	scanf("%d %d",&N,&W);

	for(int i = 0; i < N; i++){
		scanf("%d %d %d",&info[i].value,&info[i].weight,&info[i].limit);
	}

	int* dp = new int[W+1];
	dp[0] = 0;
	for(int i = 1; i <= W; i++)dp[i] = -1;

	int num,mult;
	for(int i = 0; i < N; i++){
		num = info[i].limit;
		for(int k = 1; num > 0; k *= 2){
			mult = min(k,num);
			for(int w = W; w-mult*info[i].weight >= 0; w--){
				if(dp[w-mult*info[i].weight] == -1)continue;
				dp[w] = max(dp[w],dp[w-mult*info[i].weight]+mult*info[i].value);
			}
			num -= mult;
		}
	}

	int ans = 0;
	for(int i = 0; i <= W; i++)ans = max(ans,dp[i]);

	printf("%d\n",ans);

	return 0;
}




Measured memory_bytes: 3244
import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    m, n = map(int, input().split())
    grid = [input() for _ in range(m)]
    dp = [[0] * n for _ in range(m)]
    dp[0][0] = 1

    D = [(1, 0), (0, 1)]
    for i in range(m):
        for j in range(n):
            for di, dj in D:
                ni, nj = i + di, j + dj
                if not (0 <= ni < m and 0 <= nj < n):
                    continue
                if grid[ni][nj] == '#':
                    continue
                dp[ni][nj] += dp[i][j]
                if dp[ni][nj] >= MOD:
                    dp[ni][nj] -= MOD

    print(dp[m - 1][n - 1])
resolve()

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  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;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

ll firstp(ll n)
{
  for(ll i = 2; i * i <= n; i++) {
    if(n % i == 0) return i;
  }
  return n;
}

void solve()
{
  ll N; cin >> N;
  vector<ll> a(N); rep(i, N) cin >> a[i];
  //  cerr << firstp(1) << endl;
    ll maxa = 0;
  rep(i, N) {
    maxa = max(maxa, a[i]);
  }

  vector<ll> D(maxa+1);
  rep1(i, maxa) {
    D[i] = firstp(i);
  }
  vector<ll> pc(maxa + 1, 0);
  rep(i, N) {
    //            cerr << a[i] << "] ";
    ll b = a[i];
    while(b > 1) {
      //      cerr << D[b] << " ";
      ll p1 = D[b];
      pc[p1] ++;
      while(b % p1 == 0) b /= p1;
    }
    //    cerr << endl;
  }
  ll pcmax = 0;
  for(ll i = 2; i <= maxa; i++) {
    pcmax = max(pcmax, pc[i]);
  }
  //  cerr << "pcmax:" << pcmax << endl;
  if(pcmax <= 1) cout << "pairwise coprime\n";
  else if(pcmax < N) cout << "setwise coprime\n";
  else cout << "not coprime\n";
 
    
  
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 26736
from collections import defaultdict


def main():
    N = int(input())
    T_list = list(map(int, input().split()))
    M = int(input())
    drink_list = []
    for _ in range(M):
        p, x = map(int, input().split())
        drink_list.append((p, x))

    for p, x in drink_list:
        total = 0
        for i, t in enumerate(T_list, start=1):
            if i == p:
                total += x
            else:
                total += t
        print(total)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3444
import sys
import itertools
# import numpy as np
import time
import math

sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(input())

facts = []
for i in range(2, int(math.sqrt(n)) + 1):
    count = 0
    while n % i == 0:
        n = n // i
        count += 1
    if count > 0:
        facts.append((i, count))
if n != 1:
    facts.append((n, 1))

ans = 0
for p in facts:
    count = p[1]
    cur = 1
    while count - cur >= 0:
        count -= cur
        ans += 1
        cur += 1

print(ans)


Measured memory_bytes: 9500
#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;

int main(){

  string s;
  
  cin >> s ;
  
  long long int dp[100010][15]={0};
  
  dp[0][0] = 1;
  
  for(int i=0;i<s.size();i++){
    
    for(int j=0;j<13;j++){
      
    if(s[i] == '?'){
      for(int k=0;k<10;k++){
        dp[i+1][(j*10+k)%13] += dp[i][j];
        dp[i+1][(j*10+k)%13] %= 1000000007;
      }
    }
      else{
       int k = (int) (s[i]-'0');
        
        dp[i+1][(j*10+k)%13] += dp[i][j];
        dp[i+1][(j*10+k)%13] %= 1000000007;
      }
    }
    }
    
    cout << dp[s.size()][5]%1000000007 << endl;
    
  }
        


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

int main(){
	ll n; cin >> n;
	ll a[n][3];
	for(ll i = 0; i < 3 * n; ++i) cin >> a[i % n][i / n];
	ll sum[n + 1][2];
	sum[0][0] = sum[n][1] = 0;
	for(ll i = 0; i < n; ++i){
		sum[0][0] += a[i][0];
		sum[n][1] += a[i][2];
	}
	priority_queue<ll, vector<ll>, bool (*)(ll, ll)> qmin([&](ll a, ll b){return a > b;});
	for(ll i = 0; i < n; ++i)qmin.push(a[i][0]);
	for(ll i = 1; i <= n; ++i){
		ll po = qmin.top();
		qmin.pop();
		sum[i][0] = sum[i - 1][0] + max<ll>(po, a[i - 1][1]) - po;
		qmin.push(max<ll>(po, a[i - 1][1]));
	}
	priority_queue<ll, vector<ll>, bool (*)(ll, ll)> qmax([&](ll a, ll b){return a < b;});
	for(ll i = 0; i < n; ++i)qmax.push(a[i][2]);
	for(ll i = n - 1; i >= 0; --i){
		ll po = qmax.top();
		qmax.pop();
		sum[i][1] = sum[i + 1][1] + min<ll>(po, a[i][1]) - po;
		qmax.push(min<ll>(po, a[i][1]));
	}
	ll ans = -1145148931919810;
	for(ll i = 0; i <= n; ++i) ans = max<ll>(ans, sum[i][0] - sum[i][1]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6516
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//																				NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define mod 1000000007
#define testcases() int t; cin>>t; while(t--)
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
 //----------------------------------------------------------------------------------------------------------------------------------------------------

vector<vector<ll>> g;
vector<ll> lazy;

void dfs(ll u, ll parent)
{
	for(auto it: g[u])
	{
		if(it==parent)
			continue;
		lazy[it]+=lazy[u];
		dfs(it,u);
	}
}

int main()
{
	fast;
	ll n,q,u,v;
	cin>>n>>q;
	g.resize(n+5);
	lazy.resize(n+5);
	for(int i=1;i<=n-1;i++)
	{
		cin>>u>>v;
		g[u].pb(v);
		g[v].pb(u);
	}
	for(int i=1;i<=q;i++)
	{
		cin>>u>>v;
		lazy[u]+=v;
	}
	dfs(1,-1);
	for(int i=1;i<=n;i++)
		cout<<lazy[i]<<" ";
	return 0;
}

Measured memory_bytes: 24320
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>

#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <iterator>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define INF (1 << 30)
#define ALEN(ARR) (sizeof(ARR) / sizeof((ARR)[0]))
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back

#if DEBUG
#define _DEBUG(x) cout << #x << ": " << x << endl
#define _DDEBUG(x, y) cout << #x << ": " << x << ", " << #y << ": " << y << endl
#else
#define _DEBUG(x) ;
#define _DDEBUG(x, y) ;
#endif

#define ll long long
#define ull unsigned long long
#define MOD 1000000007

/** FOR VECTOR DEBUG */
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v)
{
    if (!v.empty())
    {
        out << '[';
        copy(v.begin(), v.end(), ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

/* template end */

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

    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int x3, y3, x4, y4;
    x3 = x2 - y2 + y1;
    y3 = y2 + x2 - x1;
    x4 = x1 - y2 + y1;
    y4 = y1 + x2 - x1;
#if DEBUG
    cout << "** RESULT **" << endl; // debug
#endif
    printf("%d %d %d %d\n", x3, y3, x4, y4);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#include <deque>
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl
#define isort(a) sort(a.begin(),a.end())

using namespace std;

#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

typedef pair<ll,ll> Pair;
const ll inf =1000000007;

//マンハッタン距離
ll mandis(Pair a,Pair b){
    return abs(a.first-b.first)+abs(a.second-b.second);
}

void solve(){
    ll k,a,b;
    cin >> k >> a >> b;
    bool ans=false;
    for(ll i=a;i<=b;i++){
        if(i%k==0) ans=true;
    }
    if(ans) cout <<"OK" << endl;
    else cout << "NG" << endl;
}


int main(){
    solve();
}

Measured memory_bytes: 3596
import java.util.Scanner;


public class Main {


//	final int MOD = 1000000007;

	public static long ans = 0;

	public static void main(String[] args) {

//		int ans = 0;
		Scanner sc = new Scanner(System.in);
		boolean f = false;

//		long a = sc.nextLong();

		int h = sc.nextInt();
		int w = sc.nextInt();
		int k = sc.nextInt();

		String[][] s = new String[h][w];
		for(int i = 0; i < h; i++) {
			String string = sc.next();
			String[] tmp = string.split("");
			for(int j = 0; j < w; j++) {
				s[i][j] = tmp[j];
			}
		}


		//-------------------------------------------------------------------------------------

		//以下メイン処理
		for (int i = 0; i < (1 << h); i++) {
			for(int j = 0; j < (1 << w); j++) {
				String[][] tmp = new String[h][w];

				for(int a = 0; a < h; a++) {
					for(int b = 0; b < w; b++) {
						tmp[a][b] = s[a][b];
					}
				}

				for (int a = 0; a < h; a++) {
					if(((1&i>>a) == 1)) {
						for(int b = 0; b < w; b++) {
							tmp[a][b] = "r";
						}
					}
				}
				for (int a = 0; a < w; a++) {
					if(((1&j>>a) == 1)) {
						for(int b = 0; b < h; b++) {
							tmp[b][a] = "r";
						}
					}
				}

//				for(int a = 0; a < h; a++) {
//					for(int b = 0; b < w; b++) {
//						System.err.print(tmp[a][b]);
//					}
//					System.err.println();
//				}

				int count = 0;
				for(int a = 0; a < h; a++) {
					for(int b = 0; b < w; b++) {
						if(tmp[a][b].equals("#"))
							count++;
					}
				}

				if(count == k)
					ans++;
			}
		}

		//-------------------------------------------------------------------------------------

//		if(f) {
//			System.out.println("Yes");
//		} else {
//			System.out.println("No");
//		}

		System.out.println(ans);

		sc.close();
	}
}

Measured memory_bytes: 38928
#include<stdio.h>

int main()
{

    int no, motp, i, j[1000] , small ;

    int sum = 0 ;

    scanf("%d%d",&no,&motp) ;





    for(i=0 ; i<no ; i++)
    {
        scanf("%d",&j[i]) ;
        if(i==0)small = j[i] ;
        if(small>j[i])small = j[i] ;
        sum = sum + j[i] ;
    }


    printf("%d\n",no + (motp-sum)/small) ;

}

Measured memory_bytes: 128
n = int(input())
s = str(input())
r, g, b = map(s.count, "RGB")
ans = r*g*b
for i in range(n):
    for j in range(i+1, n):
        k = 2*j - i
        if k<n and len(set([s[i], s[j], s[k]])) == 3:
            ans -= 1
print(ans)

Measured memory_bytes: 73656
#include<vector>
#include<iostream>
#include<list>
#include<algorithm>
#include<chrono>
#include<map>
#include<set>
#include<string>
#include<unordered_map>


using namespace std;
typedef long long ll;
const int mod=1e9+7;

ll qpow(ll a,ll n){
    ll res=1;
    while(n)
    {
        if(n&1) res = res*a%mod;
        a=a*a%mod;
        n >>= 1;
    }
    return res;
}

int n,m;
ll ans,f[500005]={1},inv[500005]={1};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >>n >>m;
    for(int i=1;i<=5e5;i++){
        f[i] = f[i-1] * i%mod;
        inv[i] = qpow(f[i],mod-2); //质数模下的逆元，根据费马定理
    }
    for(int i=0;i<=n;i++){
        ans = (ans+ ((i&1)?-1:1)*f[n]*inv[i]%mod*inv[n-i]%mod*f[m]%mod*inv[m-i]%mod*f[m-i]%mod*inv[m-n]%mod*f[m-i]%mod*inv[m-n]%mod)%mod;
    }
    cout<<(ans+mod)%mod<<endl;
    return 0;
}

Measured memory_bytes: 11008
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int N, a[109];
int main()
{
    cin >> N;
    for (int i = 0; i < N; i++)
        cin >> a[i];
    sort(a, a + N, greater<int>());

    int ret = 0,reet=0;

    for (int i = 0; i < N; i++)

        if (i % 2 == 0)
        {
            ret += a[i];
        }
        else
        {
            reet += a[i];
        }
    cout << ret-reet << endl;
    return 0;
}


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

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n, -1);
    rep(i,k){
        int d; cin >> d;
        rep(j,d){
            int A;
            cin >> A;
            a[A-1] = 1; 
        }
    }
    int ans = 0;
    rep(i,n){
        // cout << a[i] << endl;
        if(a[i] != 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value
ll N;

void solve() {
	
	cin >> N;

	ll ans = 0;

	vl div;

	for (ll i = 1; i * i <= N; i++) {
		if (N % i == 0) {
			div.eb(i);
			div.eb(N / i);
		}
	}

	for (int i = 0; i < div.size(); i++) {
		if (div[i] == 1) continue;
		if (N / (div[i] - 1) == N / div[i]) ans += div[i] - 1;
	}

	cout << ans << endl;
	

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;i++)
#define For(i,a,b) for(int i=(a),i##_end=(b);i<i##_end;i++)
#define per(i,a,b) for(int i=(b),i##_st=(a);i>=i##_st;i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define dbg(x) cerr<<#x" = "<<x<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define Es(x,i) for(Edge *i=G[x];i;i=i->nxt)
typedef long long ll;
typedef pair<int,int> pii;
const int inf=~0u>>1,MOD=1e9+7;
inline int rd() {
    int x,c,f=1;while(!isdigit(c=getchar()))f=c!='-';x=c-'0';
    while(isdigit(c=getchar()))x=x*10+c-'0';return f?x:-x;
}
const int N=200011;
int n,K,b[N],R;
map<int,int> a;
inline int cmp(int i,int j){return i>j;}
int main(){
	n=rd(),K=rd();
	rep(i,1,n){
		a[rd()]++;
	}
	int tc=0;
	for(map<int,int>::iterator i=a.begin();i!=a.end();i++){
		b[++tc]=i->se;
	}
	sort(b+1,b+tc+1,cmp);
	int r=0;
	rep(i,K+1,tc)r+=b[i];
	printf("%d\n",r);
}

Measured memory_bytes: 10368
// https://atcoder.jp/contests/abc057/tasks/abc057_c

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

ll N, m;

int main()
{
  m = INF;
  cin >> N;

  FOR(i, 1, sqrt(N + 1))
  {
    if (N % i == 0)
      m = min(m, (ll)(to_string(N / i).length()));
  }

  cout << m << '\n';

  return 0;
}


Measured memory_bytes: 256