akhauriyash/Code-Regression huggingface dataset:
fun main(args:Array<String>) {
  val (M, n) = readLine()!!.split(" ").map(String::toInt)

  (1..n).map { 
    val (a,b) = readLine()!!.split(" ").map(String::toInt) 
    listOf( Pair(a,b), Pair(b,a) )
  }.flatten().let {
    val m = mutableMapOf<Int,MutableList<Int>>()
    it.map { 
      val (key,value) = it
      //println(it)
      if( m[key] == null ) m[key] = mutableListOf()
      m[key]!!.add( value )
    }
    //println(m)
    m.toList().map { it.second }.any { it.contains(1) && it.contains(M) }.let { when(it) { true -> "POSSIBLE"; else -> "IMPOSSIBLE" } }.run(::println) 
  }
}

Measured memory_bytes: 176124
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const int MOD=1e9+7;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

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

  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  REP(i, n) cin >> h[i];
  int cnt = 0;
  REP(i, n) if(h[i] >= k) cnt++;
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int N; cin >> N;
	vector<ll>A(N);
	rep(i, 0, N)cin >> A[i];
	sort(all(A));
	vector<ll>sum(N);
	sum[0] = A[0];
	rep(i, 1, N)sum[i] = sum[i - 1] + A[i];
	vector<bool>ans(N, false);
	ans[N - 1] = true;
	rREP(i, 0, N - 1) {
		if (A[i] * 2 >= A[i + 1] && ans[i + 1])ans[i] = true;
		else if (sum[i] * 2 >= A[i + 1] && ans[i + 1])ans[i] = true;
	}
	int x = 0;
	rep(i, 0, N)if (ans[i])x++;
	cout << x << "\n";

	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int n;
int k;
long long dp[110][110000];
vector<int> a;
int main() {
    cin >> n >> k;
    a.resize(n+1);
    for (int i = 1; i <= n; i++) cin >> a[i];
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        long long sum = 0;
        for (int j = 0; j <= k; j++) {
            sum += dp[i-1][j];
            if (j > a[i]) sum -= dp[i-1][j - a[i] - 1];
            sum = (sum + MOD) % MOD;
            // sum %= MOD;
            // if (sum < 0) sum += MOD;
            // cout << sum << endl;
            dp[i][j] = sum;
        }
        // int cnt = -1;
        // do{
        //     cnt++;
        //     // printf("%d\n", cnt);
        //     for (int j = 0; j <= a[i] && j <= k; j++) {
        //         if (cnt + j < 110000) {
        //             dp[i+1][cnt + j] += dp[i][j];
        //             dp[i+1][cnt + j] %= MOD;
        //         }
        //     }
        // } while (cnt <= k && dp[i][cnt] != 0);
    }
    cout << dp[n][k] << endl;
    return 0;
}

Measured memory_bytes: 82140
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int N,ki=0,gu=0;
  cin>>N;
  int A[N];
  for(int i=0;i<N;i++){
    cin>>A[i];
    if(A[i]%2==0) gu++;
    else ki++;
  }
  
  for(;ki>1;){
    ki-=2;
    gu++;
  }
  for(;gu>1;){
  	gu-=2;
    gu++;
  }
  if(ki==1&&gu==0) cout<<"YES"<<endl;
  else if(gu==1&&ki==0) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		String[] inputstr = str.split(" ");
		int[] input = new int[3];
		for (int i = 0; i < 3; i++) {
			input[i] = Integer.parseInt(inputstr[i]);
		}
		if (input[1] == (input[0] + input[2]) / 2f)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}


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

// ------ graph ------ //
using Weight = long long;
using Flow = int;
struct Edge {
    int src, dst;
    Weight weight;
    Flow cap;
    Edge() : src(0), dst(0), weight(0) { }
    Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) { }
};
bool operator < (const Edge &e, const Edge &f) {
    return e.weight != f.weight ? e.weight > f.weight : // pqが降順のため
        e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
using Edges = vector<Edge>;
struct Graph {
    vector<Edges> adj;
    Graph(int n) : adj(n) { }
    int size() { return adj.size(); }
    Edges operator [] (int v) { return adj[v]; }
    void add_edge(int a, int b, Weight w = 1) { // graph
        adj[a].emplace_back(a, b, w);
        adj[b].emplace_back(b, a, w);
    }
    void add_arc(int a, int b, Weight w = 1) {  // digraph
        adj[a].emplace_back(a, b, w);
    }
};
using Array = vector<Weight>;
using Matrix = vector<Array>;

// ------ disjoint set ------ //
struct UnionFind {
    vector<int> data;
    int __size;
    UnionFind(int size) : data(size, -1), __size(size) { }
    bool unionSet(int x, int y) {
        if ((x = root(x)) != (y = root(y))) {
            if (data[y] < data[x]) swap(x, y);  // par -> child とは限らない
            data[x] += data[y]; data[y] = x; __size--;
        }
        return x != y;
    }
    bool findSet(int x, int y) { return root(x) == root(y); }
    int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
    int size(int x) { return -data[root(x)]; }
    int size() { return __size; }
};

// ------ minimumSpanningForest ------ //
pair<Weight, Edges> kruskal(Graph &g) {
    int n = g.size();
    UnionFind uf(n);
    priority_queue<Edge> PQ;
    for (int u = 0; u < n; u++) for (Edge &e : g[u]) {
        if (u < e.dst) PQ.push(e);
    }
    Weight total = 0;
    Edges F;
    while (F.size() < n-1 && !PQ.empty()) {
        Edge e = PQ.top(); PQ.pop();
        if (uf.unionSet(e.src, e.dst)) {
            F.push_back(e);
            total += e.weight;
        }
    }
    return pair<Weight, Edges>(total, F);
}

int main() {
    int V, E; cin >> V >> E;
    Graph g(V);
    while (E--) {
        int s, t, w; cin >> s >> t >> w;
        g.add_edge(s, t, w);
    }
    cout << kruskal(g).first << endl;
    return 0;
}


Measured memory_bytes: 13852
#include<stdio.h>
#include<string.h>
int main(){
	int n,k;
	scanf("%d %d",&n,&k);
	int x,i,ans=0,t;
	int s[105]={0};
	while(k>0){
		scanf("%d",&x);
		for(i=1;i<=x;i++){
			scanf("%d",&t);
			s[t]++;
		}
		k--;
	}
	for(i=1;i<=n;i++){
		if(s[i]==0)  ans++;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1732
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

#define ll long long
#define FOR(x,y) for(ll x=0; x < (ll)y; x++)



int main() {

    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if(s[0] != s[2]){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;

const int maxn = 100000 + 10;
char s[maxn];

int a[10];

int cmp(int a, int b)
{
	return a > b;
}

int main()
{
	while(scanf("%s",s) == 1)
	{
		memset(a,0,sizeof(a));
		for(int i = 0; i < strlen(s); i++)
			a[s[i] - 'a']++;

		int ok = 1;
		sort(a,a+3,cmp);
		if(a[0] - a[1] > 1) ok = 0;
		if(a[0] - a[2] > 1) ok = 0;
		if(ok) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>

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

    int cnt = 0;
    for (int i = a; i <= b; ++i) {
        if (c % i == 0) {
            ++cnt;
        }
    }

    std::cout << cnt << std::endl;


    return 0;
}


Measured memory_bytes: 3112
import java.util.Scanner;

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

        int n = sc.nextInt();
        int[] h = new int[n];

        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }

        int[] dp = new int[n+10];

        dp[0] = 0;
        for (int i = 1; i < n; i++) {
            dp[i] = Integer.MAX_VALUE;

            if (i-2 >= 0) {
                int cost = Math.abs(h[i] - h[i-2]);
                dp[i] = Math.min(cost+dp[i-2], dp[i]);
            }
            int cost = Math.abs(h[i] - h[i-1]);
            dp[i] = Math.min(cost+dp[i-1], dp[i]);
        }

        System.out.println(dp[n-1]);
    }
}


Measured memory_bytes: 50896
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#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())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  string n;
  cin>>n;


  if(n=="RRR")cout << 3 << endl;
  if(n=="RRS")cout << 2 << endl;
  if(n=="SRR")cout << 2 << endl;
  if(n=="RSR")cout << 1 << endl;
  if(n=="SSR")cout << 1 << endl;
  if(n=="SRS")cout << 1 << endl;
  if(n=="RSS")cout << 1 << endl;
  if(n=="SSS")cout << 0 << endl;

}

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

int main(){
	int n;
	cin >> n;
	map<string, int>m;
	m["AC"] = 0;
	m["WA"] = 0;
	m["TLE"] = 0;
	m["RE"] = 0;
	while(n--){
		string str;
		cin >> str;

		m[str]++;
	}

	cout << "AC" << " x " << m["AC"] << endl;
	cout << "WA" << " x " << m["WA"] << endl;
	cout << "TLE" << " x " << m["TLE"] << endl;
	cout << "RE" << " x " << m["RE"] << endl;

	return 0;
}

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

int main() {
    //input
    int n,m;
    cin >> n;
    cin >> m;
    //
    priority_queue<int> que;
    int a;
    for(int i=0;i<n;i++){
        cin>>a;
        que.push(a);
    }
    for(int i=0;i<m;i++){
        int r = que.top();
        que.pop();
        que.push(r/2);
    }
    long long ans = 0;
    for(int i=0;i<n;i++){
        ans += que.top();
        que.pop();
    }
    cout << ans << endl;

    return 0;
}

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

const int N = 2005, inf = int(2e9);
int n, a[N], q, k, p[N], c[N], r = inf;

int main(){
    scanf("%d%d%d", &n, &k, &q);
    for(int i = 1; i <= n; i++) scanf("%d", a + i);
    iota(p + 1, p + n + 1, 1);
    sort(p + 1, p + n + 1, [](int x, int y){ return a[x] < a[y]; });
    c[n + 1] = 1;
    for(int t = 1; ; t++){
        priority_queue<int, vector<int>, greater<int>> pq, ppq;
        for(int i = 1; i <= n + 1; i++){
            if(c[i]){
                while(!pq.empty()){
                    if(pq.size() >= k) ppq.push(pq.top());
                    pq.pop();
                }
            }
            else pq.push(a[i]);
        }
        if(ppq.size() < q) break;
        int mn = ppq.top();
        for(int i = 0; i < q - 1; i++) ppq.pop();
        r = min(r, ppq.top() - mn);
        c[p[t]] = 1;
    }
    printf("%d\n", r);
}

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

int main(){

  int student[30];
  memset(student,-1,sizeof(student));

  for(int i = 0; i < 28; i++){
    int n;
    cin >> n;
    student[n-1] = 0;
  }

  for(int i = 0; i < 30; i++){
  if(student[i] == -1) cout << i+1 << endl;
  }


}

Measured memory_bytes: 1160
import numpy as np
H,W = map(int,input().split())
A = [[0]*W for i in range(H)]
B = [[0]*W for i in range(H)]
for i in range(H):
  inf = [int(c) for c in input().split()]
  for j in range(W):
    A[i][j] = inf[j]
    
for i in range(H):
  inf = [int(c) for c in input().split()]
  for j in range(W):
    B[i][j] = inf[j]

X = (H + W) * 80
L = X + X + 1
# X点持った状態から始める
dp = [[0] * W for _ in range(H)]
d = abs(A[0][0] - B[0][0])
dp[0][0] = np.zeros(L,np.bool)
dp[0][0][X+d] = 1
for h in range(H):
    for w,(a,b) in enumerate(zip(A[h],B[h])):
        if h == w == 0:
            continue
        d = abs(a - b)
        x = np.zeros(L,np.bool)
        if h != 0:
            x[d:] |= dp[h-1][w][:L-d]
            x[:L-d] |= dp[h-1][w][d:]
        if w != 0:
            x[d:] |= dp[h][w-1][:L-d]
            x[:L-d] |= dp[h][w-1][d:]
        dp[h][w] = x

dp2 = dp[-1][-1]
can_make = np.where(dp2)[0] - X

answer = np.abs(can_make).min()
print(answer)


Measured memory_bytes: 173700
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;



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

	int N,L;
	cin>>N>>L;
	int a=0,b=int(1e9);
	rep(i,0,N) {
		a+=L+i;
		if (abs(b)>abs(L+i)) b=L+i;
	}
	cout<<a-b<<"\n";
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sample = 'abcdefghijklmnopqrstuvwxyz'


def solve(n: int, S: "List[str]"):
    d = []
    for i in list(sample):
        mx = [S[j].count(i) for j in range(n)]
        if(len(mx) == 0):
            d.append(0)
        else:
            d.append(min(mx))
    ans = ""
    for i,s in enumerate(list(sample)):
        ans += s*d[i]

    print(ans)
    # from collections import OrderedDict
    # d = {}
    # for i in list(sample):
    #     mx = []
    #     for j in range(n):
    #         mx.append(S[j].count(i))

    #     d[i] = min(mx) if len(mx) != 0 else 0

    # ans = ""
    # for k,v in d.items():
    #     print(k,v)
    #     ans += k*v

    # print(''.join(ans))



# Generated by 1.1.4 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
    S = [ next(tokens) for _ in range(n) ]  # type: "List[str]"
    solve(n, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
x = [LIST() for i in range(n)]
reg = 0

for i in range(n):
    for j in range(n):
        if i != j:
            p = x[j][0] - x[i][0]
            q = x[j][1] - x[i][1]
            count = 0
            for k in range(n):
                for l in range(n):
                    if x[l][0] - x[k][0] == p  and x[l][1] - x[k][1] ==  q:
                        count += 1
            reg = max(reg, count)

ans = n - reg
print(ans)

Measured memory_bytes: 10200
#include<bits/stdc++.h>
using namespace std;
int main()
{
    /*#ifdef TarekHasan
        freopen("input.txt","r",stdin);
    #endif // TarekHasan*/

    string str1,str2;
    cin >> str1;
    cin >> str2;

    int counter=0;

    for(int i=0;i<str1.size();i++)
    {
        if(str1[i]!=str2[i])
            counter++;
    }
    cout << counter << endl;


    #ifdef TarekHasan
        main();
    #endif // TarekHasan

    return 0;
}


Measured memory_bytes: 3916
#include <cstdio>
#include <cstdlib>
#include <algorithm>

int main() {
  int a[3];
  for (int i=0; i<3; ++i)
    scanf("%d", &a[i]);

  int res=10000;
  std::sort(a, a+3);
  do {
    int cur=abs(a[1]-a[0]);
    cur += abs(a[2]-a[1]);
    res = std::min(res, cur);
  } while (std::next_permutation(a, a+3));
  printf("%d\n", res);
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char[] c = s.toCharArray();
        boolean f = false;
        for(int i = 0; i < 3; i++){
            if(c[i+1] == c[i]){
                f =true;
            }
        }

        if(f){
            System.out.println("Bad");
        } else {
            System.out.println("Good");
        }
    }
}

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

string a;
int ans = 1, letters[26];

signed main() {
    cin >> a;
    int len = a.size();
    for (int i = 0; i < len; i++) {
        letters[a[i] - 'a']++;
    }
    for (int i = 0; i < 26; i++) {
        len -= letters[i];
        ans += letters[i] * len;
    }
    cout << ans << endl;
    return 0;
}

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

#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);

int main() {
    ios_base::sync_with_stdio(false);
    int n; cin >> n;
    if(n) n = n%10;
    if(n==3) cout << "bon\n";
    else if(n == 0 or n == 1 or n == 6 or n == 8) cout << "pon\n";
    else cout << "hon\n";



    return 0;
}



Measured memory_bytes: 3596
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << "[" << pa.first << ", " << pa.second << "]";
}

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

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl

// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

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

  ll n,k;
  std::cin>>n>>k;

  std::deque<ll> c;

  ll sq=1;
  while(sq*sq<=n)sq++;
  sq--;
  c.push_back(sq);

  if(n/sq!=sq)c.push_back(n/sq);

  for(ll i=sq-1;i>0;i--){
    c.push_front(i);
    c.push_back(n/i);
  }

  std::vector<ll> cnt;

  ll prv=0;
  while(!c.empty()){
    ll now=c.front();c.pop_front();
    cnt.push_back(now-prv);
    prv=now;
  }

  ll m=cnt.size();

  std::vector<std::vector<ll>> dp(k,std::vector<ll>(m));
  std::vector<ll> sum(m,0);

  rep(i,0,m)dp[0][i]=1;
  sum[0]=(dp[0][0]*cnt[0])%MOD;
  rep(i,1,m)sum[i]=(sum[i-1]+(dp[0][i]*cnt[i])%MOD)%MOD;

  rep(i,1,k){
    rep(j,0,m)dp[i][j]=sum[m-1-j];

    sum[0]=(dp[i][0]*cnt[0])%MOD;
    rep(j,1,m)sum[j]=(sum[j-1]+(dp[i][j]*cnt[j])%MOD)%MOD;
  }

  std::cout<<sum[m-1];

  return 0;
}

Measured memory_bytes: 51448
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <sstream>
using namespace std;

const int inf=0x3f3f3f3f;
const int maxn=100005;
int n, fa[maxn], cnt;

struct edge{
    int u, v, cost;
    edge(int cu, int cv, int ccost){u=cu, v=cv, cost=ccost;}
    edge(){}
    bool operator<(const edge &cmp) const{
    	return cost<cmp.cost;
    }
}E[maxn*4];

struct point{
    int x, y, id;
}P[maxn];

bool cmpx(point c1, point c2){return c1.x<c2.x;}
bool cmpy(point c1, point c2){return c1.y<c2.y;}

int Find(int x){
    return x==fa[x]?x:fa[x]=Find(fa[x]);
}
 
long long Kruskal(){
    for(int i=0;i<=n;i++)fa[i]=i;
    sort(E, E+cnt);
    long long ans=0;
    for(int i=0;i<cnt;i++){
        int fu=Find(E[i].u);
        int fv=Find(E[i].v);
        if(fu!=fv){
            ans+=E[i].cost;
            fa[fu]=fv;
        }
    }
    return ans;
}
 
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        scanf("%d%d", &P[i].x, &P[i].y);
        P[i].id=i;
    }
    cnt=0;
    sort(P, P+n, cmpx);
    for(int i=1;i<n;i++){
        E[cnt++]=edge(P[i-1].id, P[i].id, P[i].x-P[i-1].x);
    }
    sort(P, P+n, cmpy);
    for(int i=1;i<n;i++){
        E[cnt++]=edge(P[i-1].id, P[i].id, P[i].y-P[i-1].y);
    }
    printf("%lld\n", Kruskal());
    return 0;
}

Measured memory_bytes: 6528
#include<stdio.h>
#include<string.h>
#include<string>
#include<math.h>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
#define MAX 1000000007
using namespace std;
int main(){
    int n,m;
    while(~scanf("%d%d",&n,&m)){
        long long ans=1;
        if(n-m>1||m-n>1){
            printf("0\n");
        }
        else{
            if(n==m){
                for(int i=2;i<=n;i++){
                    ans=(ans*i)%MAX;
                    ans=(ans*i)%MAX;
                }
                ans=(ans*2)%MAX;
            }
            else{
                int pp;
                if(m<n){
                    pp=n;
                    n=m;
                    m=pp;
                }
                for(int i=2;i<=n;i++){
                    ans=(ans*i)%MAX;
                    ans=(ans*i)%MAX;
                }
                ans=(ans*m)%MAX;
            }
            printf("%lld\n",ans);
        }
    }
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=110000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  ll r;
  cin >> r;
  cout << 3*r*r << endl;
  return 0;
}


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

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


/*alias*/
#define F first
#define S second

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

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int32_t GCD(int32_t a, int32_t b){return b ? GCD(b, a%b) : a;}
int64_t GCD(int64_t a, int64_t b){return b ? GCD(b, a%b) : a;}
int32_t LCM(int32_t a, int32_t b){return a * b / GCD(a, b);}
int64_t LCM(int64_t a, int64_t b){return a * b / GCD(a, b);}

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

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


//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

/*global*/



//#define int int64_t
signed main()
{
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0, i_len = (int)n; i < i_len; ++i) cin >> a[i];

	int x2 = 0;
	for(int i = 0; i < n; ++i)
	{
		if(i&1) x2 -= a[i];
		else x2 += a[i];
	}
	vector<int> ans(n);
	ans[0] = x2/2;
	for(int i = 0; i < n-1; ++i)
	{
		ans[i+1] = a[i] - ans[i];
	}
	for(int i = 0; i < n; ++i){
		ans[i] *= 2;
	}
	for(int i = 0; i < n; ++i){
		cout << ans[i] << '\n';
	}
}

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


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

  string ans = "No";

  for(int i=0; i<N.size(); i++){
    if(N.at(i) == '7') ans = "Yes";
  }

  cout << ans << endl;
   
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
int main(){
	char a, b; cin >> a >> b;
	if(a == 'H'){
		cout << b << endl;
	}else{
		cout << (b == 'H' ? 'D' : 'H') << endl;
	}
}


Measured memory_bytes: 256
use std::collections::*;
use std::io::*;
use std::*;
// template {{{
macro_rules! get {
    ($($t:tt),*; $n:expr) => {
        {
            let stdin = std::io::stdin();
            let ret = std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
                let line = line.unwrap();
                let mut it = line.split_whitespace();
                _get!(it; $($t),*)
            }).collect::<Vec<_>>();
            ret
        }
    };
    ($($t:tt),*) => {
        {
            let mut line = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut it = line.split_whitespace();
            _get!(it; $($t),*)
        }
    };
}
macro_rules! _get {
    ($it:ident; [char]) => {
        _get!($it; String).chars().collect::<Vec<_>>()
    };
    ($it:ident; [u8]) => {
        _get!($it; String).bytes().collect::<Vec<_>>()
    };
    ($it:ident; usize1) => {
        $it.next().unwrap().parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
    };
    ($it:ident; [usize1]) => {
        $it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
    };
    ($it:ident; [$t:ty]) => {
        $it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
    };
    ($it:ident; $t:ty) => {
        $it.next().unwrap().parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
    };
    ($it:ident; $($t:tt),+) => {
        ($(_get!($it; $t)),*)
    };
}
// }}}

fn main() {
    let n = get!(usize);
    let l = get!([i64]);
    let mut ans = 0;
    for i in 0..n {
        for j in 0..n {
            if i >= j {
                continue;
            }
            if l[i] == l[j] {
                continue;
            }
            for k in 0..n {
                if j >= k {
                    continue;
                }
                if l[j] == l[k] || l[i] == l[k] {
                    continue;
                }
                let m = l[i].max(l[j].max(l[k]));
                let s = l[i] + l[j] + l[k];
                if s-m > m {
                    ans += 1;
                }
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2160
#include<stdio.h>
#include<stdlib.h>
#define mymalloc(p,n) {p=malloc((n)*sizeof(*p));if((p)==NULL){printf("not enough memory\n");exit(1);};}

void print_array(int N, int *array){
    int i;
    printf("%d",array[0]);
    for(i=1;i<N;i++){
        printf(" %d", array[i]);
    }
    printf("\n");
}

void d_insertion_sort(int N, int *array){
    int i,j,key;
    print_array(N,array);
    for(i=1;i<N;i++){
        key=array[i];
        j=i-1;
        while(j>=0 && array[j]>key){
            array[j+1]=array[j];
            j--;
        }
        array[j+1]=key;
        print_array(N,array);
    }
}

main(){
    int i,j,n;
    int *array;
    scanf("%d", &n);
    mymalloc(array,n);
    for(i=0;i<n;i++){
        scanf("%d",&j);
        array[i]=j;
    }
    d_insertion_sort(n,array);
    return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <cstdio>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    set<int> water;
    set<int> sugar;
    water.insert(100 * A);
    for (int i = 0; i <= 30; i++) {
        for (int j = 0; j <= 15; j++) {
            int w = 100 * A * i + 100 * B * j;
            if (w == 0 || w > F) {
                continue;
            }
            // cout << w << endl;
            water.insert(w);
        }
    }
    sugar.insert(0);
    sugar.insert(C);
    sugar.insert(D);
    for (int i = 1; i <= F; i++) {
        if (sugar.find(i - C) != sugar.end() || sugar.find(i - D) != sugar.end()) {
            sugar.insert(i);
            // cout << i << endl;
        }
    }

    float maxRate = 0;
    int maxWater = 100 * A;
    int maxSugar = 0;
    for (auto w: water) {
        int limitSugar = w * E / 100;
        // cout << "L" << w << " " << limitSugar << endl;;
        for (auto s: sugar) {
            // cout << s << endl;
            if (w + s <= F && s <= limitSugar) {
                if (maxRate < (float)s / w) {
                    maxRate = (float)s / w;
                    maxWater = w;
                    maxSugar = s;
                }
            }
        }
    }
    cout << maxWater + maxSugar << " " << maxSugar << endl;
    return 0;
}


Measured memory_bytes: 384
/*author : Yashvardhan
Friday, May 31, 2019
5:17 PM
*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int pow(int a, int b, int m)
{
	int ans = 1;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	int n,m;
	cin>>n>>m;
	vi arr;

	if(n >= m){
		cout<<0<<endl;
		return 0;
	}

	for(int i = 0; i < m ; i++){
		int x;
		cin>>x;
		arr.pb(x);
	}

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

	vi req;
	int ans = 0;
	for(int i = 1; i < m ; i++){
		req.pb(arr[i] - arr[i-1]);
		ans += arr[i] - arr[i-1];
	}

	sort(req.rbegin(),req.rend());

	//debug(req);

	for(int i = 0; i < n-1 ; i++){
		ans -= req[i];
	}

	cout<<ans<<endl;


	

	t2 = clock();
	cerr<<endl<<t2-t1<<endl;
	
	return 0;
}



Measured memory_bytes: 2548
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")
from itertools import accumulate


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    for k in range(K):
        imos = [0]*(N+1)
        for i, a in enumerate(A):
            imos[max(i-a, 0)] += 1
            imos[min(i+a+1, N)] -= 1
        B = list(accumulate(imos))[:-1]
        if min(B) == N:
            break
        A = B
    print(" ".join(map(str, B)))
    return


if __name__ == '__main__':
    main()


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

const int N = 200005;

int n;
string s[N];

int solve() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
  }

  sort(s, s + n);
  printf("%d\n", unique(s, s + n) - s);
  return 0;
}

int main() {
  int t = 1;
  // scanf("%d", &t);
  for (int tc = 0; tc < t; ++tc) {
    // printf("Case #%d: ", tc+1);
    solve();
  }
  return 0;
}


Measured memory_bytes: 10048
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

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

    int n = s.size();
    if (n == 2) {
        cout << (s[0] == s[1] ? "1 2" : "-1 -1") << endl;
        quick_exit(0);
    }

    for (int i = 0; i < n - 2; i++) {
        if (s[i] == s[i + 1] || s[i + 1] == s[i + 2] || s[i + 2] == s[i]) {
            cout << i + 1 << ' ' << i + 3 << endl;
            quick_exit(0);
        }
    }

    cout << "-1 -1" << endl;

    return 0;
}

Measured memory_bytes: 512
require 'pp'

N,M=gets.chomp.split(' ').map{|n| n.to_i}

if(N>2 && M>2)
	puts "#{(N-2)*(M-2)}"
elsif(N==2)
	puts 0
elsif(N==1 && M==1)
	puts 1
elsif(N==1)
	puts M-2
elsif(M==2)
	puts 0
elsif(M==1)
	puts N-2
end


Measured memory_bytes: 2044
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法
#define JUUHATI 1000000000000000000 
#define JUUHATIPLUS 1000000000000000001 

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

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

    if(s.at(2) == s.at(3) and s.at(4) == s.at(5))
        cout << "Yes" << endl;
    else
        cout << "No" << endl; 
}

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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void solve() {
    int R;
    cin >> R;
    if (R < 1200) {
        print("ABC");
    } else if (R < 2800) {
        print("ARC");
    } else {
        print("AGC");
    }
}

signed main() {
    solve();
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scn = new Scanner(System.in)) {
			int A = scn.nextInt();
			int B = scn.nextInt();
			int H = scn.nextInt();
			int M = scn.nextInt();

			double longAngle = M * 6;
			double shortAngle = H * (360/12) + M * 0.5;

			double angle = 0;

			if(longAngle < shortAngle) {
				longAngle = 360 + longAngle;
				angle = longAngle - shortAngle;
			} else {
				angle = longAngle - shortAngle;
			}

			//余弦定理
			System.out.println(Math.sqrt(Math.pow(A, 2) + Math.pow(B, 2) -2*A*B*Math.cos(Math.toRadians(angle))));
		}
	}
}

Measured memory_bytes: 27140
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	string n;
	cin >> n;
	int64_t sum = 0;
	for (char c : n) {
		sum += (c - '0');
	}
	string ans = "Yes";
	if (sum % 9 != 0) {
		ans = "No";
	}

	cout << ans << '\n';
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int N = 1e5+50;
const int M = 1e6;
const ll oo = 1e18;
const int mod = 1e9+7;

string g[1010];
int dp[1010][1010];

int main(){

	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>g[i];
	dp[n][m-1] = 1;
	for(int i=n-1;i>=0;i--){
		for(int j=m-1;j>=0;j--){
			if(g[i][j] == '#')continue;
			dp[i][j] = (dp[i+1][j] + dp[i][j+1])%mod;
		}
	}
	cout << dp[0][0] << endl;
}

Measured memory_bytes: 5248
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define pb push_back

///Input/Output macros!
#define gi(x) scanf("%d", &x)
#define gi2(x, y) scanf("%d%d", &x, &y)
#define gi3(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define gill(x) scanf("%lld", &x)
#define gill2(x, y) scanf("%lld%lld", &x, &y)
#define gill3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z)
#define pi(x) printf("%d\n", x)
#define pill(x) printf("%lld\n", x)


///Basic Debugging macros!
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(ll __i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(ll __i__=0;__i__<r;__i__++){for(ll __j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}

using namespace std;

///Power of 2 till 2^31!
ll pow2[32] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648};

///Power function!
ll power(ll x,ll y)
{
        ll res = 1;
        while(y>0){
            if(y&1)
                res *= x;
            y>>=1;
            x*=x;
        }
        return res;
}

///Basic Sieve of Eratosthenes!
void Sieve(ll n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (ll p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}

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

bool isPerfectSquare(ll x){ ll s = sqrt(x); return (s*s == x);}

bool isFibonacci(int n){return isPerfectSquare(5*n*n + 4) || isPerfectSquare(5*n*n - 4);}

bool isPrime(int n){if (n <= 1)return false;if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0)return false;
    return true;
}

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;


const int MOD = 1000000007;
const long double PI = 4*atan((long double)1);
const ll INF = 1e18;



int main()
{
    ll a,b,x;
    scanf("%lld%lld%lld",&a,&b,&x);
    ll vol = a*a*b;
    if(x<vol/2){
        double d = (a*b*b)/(2.0*x);
        //cout<<d<<' ';
        double ans = (atan(d)*180)/3.14159265;
        cout<<fixed<<setprecision(10)<<ans<<'\n';//cout<<ans<<'\n';
    }
    else{
        x = vol-x;
        double d = (2*x)/(double)(a*a*a);
        double ans = (atan(d)*180)/3.14159265;
        cout<<fixed<<setprecision(10)<<ans<<'\n';
    }
}


Measured memory_bytes: 256
n,m=map(int,input().split())
a = []
b = []
ans = 0
for i in range(n):
    tempa,tempb = map(int,input().split())
    a.append(tempa)
    b.append(tempb)
test = list(zip(a,b))
test = sorted(test)
i=0
while m>0:
    if m-test[i][1] >=0:
        ans += test[i][0]*test[i][1]
        m -=test[i][1]
    else:
        ans += test[i][0]*m
        m=0
        print(ans)
        exit()
    i+=1
print(ans)

Measured memory_bytes: 19412
'use strict';
(function(stdin) { 
  var inputs = stdin.toString();
  var S = parseInt(inputs.split('\n')[0],10);
  var h = Math.floor(S / 3600);
  var m = Math.floor(S % 3600 / 60);
  var s = S % 60;
  console.log([h,m,s].join(':'));

}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 7644
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = int(a); i <= int(b); ++i)
using namespace std;
template <class A>
void pr(A a) {
  cout << (a) << endl;
}
template <class A, class B>
void pr(A a, B b) {
  cout << a << " ";
  pr(b);
}
template <class A, class B, class C>
void pr(A a, B b, C c) {
  cout << a << " ";
  pr(b, c);
}
template <class A, class B, class C, class D>
void pr(A a, B b, C c, D d) {
  cout << a << " ";
  pr(b, c, d);
}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF = numeric_limits<int>::max();
// for(int j=0;j<N;++j) {

int main(void) {
  int a, b;
  cin >> a >> b;
  pr(a * b);
  return 0;
}


Measured memory_bytes: 3624
/// Bismillah Hir Rahmanir Rahim

/**
    Practice like Cristiano Ronaldo
        Play Like Leo Messi..
**/

#include <bits/stdc++.h>

using namespace std;

#define PI                    acos(-1.0)
#define Pi                    3.141592653589793
#define ff                    first
#define ss                    second
#define pb                    push_back
#define space                 " "
#define all(x)                (x).begin(), (x).end()
#define clr(ar)               memset(ar, 0, sizeof(ar))
#define eprintf(...)          fprintf(stderr, __VA_ARGS__)

/*
template <class T> T gcd(T a,T b){ if(b == 0) return a; return gcd( b,a % b ); }
template <class T> T lcm(T a, T b ){ return ( a * b ) / gcd( a,b ); }
template<class T> string ToString(const T &x){ stringstream s; s << x; return s.str(); }
template<class T> int ToInteger(const T &x){ stringstream s; s << x; int r; s >> r; return r; }
*/

typedef  long long int            ll;
typedef  map<string,int>          msi;
typedef  map<int,int>	          mii;
typedef  map<char,int>            mci;
typedef  map<int,string>	      mis;
typedef  pair<int,int> 	          ii;
typedef  pair<string, int>        psi;
typedef  vector<int> 	          vi;
typedef  vector<string> 	      vs;
typedef  vector< ii >             vii;

template<class T1> void deb(T1 e1)
{
    cout << e1 << endl;
}
template<class T1,class T2> void deb(T1 e1, T2 e2)
{
    cout << e1 << space << e2 << endl;
}
template<class T1,class T2,class T3> void deb(T1 e1, T2 e2, T3 e3)
{
    cout << e1 << space << e2 << space << e3 << endl;
}

#define sf                    scanf
#define pf                    printf

#define sf1(a)                scanf("%d", &a)
#define sf2(a,b)              scanf("%d %d",&a, &b)
#define sf3(a,b,c)            scanf("%d %d %d", &a, &b, &c)
#define sf4(a,b,c,d)          scanf("%d %d %d %d", &a, &b, &c, &d)

#define sf1ll(a)              scanf("%I64d", &a)
#define sf2ll(a,b)            scanf("%I64d %I64d", &a, &b)
#define sf3ll(a,b,c)          scanf("%I64d %I64d %I64d", &a, &b, &c)
#define sf4ll(a,b,c,d)        scanf("%I64d %I64d %I64d %I64d", &a, &b, &c, &d)

#define READ                  freopen("in.txt", "r", stdin);
#define WRITE                 freopen("out.txt", "w", stdout);
/// The End.

void check_time()
{
#ifdef the_badcoder
    eprintf("%.5lf\n", (double)clock() / CLOCKS_PER_SEC);
#endif
}

const int res = 1e5 + 10;
const ll mod = 1e9 + 7;

bool isPerfectSquare(long long n)
{
    long long squareRootN=(long long)round((sqrt(n)));

    if(squareRootN*squareRootN == n)
    {
        return true;
    }
    else
    {
        return false;
    }

}

int main()
{
    ll n, maxi = -1;

    sf1ll( n );

    for( ll i = n; i >= 1; i-- )
    {
        if( isPerfectSquare( i ) ){
            deb( i );
            return 0;
        }
    }

    //deb( maxi );
    return 0;
}


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

int main() {
  int x, n;
  cin >> x >> n;
  vector<int> pline(n);
  vector<int> igai(102);
  for (int i = 0; i < 102; i++) {
    igai.at(i) = i;
  }
  for (int i = 0; i < n; i++) {
    cin >> pline.at(i);
    igai.at(pline.at(i)) = 1000000;
  }
  int kyori = 10000;
  int ans = 100000;
  for (int i = 0; i < 102; i++) {
    int zettai = abs(x-igai.at(i));
    if (zettai < kyori) {
      kyori = zettai;
      ans = igai.at(i);
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define read() freopen("C:\\Users\\Mehedi\\Desktop\\input.txt","r",stdin)
#define write() freopen("C:\\Users\\Mehedi\\Desktop\\output.txt","w",stdout)
#define debug(x) cout<< #x<<" = "<<x<<endl;
#define dbg(x,y) cout<<#x<<" = "<<x<<" , "<<#y<<" = "<<y<<endl;
#define optimizar ios_base::sync_with_stdio(0); cin.tie(0)
#define mx 44721
#define mod  1000
void File_IO () {
  #ifndef ONLINE_JUDGE 
  read();write();
  #endif
}
using namespace std;
typedef long long ll ;
int a[55][55],b[55][55];
int main(){
	//File_IO();
	int n,k;
	cin>>n>>k;
	if(n<10)cout<<k+(100*(10-n))<<endl;
	else cout<<k<<endl;

}

Measured memory_bytes: 256