akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 998244353;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    if (v.size() == 0) return os;
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    os << v[v.size() - 1];
    return os;
}

void solve() {
    int n, k;
    cin >> n >> k;
    vint l(k), r(k);
    REP(i,k) {
        cin >> l[i] >> r[i];
    }
    vll dp(n, 0);
    dp[0] = 1;
    REP(i, n) {
        REP(j, k) {
            int lbd = i + l[j], rbd = i + r[j] + 1;
            if (lbd <= n-1) {
                dp[lbd] = (dp[i] + dp[lbd]) % MOD;
            }
            if (rbd <= n-1) {
                dp[rbd] = (dp[rbd] + MOD - dp[i]) % MOD;
            }
        }
        if (i != 0 && i < n - 1) {
            dp[i+1] = (dp[i+1] + dp[i]) % MOD;
        }
    }
    cout << dp[n-1] << endl;
}


int main() {
    solve();
    char tmp;
    while (cin >> tmp) {
        cin.putback(tmp);
        solve();
    }
}



Measured memory_bytes: 4836
import itertools

N, M = map(int, input().split())

Ss = []
for i in range(M):
    tmp = list(map(int,input().split()))
    k = tmp[0]
    Ss.append(list(tmp[1:]))
Ps = list(map(int,input().split()))

all_list = list(itertools.product(range(2),repeat=N))

count = 0
for l in all_list:
    is_ok = True
    for light_num, s in enumerate(Ss):
        summation = 0
        for index in s:
            summation += l[index - 1]
        if summation % 2 != Ps[light_num]:
            is_ok = False
            break
    if is_ok:
        count += 1

print(count)

Measured memory_bytes: 3188
#include <cstdio>
int bag[401][401],a[41],b[41],c[41];
int main()
{
    int N,Ma,Mb,ans;
    scanf("%d%d%d",&N,&Ma,&Mb);
    for(int i=0;i<N;i++)
        scanf("%d%d%d",&a[i],&b[i],&c[i]);
    for(int i=0;i<401;i++)
        for(int j=0;j<401;j++)
            bag[i][j]=-1;
    bag[0][0]=0;
    for(int i=0;i<N;i++)
        for(int j=400;j>=a[i];j--)
            for(int k=400;k>=b[i];k--)
                if(bag[j-a[i]][k-b[i]]!=-1&&(bag[j][k]==-1||bag[j][k]>bag[j-a[i]][k-b[i]]+c[i]))
                    bag[j][k]=bag[j-a[i]][k-b[i]]+c[i];
    ans=-1;
    for(int i=1;i<401;i++)
        if(i%Ma==0&&i/Ma*Mb<=400&&bag[i][i/Ma*Mb]!=-1)
            if(ans==-1||bag[i][i/Ma*Mb]<ans)
                ans=bag[i][i/Ma*Mb];
    printf("%d\n",ans);
    return 0;
}


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

int main(){
	int N;
	cin >> N;
	vector<int> a(N);
	for(auto &i:a)cin >> i;
	
	int ans=0;
	int M= *max_element(a.begin(),a.end());
	int m= *min_element(a.begin(),a.end());
	
	if(m>=0){
		cout << N-1 << endl;
		for(int i=0;i<N-1;i++)cout << i+1 << " " << i+2 << endl;
		return 0;
	}
	if(M<0){
		cout << N-1 << endl;
		for(int i=0;i<N-1;i++)cout << N-i << " " << N-i-1 << endl;
		return 0;
	}
	if(abs(M)>=abs(m)){
		cout << 2*(N-1) << endl;
		int maxi=(int)(max_element(a.begin(),a.end())-a.begin());
		for(int i=0;i<N;i++){
			if(i==maxi)continue;
			cout << maxi+1 << " " << i+1 << endl;
		}
		for(int i=0;i<N-1;i++)cout << i+1 << " " << i+2 << endl;
		return 0;
	}else{
		cout << 2*(N-1) << endl;
		int mini=(int)(min_element(a.begin(),a.end())-a.begin());
		for(int i=0;i<N;i++){
			if(i==mini)continue;
			cout << mini+1 << " " << i+1 << endl;
		}
		for(int i=0;i<N-1;i++)cout << N-i << " " << N-i-1 << endl;
		return 0;
	}
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    char A,T,G,C;
    char b,c=0;
    scanf("%c",&b);
    if(b==65)
    c=84;
    if(b==84)
    c=65;
    if(b==71)
    c=67;
    if(b==67)
    c=71;
    
    printf("%c",c);
    return(0);
}

Measured memory_bytes: 128
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N, M = map(int, input().split())
P = [[] for _ in range(N + 1)]
for i in range(M):
    p, y = map(int, input().split())
    P[p].append((y, i))

ans = [0] * M
for i in range(1, N + 1):
    if P[i] == 0:
        continue
    upper = ('0' * 5 + str(i))[-6:]
    A = sorted(P[i])
    for i, (_, j) in enumerate(A):
        lower = ('0' * 5 + str(i + 1))[-6:]
        ans[j] = upper + lower
        
for a in ans:
    print(a)



Measured memory_bytes: 39236
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		var s int
		fmt.Scanf("%d", &s)
		as[i] = s
	}

	as = append([]int{0}, as...)
	as = append(as, 0)
	sum := 0
	ds := make([]int, len(as)-1)
	for i := 0; i < len(as)-1; i++ {
		d := as[i+1] - as[i]
		if d < 0 {
			d = -d
		}
		ds[i] = d
		sum += d
	}
	for i := 1; i < len(as)-1; i++ {
		d1 := as[i+1] - as[i-1]
		if d1 < 0 {
			d1 = -d1
		}
		d2 := as[i] - as[i-1]
		if d2 < 0 {
			d2 = -d2
		}
		d3 := as[i+1] - as[i]
		if d3 < 0 {
			d3 = -d3
		}
		fmt.Printf("%d\n", sum+d1-d2-d3)
	}
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
int sumOfN(int n)
{
    int sum = 0;
    while(n!=0)
    {
        int  d = n%10;
        sum+=d;
        n/=10;
    }

    return sum;
}
int main()
{
    int n;
    cin>>n;


    if(n%sumOfN(n) == 0)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}



Measured memory_bytes: 3600
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let l: i32 = read();
    let mut r: u32 = 1;
    loop {
        if 2i32.pow(r) - 1 >= l {
            break;
        }
        r += 1;
    }
    let r = r - 1;
    let mut edges = Vec::new();

    for i in 1..r + 1 {
        edges.push((i, i + 1, 0));
        edges.push((i, i + 1, 2i32.pow(i - 1)));
    }

    let mut cur_max = 2i32.pow(r);
    // println!("cur max {:?}", cur_max);
    // println!("r {:?}", r);
    let mut res = l - cur_max;

    for t in (1..r + 1).rev() {
        // println!("res {0} t {1}", res, t);
        if res >= 2i32.pow(t - 1) {
            edges.push((t, r + 1, cur_max));
            cur_max += 2i32.pow(t - 1);
            res = l - cur_max;
        }
    }
    println!("{0} {1}", r + 1, edges.len());
    for edge in edges {
        let (s, t, c) = edge;
        println!("{0} {1} {2}", s, t, c);
    }
}


Measured memory_bytes: 4352
s=""
import fileinput
a=fileinput.input()
for i in a:
	s+=i
s=list(s)
res=[0 for i in range(26)]
for i in s:
	if i.isalpha():
		i=i.lower()
		res[ord(i)-ord("a")]+=1

for i in range(26):
	s=chr(i+ord("a"))+" : "+str(res[i])
	print(s)

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

int main() {
	string s, t;
	cin >> s >> t;

	int ans = 0;
	int cnt = 0;
	for (int i = 0; i < s.size() - t.size() + 1; ++i) {
		for (int j = 0; j < t.size(); ++j) {
			if (s[i + j] == t[j]) ++cnt;
		}
		ans = max(ans, cnt);
		cnt = 0;
	}

	cout << t.size() - ans << endl;
}

Measured memory_bytes: 3196
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
using namespace std;

#define ll long long
#define ull unsigned long long

int main()
{
	int n, k;
	cin >> n >> k;
	list<ll> v;
	for (int i = 0; i < n; i++)
	{
		ll in;
		cin >> in;
		v.push_back(in);
	}

	priority_queue<ll, vector<ll>, greater<ll>> have;
	int small = n > k ? k : n;
	ll max = -1;
	//	左からi, 右からj個とるとする
	for(int i = 0; i <= small; i++)
		for (int j = 0; j <= small - i; j++)
		{
			while (!have.empty())
				have.pop();
			int p = 0;
			for (auto itr = v.begin(); p < i; p++, itr++)
				have.push(*itr);
			p = 0;
			for (auto itr = --v.end(); p < j; p++, itr--)
				have.push(*itr);
			if(i + j < k)
				for (p = 0; p < k - i - j && !have.empty(); p++)
				{
					if (have.top() > 0)
						break;
					have.pop();
				}
			ll r = 0;
			while (!have.empty())
			{
				r += have.top();
				have.pop();
			}

			if (r > max)
				max = r;
		}

	printf("%lld", max);

	return 0;
}


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

int main(){
    int n = 0;
    string s;
    cin >> n >> s;
    long long r,g,b;
    long long ans = 0;
    r = g = b = 0;

    for (int i = 0;i < n;i++){
        if(s[i] == 'R')r++;
        if(s[i] == 'G')g++;
        if(s[i] == 'B')b++;
    }

    ans = r * g * b;

    for (int i = 0;i < n;i++){
        for (int j = i + 1;j < n;j++){
            int k = 2 * j - i;
            if(k>=n)continue;
            if ((s[i]!=s[j])&&(s[i]!=s[k])&&(s[k]!=s[j]))ans--;
        }
    }

    cout << ans;

}

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

int main()
{
	char s[5];
	scanf("%s",s);

	int x=(s[0]-48)*10+s[1]-48,y=(s[2]-48)*10+s[3]-48;

	if(x>0 && x<=12 && y>0 && y<=12)printf("AMBIGUOUS\n");
	else if(x>0 && x<=12)printf("MMYY\n");
	else if(y>0 && y<=12)printf("YYMM\n");
	else printf("NA\n");

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int max1=max(a,max(b,c));
    cout<<a+b+c-max1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define rep(i, n) FOR(i, 0, n - 1)
using namespace std;
typedef long long ll;
template <class T> inline bool dpmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool dpmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

void solve(long long N, vector<long long> H) {

    /* long cnt=0; */
    /* long maxcnt=0; */
    /* for (long i=1; i<n; i++) { */
    /*     if (h.at(i)<=h.at(i-1)) { */
    /*         cnt++; */
    /*         maxcnt=max(maxcnt, cnt); */
    /*     } else { */
    /*         cnt=0; */
    /*     } */
    /* } */
    /* cout << maxcnt << endl; */

    ll ans = 0;
    ll ans_max = 0;
    for (ll i=0; i<N-1; i++) {
        if (H[i]>=H[i+1]) {
            ans++;
            ans_max = max(ans_max, ans);
        } else {
            ans = 0;
        }
    }

    cout << ans_max << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips:
// You use the default template now. You can remove this line by using your
// custom template)
int main() {
  long long N;
  cin >> N;
  vector<long long> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  solve(N, move(H));
  return 0;
}


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

int main(){
  string S;
  cin >>S;
  int N=0;
  N=S.length();
  if(N==7){
    if (S=="keyence"){
      cout<<"YES"<<endl;
      return 0;
    }
    else cout<<"NO"<<endl;
    return 0;
  }
  for (int i=0;i<N;i++){
    string P=S;
    int C=N-7;
    if(P.erase(i,C)=="keyence"){
      cout<<"YES"<<endl;
        return 0;
    }
  }
  cout<<"NO"<<endl;
  return 0;
}

    

  
      

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

#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007

using namespace std;

struct UnionFind{
  vector<int> par,num;

  UnionFind(int N) : par(N),num(N){
    for(int i=0;i<N;i++){
      par[i] = i;
      num[i] = 1;
    }
  }

  int root(int x){
    if(par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry) return;
    par[rx] = ry;
    num[ry] = num[ry]+num[rx]; 
  }

  int get_num(int x){
    int rx = root(x);
    return num[rx];
  }

  bool same(int x, int y){
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};


int main(void){
  int n,k;
  cin >> n >> k;
  int flag[n+1];

  rep(i,n){
    flag[i+1] = false;
  }

  rep(i,k){
    int d;
    cin >> d;
    rep(j,d){
      int work;
      cin >> work;
      flag[work] = true;
    }
  }

  int cnt = 0;
  rep(i,n){
    if(flag[i+1] == false)cnt++;
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3632
import sys
input = sys.stdin.readline
from fractions import gcd


def read():
    N, M = map(int, input().strip().split())
    AB = []
    for i in range(M):
        a, b = map(int, input().strip().split())
        AB.append((a-1, b-1))
    return N, M, AB


def solve(N, M, AB):
    n_neighbors = [0 for i in range(N)]
    for a, b in AB:
        n_neighbors[a] += 1
        n_neighbors[b] += 1
    for x in n_neighbors:
        print(x)


if __name__ == '__main__':
    inputs = read()
    solve(*inputs)


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int main()
{
    string s,ans="";
    cin>>s;
    if(s=="zyxwvutsrqponmlkjihgfedcba")ans="-1";
    else
    {
        int ls[26];
        m0(ls);
        
        for(int i = 0; i < s.size(); i++)
        {
            ls[s[i]-'a']++;
        }
        if(s.size()<26)
        {
            for(int i = 0; i < 26; i++)
            {
                if(ls[i]==0)
                {
                    ans=s+(char)('a'+i);
                    break;
                }
            }
        }
        
        else
        {
            char c='z';
            for(int i = 26 - 1; i > 0; i--)
            {
                if(s[i-1]<s[i])
                {
                    for(int j = 0; j < i-1; j++)
                    {
                        ans+=s[j];
                    }
                    
                    for(int j = i; j < 26; j++)
                    {
                        if(s[i-1]<s[j])
                        {
                            c=min(c,s[j]);
                        }
                    }
                    
                    ans+=c;
                    break;
                }
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int n, k;

// ?°?????????????????????¢??°
int min(int a, int b)
{
	if (a < b) {
		return a;
	}

	else {
		return b;
	}
}

// ???????????????????????????????????¢???????°?
int solve1(int a, int b)
{
	return ((min(min(a - 1, b - 1), min(n - a, n - b))) % 3 + 1);
}

// ????§??????§????????£???????????§??????????±???????
int solve2(int a, int b)
{
	if (a <= b) {
		if (a + b <= n) {
			return (a - 1) % 3 + 1;
		}
		else {
			return (n - b) % 3 + 1;
		}
	}
	else {
		if (a + b <= n) {
			return (b - 1) % 3 + 1;
		}
		else {
			return (n - a) % 3 + 1;
		}
	}
}

int main(void)
{
	int i;
	int a, b;

	scanf("%d %d", &n, &k);
	for (i = 0; i < k; ++i) {
		scanf("%d %d", &a, &b);

		//printf("%d\n", solve1(a, b));
		printf("%d\n", solve2(a, b));
	}

	return (0);
}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    ios::sync_with_stdio(false);

    PII A, B;
    cin >> A.first >> A.second;
    cin >> B.first >> B.second;

    cout << max(0, min(A.second, B.second) - max(A.first, B.first)) << endl;
}

Measured memory_bytes: 256
// 前から解くバージョン
#include <bits/stdc++.h>
 
typedef long long ll;
using namespace std;
 
int main() {
    int n;
    cin >> n;
 
    // 先頭から見ていくバージョン
    int counter = 0, result = 0;
    int formerHeight;
    int currentHeight;
    for (int i = 0; i < n; i++) {
        cin >> currentHeight;
        if (i > 0 && formerHeight >= currentHeight) {
            ++counter;
            result = max(result, counter);
        } else {
            counter = 0;
        }
        formerHeight = currentHeight;
    }
 
    cout << result << endl;
}
 


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

using namespace std;

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


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

int main(void)
{
	int i, n, x;

	cin >> n ;
	
	for(i = 1; i <= n ; i++){
		x = i;
		if ( x % 3 == 0 ){		
			//x???3??§??????????????????????????????
			cout << " " << i;
		}else {
			while(x){
				//?????????3???????????¨????????????
				if(x%10 == 3){
					cout << " " << i;
					break;
				}
				x /= 10;
			}
		}
	}
	cout << endl;
}

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

int main(){
  string s;
  unsigned long k;
  cin >> s >> k;
  bool one = true;
  int one_i = s.size() - 1;
  if(s.size() < k){
    for(int i=0; i < s.size(); i++){
      if(s.substr(i, 1) != "1"){
        one_i = i;
        break;
      }
    }
    if(one_i <= k){
      cout << s.substr(one_i ,1) << endl;
    }else{
      cout << s.substr(1 ,1) << endl;
    }
  }else{
    for(int i=0; i < k; i++){
      if(s.substr(i, 1) != "1"){
        one = false;
        one_i = i;
        break;
      }
    }
    if(one){
      cout << 1 << endl;
    }else if(one_i <= k){
      cout << s.substr(one_i ,1) << endl;
    }else{
      cout << s.substr(1 ,1) << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 888
N = int(input())
xylist = []
for n in range(N) :
    xylist.append(list(map(int, input().split())))

def minus2d(list1, list2) :
    return [list1[0]-list2[0],
            list1[1]-list2[1]]
longsabun = []
cmax = 0
for key in xylist :
    sabun = list(map(lambda a : minus2d(a, key), xylist))
    longsabun += sabun
for skey in longsabun :
    if skey != [0,0] :
        counter = longsabun.count(skey)
        cmax = max(cmax, counter)
print(N-cmax)

Measured memory_bytes: 3444
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x=sc.nextLong(),y=sc.nextLong();
        int ans=0;
        do{
            ans++;
            x*=2;
        }while(x<=y);
        System.out.println(ans);
    }

}


Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <string.h>
using namespace std;

int main(){
    int n, Tpoint = 0, Hpoint = 0;
    cin >> n;
    for(int i=0; i<n; i++){
        string Taro, Hanako;
        cin >> Taro >> Hanako;
        if (Taro > Hanako) Tpoint += 3;
        if (Hanako > Taro) Hpoint += 3;
        if (Taro == Hanako) {
            Tpoint += 1;
            Hpoint += 1;
        }
    }
    cout << Tpoint << " " << Hpoint << endl;
    return 0;
}


Measured memory_bytes: 3160
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		WriteLine(48 - F);
	}
}


Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;


int main() {

	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);

	int l, r; cin >> l >> r;

	long long ans = 2019;
	for (int i = l; i < r; ++i) {
		for (int j = i + 1; j <= r; ++j) {
			long long tmp = 1LL * i * j;
			ans = min(ans, tmp % 2019);
			if (ans == 0) {
				cout << "0\n";
				return 0;
			}
		}
	}
	cout << ans << "\n";
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,m;
    cin>>n;
    int s[n];
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        s[i]=a;
    }
    cin>>m;
    int t[m];
    for(int j=0;j<m;j++){
        int a;
        cin>>a;
        t[j]=a;
    }
    sort(s,s+n);
    sort(t,t+m);
    int l=0;
    for(int i=0;i<m;i++){
        while(l<=n-1){
            if(t[i]==s[l]){
                l++;
                break;
            }
            else l++;
            if(l==n-1 && i!=m-1){
                cout<<"NO"<<endl;
                return 0;
            }
        }
    }
    if(t[m-1]==s[l-1])cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 1792
import numpy
import queue

n,m=map(int,input().split())#n=room m=way

r=[]
for i in range(n):
    r.append([])

for i in range(m):
    a,b=map(int,input().split())
    r[a-1].append(b)
    r[b-1].append(a)

#reach=numpy.zeros(n,dtype=int)
mark=numpy.zeros(n,dtype=int)

q=queue.Queue()
q.put(1)

while q.empty()==False:
    c=q.get()
    for i in iter(r[c-1]):
        if mark[i-1]==0:
            q.put(i)
            mark[i-1]=c


print("Yes")
for i in range(1,n):
    print(mark[i])

Measured memory_bytes: 51696
arr = []
5.times do
  arr.push(gets.to_i)
end
min_r = 10
min_r_index = -1
arr.each_with_index do |num,i|
  if arr[i] % 10 != 0
    if arr[i] % 10 < min_r
      min_r = arr[i] % 10
      min_r_index = i
    end
  end
end
arr.each_with_index do |num,i|
  if arr[i] % 10 != 0
    if i != min_r_index
      arr[i] += 10 - (arr[i] % 10)
    end
  end
end
puts arr.sum

Measured memory_bytes: 14324
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <cstring>
#include <string>
#include <ctime>
#include <algorithm>
#include <map>
#define MAXN 200005
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ba 823
#define mo 974711
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
int N;
int id[MAXN],X[MAXN],B[MAXN];
bool cmp(int a,int b) {
	return X[a] < X[b];
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    scanf("%d",&N);
    for(int i = 1 ; i <= N ; ++i) {
    	scanf("%d",&X[i]);
    	id[i] = i;
    }
    sort(id + 1,id + N + 1,cmp);
    int T = N / 2;
    for(int i = 1 ; i <= T ; ++i) {
    	B[id[i]] = X[id[T + 1]];
    }
    for(int i = T + 1 ; i <= N ; ++i) {
    	B[id[i]] = X[id[T]];
    }
    for(int i = 1 ; i <= N ; ++i) {
    	printf("%d\n",B[i]);
    }
    return 0;
}

Measured memory_bytes: 4608
//
// Created by rajshah9914 on 30/03/20.
//

#include <bits/stdc++.h>
using namespace std;
int n,k,a[101];
bool dp[100005];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<=k;i++)
    {
        for(int x=0;x<n;x++)
        {
            if(i>=a[x] && !dp[i - a[x]])
                dp[i]=true;
        }
    }
    if(dp[k])
        cout<<"First"<<endl;
    else
        cout<<"Second"<<endl;
}

//#include <bits/stdc++.h>
//using namespace std;
//
//const int mxN=100, mxK=1e5;
//int n, a[mxN], k;
//bool dp[mxK+1];
//
//int main() {
//    ios::sync_with_stdio(0);
//    cin.tie(0);
//
//    cin >> n >> k;
//    for(int i=0; i<n; ++i)
//        cin >> a[i];
//    for(int i=0; i<=k; ++i) {
//        for(int j=0; j<n; ++j)
//            if(i-a[j]>=0&&!dp[i-a[j]])
//                dp[i]=1;
//    }
//    cout << (dp[k]?"First":"Second");
//}

Measured memory_bytes: 384
// ------------------
// author: MatsuTaku
// date  : 22/02/2020
// ------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int N; cin>>N;
  string S; cin>>S;

  vector<bool> dp_ten(10);
  vector<bool> dp_hou(100);
  dp_ten[S[0]-'0'] = 1;
  vector<bool> ans(1000, false);
  for (int i = 1; i < N; i++) {
    int c = S[i]-'0';
    for (int n = 0; n < 100; n++) {
      if (dp_hou[n])
        ans[n*10+c] = true;
    }
    for (int n = 0; n < 10; n++) {
      if (dp_ten[n])
        dp_hou[n*10+c] = true;
    }
    dp_ten[c] = true;
  }
  int sum = 0;
  for (auto b : ans) {
    sum += b;
  }
  cout << sum << endl;

  return 0;
}


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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(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;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, a;
string s;

signed main() {
	cin >> n;
	rep(i,n) {
		cin >> s;
		if (s=="A") a++;
		else {
			if (a>0) a--;
			else return cout << "NO" << ln, 0;
		}
	}
	cout << (a==0 ? "YES" : "NO") << ln;	
}


Measured memory_bytes: 3224
import sys

N = int(input())
S = [int(input()) for _ in range(N)]
ans = sum(S)
if ans % 10 > 0:
    print(ans)
    sys.exit()

S.sort()
for si in S:
    if si % 10 > 0:
        print(ans - si)
        sys.exit()
print(0)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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

	
	string A, B;
	cin >> A >> B;

	string S;
	rep(i, A.size()) {
		S += A[i];
		if (i < B.size()) S += B[i];
	}

	co(S);

	Would you please return 0;
}

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

int main() {
  int x, a, b;
  cin >> x >> a >> b;
  x -= a;
  x -= x / b * b;
  cout << x << endl;
}

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

int main() {
  int n;
  cin >> n;
  for(int i=0; i<n; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    if (x*x+y*y == z*z || x*x+z*z==y*y || y*y+z*z==x*x)
      cout << "YES"<<endl;
    else
      cout << "NO" << endl;
  }
}

Measured memory_bytes: 0
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n,m,r=na()
rs = na()
for i in range(r):
    rs[i] -= 1

g = [[99999999999]*n for _ in range(n)]
for i in range(n):
    g[i][i] = 0
for i in range(m):
    a, b, c = na()
    a -= 1
    b -= 1
    g[a][b] = g[b][a] = c

for k in range(n):
    for i in range(n):
        for j in range(n):
            g[i][j] = min(g[i][j], g[i][k] + g[k][j])

from itertools import *

ans = 9999999999999999999
for ord in permutations(rs):
    w = 0
    for i in range(1, r):
        w += g[ord[i-1]][ord[i]]
    ans = min(ans, w)
print(ans)

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

int main()
{
    int n;cin>>n;
    vector<long long int> v(n);
    for(long long int &x: v){
        cin>>x;
    }
    vector<vector<long long int>> dp(n+1,vector<long long int>(n+1));
    //dp[i][j] denotes the answer for index i to j
     for(int i=n-1;i>=0;i--){
        for(int j=i;j<n;j++){
            if(i==j){
                dp[i][j]=v[i];
                continue;
            }
            dp[i][j]=max(v[i]-dp[i+1][j],v[j]-dp[i][j-1]);
        }
     }
     cout<<dp[0][n-1];
}


Measured memory_bytes: 73736
import sys
import numpy as np
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    A = np.array(list(map(int, input().split())))
    
    ans = 0
    B = np.zeros(40, dtype=int)
    
    for i in range(40):
        B[39-i] = np.count_nonzero(A%2)
        A //= 2
        
    k = 2**39
    x = 0
    for i in range(40):
        if B[i] > N-B[i]: ans += B[i]*k
        else:
            if x+k <= K: x += k; ans += (N-B[i])*k
            else: ans += B[i]*k
        k //= 2
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 23636
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
const int Mod=998244353;
int n,m;
#define Maxn 3000010
int fact[Maxn],inv[Maxn];
inline int C(int i,int j){return 1ll*fact[i]*inv[i-j]%Mod*inv[j]%Mod;}
inline int calc(int x){return C(x+n-1,n-1);}
int main(){
	scanf("%d%d",&n,&m);
	fact[0]=1;
	for(register int i=1;i<=3000000;++i)fact[i]=1ll*fact[i-1]*i%Mod;
	inv[0]=inv[1]=1;
	for(register int i=2;i<=3000000;++i)
		inv[i]=1ll*(Mod-Mod/i)*inv[Mod%i]%Mod;
	for(register int i=2;i<=3000000;++i)inv[i]=1ll*inv[i-1]*inv[i]%Mod;
	int Ans=0;
	for(register int i=0;i<=min(m,n);++i)
	if((m-i)%2==0){
		int at=(3*m-i)/2;
		int res=calc(at);
		res=(res-1ll*i*C(at-m+n-1,n-1)%Mod+Mod)%Mod;
		if(at>m)res=(res-1ll*(n-i)*C(at-m+n-2,n-1)%Mod+Mod)%Mod;
		res=1ll*res*C(n,i)%Mod;
		Ans=(Ans+res)%Mod;
	}
	printf("%d\n",Ans);
	return 0;
}

Measured memory_bytes: 23680
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};



ll sumofdigits(ll n){
    int sum =0;
    while(n>0){
        sum += n%10;
        n /=10;
    }
    return sum;
}


void solve(){
    ll n,a,b;
    cin>>n>>a>>b;
    ll ans=0;
    rep2(i,1,n+1){
        if(sumofdigits(i)>=a&&sumofdigits(i)<=b) ans+=i;
    }
    cout<<ans<<endl;
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    solve();

    return 0;
}


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

typedef struct 
{
    double x;
    double y;
} XY;

void koch(int,XY,XY);
void output(XY);

int main() 
{
    int i,n;
    XY p1={0,0},p2={100,0};

    scanf("%d",&n);
    output(p1);
    koch(n,p1,p2);
    output(p2);
    return 0;
}

void koch(int n,XY p1,XY p2)
{
    XY s,t,u;

    if(n==0)
    return 0;

    s.x=(2.0*p1.x+p2.x)/3.0;
    t.x=(p1.x+2.0*p2.x)/3.0;
    s.y=(2.0*p1.y+p2.y)/3.0;
    t.y=(p1.y+p2.y*2.0)/3.0;
    u.x=(t.x-s.x)*cos(M_PI/3)-(t.y-s.y)*sin(M_PI/3)+s.x;
    u.y=(t.x-s.x)*sin(M_PI/3)+(t.y-s.y)*cos(M_PI/3)+s.y;
    koch(n-1,p1,s);
    output(s);
    koch(n-1,s,u);
    output(u);
    koch(n-1,u,t);
    output(t);
    koch(n-1,t,p2);
}

void output(XY p)
{
    printf("%lf %lf\n",p.x,p.y);
}


Measured memory_bytes: 1992
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <math.h>
#include <map>
#include <stack>
using namespace std;
static const int INF = 1e9+7;
// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

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

int main(){
    int n; cin >> n;
    ll power = 1;
    ll amari;
    repr(i, 1, n+1){
        power = ((power % INF) * (i % INF)) % INF;
        
    }
    cout << power << endl;
    return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main(){
  char s;
  cin >> s;
  if(s == 'A') cout << "T" << endl;
  if(s == 'T') cout << "A" << endl;
  if(s == 'C') cout << "G" << endl;
  if(s == 'G') cout << "C" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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 maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw_2(62,1);


int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,61) pw_2[i]=-2*pw_2[i-1];}
    
    ll N,K; cin>>N>>K;
    if(K==1) cout<<0<<endl;
    else{
        cout<<N-(K-1)-1<<endl;
    }
}



Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define double long double
#define int long long 
#define f(z) for(int i=1;i<=z;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define vi vector<int>
#define pb push_back
#define si set<int>
int cl(int n ,int m) { if(n%m)return n/m + 1 ;else return n/m ;}
int pw(int a,int b,int M){a%=M;int r=1;while(b>0){if(b&1)r=r*a%M;a=a*a%M;b>>=1;}return r;}
#define mod  1000000007
#define T() int TT; cin>>TT; while(TT--)
#define P pair<int,int>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pr(r) cout <<"Case #"<<r <<": " ;

const int N = 1e6 + 5 ;

signed main(){
	int k , a, b ;
	cin >> k >> a >> b ;
	for ( int i = a; i<=b ; i++){
		if( i%k == 0 ){ 
			cout <<"OK\n";
			exit(0) ;
		}
	}
	cout <<"NG\n";
}


Measured memory_bytes: 3588
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		long r = scan.nextLong();
		long d = scan.nextLong();
		long x = scan.nextLong();

		long[] ans = new long[11];
		ans[0] = r * x - d;
		int i;
		for(i = 1; i < 10; i++) {
			ans[i] = r * ans[i - 1] - d;
		}

		for(i = 0; i < 10; i++)
			System.out.println(ans[i]);
	}
}


Measured memory_bytes: 21844
h,w,k=map(int,input().split())
c=[input() for i in range(h)]
ans=0
for p in range(2**(h+w)):
    bi=bin(p)[2:].zfill(h+w)
    cnt=0
    for i in range(h):
        for j in range(w):
            if c[i][j]=="#" and bi[i]=="0" and bi[h+j]=="0":
                cnt+=1
    
    if cnt==k: ans+=1
print(ans)


Measured memory_bytes: 68644
N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]

H.sort()

res = H[-1] - H[0]

for i in range(N - K + 1):
    t1 = H[i]
    t2 = H[i + K - 1]
    res = min(res, abs(t2 - t1))

print(res)

Measured memory_bytes: 13340
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

int n,k,ans=0;

inline int read(){
	int s=0,t=1;
	char c=getchar();
	while((c>'9'||c<'0')&&c!='-')c=getchar();
   	if(c=='-')t=-1,c=getchar();
   	while(c>='0'&&c<='9')s=s*10+c-'0',c=getchar();
   	return s*t;
}

int main(void){
	scanf("%d %d",&n,&k);
	for(int i=1;i<=n;i++){
		int a;
		scanf("%d",&a);
		if(a>=k)ans++;
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>

using namespace std;

int main() {
  long N, A, B, C ,D, E;
  cin >> N  >> A >> B >> C >> D >> E;

  long res = min(A, min(B, min(C, min(D,E))));
  res = N/res + ((N%res != 0)? 1 : 0) + 4;



  /*
  cout << "----" << endl;
  cout << a << endl;
  cout << b << endl;
  cout << c << endl;
  cout << d << endl;
  cout << "----" << endl;
  */
  cout << res << endl; 
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
 
int main()
{
  double a, b, c;
  double angle, rad;
  double S,L,h;

  cin >> a >> b >> angle;

  rad = angle*M_PI/180;

  h = b * sin(rad);
  S = a * h / 2;
  c = sqrt( pow( h, 2.0) + pow(a-b*cos(rad), 2.0) );
  L = a + b + c;
                         
  
  cout << fixed
    << setprecision(5)
      << S
        << " "
          << L
            << " "
              << h
                << endl;

  return(0);
}

Measured memory_bytes: 1292
from itertools import accumulate
N,K=map(int,input().split())
N_s=int(N**0.5)
list_a=[1]*N_s
list_b=[N//j-N_s for j in range(1,N_s+1)]
list_p=[N//j-N_s for j in range(1,N_s+1)]
for p in range(1,len(list_p)):
        list_p[p-1]=list_p[p-1]-list_p[p]
        
for p in range(1,len(list_b)):
    list_b[p-1]=list_b[p-1]-list_b[p]

list_bb=list(reversed(list(accumulate(reversed(list_b)))))
list_aa=list(accumulate(list_a))

mod=10**9+7

for i in range(K-1):
    temp=sum(list_a)
    list_an=[(temp+list_bb[j])%mod for j in range(N_s)]
    list_bn=[(list_p[j-1]*list_aa[j-1])%mod for j in range(1,N_s+1)]

    list_bbn=list(reversed(list(accumulate(reversed(list_bn)))))
    list_aa=list(accumulate(list_an))
    list_a=list_an
    list_b=list_bn
    list_bb=list_bbn
    
print((sum(list_a)+sum(list_b))%mod)

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


def solve(x, t, f, s):
    if x > N:
        return 0

    res = 0
    if t and f and s:
        res += 1

    res += solve(x*10+3, t+1, f, s)
    res += solve(x*10+5, t, f+1, s)
    res += solve(x*10+7, t, f, s+1)

    return res


def main():
    print(solve(0, 0, 0, 0))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
"use strict";
const fs = require("fs");

const winningHands = {
  r: "P",
  s: "R",
  p: "S"
};
const lines = fs.readFileSync("/dev/stdin", { encoding: "utf8" }).split("\n");
const firstLine = lines[0].split(" ");
const secondLine = lines[1].split(" ");
const N = parseInt(firstLine[0]);
const K = parseInt(firstLine[1]);
const R = parseInt(secondLine[0]);
const S = parseInt(secondLine[1]);
const P = parseInt(secondLine[2]);
const T = lines[2];

const POINTS = { R, S, P };

let answer = 0;
for (let k = 0; k < K; ++k) {
  answer += sub(k, K);
}
console.log(answer);

function sub(offset, stride) {
  let totalScore = 0;
  let prevHand = null;
  let cnt = 0;
  for (let t = offset; t < T.length; t += stride) {
    const winningHand = winningHands[T[t]];
    if (winningHand !== prevHand) {
      if (prevHand) {
        totalScore += POINTS[prevHand] * Math.floor((cnt + 1) / 2);
      }
      cnt = 0;
    }
    prevHand = winningHand;
    cnt++;
  }
  if (prevHand) {
    totalScore += POINTS[prevHand] * Math.floor((cnt + 1) / 2);
  }
  return totalScore;
}


Measured memory_bytes: 8268
#include <iostream>
#include <cmath>
#define pi acos(-1)

using namespace std;

int main() {
  double r,ans;
  while(scanf("%lf", &r) == 1) {
   ans = 2.0 * pi * r;
   printf("%lf\n", ans);
  }
  return 0;
}
  

Measured memory_bytes: 3836
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, h: "List[int]"):
    dp = [float("inf")] * N
    dp[0] = 0
    dp[1] = abs(h[0] - h[1])

    for i in range(2, N):
        for k in range(1, K+1):
            if i - k < 0:
                continue
            dp[i] = min(dp[i], dp[i-k] + abs(h[i] - h[i-k]))

    print(dp[-1])


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    h = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, h)


if __name__ == '__main__':
    main()


Measured memory_bytes: 55716
#include <iostream>
using namespace std;
int main(){
     string s;
     int count=0;
     cin>>s;
     int m=s.find("A");
     int k=s.rfind("Z");
         if(k>m){
         	for(int i=m;i<=k;i++){
         		count++;
			 }
		 }
	      cout<<count;
	  
	  
	  



	return 0;
}

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

int main() {
    int x;
    cin >> x;
    int flag = 0;
    for (long long i = 0; i <= 200; ++i) {
      if (flag){
        break;
      }
        for (long long j = 0; j <= 200; ++j) {
            if ( pow( i, 5) - pow( j, 5) == x){
				cout << i << " " << j << endl;
                flag = 1;
                break;
            }
            else if ( pow( i, 5) + pow( j, 5) == x) {
				cout << i << " " << -j << endl;
                flag = 1;
                break;
            }
        }
    }
}

Measured memory_bytes: 4104
"use strict";

function main(arg) {
    const A = parseInt(arg.split("\n")[0].split(" ")[0]);
    const B = parseInt(arg.split("\n")[0].split(" ")[1]);
    
    const calc = [];
    
    calc.push(A + B);
    calc.push(A - B);
    calc.push(A * B);
    
    console.log(parseInt(Math.max(...calc)));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

typedef long long ll;
const int N = 160;
int n, k, mod, g[N][N], f[N][N][N];

int main() {
  scanf("%d%d%d", &n, &k, &mod);
  if (!(k & 1)) {
    g[0][0] = 1;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j <= i && j <= k >> 1; j++) {
        g[i + 1][j + 1] = (g[i + 1][j + 1] + g[i][j]) % mod;
        g[i + 1][0] = (g[i + 1][0] + g[i][j]) % mod;
      }
    }
    int ansx = 0, ansy = 0;
    for (int j = 0; j <= n + 1 >> 1 && j <= k >> 1; j++) {
      ansx = (ansx + g[n >> 1][j]) % mod;
      ansy = (ansy + g[n + 1 >> 1][j]) % mod;
    }
    ansx = (ll) ansx * ansy % mod;
    printf("%d\n", ansx);
  } else {
    f[0][0][0] = 1;
    for (int i = 0; i <= n; i++) {
      bool px = 2 * i + 1 <= n, py = 2 * i + 1 - k >= 2 && 2 * i + 1 - k <= n;
      for (int c = 0; c <= i + 1 && c < k + 2; c++) {
        for (int d = 0; d <= i; d++) {
          if (true   ) f[i + 1][0][0] = (f[i + 1][0][0] + f[i][c][d]) % mod;
          if (px     ) f[i + 1][0][d + 1] = (f[i + 1][0][d + 1] + f[i][c][d]) % mod;
          if (py     ) f[i + 1][c ? c + 1 : 0][0] = (f[i + 1][c ? c + 1 : 0][0] + f[i][c][d]) % mod;
          if (px & py) f[i + 1][max(c + 1, d + 2)][d + 1] = (f[i + 1][max(c + 1, d + 2)][d + 1] + f[i][c][d]) % mod;
        }
      }
    }
    printf("%d\n", f[n + 1][0][0]);
  }
}


Measured memory_bytes: 13312