akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.List;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long A = in.nextLong(), B = in.nextLong(), K = in.nextLong();
			List<Long> l = new ArrayList<>();
			for (long i = A; i < A + K && i <= B; i++) {
				l.add(i);
			}

			for (long i = B - K + 1; i <= B && i >= A; i++) {
				if (!l.contains(i)) {
					l.add(i);
				}
			}

			Collections.sort(l);
			for (long ln : l) {
					out.println(ln);
			}


		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


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

int main() {
  int n, k;
  cin >> n >> k;

  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];

  cout << ceil((n - 1) / (double)(k - 1)) << endl;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
#define endl "\n"
//#define int long long
#define ALL(x) begin(x),end(x)
#define resort(v) sort((v).rbegin(), (v).rend())
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
//const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return ((fact(i - 1)) * i) % MOD;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
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;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された
    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }
    return true;
}
int ans;
int cnt;
/*signed*/int main(void) {
    string s;
    cin >> s;
    if (s[0] == 'R' && s[1] == 'R' && s[2] == 'R') cout << "3" << endl;
    else if (s[1] == 'R' && s[0] == 'R') cout << "2" << endl;
    else if (s[1] == 'R' && s[2] == 'R') cout << "2" << endl;
    else if (s[0] == 'S' && s[1] == 'S' && s[2] == 'S') cout << "0" << endl;
    else cout << "1" << endl;
}

Measured memory_bytes: 3624
#include<stdio.h>

int main(){
  int n,i,j,v,a[100];
  scanf("%d",&n);

  for(i = 0;i < n;i++){
    scanf("%d",&a[i]);
  }

  for(j = 0;j < n;j++){
    if(j == n - 1){
      printf("%d",a[j]);
    }
    else{
      printf("%d ",a[j]);
    }
  }
  printf("\n");

  for(i = 1;i <= n - 1;i++){
    v = a[i];
    j = i - 1;

    while(j >= 0 && a[j] > v){
      a[j+1] = a[j];
      j--;
      a[j+1] = v;
    }

    for(j = 0;j < n;j++){
      if(j == n - 1){
	printf("%d",a[j]);
      }
      else{
	printf("%d ",a[j]);
      }
    }
   printf("\n");
  }
  return 0;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void anss(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=0,res2=INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  ll x;cin>>x;
  res=x/11;
  if(x%11==0)res1=0;
  else if(x%11<=6)res1=1;
  else res1=2;
  cout<<res*2+res1<<endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] student = new int[N];
        
        for (int i = 1; i < N+1; i++)
            student[scanner.nextInt()-1] = i;
        for (int i = 0; i < N; i++)
            System.out.print(student[i] + " ");
    }
}

Measured memory_bytes: 63508
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=1e5+5;
const int mod=1e9+7;

int h,w,K;
string s[15];
signed main(){
    FastIO;
    cin>>h>>w>>K;
    rep(i,1,h) cin>>s[i];
    int ans=1e9;
    rep(i,0,(1<<(h-1))-1){
        bool ok=true;
        int cuts=__builtin_popcount(i);
        vector<int>v(h,0);
        rep(j,1,w){
            int curr=0,temp=0;
            vector<int>u(h,0);
            rep(k,1,h){
                temp+=(s[k][j-1]=='1');
                if(i&(1<<(k-1))){
                    if(temp>K) ok=false;
                    u[curr++]=temp;
                    temp=0;
                }
            }
            if(temp>K) ok=false;
            u[curr]=temp;
            bool flag=true;
            rep(l,0,curr){
                if(v[l]+u[l]>K){
                    flag=false;
                }
                v[l]+=u[l];
            }
            cuts+=(!flag);
            if(!flag) v=u;
        }
        if(ok) ans=min(ans,cuts);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int tate, yoko, menseki, syuu;

        tate = stdIn.nextInt();
        yoko = stdIn.nextInt();

        menseki = tate * yoko;
        syuu = (tate + yoko) * 2;

        System.out.printf(menseki + " " + syuu + "\n");
    }
}



Measured memory_bytes: 26196
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int count=0;
    for(int i=0; i<t.size(); i++)
    {
        if(s[i]==t[i])
            count++;
    }
    cout<<count<<endl;

}



Measured memory_bytes: 3628
num = [0,2,5,5,4,5,6,3,7,6]
n, m = map(int, input().split())
dp = [-1] * (n+10)
a = list(map(int, input().split()))
a.sort()
a.reverse()
b = list()
for x in a:
    b.append(num[x])
dp[0] = 0
for i in range(n):
    for x in b:
        dp[i+x] = max(dp[i+x], dp[i] + 1)
ans = str()
while n > 0:
    for i in range(m):
        if n-b[i] >= 0 and dp[n] == dp[n-b[i]] + 1:
            n -= b[i]
            ans += str(a[i])
            break
print(ans)

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

int main(){
  int N; cin >> N;
  vector<int> MY(N);
  for(int i=0;i<N;i++){
    cin >> MY[i];
  }
  int ans=0;
  for(int i=0;i<N-1;i++){
    if(MY[i]==MY[i+1]){
      ans++;
      MY[i+1]=-1;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n,m=gets.split.map(&:to_i)
array=Array.new(n).map{Array.new(2,0)}
n.times do |i|
    a,b=gets.split.map(&:to_i)
    array[i][0]=a
    array[i][1]=b
end

array.sort!
ans=0
count=0
n.times do |i|
    if (count+array[i][1]<m)
        ans+=array[i][0]*array[i][1]
        count+=array[i][1]
    else
        ans+=array[i][0]*(m-count)
        puts ans
        return
    end
end


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

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

    static const double pi = 3.141592653589793;

    double A, B, H, M;
    cin >> A >> B >> H >> M;

    double x1 = sin(pi / (30.0 / M));
    double y1 = cos(pi / (30.0 / M));

    x1 *= B;
    y1 *= B;

    double x2 = sin(pi / (30.0 / (H * 5.0 + M / 12.0)));
    double y2 = cos(pi / (30.0 / (H * 5.0 + M / 12.0)));

    x2 *= A;
    y2 *= A;

    cout << fixed << setprecision(15) << sqrt(pow((x2 - x1), 2) + pow((y2 - y1), 2)) << endl;
}

Measured memory_bytes: 4180
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A, B, C, D, E):
    m  = min((A, B, C, D, E ))
    return math.ceil(N/m) + 4


def main():
    N = read_int()
    A = read_int()
    B = read_int()
    C = read_int()
    D = read_int()
    E = read_int()

    print(slv(N, A, B, C, D, E ))


if __name__ == '__main__':
    main()


Measured memory_bytes: 6504
#include <iostream>
#include <algorithm>

using namespace std;

#define ll long long

ll gcd(ll a, ll b){
	if(a < b) swap(a,b);
	if(b == 0) return a;
	
	return gcd(b, a%b);
}

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

int main(void){
	ll a,b,c,d,e,f,g;
	long long ret;
	ll tmp = 1;
	
	while(cin >> a >> b >> c >> d >> e >> f){
		if((a|b|c|d|e|f|g) == 0) break;
		
		int i=0,j=0,k=0;
		
		tmp = 1;
		do{
			tmp = a * tmp % b;
			i++;
		}while(tmp != 1);
		tmp = 1;
		do{
			tmp = c * tmp % d;
			j++;
		}while(tmp != 1);
		tmp = 1;
		do{
			tmp = e * tmp % f;
			k++;
		}while(tmp != 1);
			
		ret = lcm(i, lcm(j, k));
		cout << ret << endl;
	}
}

Measured memory_bytes: 0
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = getLine >> getList >>= print . sum . map f

f x
	| x `mod` 2 == 0 = 1 + f ( x `div` 2 )
	| otherwise = 0

Measured memory_bytes: 1148
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

int main()
{
	char c[201],c2[101],c3[101];
	cin >> c >> c3;
	strcpy(c2,c);
	strcat(c,c2);

	if(strstr(c,c3) == NULL) cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    ll K;
    cin>>K;
    ll th=K/50;
    cout<<50<<endl;
    cout<<th<<sp;
    rep1(i, 49){
        th++;
        if(i==50-K%50) th++;
        if(i!=49) cout<<th<<sp;
        else cout<<th<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define PER(i, x, y) for(ll i = x; i > y; i--)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

int main() {
    ll N;
    cin >> N;
    ll a[N];
    bool ok = false;
    REP(i, 0, N) {
        cin >> a[i];
        if (a[i] % 2 != 0) {
            ok = true;
        }
    }
    if (ok) {
        cout << "first" << endl;
    } else {
        cout << "second" << endl;
    }
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>

using namespace std;

const int kMaxN = 50;
const int kMaxD = 1000000000;

struct Point {
    int x, y;
};

int main () {
    int n, m;
    Point a[kMaxN], b[kMaxN];

    cin >> n >> m;

    for (int i = 0; i < n; i++) {
        cin >> a[i].x >> a[i].y;
    }

    for (int i = 0; i < m; i++) {
        cin >> b[i].x >> b[i].y;
    }

    for (int i = 0; i < n; i++) {
        int min = kMaxD;
        int ans = 0;
        for (int j = 0; j < m; j++) {
            int d = abs(a[i].x - b[j].x) + abs(a[i].y - b[j].y);
            if (min > d) {
                min = d;
                ans = j + 1;
            }
        }
        cout << ans << endl;
    }
}
            


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <list>
#include <tuple>
#include <bitset>
#include <ciso646>
#include <cassert>

using namespace std;

#define int long long
#define double long double

typedef pair<int, int> P;
typedef tuple<int, int, int> T;

template<class T> string tostr(T x) { stringstream o; o << x; return o.str(); }
template<class T> T sqr(T x) { return x*x; }
template<class T> T mypow(T x, int n) { T r = 1; while (n > 0) { if (n & 1)r = r*x; x = x*x; n >>= 1; }return r; }

int toint(string s) { int v; stringstream i(s); i >> v; return v; }
bool check(int x, int y, int w, int h) { return x >= 0 && y >= 0 && w > x && h > y; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

#define REP(i,a,b)	for(int (i) = (a);i < (b);(i)++)
#define rep(i,n)	REP(i,0,n)
#define PER(i,a,b)	for(int (i) = (a-1);i >= (b);(i)--)
#define per(i,n)	PER(i,n,0)
#define each(i,n)	for(auto &i : n)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()
#define dump(val) 	cerr << #val " = " << val << endl;
#define dum(val)	cerr << #val " = " << val;
#define FILL(a,v)	fill(a,a+sizeof(a)/sizeof(*a),v)

const int dx[8] = { +1,+0,-1,+0,+1,+1,-1,-1 };
const int dy[8] = { +0,-1,+0,+1,-1,+1,-1,+1 };
const int mod = 1e9 + 7;
const int INF = 1e17 + 9;

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

	int n;
	cin >> n;

	vector<map<char, int>> s(n);
	int ma = 0;
	for (int i = 0; i < n; i++) {
		string t;
		cin >> t;
		each(c, t) {
			s[i][c]++;
		}
	}

	string ans;
	for (char c = 'a'; c <= 'z'; c++) {
		int mi = INF;
		rep(i, n) {
			mi = min(mi, s[i][c]);
		}
		rep(i, mi) {
			ans += c;
		}
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long;
using P = pair<int,int>;
int main(void) {
    vector<int> vc(4);
    rep(i, 4) cin >> vc[i];
    cout << max(vc[0]*vc[1], vc[2]*vc[3]);
}


Measured memory_bytes: 256
#include<iostream>

int main()
{
	int n;
	int a[4][3][10] = { 0 };
	int b, f, r, v;
	std::cin >> n;

	for (int i = 0; i < n; i++) {
		std::cin >> b >> f >> r >> v;
		a[b - 1][f - 1][r - 1] += v;
	}

	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++) {
				std::cout << " " << a[i][j][k];
			}
			std::cout << std::endl;
		}
		if (i < 3)
			std::cout << "####################" << std::endl;
	}
}

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

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> X(N);
	for (int i = 0; i < N; i++) cin >> X[i];
	int MIN = 300000001;
	for (int i = 0; i < N - K + 1; i++) {
		if (X[i + K - 1] <= 0) MIN = min(MIN, -X[i]);
		if (X[i] >= 0) MIN = min(MIN, X[i + K - 1]);
		if (X[i] <= 0 && X[i + K - 1] >= 0) MIN = min(MIN, min(-X[i], X[i + K - 1]) - X[i] + X[i + K - 1]);
	}
	cout << MIN << endl;
}

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

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

  vector<bool> is_prime(1000009, true);
  for (int i = 2; i < 1000009; ++i) {
    if (is_prime[i] == false) continue;
    if (i >= x) {
      cout << i << endl;
      return 0;
    }
    for (int j = 2 * i; j < 1000009; j += i) is_prime[j] = false;
  }
  return 0;
}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<
//        pair<int, int>, // change type
//        null_type,
//        less<pair<int, int> >, // change type
//        rb_tree_tag,
//        tree_order_statistics_node_update>
//        ordered_set;

typedef long long ll;
#define rep(i, start, end) for(int i = start; i < end; ++i)
#define sz(x) (int)(x).size()
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(d, v) memset(d, v, sizeof(d))
#define pii pair<int, int>
const double PI = 3.14159265358979323846;
const double eps = (1e-8);


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("facebook.txt", "w", stdout);
#endif
    int a, b;
    cin >> a >> b;
    if (b%a == 0)
        cout << a + b;
    else
        cout << b - a;
    return  0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
typedef long long ll;
const int mod = 1e9 + 7;
ll gcd(ll a, ll b) {

    if(b == 0)
        return a;
    else
        gcd(b, a%b);
}

vector<pair<ll, int>> factorize(ll num){

    vector<pair<ll, int>> res;
    for(ll i=2; i*i<=num; i++){
        if(num%i) continue;

        res.emplace_back(i, 0);
        while(num%i==0){
            res.back().second++;
            num /= i;
        }
    }
    if(num != 1){
        res.emplace_back(num, 1);
    }
    return res;
}

int main() {

    ll a, b;
    cin >> a >> b;
    
    ll g = gcd(a, b);
    auto f = factorize(g);

    ll ans = f.size() + 1;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)


int main(){
	int n;
	cin>>n;
	if(n==0)cout<<1<<endl;
	else if(n==1)cout<<2<<endl;
	else if(n==2)cout<<1<<endl;
	else cout<<"0"<<endl;
}

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

int main()
{
	ll nn,i;
	cin >> nn;
	ll a[nn];
	for(i=0;i<nn;i++)
	{
		cin >> a[i];
	}
	ll ans=0LL;
	for(i=1;i<nn;i++)
	{
		if(a[i]<a[i-1])
		{
			ans+=(a[i-1]-a[i]);
			a[i]=a[i-1];
		}
	}
	cout << ans ;
}

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

bool is_prime(long long n)
{
    if (n <= 1)
        return false;
    for (long long p = 2; p * p <= n; p++)
    {
        if (n % p == 0)
            return false;
    }
    return true;
}

int main()
{
    long long X;
    cin >> X;
    long long res = X;
    while (!is_prime(res))
        res++;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        while (num > 0) {
            double[] triangle = new double[3];
            triangle[0] = sc.nextDouble();
            triangle[1] = sc.nextDouble();
            triangle[2] = sc.nextDouble();
            double a = Math.pow(triangle[0], 2);
            double b = Math.pow(triangle[1], 2);
            double c = Math.pow(triangle[2], 2);
            if (a + b == c || b + c == a || a + c == b) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
            num = num - 1;

        }
    }
}



Measured memory_bytes: 42076
#include <bits/stdc++.h>
using namespace std;
int main(){
  string x;cin>>x;
  vector<string>d={"SUN","MON","TUE","WED","THU","FRI","SAT"};
  int i=0;
  while(d.at(i)!=x)i++;
  cout<<7-i<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>

int main(){
    std::map<std::string, int> score;
    int N, M;
    std::cin >> N;
    std::string *blue = new std::string[N];
    for(int i = 0; i < N; i++){
        std::cin >> blue[i];
        if(score[blue[i]] == 0){
            score[blue[i]] = 0;
        }
        score[blue[i]] += 1;
    }
    std::cin >> M;
    std::string *red = new std::string[M];
    for(int j = 0; j < M; j++){
        std::cin >> red[j];
        if(score[red[j]] == 0){
            score[red[j]] = 0;
        }
        score[red[j]] -= 1;
    }
    int max = 0;
    for(auto ite = score.begin(); ite != score.end(); ++ite){
        if(ite->second > max){
            max = ite->second;
        }
    }
    std::cout << max << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

ll mod = 1e9+7;

ll f(ll a) {
  a %= mod;
  if (a < 0) a = a + mod;
  return a;
  
}

int main()
{
  ll n;
  cin >> n;
  ll ans = 0;
  ll sub = 1;
  ll k = 1;
  if (n == 0 || n == 1) {
    cout << 0 << endl;
    return 0;
  }
  ll a = 1, b = 1, c = 1;
  rep(i, n) {
    a *= 10;
    a %= mod;
    b *= 9;
    b %= mod;
    c *= 8;
    c %= mod;
  }
  a = (a - ((2*b)%mod) + mod) % mod;
  cout << (a + c) % mod << endl;
  return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  int n=len(s),l=0,r=n-1,ans=0;
  while(l<r){
    if(s[l]!=s[r]){
      if(s[l]=='x'){
        l++;
        ans++;
      }else if(s[r]=='x'){
        r--;
        ans++;
      }else{
        cout<<-1<<endl;
        return 0;
      }
    }else{
      l++;
      r--;
    }
  }
  cout<<ans<<endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<pair<int, int> > a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a.begin(), a.end(), greater<pair<int, int> >());
    vector<vector<long long> > dp(n + 1, vector<long long>(n + 1, 0));
    for(int i = 0; i < a.size(); i++){
        int val = a[i].first;
        int pos = a[i].second;
        int numb = i + 1;
        for(int x = 0; x <= numb; x ++){
            if(x >= 1)
                dp[x][numb - x] = max(dp[x-1][numb-x] + 1LL * val * abs(pos - x + 1), dp[x][numb - x]);
            if(numb - x >= 1)
                dp[x][numb - x] = max(dp[x][numb-x-1] + 1LL * val * abs(pos - (n - (numb - x))), dp[x][numb - x]);
        }
    }
    long long _max = 0;
    for(int i = 0; i <= n; i++){
        _max = max(dp[i][n - i], _max);
    }
    cout << _max;
}


Measured memory_bytes: 34568
n, x = map(int, input().split())
if x == 1 or x == 2 * n - 1:
    print('No')
else:
    print('Yes')
    if n == 2:
        print(1, 2, 3, sep='\n')
        exit()
        
    if x == 2:
        a = [x + 1, x, x - 1, x + 2]
    else:
        a = [x - 1, x, x + 1, x - 2]
    b = list(set(range(1, 2 * n)) - set(a))
    for i in a[::-1]:
        b.insert(n - 2, i)
    print(*b, sep='\n')

Measured memory_bytes: 25700
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int h,w;
vector<int>a,b;
long ans=1,mod=1e9+7;
main()
{
	cin>>h>>w;
	for(int i=0;i<h;i++)
	{
		int y;cin>>y;a.push_back(y);
	}
	for(int i=0;i<w;i++)
	{
		int y;cin>>y;b.push_back(y);
	}
	sort(a.begin(),a.end(),greater<int>());
	sort(b.begin(),b.end(),greater<int>());
	int cnt=0;
	long ia=0,ib=0;
	for(int i=h*w;i>0;i--)
	{
		long ca=0,cb=0;
		while(ia<h&&a[ia]==i)ia++,ca++;
		while(ib<w&&b[ib]==i)ib++,cb++;
		if(ca==0&&cb==0)
		{
			if(ia*ib<=cnt)
			{
				cout<<0<<endl;
				return 0;
			}
			ans=ans*(ia*ib-cnt)%mod;
			cnt++;
		}
		else if(ca>1||cb>1)
		{
			cout<<0<<endl;
			return 0;
		}
		else if(ca==1&&cb==1)
		{
			cnt++;
		}
		else if(ca==1&&cb==0)
		{
			ans=ans*ib%mod;
			cnt++;
		}
		else if(ca==0&&cb==1)
		{
			ans=ans*ia%mod;
			cnt++;
		}
	}
	cout<<ans<<endl;
}

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

int main() {
  int N;
  cin >> N;
  
  int m=N, n=100000000, sum=0;
  rep(i ,9) {
    sum += m / n;
    m %= n;
    n /= 10;
  }
  
  if (N % sum == 0) { cout << "Yes" << endl; }
  else {cout << "No" << endl;}
}

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

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

    if (a <= 0 && 0 <= b) {
        cout << "Zero" << endl;
        return 0;
    }

    int negs = min(-1, b) - a + 1;

    // cout << negs << endl;

    if (negs % 2 == 1) {
        cout << "Negative" << endl;
        return 0;
    }

    cout << "Positive" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;

int main() {
  int64_t n, s = 0, c = 0;
  cin >> n;
  while(n / 2 > 0){
    n /= 2;
    s += pow(2, c);
    ++c;
  }
  s += pow(2, c);
  cout << s << endl;
}


Measured memory_bytes: 512
import java.util.PriorityQueue
import kotlin.comparisons.compareByDescending
fun main(args: Array<String>) {
    val N = nextInt()
    val A = listOfLong()
    //前半
    val first = LongArray(N + 1)
    val fQ = PriorityQueue<Long>(N)
    fQ.addAll(A.subList(0, N))
    var fS = fQ.toList().sum()
    for (n in 0 .. N) {
        first[n] = fS
        fS += A[n + N]
        fQ.add(A[n + N])
        fS -= fQ.poll()!! //一番小さい引く
    }
    //後半
    val latter = LongArray(N + 1)
    val lQ = PriorityQueue<Long>(N, compareByDescending { it })
    lQ.addAll(A.subList(2 * N, 3 * N))
    var lS = lQ.toList().sum()
    for (n in 0 .. N) {
        latter[N - n] = lS
        lS += A[2 * N - n - 1]
        lQ.add(A[2 * N - n - 1])
        lS -= lQ.poll()!! // 一番大きい引く
    }
    var ans = (0 .. N).map { first[it] - latter[it] }.max()!!
    println(ans)
}

fun List<Long>.SUM() = this.reduce { acc, value -> acc + value }

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfInt(vararg deltas: Int) = listOfString().map { Integer.parseInt(it) }.mapIndexed { index, int -> int + deltas[index % deltas.size] }
fun listOfLong(offset: Long = 0L) = listOfString().map { it.toLong() + offset}


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

int main(){
	ll a,b; cin >> a >> b;
	if(a > b){
		rep(i,a)cout << b;
		cout << endl;
	}
	else if(a <= b){
		rep(i,b)cout << a;
		cout << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
long long n;
vector<long long> v(100005);
map<long long,vector<pair<long long,long long>>> mp;
bool used[100005];
 
void dfs(long long s,long long dist){
        used[s]=true;
        v[s]=dist;

        for(auto i:mp[s]){
            if(!used[i.first])
                dfs(i.first,dist+i.second);
        }

}
 
int main(){
    cin>>n;
    long long a,b,c;
    for(long long i=0;i<n-1;i++){
        cin>>a>>b>>c;
        a--,b--;
        mp[a].push_back(make_pair(b,c));
        mp[b].push_back(make_pair(a,c));
    }
    long long k,q;
    cin>>q>>k;
    k--;
    
 
    dfs(k,0);
 
    for(long long i=0;i<q;i++){
        long long x,y;
        cin>>x>>y;
        x--,y--;
      
        cout<<v[x]+v[y]<<endl;
    }
}

Measured memory_bytes: 23040
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];


int main()
{
    ll n,i,j,cc=0;cin>>n;
    ll ara[n];
    for(i=0;i<n;i++)cin>>ara[i];
    j=ara[0];
    for(i=1;i<n;i++){
        if(ara[i]<j)cc++;
        j=min(j,ara[i]);
    }
    cout<<cc+1<<endl;
return 0;
}


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

typedef pair <int, int> P;

char s[405][405];
int used[405][405];
int h, w;
long long ans;
queue <P> q;

void bfs(int stx, int sty){
	int cnt1, cnt2, x, y;
	cnt1 = cnt2 = 0;
	q.push({stx, sty});
	used[stx][sty] = 1;
	while (!q.empty()){
		x = q.front().first; y = q.front().second; q.pop();
		if (s[x][y] == '#') cnt1++;
		else cnt2++;
		if (x > 1 && !used[x - 1][y] && s[x - 1][y] != s[x][y]){
			q.push({x - 1, y});
			used[x - 1][y] = 1;
		}
		if (x < h && !used[x + 1][y] && s[x + 1][y] != s[x][y]){
			q.push({x + 1, y});
			used[x + 1][y] = 1;
		}
		if (y > 1 && !used[x][y - 1] && s[x][y - 1] != s[x][y]){
			q.push({x, y - 1});
			used[x][y - 1] = 1;
		}
		if (y < w && !used[x][y + 1] && s[x][y + 1] != s[x][y]){
			q.push({x, y + 1});
			used[x][y + 1] = 1;
		}
	}
	ans += 1LL * cnt1 * cnt2;
}

int main(){
	scanf("%d %d",&h,&w);
	for (int i = 1; i <= h; i++) scanf("%s", s[i] + 1);
	ans = 0;
	memset(used, 0, sizeof(used));
	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++){
			if (!used[i][j] && s[i][j] == '#') bfs(i, j);
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
using namespace std;

int main() {
	
	long long int N;
	
	cin >> N;
	
	map<long long int, long long int> m;
	map<long long int, long long int>::iterator ite;
	
	long long int ss = 0;
	m[0] = 1;
	
	for(int i = 0; i < N; i++){
		long long int num;
		cin >> num;
		ss += num;
		
		ite = m.find(ss);
		if(ite == m.end()){
			m[ss] = 1;
		}else{
			m[ss]++;
		}
	}
	
	long long int ans = 0;
	
	for(ite = m.begin(); ite != m.end(); ite++){
		long long int num = ite -> second;
		//cout << num;
		ans += num * (num - 1) / 2;
	}
	
	cout << ans << endl;
	
	return 0;
}



Measured memory_bytes: 12800
import java.util.Scanner;

/**
 * A - Lucky 7
 * 3  桁の整数 N が与えられます。
 * N のいずれかの桁に数字の 7 は含まれますか？
 * 含まれるなら Yes を、含まれないなら No を出力してください。
 */
public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner( System.in );
        // 入力された整数
        int n = sc.nextInt();

        System.out.println( String.valueOf( n ).contains( "7" ) ? "Yes" : "No" );

        sc.close();
    }
}

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

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> x(N);
    rep(i,N)cin >> x[i];
    int l = 0;
    int res = 1000000000;
    for(int r = K-1; r < N; r++){
        int lr = abs(x[l]) + abs(x[r] - x[l]);
        int rl = abs(x[r]) + abs(x[r] - x[l]);
        res = min(res,min(lr,rl));
        l++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;

int H, W;
int h, w;

signed main()
{
	cin >> H >> W;
	cin >> h >> w;

	int hh = H - h;
	int ww = W - w;

	cout << hh * ww << endl;
}









Measured memory_bytes: 256
dice = list(map(int, input().split()))
num = int(input())
for i in range(num):
    a = list(map(int, input().split()))
    if a in [[dice[1],dice[2]],[dice[2],dice[4]],[dice[3],dice[1]],[dice[4],dice[3]]]:
        print(dice[0])
    elif a in [[dice[0],dice[3]],[dice[2],dice[0]],[dice[3],dice[5]],[dice[5],dice[2]]]:
        print(dice[1])
    elif a in [[dice[0],dice[1]],[dice[1],dice[5]],[dice[4],dice[0]],[dice[5],dice[4]]]:
        print(dice[2])
    elif a in [[dice[0],dice[4]],[dice[1],dice[0]],[dice[4],dice[5]],[dice[5],dice[1]]]:
        print(dice[3])
    elif a in [[dice[0],dice[2]],[dice[2],dice[5]],[dice[3],dice[0]],[dice[5],dice[3]]]:
        print(dice[4])
    else:
        print(dice[5])


Measured memory_bytes: 5608
#include <iostream>
#include <sstream>
#include <vector>
//#include <numeric>
//#include <algorithm>
#include <cmath>
#include <string>
//#include <map>
//#include <iomanip>
using namespace std;

//関数getinputdata宣言
vector<vector<string>> getinputdata();
vector<vector<int>> getinputdata2();
vector<vector<double>> getinputdata3();

void abc074_b(vector<vector<int>> v) {

    int n = v[0][0];
    int k = v[1][0];
    
    vector<int>vec =v[2];
    
    int mysum=0;
    
    for(auto val :vec){
        
        mysum+=min(abs(val-0),abs(val-k));
    }
    
    cout << mysum * 2 << endl;
    


}

int main() {

//    vector<vector < string>> vec_arr_result;
        vector<vector<int>> vec_arr_result;
    vec_arr_result = getinputdata2();

    abc074_b(vec_arr_result);

    return 0;
}

//関数getinputdata実装

vector<vector<double>> getinputdata3() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<double>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<double> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atof(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;
}

//関数getinputdata実装

vector<vector<int>> getinputdata2() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<int>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<int> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atoi(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;


}

//関数getinputdata実装

vector<vector < string >> getinputdata() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector < string>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<string> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(ret);
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int nax = 1e6 + 7;
int factor[nax];
void generatePrimeFactors() {
	factor[1] = 1;
	for (int i = 2; i < nax; i++)
		factor[i] = i;
	for (int i = 4; i < nax; i += 2)
		factor[i] = 2;

	for (int i = 3; i * i < nax; i++) {

		if (factor[i] == i) {
			for (int j = i * i; j < nax; j += i) {
				if (factor[j] == j)
					factor[j] = i;
			}
		}
	}
}
int calculateNoOFactors(int n)
{
	if (n == 1)
		return 1;
	int ans = 1;
	int dup = factor[n];
	int c = 1;
	int j = n / factor[n];
	while (j != 1) {
		if (factor[j] == dup)
			c += 1;
		else {
			dup = factor[j];
			ans = ans * (c + 1);
			c = 1;
		}
		j = j / factor[j];
	}
	ans = ans * (c + 1);
	return ans;
}
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	int ans = 0;
	generatePrimeFactors();
	for (int i = 1; i < n; i++) {
		int have = n - i;
		ans += calculateNoOFactors(have);
	}
	cout << ans << endl;
}

Measured memory_bytes: 7556
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define INF ((1LL<<62)-(1LL<<31))
#define min(p,q)((p)<(q)?(p):(q))

//辺の情報を個別に持つタイプ
typedef struct edge{ll s,g,c;}E;
typedef struct graph{
	int vcnt,ecnt;
	E  e[200010];//適宜変える(ecnt)
	int inv[200010];//逆辺のindex(ecnt)
	int id[100010];//適宜変える(vcnt)
}G;
G g;

int esort(const void*a,const void*b){
	E*p=(E*)a,*q=(E*)b;
	if((*p).s<(*q).s)return -1;
	if((*p).s>(*q).s)return  1;
	if((*p).g<(*q).g)return -1;
	return 1;
}
int csort(const void*a,const void*b){
	ll p=(*(E*)a).c,q=(*(E*)b).c;
	return p<q?-1:p>q?1:0;
}

void makeinvedge(){
	//逆辺とidx
	rep(i,0,g.ecnt){
		int l=0,r=g.ecnt;
		while(r-l>1){
			int m=(l+r)/2;
			if(g.e[m].s<g.e[i].g||(g.e[m].s==g.e[i].g&&g.e[m].g<=g.e[i].s))l=m;
			else r=m;
		}
		if(g.e[l].s!=g.e[i].g||g.e[l].g!=g.e[i].s){
			g.e[g.ecnt].s=g.e[i].g;
			g.e[g.ecnt].g=g.e[i].s;
			g.e[g.ecnt].c=0;
			g.ecnt++;
		}
	}
	qsort(g.e,g.ecnt,sizeof(E),esort);
	rep(i,0,g.ecnt){
		int l=0,r=g.ecnt;
		while(r-l>1){
			int m=(l+r)/2;
			if(g.e[m].s<g.e[i].g||(g.e[m].s==g.e[i].g&&g.e[m].g<=g.e[i].s))l=m;
			else r=m;
		}
		g.inv[i]=l;
	}
}

void readgraph(){
	//適宜変える
	ll n,m;
	char s[510];
	scanf("%lld%lld%s",&n,&m,s);
	rep(i,0,n){
		int t;
		scanf("%d",&t);
		g.e[2*i  ].s=n;
		g.e[2*i  ].g=i;
		g.e[2*i  ].c=s[i]=='L'?t:0;
		g.e[2*i+1].s=i;
		g.e[2*i+1].g=n+1;
		g.e[2*i+1].c=s[i]=='R'?t:0;
	}
	rep(i,0,m){
		ll x,y,c;
		scanf("%lld%lld%lld",&x,&y,&c);
		if(x<y){int t=x;x=y;y=t;}
		x--;y--;
		g.e[2*n+i].s=x;
		g.e[2*n+i].g=y;
		g.e[2*n+i].c=c;
	}
	g.vcnt=n+2;
	g.ecnt=2*n+m;
	qsort(g.e,g.ecnt,sizeof(E),esort);
//	qsort(g.e,g.ecnt,sizeof(E),csort);
	makeinvedge();

	int p=0;
	rep(i,0,g.vcnt){
		while(p<g.ecnt&&g.e[p].s<i)p++;
		g.id[i]=p;
	}
	g.id[g.vcnt]=g.ecnt;//番兵
}




//dinic ただしO(VVE)ではなくO(V^4)
//有向グラフの隣接行列capaと、ソースs,シンクtを引いてsからtへの最大流を返す
//*
int dist[1010];//ソースからの距離
int checked[1010];//dfsの行き止まりフラグ
void dinicbfs(int s){
	rep(i,0,g.vcnt)dist[i]=-1;
	dist[s]=0;
	//まだ流せる辺だけを使ってbfs
	int que[1010],qcnt=0;
	que[qcnt++]=s;
	rep(q,0,qcnt){
		int v=que[q];
		rep(i,g.id[v],g.id[v+1])if(g.e[i].c>0&&dist[g.e[i].g]==-1){
			dist[g.e[i].g]=dist[v]+1;
			que[qcnt++]=g.e[i].g;
		}
	}
}
ll dinicdfs(int a,int t,ll m){
	//aはm受け取ってる(⇔aから最大m流せる)
	//いくら流せるかを返す
	if(a==t)return m;
	if(checked[a])return 0;
	ll ans=0;
	checked[a]=1;
	rep(i,g.id[a],g.id[a+1])if(g.e[i].c>0&&dist[g.e[i].g]>dist[a]){
		int b=g.e[i].g;
		ll addedflow=dinicdfs(b,t,min(m,g.e[i].c));
		if(addedflow){
			g.e[i].c-=addedflow;
			g.e[g.inv[i]].c+=addedflow;
			checked[a]=0;
			ans+=addedflow;
			m-=addedflow;
			if(m<=0)break;
		}
	}
	return ans;
}
//ソース,シンク
ll dinic(int s,int t){
	ll ans=0;
	int flag=1;
	while(flag){
		flag=0;//更新フラグ
		dinicbfs(s);
		while(!checked[s]){
			ll addedflow=dinicdfs(s,t,INF);
			ans+=addedflow;
			if(addedflow)flag=1;
		}
		rep(i,0,g.vcnt)checked[i]=0;
	}
	return ans;
}
//*/

int main(){
	readgraph();
	printf("%lld\n",dinic(g.vcnt-2,g.vcnt-1));
}


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

int main() {
	int N;
	cin >> N;
	map<string, int> cnts;
	cnts["AC"] = 0;
	cnts["WA"] = 0;
	cnts["TLE"] = 0;
	cnts["RE"] = 0;
	for (int i = 0; i < N; ++i) {
		string in;
		cin >> in;
		cnts[in]++;
	}
	cout << "AC x " << cnts["AC"] << endl;
	cout << "WA x " << cnts["WA"] << endl;
	cout << "TLE x " << cnts["TLE"] << endl;
	cout << "RE x " << cnts["RE"] << endl;
}

Measured memory_bytes: 3640
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [-int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()
    DD = ((1,0),(0,1),(-1,0),(0,-1))

    x,y = LI()

    n = x * 4 - y
    if n % 2:
        print('No')
        return
    if 0 <= n // 2 <= x:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

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

int main(){
    int K;
    int A, B;
    cin >> K >> A >> B;

    for(int i=A; i<=B; i++){
        if(i % K == 0 ){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;

    return 0;
}

Measured memory_bytes: 3608