akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

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

		char[] chars = s.toCharArray();
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < s.length(); i++) {
			char c = (char)('A' + ((chars[i] - 'A' + n) % 26));
			sb.append(String.valueOf(c));
		}
		System.out.println(sb.toString());
	}
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000




int main(){
	
	int N;
	cin>>N;
	
	int X;
	cin>>X;
	
	vector<int> S(N);
	for(int i=0;i<N;i++)cin>>S[i];
	
	sort(S.rbegin(),S.rend());
	
	int M = 100000;
	
	vector<vector<int>> dp(N+1,vector<int>(M+1,0));
	dp[0][X] = 1;
	
	for(int i=0;i<N;i++){
		for(int j=0;j<=M;j++){
			dp[i+1][j%S[i]] = mod(dp[i][j]+dp[i+1][j%S[i]]);
			dp[i+1][j] = mod(dp[i+1][j] + mod(dp[i][j]*(N-1-i)));
		}
	}
	
	int ans = 0;
	for(int i=0;i<=M;i++){
		ans = mod(ans + mod(dp.back()[i] * i));
	}
	
	cout<<ans<<endl;
	
    return 0;
}


Measured memory_bytes: 79488
#!/usr/bin/env python

N = input()
N = int(N)

v = []
v = input().split()
#print(v)
v = [float(n) for n in v]
#print(v)
v.sort()
#print(v)

for i in range(N - 1) :
	v[i + 1] = (v[i] + v[i + 1]) / 2

#print(v)
print(v[N - 1])


Measured memory_bytes: 3060
#include <iostream>

int main() {
  int x = 1, n = 0, k = 0;
  
  std::cin >> n >> k;
  
  for (int i = 0; i < n; i++) {
    if (x <= k) {
      x *= 2;
    } else {
      x += k;
    }
  }
  
  std::cout << x << std::endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

#define ll long long int
#define mod 1000000007

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    cout << n*(n-1)/2 + m*(m-1)/2;
}









Measured memory_bytes: 256
using System;

class Program
{
  static void Main(string[] args)
  {
    string S = Console.ReadLine();
    int N = S.Length;
    char[] A = new char[(N + 1) / 2];

    for (int i = 0; i < N; ++i)
    {
      if (i % 2 == 0)
      {
        A[i / 2] = S[i];
      }
    }

    string ans = new string(A);

    Console.WriteLine(ans);
  }
}


Measured memory_bytes: 11616
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD;
#define MODSUB(SUB_X,SUB_Y)  (SUB_X-SUB_Y)+MOD)%MOD;
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD;
#define LCM(LCM_X,LCM_Y) (LCM_X*LCM_Y)/__gcd(LCM_X,LCM_Y);
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};
int arr[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int f=0,n;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    arr[0]--;
    for(int i=1; i<n; i++)
    {
        arr[i]--;
        if(arr[i]<arr[i-1])
            arr[i]++;
        if(arr[i]<arr[i-1]){

            f=1;
        }
    }
    if(f)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;


    return 0;
}


Measured memory_bytes: 4004
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
int mod(ll a){return a%1000000007;};
typedef pair<int,int> i_i;


int main(){
    int n;cin>>n;
    int a[n+1];for(int i=1;i<=n;i++)cin>>a[i];
    int b[n+1];
    if(n%2==0){
        for(int i=1;i<=n/2;i++){
            b[i]=a[n-2*i+2];
        }
        for(int i=1;i<=n/2;i++){
            b[n/2+i]=a[2*i-1];
        }
    }else{
        for(int i=1;i<=n/2+1;i++){
            b[i]=a[n-(2*i)+2];
        }
        for(int i=1;i<=n/2;i++){
            b[n/2+1+i]=a[2*i];
        }
    }
    for(int i=1;i<=n;i++)cout<<b[i]<<" ";
    
    return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n, l, a[100008], ans[100008];
string s;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> n >> l;
	rep(i, 1, n){
		cin >> a[i];
	}
	
	ll flag = false;
	ll last = 0;
	rep(i, 1, n-1){
		if(a[i]+a[i+1] >= l){
			flag = true;
			last = i;
			break;
		}
	}
	
	if(!flag){
		print("Impossible")
	}
	else{
		print("Possible")
		rep(i, 1, last-1){
			print(i)
		}
		rrep(i, n-1, last+1){
			print(i)
		}
		print(last)
	}
	return 0;
}

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

#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) REP(i, 0, n)
#define ALL(r) (r).begin(), (r).end()

void Main();

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main() {
    int64_t n, x = 1, y = 1, z = 1;
    cin >> n;

    rep(i, n) {
        x = (x * 10) % 1000000007;
        y = (y *  9) % 1000000007;
        z = (z *  8) % 1000000007;
    }

    x -= y;
    x = (x >= 0 ? x : x + 1000000007);
    x -= y;
    x = (x >= 0 ? x : x + 1000000007);
    x += z;
    x %= 1000000007;
    cout << x << endl;
}


Measured memory_bytes: 3640
class UnionFind:
    def __init__(self, n):
        self.par = [-1 for i in range(n+1)]
        self.rank = [0] * (n+1)
 
    # 検索
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
 
    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if not x==y: # 根が同じでない場合のみ併合する
            if self.rank[x] < self.rank[y]:
                self.par[y] += self.par[x] # 要素数を併合
                self.par[x] = y # 根を付け替えている
            else:
                self.par[x] += self.par[y]
                self.par[y] = x
                if self.rank[x] == self.rank[y]:
                    self.rank[x] += 1
        
    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y) 
 
def main():
    import sys
    input = sys.stdin.readline
    
    N,M,Q = map(int,input().split())
    KI = UnionFind(N-1)
    CC = []
    for i in range(Q):
        A,B,C = map(int,input().split())
        if C == 0:
            KI.union(A,B)
        else:
            CC.append([A,B])
    
    flag = 0
    
    oya = {}
    for i in range(N):
        p = KI.find(i)
        oya[p]=1
    PPP = len(oya)
    
    for i in CC:
        A,B = i
        if KI.same_check(A,B):
            flag = 1
            break
        elif PPP<=2:
            flag = 1
            break
        elif M == N-1:
            flag = 1
            break
    
    if N-1+((PPP-2)*(PPP-1))//2 < M:
        flag = 1
            
    if flag == 0:
        print("Yes")
    else:
        print("No")
    
    
    
    
main()

Measured memory_bytes: 76204
let () =
  let n = Scanf.scanf "%d " (fun x -> x) in
  let spot = Array.init n (fun _ ->
                 Scanf.scanf " %d" (fun x -> x)) in
  let sum =
    let rec loop i sum arr =
      if i = 0 then
        loop (i+1) (sum + abs (0 - arr.(i))) arr
      else
        begin
        if i = n then
          sum + (abs (arr.(n-1) - 0))
        else
          loop (i+1) (sum + abs (arr.(i-1) - arr.(i))) arr
        end
    in
    loop 0 0 spot
  in
  (* Printf.printf "%d\n" sum *) 
  for i = 0 to (n-1) do
    Printf.printf "%d\n"
      (sum +
         (if i = n-1 then
            - abs (spot.(n-2) - spot.(n-1))
            - abs (spot.(n-1) - 0)
            + abs (spot.(n-2) - 0)
          else
            (if i = 0 then
               - abs (spot.(0) - 0)
               - abs (spot.(0) - spot.(1))
               + abs (spot.(1) - 0)
             else
               - abs (spot.(i-1) - spot.(i))
               - abs (spot.(i) - spot.(i+1))
               + abs (spot.(i-1) - spot.(i+1)) )))
  done;
  


Measured memory_bytes: 6272
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
using namespace std;
using ll = long long;
int main(){
  int x,y,a,b,c;
  cin >> x >> y;
  cin >> a >> b >> c;
  vector<ll> p(a),q(b),r(c);
  for(int i=0;i<a;i++) cin >> p[i];
  for(int i=0;i<b;i++) cin >> q[i];
  for(int i=0;i<c;i++) cin >> r[i];

  sort(p.begin(),p.end());
  sort(q.begin(),q.end());

  priority_queue<ll,vector<ll>,less<ll>> Q;
  for(int i=a-1;i>a-x-1;i--) Q.push(p[i]);
  for(int i=b-1;i>b-y-1;i--) Q.push(q[i]);
  for(int i=0;i<c;i++) Q.push(r[i]);

  ll sum = 0;
  for(int i=0;i<x+y;i++){
    ll v = Q.top();
    Q.pop();
    sum += v;
  }

  cout << sum << endl;
}


Measured memory_bytes: 8816
import sys
def input():
	return sys.stdin.buffer.readline()[:-1]
n = int(input())
b = [tuple(map(int, input().split())) for _ in range(n)]
b.sort(key=lambda x: x[0]+x[1])

dp = [0 for _ in range(20010)]
dp[0] = 0

for i in range(n):
	for j in range(b[i][1] + b[i][0], b[i][0]-1, -1):
		dp[j] = max(dp[j], dp[j - b[i][0]] + b[i][2])

print(max(dp))

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

int main() {
  string a;
  cin >> a;
  
  if (a == "a" || a == "i" || a == "u" || a == "e" || a == "o")
    cout << "vowel" << endl;
  
  else
    cout << "consonant" << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int len(int n) {
    if (n % 2 == 0 || n % 5 == 0) return -1;
 
    int k = 0;
 
    for (int i = 1; i <= 1000000; i++) {
        k = (k*10+7) % n;
        if (!k) return i;
    }
    if (k) return -1;
}
 
int main() 
{
    int n;
    cin >> n;
    cout << len(n);
 
    return 0;
}

Measured memory_bytes: 3604
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
#include<iostream>
#include<bits/stdc++.h>
#include<cstdio>
#include<string.h>
#include<map>
#include<cmath>
#include<stack>
#include<algorithm>
#include<assert.h>
using namespace std;
#define endl '\n'
#define pb push_back
//#define int long long
#define mp make_pair
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define mem0(s) memset(s,0,sizeof(s))
#define meminf(s) memset(s,0x3f,sizeof(s))
#define mp_insert(a,b,c) mp.insert(map<pair<int,int>,int>::value_type(make_pair(a,b),c))
double pi=acos(-1);
typedef long long ll;
typedef unsigned long long ull;
inline ll lowbit(ll x){return x&(-x);}
inline ll min(ll a,ll b){return a<b?a:b;}
inline ll max(ll a,ll b){return a>b?a:b;}
const double Rad_to_deg=45.0/atan(1.0);
inline ll floor(const ll&a,const ll&b){return a/b;}
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
const ll INF=4223372036854775807,max_n=100010,mod=998244353;
inline int cal(int x){int res=0;while(x){x/=10;res++;}return res;}
inline ll ceil(const ll&a,const ll&b){if(a%b==0)return a/b;return a/b+1;};
inline ll pow(ll a,ll b,ll mod){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;}
inline int mul(int a,int b){return (ll)a*b%mod;}
int ans[max_n];
int x;
int main()
{
	ll n,k,q;cin>>n>>k>>q;
	for(int i=1;i<=q;i++)
	{
		cin>>x;
		ans[x]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(k-q+ans[i]>0)
		{
			cout<<"Yes"<<endl;
		}
		else cout<<"No"<<endl;
	}
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    Int(x);
    int n = 100;

    int ret = 0;
    while (n < x) {
        n = (double)n * 1.01;
        ret++;
    }
    cout << ret << endl;

    return 0;
}


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

using i64 = long long int;

int main(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    int ans = 0;
    for(int i=0;i<3;++i){
        for(int j=0;j<3;++j){
            if(i != j){
                int k = 3 ^ (i|j);
                ans = max(ans, a[i]*10+a[j]+a[k]);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
N=gets.to_i
as=gets.split.map(&:to_i)
bs=Array.new(N,0)
if as[0]!=0 || as[1..-1].any?{|e|e==0}
    puts 0
    exit
end
as.each do |e|
    bs[e]+=1
end
ls=as.max
cnt=1
(ls).times do |i|
    cnt=cnt*(bs[i]**bs[i+1])
    cnt%=998244353
end
puts cnt%998244353

Measured memory_bytes: 9604
use proconio::*;
use proconio::marker::*;

#[fastout]
fn run() {
    input! {
        n: usize,
        e: [(Usize1, Usize1, u64); n - 1],
    }
    let mut g = vec![vec![]; n];
    for (a, b, c) in e {
        g[a].push((b, c));
        g[b].push((a, c));
    }
    let mut q = vec![0];
    let mut parent = vec![0; n];
    for i in 0..n {
        let v = q[i];
        let p = parent[v];
        for &(u, _) in g[v].iter().filter(|e| e.0 != p) {
            parent[u] = v;
            q.push(u);
        }
    }
    let mut size = vec![1; n];
    let mut sum = 0;
    for &v in q.iter().rev() {
        let p = parent[v];
        for &(u, w) in g[v].iter().filter(|e| e.0 != p) {
            sum += 2 * std::cmp::min(n as u64 - size[u], size[u]) * w;
            size[v] += size[u];
        }
    }
    let mut pos = 0;
    loop {
        let mut next = (0, 0, 0);
        for &(u, w) in g[pos].iter().filter(|e| e.0 != parent[pos]) {
            next = std::cmp::max(next, (size[u], u, w));
        }
        if 2 * next.0 > n as u64 {
            pos = next.1
        } else if 2 * next.0 == n as u64 {
            sum -= next.2;
            break;
        } else {
            sum -= g[pos].iter().map(|e| e.1).min().unwrap();
            break;
        }
    }
    println!("{}", sum);
}

fn main() {
    run();
}


Measured memory_bytes: 14060
import sys

f_i = sys.stdin

n = int(f_i.readline())

class VCost:
    def __init__(self, v, cost):
        self.v_n = v
        self.cost = cost
    def __lt__(self, other):
        return self.cost < other.cost
    def __gt__(self, other):
        return self.cost > other.cost

adj = [[VCost(int(v), int(c)) for v, c in zip(x.split()[2::2], x.split()[3::2])] for x in f_i]

import heapq

def dijkstra():
    PQ = []
    isVisited = [False] * n
    distance = [999900001] * n

    distance[0] = 0
    heapq.heappush(PQ, VCost(0, 0))
    
    while PQ:
        uc = heapq.heappop(PQ)
        u = uc.v_n

        if uc.cost > distance[uc.v_n]:
            continue

        isVisited[u] = True
        
        for vc in adj[u]:
            v = vc.v_n
            if isVisited[v] == True:
                continue
            t_cost = distance[u] + vc.cost
            if t_cost < distance[v]:
                distance[v] = t_cost
                heapq.heappush(PQ, VCost(v, t_cost))

    for v, d in enumerate(distance):
        print(v, d)


dijkstra()

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

flag = False
count = 0

while True:
  
  for num in A:
    if (num % 2) == 1:
      flag = True
      
  A = list(map(lambda x: int(x / 2), A))
  
  if flag:
    break
  
  count += 1
  
print(count)

Measured memory_bytes: 3060
import java.util.*;

class Main {
    final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    int n;
    int m;
    int x;
    int[][] a;
    int[] c;
    boolean[] isBuy;

    private void run() {
        n = sc.nextInt();
        m = sc.nextInt();
        x = sc.nextInt();

        a = new int[n][m];
        c = new int[n];

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

            for (int j = 0; j < m; j++) {
                a[i][j] = sc.nextInt();
            }
        }

        isBuy = new boolean[n+1];
        int ans = dp(0);
        System.out.println(ans == Integer.MAX_VALUE ? -1 : ans);
    }

    // i番目の本を買うもしくは買わない場合の条件を満たす最小金額を返す
    private int dp(int i) {
        // 最後まで買うか買わないかを決めたら理解度が目標に達したかをチェック
        if (i == n) {
            int[] understand = new int[m];
            int sum = 0;
            for (int j = 0; j < n; j++) {
                if (!isBuy[j]) continue; // 買わない本は無視
                sum += c[j];
                for (int k = 0; k < m; k++) {
                    understand[k] += a[j][k];
                }
            }

            for (int u : understand) {
                // 理解が足りていない言語があったらNG
                if (u < x) return Integer.MAX_VALUE;
            }
            // 全部達していたらその合計金額を返す
            return sum;
        }

        // i番目の教科書を買う場合
        isBuy[i] = true;
        int costa = dp(i+1);

        // i番目の教科書を買わない場合
        isBuy[i] = false;
        int costb = dp(i+1);

        return Math.min(costa, costb);
    }
}



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

int main() {
  char C;
  cin >> C;
  string alpha = "abcdefghijklmnopqrstuvwxyz";
  int number = 0;
  for (int i = 0; i < alpha.size(); i++){
    if (C == alpha.at(i)){
      cout << alpha.at(i+1) << endl;
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)

int main(){
  ll q,h,s,d,n,a,b;
  cin >> q >> h >> s >> d >> n;
  a = min(4*q,2*h);
  a = min(a,s);
  b = min(2*a,d);
  cout << (n/2)*b + (n%2)*a ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
#define F first
#define S second
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long 
#define ld long double
#define pii pair <int ,int >
#define bug(x)  cout<<"passed "<<x<<endl;
long long const inf = 1e18, linf = 2e9, mod = 1e9+7;
int const mxn = 4e5+10;
 
ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

long long ans , l[mxn] , cnt[mxn];

int main(){
	long long  n ; 
	cin>>n;
	for (int i = 0 ; i < n ; i++){
		cin>>l[i];
		cnt[l[i]]+=1;
	}
	for (int i = 1 ; i <= n ; i ++ ){
		long long a = cnt[i];
		ans += (a * (a-1))/2;
	}
	for (int i = 0 ; i <n;i++ ){
		int k = cnt[l[i]];
		if (k <=1)
			cout<<ans<<"\n";
		else
			cout<<ans - (k*(k-1)/2 - (k-1)*(k-2)/2)<<"\n";
	}

}

Measured memory_bytes: 7296
#include <cstdio>
#include <cmath>
int a, b, c;
int t;
int main()
{
	while(~scanf("%d%d", &a, &b)){
		int c = b;
		t = 0;
		while(c){
			c = c / 10;
			t++;
		}
		c = 1;
		while(t){
			c *= 10;
			t--;
		}
		int ans = a * c + b;
		int res = sqrt(ans);
		if(res == sqrt(ans)){
			printf("Yes\n");
		}
		else
			printf("No\n");
	}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
#define pb push_back
#define mp make_pair;
  
int main(){
	int k,x;
	scanf("%d%d",&k,&x);
	if(k*500>=x)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;	
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int W = sc.nextInt();
    int[] w = new int[N];
    int[] v = new int[N];
    for (int i = 0; i < N; i++) {
      w[i] = sc.nextInt();
      v[i] = sc.nextInt();
    }
    
    long[][] dp = new long[N+1][W+1];
    for (int i = 0; i < N; i++) {
      for (int j = 0; j <= W; j++) {
        if (j+w[i] <= W) {
          dp[i+1][j+w[i]] = Math.max(dp[i+1][j+w[i]], dp[i][j]+v[i]);
        }
        dp[i+1][j] = Math.max(dp[i+1][j], dp[i][j]);
      }
    }
    System.out.println(dp[N][W]);
  }
}

Measured memory_bytes: 127572
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define LL long long
#define ULL unsigned long long
#define bug(x) cout<<"bug-----"<<x<<endl
#define R(i,n) for(int i = 0; i < n; i++)
using namespace std;
const int mod= 1e9+7;
const int maxn = 1e6 +10;
char s[maxn];
int main(){
    //freopen("C:\\Users\\admin\\Desktop\\1.in","r",stdin);
    //freopen("C:\\Users\\admin\\Desktop\\1.out","w",stdout);
    std::ios::sync_with_stdio(false);
    scanf("%s",s);
    int l=strlen(s);
    LL ans=0,t=0;
    for(int i=0;i<l;i++)
    {
        if(s[i]=='B')
        {
            t++;
        }
        else
        {
            ans+=t;
        }
    }
    printf("%lld\n",ans);

    return 0;
}


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

const long long mod = 1000000007;

struct Matrix {
	long long a[3][3];
};

Matrix Mul(Matrix A, Matrix B) {
	Matrix C; for (int i = 0; i < 9; i++) C.a[i / 3][i % 3] = 0;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				C.a[i][j] += A.a[i][k] * B.a[k][j];
				C.a[i][j] %= mod;
			}
		}
	}
	return C;
}

Matrix Power(Matrix A, long long K) {
	Matrix V, W = A; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (i == j) V.a[i][j] = 1; else V.a[i][j] = 0; } }

	for (int i = 0; i < 32; i++) {
		if ((K / (1LL << i)) % 2 == 1) { V = Mul(V, W); }
		W = Mul(W, W);
	}
	return V;
}

long long N, M, X[1 << 17], A, B, C;
Matrix Base;

int main() {
	cin >> N >> M;
	for (int i = 1; i <= M; i++) cin >> X[i];
	X[M + 1] = N + 1;

	A = 0; B = 1; C = 1;
	Base.a[0][0] = 1; Base.a[0][1] = 0; Base.a[0][2] = 1;
	Base.a[1][0] = 1; Base.a[1][1] = 1; Base.a[1][2] = 1;
	Base.a[2][0] = 1; Base.a[2][1] = 2; Base.a[2][2] = 2;
	for (int i = 0; i <= M; i++) {
		Matrix G = Power(Base, X[i + 1] - X[i] - 1);
		long long CA = G.a[0][0] * A + G.a[0][1] * B + G.a[0][2] * C; CA %= mod;
		long long CB = G.a[1][0] * A + G.a[1][1] * B + G.a[1][2] * C; CB %= mod;
		long long CC = G.a[2][0] * A + G.a[2][1] * B + G.a[2][2] * C; CC %= mod;
		A = CA; B = CB; C = CC; if (i == M) break;

		long long EA = 1LL * A + 0LL * B + 1LL * C; EA %= mod;
		long long EB = 0LL * A + 1LL * B + 0LL * C; EB %= mod;
		long long EC = 0LL * A + 2LL * B + 1LL * C; EC %= mod;
		A = EA; B = EB; C = EC;
	}
	cout << A << endl;
	return 0;
}

Measured memory_bytes: 1024
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()
    num_list = i_list()

    count = 0
    num_list.sort()
    max_num = num_list[n-1]
    ans_list = [0] * (max_num + 1)

    num_list_counter = Counter(num_list)

    for k, v in num_list_counter.items():
        if v == 1:
            continue
        ans_list[k] = 1

    for num in num_list:
        if ans_list[num] == 0:
            count += 1
        for i in range(num, max_num+1, num):
            ans_list[i] = 1

    print(count)
 
if __name__ == '__main__':
    main()


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

int main(void)
{
	int a, b;
	int ten=1;
	scanf("%d %d", &a, &b);
	for(int i=0; i<a; i++)
		ten*=100;
	if(b!=100)
		printf("%d", ten*b);
	else
		printf("%d", ten*b+ten);
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<ctype.h>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<utility>
#define For(a,b) for(int i=(a);i<(b);i++)
#define Rep(n) for(int i=0; i<(n); ++i)
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
//----------program from here----------

int main(){
    int A=0,B=0;
    cin >> A >> B;
    cout << (A>B ? (A-B>1?A*2-1:A+B) : (B-A>1?B*2-1:A+B) ) << endl;
}

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

#define MAX_N (100000L)
#define INF (1000000000000000000L)

using namespace std;

int main() {
  // read inputs
  long N, as[3 * MAX_N];
  scanf("%ld", &N);
  for (long i = 0; i < 3 * N; i++) {
    scanf("%ld", &as[i]);
  }

  // precalculation
  //   max_sum_n_ls[i] : maximum value that can be achieved when selecting
  //                     N elements from the range 0:i + 1 and taking their sum
  //   min_sum_n_rs[i] : minimum value that can be achieved when selecting
  //                     N elements from the range i:3N and taking their sum
  long max_sum_n_ls[3 * MAX_N] = {}, min_sum_n_rs[3 * MAX_N] = {};
  // calculate max from the left
  priority_queue<long, vector<long>, greater<long>> lq;
  for (long i = 0; i < N; i++) {
    const long a = as[i];
    max_sum_n_ls[N - 1] += a;
    lq.push(a);
  }
  for (long i = N; i < 2 * N; i++) {
    const long a = as[i];
    const long min_a = lq.top();
    if (a > min_a) {
      lq.pop();
      lq.push(a);
      max_sum_n_ls[i] = max_sum_n_ls[i - 1] - min_a + a;
    } else {
      max_sum_n_ls[i] = max_sum_n_ls[i - 1];
    }
  }
  // calculate min from the right
  priority_queue<long, vector<long>, less<long>> rq;
  for (long i = 3 * N - 1; i >= 2 * N; i--) {
    const long a = as[i];
    min_sum_n_rs[2 * N] += a;
    rq.push(a);
  }
  for (long i = 2 * N - 1; i >= N; i--) {
    const long a = as[i];
    const long max_a = rq.top();
    if (a < max_a) {
      rq.pop();
      rq.push(a);
      min_sum_n_rs[i] = min_sum_n_rs[i + 1] - max_a + a;
    } else {
      min_sum_n_rs[i] = min_sum_n_rs[i + 1];
    }
  }

//   for (long i = N - 1; i < 2 * N + 1; i++) {
//     printf("i = %ld, max_sum_n_ls[i] = %ld, min_sum_n_rs[i] = %ld\n", i,
//            max_sum_n_ls[i], min_sum_n_rs[i]);
//   }

  // solve
  long ans = -INF;
  for (long i = N - 1; i < 2 * N; i++) {
    ans = max(ans, max_sum_n_ls[i] - min_sum_n_rs[i + 1]);
  }
  printf("%ld\n", ans);
}

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

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

    int now = 0;
    int ans = 1e9;
    for(int i = 0; i < 1000; i++){
        for(int j = 0; j < 1000; j++){
            now = (a + b) * i;
            if(now <= c + 60 * j && c + 60 * j <= now + a){
                ans = min(ans, c + 60 * j);
            }
        }
    }
    if (ans == 1e9) {
        puts("-1");
    } else {
        cout << ans << endl;
    }
}

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

int read() {
	char c = getchar();
	int x;
	while(c >= '0' && c <= '9') {
		x = x * 10 + c - '0';
		c = getchar();
	}
	return x;
}

double n;

int main() {
	cin >> n;
	for(double i = 0; i <= 47300; i++) {
		if(floor(i * 1.08) == n) {
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;
	return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE MultiWayIf #-}


import Control.Arrow
import Control.Concurrent
import Control.Monad
import qualified Data.ByteString.Char8 as C
import Data.Complex
import Data.Function
import Data.Function.HT
import qualified Data.IntMap.Strict as IM
import qualified Data.IntSet as IS
import Data.List
import Data.Ord
import qualified Data.Sequence as Sq
import Data.Vector.Algorithms.Search
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import Debug.Trace


------------------
-- #   Read   # --
------------------

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine



main :: IO ()
main = do
    n <- readLn :: IO Int
    as <- map fromIntegral <$> r' :: IO [Integer]
    if 0 `elem` as then print 0
        else
            print $ foldl1' (\ac n -> if ac == -1 || ac*n > 10^18 then -1 else ac*n) as


Measured memory_bytes: 13380
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));
        int m = Integer.parseInt(br.readLine());
        System.out.println(problem172a(m));
    }

    private static int problem172a(int a) {
        return a + a * a + a * a * a;
    }
}

Measured memory_bytes: 25220
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#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)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

int main(){

    ll N, M;
    cin >> N >> M;
    V x(N), y(N), z(N);
    rep(i, N)cin >> x[i] >> y[i] >> z[i];
    ll ans = 0;
    rep(i, 8){
        V v;
        rep(j, N){
            ll tmp = 0;
            tmp += x[j] * (i & 1 ? 1 : -1);
            tmp += y[j] * (i & 2 ? 1 : -1);
            tmp += z[j] * (i & 4 ? 1 : -1);
            v.push_back(tmp);
        }
        sort(v.begin(), v.end(), greater<ll>());
        ll sum = 0;
        rep(j, M)sum += v[j];
        chmax(ans, sum);
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>

using namespace std;

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

	set<int> S;

	int query, x;

	for (int i = 0; i < q; i++) {
		cin >> query >> x;
		if (query == 0) {
			S.insert(x);
			cout << S.size() << endl;
		}
		else {
			if (S.find(x) != S.end())
				cout << 1 << endl;
			else
				cout << 0 << endl;		
		}
	}
}


Measured memory_bytes: 12384
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#define INF 1000000000

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

int main()
{
	int dx[4]={0, 1, 0, -1}, dy[4]={1, 0, -1, 0};
	while(1){
		int w, h;
		cin>>w>>h;
		if(w==0 && h==0) return 0;
		int s[30][30];
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				cin>>s[i][j];
			}
		}
		int c[4];
		for(int i=0; i<4; i++){
			cin>>c[i];
		}
		int d[4][30][30];
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				for(int k=0; k<4; k++){
					d[k][i][j]=INF;
				}
			}
		}
		d[0][0][0]=0;
		priority_queue<PP, vector<PP>, greater<PP> > que;
		que.push(PP(P(0, 0), P(0, 0)));
		while(!que.empty()){
			PP p=que.top();
			que.pop();
			int k=p.first.second;
			int x=p.second.first;
			int y=p.second.second;
			for(int i=0; i<4; i++){
				int t=c[i];
				if(s[x][y]==i) t=0;
				if(!(x+dx[(k+i)%4]>=0 && x+dx[(k+i)%4]<h && y+dy[(k+i)%4]>=0 && y+dy[(k+i)%4]<w)) continue;
				if(d[(k+i)%4][x+dx[(k+i)%4]][y+dy[(k+i)%4]]>d[k][x][y]+t){
					d[(k+i)%4][x+dx[(k+i)%4]][y+dy[(k+i)%4]]=d[k][x][y]+t;
					que.push(PP(P(d[(k+i)%4][x+dx[(k+i)%4]][y+dy[(k+i)%4]], (k+i)%4), P(x+dx[(k+i)%4], y+dy[(k+i)%4])));
				}
			}
		}
		int ans=INF;
		for(int i=0; i<4; i++){
			if(d[i][h-1][w-1]<ans) ans=d[i][h-1][w-1];
		}
		cout<<ans<<endl;
	}			
	return 0;
}


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

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)

int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  string s, t; cin >> s >> t;
  vector<vector<int>> nxt(26, vector<int>(s.size()));
  for (size_t i = 0; i < s.size(); i++) {
    int c = s.at(i) - 'a';
    for (int j = i; j >= 0 && nxt.at(c).at(j) == 0; j--) {
      nxt.at(c).at(j) = i - j + 1;
    }
  }
  for (int c = 0; c < 26; c++) {
    int k = nxt.at(c).at(0);
    if (k == 0) continue;
    for (int j = s.size() - 1; j >= 0 && nxt.at(c).at(j) == 0; j--) {
      nxt.at(c).at(j) = k + s.size() - j;
    }
  }
  ll val = 0;
  int pos = 0;
  for (size_t i = 0; i < t.size(); i++) {
    int dist = nxt.at(t.at(i) - 'a').at(pos);
    if (dist == 0) {
      cout << "-1\n";
      return 0;
    }
    val += dist;
    pos = (pos + dist) % s.size();
  }
  cout << val << endl;

  return 0;
}



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

int main() {
  int n, m;
  cin >> n >> m;
  int a[n];
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  int s = 0;
  for(int i = 0; i < n; i++){
    s += a[i];
  }
  int cnt = 0;
  for(int i = 0; i < n; i++){
    if(a[i]*(4*m) >= s){
      cnt++;
    }
  }
  if(cnt >= m){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3644
N,M = map(int, input().split())
c = [0 for i in range(M)]
for i in range(M):
    p,y = map(int, input().split())
    c[i] = [i,p,y]
c = sorted(c, key = lambda x: x[2])

l = [1 for i in range(N)]
for i in c:
    i.append(l[i[1]-1])
    l[i[1]-1] += 1

c = sorted(c, key=lambda x:x[0])
for i in c:
    print(str(i[1]).zfill(6) + str(i[3]).zfill(6))

Measured memory_bytes: 32596
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


class UnionFind:
    def __init__(self, n: int):
        self.n = n
        self.parents = [-1] * n
    
    def find(self, x: int):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x: int, y: int):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return
        if self.parents[y] < self.parents[x]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def size(self, x: int):
        return -self.parents[self.find(x)]
    
    def same(self, x: int, y: int):
        return self.find(x) == self.find(y)
    
    def members(self, x: int):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
    
    def group_count(self):
        return len(self.roots())
    
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def solve():
    N, K = map(int, rl().split())
    P = list(map(lambda n: int(n) - 1, rl().split()))
    C = list(map(int, rl().split()))
    
    uf = UnionFind(N)
    for i in range(N):
        uf.union(i, P[i])
    roop_scores = defaultdict(int)
    for i in range(N):
        roop_scores[uf.find(i)] += C[i]
    
    ans = -(10 ** 18)
    K -= 1
    for s in range(N):
        cur = P[s]
        tmp = C[cur]
        ans = max(ans, tmp)
        roop_size = uf.size(s)
        roop_score = roop_scores[uf.find(s)]
        roop_cnt = K // roop_size
        if roop_cnt and 0 < roop_score:
            tmp += roop_score * roop_cnt
            rem = K % roop_size
            ans = max(ans, tmp)
            while rem:
                cur = P[cur]
                tmp += C[cur]
                ans = max(ans, tmp)
                rem -= 1
            continue
        cnt = min(roop_size, K)
        while cnt:
            cur = P[cur]
            tmp += C[cur]
            ans = max(ans, tmp)
            cnt -= 1
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 75936
package main

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

func main() {
	A, B := getStdinInt64_2()

	if A == B {
		fmt.Printf("0\n")
		return
	}

	if (A+B)%2 == 0 {
		fmt.Printf("%d\n", ((A + B) / 2))
		return
	}

	fmt.Printf("IMPOSSIBLE\n")
}

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10)

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinInt2() (int, int) {
	list := getStdinIntArr()
	return list[0], list[1]
}
func getStdinInt3() (int, int, int) {
	list := getStdinIntArr()
	return list[0], list[1], list[2]
}
func getStdinInt4() (int, int, int, int) {
	list := getStdinIntArr()
	return list[0], list[1], list[2], list[3]
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinInt64_2() (int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1]
}
func getStdinInt64_3() (int64, int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1], list[2]
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}
func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}
func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, _ := sc.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


Measured memory_bytes: 2156
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
int32_t main()
{
	#ifndef ONLINE_JUDGE
	freopen("in","r",stdin);
	freopen("out","w",stdout);
	#endif
	int n,k;
	cin>>n>>k;
	int div=0,kb2=0;
	for(int i=1;i<=n;i++)
	{
		if(i%k==0)div++;
		else if(i%k==(k/2))kb2++;
	}

	if(k%2)
	{
		cout<<div*div*div;
	}
	else
	{
		cout<<div*div*div+kb2*kb2*kb2;
	}
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    long long N, M, K; cin >> N >> M >> K;
    vector<long long> A(N);
    vector<long long> B(M);

    for(int i=0; i<N; i++){
        long long hoge; cin >> hoge;
        A.at(i) = hoge;
        if(i != 0){
            A.at(i) += A.at(i-1);
        }
    }
    for(int i=0; i<M; i++){
        long long hoge; cin >> hoge;
        B.at(i) = hoge;
        if(i != 0){
            B.at(i) += B.at(i-1);
        }
    }

    auto Iter = upper_bound(B.begin(),B.end(),K);
    long long cnt = Iter - B.begin();
    long long sol = cnt;

    for(int i=0; i<N; i++){
        long long remain = K-A.at(i);
        if(remain < 0){
            break;
        }

        auto Iter = upper_bound(B.begin(),B.end(),remain);
        long long cnt = Iter - B.begin() + i+1;
        sol = max(sol,cnt);

    }

    cout << sol << endl;

}

Measured memory_bytes: 6360
#if 1
  #include <bits/stdc++.h>
#else
  #include "../../../../bits/stdc++.h"
#endif

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

using namespace std;

typedef pair<int, int> P;
#define pb push_back
#define mp make_pair
#define ft first
#define sd second

int N;

int main(){
  cin.tie(0);
  
  cin>>N;
  cout<<"ABC"<<N<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <map>
#include <numeric>
using namespace std;


int main()
{
    int a, b;
    cin >> a >> b;
  
    if (b == 1) { 
      cout << 0 << endl;
      return 0;
    }
  
    int now = a;
    int count = 1;
    do {
        if (now >= b) {
            break;
        }
        now = (now - 1) + a;
        count++;
    } while (1);


    cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;

#define Speed ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define mod 1000000007
#define fr first
#define sc second
#define pb push_back
#define PI acos(-1.0)
#define print(num,ans) cout<<setprecision(num)<<fixed<<ans
#define ordered_set tree<pair<int,int> , null_type,less<pair<int,int> >, rb_tree_tag,tree_order_statistics_node_update>


int main()
{
    Speed;
    int n,i;
    ll a[100100];
    cin>>n;
    ll co = 0;
    for(i=0;i<n;i++)
        cin>>a[i];
    ll mx = 0;
    for(i = n - 1;i>0;i--)
    {
        if(a[i - 1] >= a[i])
            co++;
        else
            co = 0;
        mx = max(mx , co);
    }
    cout<<mx;


    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <cctype>
using namespace std;
 
#define MD 1000000007
typedef long long int ll;

int main(){
    string a,b;
    cin>>a>>b;
    if(a.size()>b.size()){
        cout<<"GREATER"<<endl;
        return 0;
    }else if(a.size()<b.size()){
        cout<<"LESS"<<endl;
        return 0;
    }
    
    for(int i=0;i<a.size();i++){
        int ta=a[i]-'0',tb=b[i]-'0';
        if(ta>tb){
             cout<<"GREATER"<<endl;
             break;
        }else if(ta<tb){
            cout<<"LESS"<<endl;
            break;
        }
        if(i+1==a.size()){
            cout<<"EQUAL"<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int i,j,n[10],k;
    for(i=0;i<10;i++){
        scanf("%d",&n[i]);
    }
    for(i=0;i<9;i++){
        for(j=0;j<9;j++){
            if(n[j]<=n[j+1]){
                k=n[j];
                n[j]=n[j+1];
                n[j+1]=k;
            }
        }
    }
    printf("%d\n%d\n%d\n",n[0],n[1],n[2]);
    return 0;
}




Measured memory_bytes: 2048
#include<iostream>
using namespace std;
int main() {
int F[45];
F[0] = 1;
F[1] = 1;
int n;
cin >> n;
for (int i = 2; i <= n; i++) {
F[i] = F[i - 1] + F[i - 2];
}
cout << F[n] << endl;
return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 20;
const int MAXM = 1000010;
const int MAXK = 110;
const int MAXQ = 200010;

int n, a[MAXN][MAXN], m[1<<MAXN];
ll f[1<<MAXN], dp[1<<MAXN];

ll solve(int mask) {
    if (dp[mask] != -1) return dp[mask];
    int u = m[mask];
    int mask2 = mask ^ (1<<u);
    ll Max = f[mask];
    for (int split = mask2; split; split = (split-1) & mask2) {
        int mask4 = mask2 ^ split ^ (1<<u);
        Max = max(Max, f[mask4] + solve(split));
    }
    return dp[mask] = Max;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    FOR(i,0,n-1) FOR(j,0,n-1) cin >> a[i][j];
    FOR(mask,1,(1<<n)-1) {
        f[mask] = 0;
        FOR(i,0,n-1)
            if (mask & (1<<i)) {
                m[mask] = i;
                FOR(j,i+1,n-1)
                    if (mask & (1<<j)) f[mask] += a[i][j];
            }
    }
    FOR(i,0,(1<<n)-1) dp[i] = -1;
    dp[0] = 0;
    cout << solve((1<<n)-1);
    return 0;
}


Measured memory_bytes: 4864
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[] line = br.readLine().split(" ");
		int a = Integer.parseInt(line[0]);
		int b = Integer.parseInt(line[1]);
		System.out.println(Math.max(Math.max(a+b, a-b), a*b));
	}
}


Measured memory_bytes: 23124
while line = gets do
  s = line.chomp
  if s == "-"
    break
  end
  m = gets.chomp.to_i
  h = []
  for i in 1..m do
    h[i-1] = gets.chomp.to_i
  end
  b = h.inject(:+) % s.size
  printf("%s\n",s[b,s.size-b] + s[0,b])
end


Measured memory_bytes: 6872