akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    h, n = map(int, input().split())
    m = [tuple(map(int, input().split())) for _ in range(n)]

    a, b = m[0]
    dp = [[10**18] * (h + 1) for _ in range(n)]
    dp[0] = [((i + a - 1) // a) * b for i in range(h + 1)]
    for i in range(1, n):
        a, b = m[i]
        for j in range(h + 1):
            dp[i][j] = min(dp[i - 1][j], b + dp[i][max(0, j - a)])

    print(dp[n - 1][h])


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 119152
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int check =0;
    for (int i=0; i<S.length(); i++) {
      if (i % 2 == 0) {
        if (S.charAt(i) == 'L') {
        check++;
        break;
        }
      } else {
        if (S.charAt(i) == 'R') {
        check++;
        break;
        }
      }
    }
    if (check != 0) {
      System.out.println("No");
    } else {
      System.out.println("Yes");
    }
  }
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
#define eps 1e-7
#define SIZE 1000100
#define rep(i, a, b) for (long long i = a; i <= b; ++i)
#define pi acos(-1.0)
#define mp make_pair
#define ll long long
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
int n, m, k, t;
const int maxn=2e5+5;
int a[maxn];
int q[maxn];
int ma[maxn],mi[maxn];
int main() {
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    int l=1,r=0,m=k+1;
    for(int i=1,j=0;i<=n;i++){
        while(r>=l&&a[q[r]]>=a[i]) r--;
        q[++r]=i;
        while(r>=l && q[l]<i-m+1)l++;
        if(i>=m)mi[++j]=a[q[l]];
    }
    l=1,r=0;
    for(int i=1,j=0;i<=n;i++){
        while(r>=l&&a[q[r]]<=a[i]) r--;
        q[++r]=i;
        while(r>=l && q[l]<i-m+1)l++;
        if(i>=m)ma[++j]=a[q[l]];
    }
//    for(int i=1;i<=n-k;i++)cout<<mi[i]<<" ";cout<<endl;
//    for(int i=1;i<=n-k;i++)cout<<ma[i]<<" ";cout<<endl;
    int ans=1;
    for(int i=1;i<=n-k;i++){
        if(a[i]==mi[i]&&a[i+k]==ma[i])
            continue;
        ans++;
    }
    int temp=0;
    for(int i=1;i<=n;i++){
        int j;
        for(j=i+1;j<=n;j++)
            if(a[j]<a[j-1])break;
        j--;
//        printf("i=%d j=%d\n",i,j);
        if(j-i+1>=k) temp++;
        i=j+1-1;
    }
    if(temp>1)
        ans-=(temp-1);
    printf("%d\n",ans);
}
/*
10 4
2 0 1 3 7 5 4 6 8 9

5 3
0 2 1 4 3
*/


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

int main(){
  int i,j,cnt=0;
  int n;
  cin>>n;
  for(i=1;i<=5;i++){
    if(n==(int)round(pow(10,i))){
      cout<<10;
      return 0;
    }
  }
  for(i=0;i<=4;i++){
    cnt+=(n/(int)round(pow(10,i)))%10;
  }
  cout<<cnt;
}

Measured memory_bytes: 256
n, a, b = gets.strip.split.map(&:to_i)
#n,a,b = STDIN.gets.chomp.split(" ").map(&:to_i)
result = 0
 
(1..n).each do |i|
  j = i
  sum = 0
  while j > 0
    sum += j % 10
    j = j / 10
  end
  if sum >= a && sum <= b
    result += i
  end
end
 
puts result

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (110)
#define pii pair<int, int>

/////////////////////////////////////////////////////////

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

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

template<typename T1, typename T2>
T1 mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  T1 tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

bool isPrime(int n){
  if(n == 1) return false;
  rep(i, 2, min((int)(pow(n, 0.5) + 1), n)){
    if(n % i == 0) return false;
  }
  return true;
}

/////////////////////////////////////////////////////////

int count(int y, int m, int d){
  if(m < 3){
    y--;
    m += 12;
  }
  int res = 365 * y + y / 4 - y / 100 + y / 400 + 306 * (m + 1) / 10 + d - 429;
  return res;
}

void Main() {
  ll A, B, C; cin >> A >> B >> C;
  cout << B + min(C, A + B + 1) << endl;
}

/////////////////////////////////////////////////////////

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

  Main();
}


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

int main(){
    int N, W; cin >> N >> W;
    ll w[110]; int v[110];
    int sum=0;
    for(int i=0; i<N; i++){
        cin >> w[i+1] >> v[i+1];
        sum +=v[i+1]; 
    }
    vector< vector<ll> > dp(N+1,vector<ll>(sum+1));
    const ll INF = 100100100100;
    for(int i=0; i<=N; i++){
        for(int j=0; j<=sum; j++){
            dp[i][j] = INF;
        }
    }
    dp[0][0]=0;
    for(int i=1; i<=N; i++){
        for(int j=0; j<=sum; j++){
            if(j-v[i]>=0){
                dp[i][j] = min(dp[i-1][j], dp[i-1][j-v[i]]+w[i]);
            }
            else{
                dp[i][j]=dp[i-1][j];
            }
        }
    }

//    for(int i=0; i<=N; i++){
//        for(int j=0; j<=sum; j++){
//            cout << dp[i][j] << " ";
//        }
//        cout << endl;
//    }

    for(int j=sum; j>=0; j--){
        if(dp[N][j] <=W){
            cout << j << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 80256
K, A, B = map(int,input().split(" "))
bis = 1
if A+1 >= B:
    print(int(K)+1)
else:
    bis += A-1
    K -= A-1
    if K%2 == 1:
        bis += 1
        K -= 1
    bis += (B-A) * (K // 2)
    print(bis)


Measured memory_bytes: 2940
h,w,k=map(int,input().split())
l=[[0 for i in range(w+1)]]+[[0]+[int(j) for j in input()] for i in range(h)]
a=[[0 for i in range(w+1)] for i in range(h+1)]
for i in range(1,h+1):
    for j in range(1,w+1):
        a[i][j]=a[i-1][j]+a[i][j-1]-a[i-1][j-1]+l[i][j]
ans=h*w
def ink(h2,h1,w2,w1):
    return a[h2][w2]-a[h1][w2]-(a[h2][w1]-a[h1][w1])
for i in range(2**(h-1)):
    tl=[0]
    for j in range(h-1):
        if i>>j&1:
            tl.append(j+1)
    tl.append(h)
    t=len(tl)-2
    w1=0
    for w2 in range(1,w+1):
        for h1,h2 in zip(tl,tl[1:]):
            if ink(h2,h1,w2,w1)>k:
                if w2-1==w1:
                    t=h*w
                    break
                w1=w2-1
                t+=1
                break
    ans=min(ans,t)
print(ans)

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

using namespace std;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define debug(x) cerr << #x << ":" << x << endl;
#define debug2(x) for(auto a : x) cerr << a << " "; cerr << endl;
#define debug3(x) rep(i, sizeof(x)) cerr << x[i] << " "; cerr << endl;

vector<pii> around = {MP(1, 0), MP(-1, 0), MP(0, 1), MP(0, -1)};

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

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

    map<ll, ll> mp;
    ll n;
    cin >> n;
    ll a[n];
    rep(i, n) cin >> a[i];
    rep(i, n) mp[i] = mp[i - 1] + a[i];
    ll ans = LINF;

    rep(i, n - 1) {
        ans = min(ans, abs(mp[n - 1] - 2 * mp[i]));
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  string s,t;
  cin>>s>>t;

  ll ans=LLINF;
  ll ns=s.size();
  ll nt=t.size();
  for(ll i=0; i<ns-(nt-1); i++){
    ll now=0;
    REP(j,nt){
      if(s[i+j]!=t[j])
        now++;
    }

    ans=min(ans,now);
  }
  cout<<ans<<endl;
}



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

int main() {
	int N;
	string S;
	cin >> N >> S;
	string ans;
	if (N % 2 == 1) {
		ans = "No";
	}
	else if (S.substr(0, N/2) == S.substr(N/2, N/2)) {
		ans = "Yes";
	}
	else {
		ans = "No";
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll x, ll y) {
	ll res = 1;
	for (ll i = 0; i < y; i++) res = res * x % mod;
	return res;
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

int main() {
	int n;
	cin >> n;
	vector<int> x(n);
	for (int i = 0; i < n; i++) cin >> x[i];
	int ans = INF;
	for (int i = 1; i <= 100; i++) {
		int total = 0;
		for (int j = 0; j < n; j++) {
			total += (x[j] - i) * (x[j] - i);
		}
		ans = min(ans, total);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3572
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner input = new Scanner(System.in);
    int a = input.nextInt();
    int b = input.nextInt();
    String ans = "Odd";
    if (a*b%2==0){
      ans = "Even";
    };
    System.out.println(ans);
  }
}

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

            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];
ll x[10];
ll y[10];

int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    cout<<min(b/a,c)<<endl;
return 0;
}


Measured memory_bytes: 4992
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define N 5000

typedef struct list
{
	int x, y;
	char ground;
	struct list *prev;
	struct list *next;
} list;

list head;
list tail;
	
void Insert(char);
list *FarSide(list *);
int PubbleArea(list *, list *);

int main()
{
	int i;
	char c;
	list *p;
	list *farSide;
	int pubbleCount = 0;
	int pubble[N];
	int sumPubble = 0;
	
	head.next = &tail;
	tail.prev = &head;
	
	// Input
	while(1)
	{
		c = getchar();
		if(c == '\n') break;

		Insert(c);
	}

	// ?°´??????????????¢????????????
	for(p = head.next; p != &tail; p = p->next)
	{
		if(p->ground == '\\' &&
		   (farSide = FarSide(p)) != NULL)
		{
			pubble[pubbleCount] = PubbleArea(p, farSide);
			sumPubble += pubble[pubbleCount];
			p = farSide;
			pubbleCount++;
		}
		
	}

	// Output
	printf("%d\n%d", sumPubble, pubbleCount);
	for(i = 0; i < pubbleCount; i++)
	{
		printf(" %d", pubble[i]);
	}
	printf("\n");
	
	return 0;
}

void Insert(char c)
{
	static int xCount = 0;
	static int yCount = 0;
	list *p;

	p = (list*)malloc(sizeof(list));
	p->prev = tail.prev;
	tail.prev->next = p;
	p->next = &tail;
	tail.prev = p;

	xCount++;
	if(c == '\\') yCount--;
	if(c == '/' ) yCount++;
	p->x = xCount;
	p->y = yCount;
	p->ground = c;
}

// ??????????±?????????¢??°
// ?????°??? '\' ??????????§???????
// ????????????'/'??????????????£??¢??¨???????§???????
list *FarSide(list *s)
{
	list *i_p;
	int height;
	height = s->y + 1;

	for(i_p = s->next; i_p != &tail; i_p = i_p->next)
	{
		if(i_p->y == height) return i_p;
	}
	return NULL;
}

// ??????????°´??????????????¢???????±?????????¢??°
// ?????°??? ?°´?????????????§??????¨??????????????¨????§???????
// ???????????? ??¢???
int PubbleArea(list *pS, list *pE)
{
	list *i_p;
	list *farSide;
	int area = 0;
	
	for(i_p = pS; i_p != pE; i_p = i_p->next)
	{
		if(i_p->ground == '\\')
		{
			farSide = FarSide(i_p);
			area += farSide->x - i_p->x;
		}
	}
	return area;
}

Measured memory_bytes: 1484
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(i64 i = 0; i < N; i++)
#define Rep(i, k, N) for(i64 i = k; i < N; i++)
#define all(v) v.begin(), v.end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    Cout(Yes((C+B-1)/B <= (A+D-1)/D));
}


Measured memory_bytes: 3588
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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

    vector<int>k(999);
    k[0]=1;
    for(int i=2;i<=999;i++){
        k[i-1] = k[i-2]+i;
    }

    // for(int i:k)cout<<i<<endl;

    for(int i=0;i<999;i++){
        // cout<<k[i]-a<<" "<<k[i+1]-b<<endl;
        if((k[i]-a )== (k[i+1]-b)){
            cout<<k[i]-a<<endl;
            return 0;
        }
    }
    // cout<<"nanimo";

}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int w,h,x,y,r;
	int temp;
	int min,med,max;
	
	scanf("%d", &w);
	scanf("%d", &h);
	scanf("%d", &x);
	scanf("%d", &y);
	scanf("%d", &r);
	
	if(x-r >= 0 && x+r <= w){
		if(y-r >= 0 && y+r <= h)
			printf("Yes\n");
		else
			printf("No\n");
	}else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 1012
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define ALL(v) v.begin(),v.end()

int main(int argc, char const *argv[])
{
    ll n, k;
    cin >> n >> k;
    map<ll, ll> m;
    for (ll i = 0; i < n; i++)
    {
        ll a;
        cin >> a;
        m[a]++;
    }
    vector<ll> v;
    for (auto p : m)
    {
        v.push_back(p.second);
    }
    sort(ALL(v));
    ll ans = 0;
    for (ll i = 0; i < (ll)v.size() - k; i++)
    {
        ans += v[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 14964
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define MOD 998244353
#define INIT -1

int main()
{
   string n;
   cin >> n;
   // result[i][0] : i - 1桁めまで払ってる　繰り下がりはない
   // result[i][1] : i - 1桁目まで払ってる　繰り下がりあり
   int result[1000010][2] = {};
   result[0][0] = 0;
   result[0][1] = 1;
   for (int i = 1; i <= n.length(); i++)
   {
      result[i][0] = min(result[i - 1][0] + (n[i - 1] - '0'), result[i - 1][1] + (10 - (n[i - 1] - '0')));
      result[i][1] = min(result[i - 1][1] + (10 - (n[i - 1] - '0') - 1), result[i - 1][0] + (n[i - 1] - '0' + 1));
   }
   cout << result[n.length()][0] << endl;
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var dict = new Dictionary<int, int>();

            for (var i = 0; i < N; i++)
                dict[i + 1] = A[i];

            foreach (var d in dict.OrderBy(z => z.Value))
            {
                Console.WriteLine(d.Key);
            }
        }
    }
}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
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;}
const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    multiset<int> s;
    REP(i, n) {
        cin >> a[i];
        s.insert(a[i]);
    }
    sort(ALL(a), greater<int>());

    int t = 0;
    REP(i, n) {
        auto it = s.find(a[i]);
        if (it == s.end()) continue;
        s.erase(it);
        int x = 1;
        while (a[i] >= x) x <<= 1;
        it = s.find(x - a[i]);
        if (it == s.end()) continue;
        t++;
        s.erase(it);
    }
    cout << t << endl;
}

Measured memory_bytes: 10368
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_set>
#include <queue>
#include <set>
#include <iomanip> 
#include <stack>
#define int long long
#define ld long double
#define dbg(x) cout <<#x<<":"<<x<<'\n';
#define dbg2(x,y) cout<<#x<<":"<<x<<' '<<#y<<":"<<y<<'\n';
#define endl '\n'
#define inf 1000000010
#define eps 1e-8l
using namespace std;

const int N=2e5+5;
std::vector<int> g[N],c(N),gd(N),p(N),r(N);
vector<bool> vis(N);
int power(int x,int y){int res = 1;while(y>0){if(y&1)res = (res*x);x = (x*x);y = y>>1;}return res;}

//int n,m;
int n,a,b,da,db,md,nd,m;

int const dpn=2e5+5;
int dp[dpn];

bool comp(pair<int,int> l,pair<int,int> r){
	if(l.first!=r.first)
		return (l.first<r.first);
	return l.second>r.second;
}

int find(int i){
	if(p[i]!=i)
		return p[i]=find(p[i]);
	return i;
}

void join(int x,int y){
	int px=find(x);
	int py=find(y);
	if(r[px]>r[py])
		p[py]=px;
	else if(r[px]<r[py])
		p[px]=py;
	else
		p[py]=px,r[px]++;
}

int32_t main(){
	ios_base::sync_with_stdio(0); 
	cin.tie(0); cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--){
		//int n;
		//int n;
		int d,t,s;
		cin>>d>>t>>s;
		if((double)d/(double)s<=(double)t)
			cout<<"Yes\n";
		else
			cout<<"No\n";

	}
	return 0;
}


Measured memory_bytes: 13448
using System;
using System.Text;

namespace abc154_b
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int sLength = s.Length;

            StringBuilder x = new StringBuilder();
            for(int i = 0; i < sLength; i++)
            {
                x.Append("x");
            }

            Console.WriteLine(x.ToString());
        }
    }
}


Measured memory_bytes: 25888
#include <bits/stdc++.h>
#define SEKAI_NO_OWARI return 0;
#define INIT cin.tie(0); ios::sync_with_stdio(false);
#define rep(i, n) for(int i=0; i<n; i++)

using namespace std;

void solve() {
	int n; cin >> n;
	vector<int> p(n);
	for (int i = 0; i < n; i++) {
		//scanf("%d", &p[i]);
		cin >> p[i];
    }

	int res = 0;
	for (int i = 1; i < n - 1; i++) {
		if ((p[i - 1] < p[i]) && (p[i] < p[i + 1])) {
			res++;
		}
		else if ((p[i - 1] > p[i]) && (p[i] > p[i + 1])) {
			res++;
		}
	}
	cout << res << endl;
}

int main(void) {
	//INIT
	solve();
	return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<vector>
#include<functional>
using namespace std;
typedef long long LL;
inline long long read()
{
	long long kk=0,f=1;
	char cc=getchar();
	while(cc<'0'||cc>'9'){if(cc=='-')f=-1;cc=getchar();}
	while(cc>='0'&&cc<='9'){kk=(kk<<1)+(kk<<3)+cc-'0';cc=getchar();}
	return kk*f;
}
int asd,n;
int main()
{
	asd=read();n=read();
	for(int i=1;i<=n;++i)asd-=read();
	printf("%d\n",max(asd,-1));
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
#define ll long long
#define PI 3.141592653589
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define EPS 1e-7
#define f first
#define s second
using namespace std;
int arr[22][22];
int memo[(1<<21)+5][22];
const int MOD = 1e9+7;
int n;
int solve(int mask, int idx){
    if(__builtin_popcount(mask)==n)
        return 1;
    int &res = memo[mask][idx];
    if(res != -1)
        return res;
    res = 0;
    for(int i = 0; i < n; ++i){
        if(arr[idx][i] == 1 && !(mask&(1<<i))){
            res = (res+solve(mask|(1<<i), idx+1))%MOD;
        }
    }
    return res;
}
int main() {
    IO;
    cin >> n;
    memset(memo, -1, sizeof memo);
    for(int i = 0; i < n; ++i)
        for(int j = 0; j < n; ++j)
            cin >> arr[i][j];
    cout << solve(0, 0);
}


Measured memory_bytes: 180480
#include<iostream>
#include<numeric>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<map>
#include<utility>
#include<cmath>
#include<tuple>
#include<string>
#include<bitset>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
typedef long long ll;

int main(){
    double a,b,h,m;
    cin>>a>>b>>h>>m;

    double r=min(abs(6*m-(60*h+m)/2),abs(360-abs(6*m-(60*h+m)/2)));

    double ans=a*a+b*b-2*a*b*cos(acos(-1)*r/180);
    printf("%.20f\n",sqrt(ans));
}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}


int main()
{
    lol sum{1};
    lol n; cin >> n;
    int k; cin >> k;
    
    vector<lol> a(n);
    REP(i, n)
    {
        cin >> a[i];
    }
    REP(i, k)
    {
        sum *= a[i];
    }
    REP(i, n - k)
    {
        if(a[i] < a[i + k])
            cout << "Yes" << endl;
        else
        {
            cout << "No" << endl;
        }
       
    }

    //cout << result << endl;
    return 0;
}


Measured memory_bytes: 4840
import java.util.LinkedHashSet;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    LinkedHashSet<String> lhs = new LinkedHashSet<String>();
    int n = sc.nextInt();
    String[] s = new String[n];
    for (int i = 0; i < n; i++) {
      s[i] = sc.next();
      lhs.add(s[i]);
    }

    int m = sc.nextInt();
    String[] t = new String[m];
    for (int i = 0; i < m; i++) {
      t[i] = sc.next();
      lhs.add(t[i]);
    }

    int max = 0;
    for (String str : lhs) {
      int tmp = 0;

      for (int i = 0; i < n; i++) {
        if (s[i].equals(str)) {
          tmp++;
        }
      }

      for (int i = 0; i < m; i++) {
        if (t[i].equals(str)) {
          tmp--;
        }
      }

      max = Math.max(max, tmp);
    }

    System.out.println(max);

  }
}

Measured memory_bytes: 35800
#include<bits/stdc++.h>
#define ll  long long
#define ff first
#define ss second
#define pb push_back
#define pp pair<ll,ll>
#define maxn 1000005
#define db double
#define mod 1000000007
using namespace std;
void solve()
{
	ll n;
	cin>>n;
	map<ll,ll> mp;
	for(ll i=0;i<n-1;i++)
	{
		ll x;
		cin >> x;
		mp[x]++;
	}
	for(ll i=1;i<=n;i++)
	{
		cout << mp[i] <<"\n";
	}
}
int main()
{
	ll t=1,i=1;
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
    std::cout.precision(6);
    std::cout.setf( std::ios::fixed, std:: ios::floatfield ); 
	//cin >> t;
	//cin >> n;
	while(i<=t)
	{
		solve();
		i++;
	}
	return 0;
}

Measured memory_bytes: 16164
#include<stdio.h>
#include<string.h>
char S[100001];
int ans[100000];

int abs(int x) { return x >= 0 ? x : -x; }

int main() {
    scanf("%s", S);
    int n = strlen(S);
    for(int i = 0; i < n; i++) ans[i] = 0;

    int p = 0;
    while (p < n) {
        int s = p;
        while(S[p] == 'R') p++;
        int d = p - 1;
        while(S[p] == 'L') p++;
        for(int i = s; i < p; i++) {
            ans[d + (d + i) % 2] += 1;
        }
    }

    for(int i = 0; i < n; i++) printf("%d ", ans[i]);
    puts("\n");
    return 0;
}

Measured memory_bytes: 896
#include <cstdio>
#include <vector>
using namespace std;
#define ri register int
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	// input a signed integer
	template <class I>
	inline void gi (I &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = (x << 1) + (x << 3) + (c & 15); x *= f;
	}
	// print a signed integer
	template <class I>
	inline void print (I x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: gi;
using io :: putc;
using io :: print;
const int N=2e5+5,M=N<<3;
int n,q[N],tmp[N],ansx[N],ansy[N];
inline int min(ri x,ri y){
	return x<y ? x:y;
}
struct flow{
	int tot=1,head[N],nxt[M],adj[M],w[M],dep[N],q[N],cur[N],size,s,t;
	inline void addedge(ri x,ri y,ri z){
		nxt[++tot]=head[x];
		adj[head[x]=tot]=y;
		w[tot]=z;
	}
	inline void add(ri x,ri y,ri z){
		addedge(x,y,z);
		addedge(y,x,0);
	}
	inline bool bfs(){
		ri i,l,r,x,y;
		for(i=1;i<=size;++i) dep[i]=0;
		dep[s]=1;
		q[l=r=1]=s;
		while(l<=r){
			x=q[l++];
			for(i=head[x];i;i=nxt[i])
				if(w[i]&&!dep[y=adj[i]])
					q[++r]=y,
					dep[y]=dep[x]+1;
		}
		return dep[t];
	}
	inline int dfs(ri x,ri now){
		if(x==t) return now;
		ri y,tmp,res=0;
		for(int &i=cur[x];i;i=nxt[i])
			if(w[i]&&dep[y=adj[i]]==dep[x]+1&&(tmp=dfs(y,min(now,w[i])))){
				res+=tmp;
				w[i]-=tmp;
				w[i^1]+=tmp;
				if(!(now-=tmp)) return res;
			}
		return res;
	}
	inline long long maxflow(){
		ri i;
		register long long res=0;
		while(bfs()){
			for(i=1;i<=size;++i) cur[i]=head[i];
			res+=dfs(s,2147483647);
		} 
		return res;
	}
}flow;
vector<pair<int,int> > v[N];
vector<int> h[N];
inline void bfs(){
	ri i,l,r,x,m=0;
	q[l=r=1]=1;
	while(l<=r){
		x=q[l++];
		for(auto o:h[x])
			if(tmp[o]) ++m,ansx[o]=x,ansy[o]=tmp[o],q[++r]=tmp[o],tmp[o]=0;
	}
	if(m!=n-1) puts("-1");
	else
		for(i=1;i^n;++i) print(ansx[i]),putc(' '),print(ansy[i]),putc('\n');
}
int main(){
	ri c,x,i;
	gi(n);
	for(i=1;i^n;++i){
		gi(c);
		while(c--){
			gi(x);h[x].push_back(i);
			if(x!=1) flow.add(x,i+n,1),v[i].push_back(make_pair(x,flow.tot));
		}
	}
	flow.s=n<<1;
	flow.size=flow.t=n<<1|1;
	for(i=2;i<=n;++i) flow.add(flow.s,i,1);
	for(i=n+1;i<flow.s;++i) flow.add(i,flow.t,1);
	flow.maxflow();
	for(i=1;i^n;++i)
		for(auto o:v[i])
			if(flow.w[o.second]){
				tmp[i]=o.first;
		//		printf("%d %d\n",i,o.first);
				break;
			}
	bfs();
	return 0;
}

Measured memory_bytes: 41472
n = int(input())
a = list(map(int,input().split()))

print(2*n-1)

if abs(max(a))<abs(min(a)):
	x = a.index(min(a))
	for i in range(n):
		print(x+1,"",i+1)
	for i in range(n-1):
		print(n-i,"",n-i-1)
else:
	x =a. index(max(a))
	for i in range(n):
		print(x+1,"",i+1)
	for i in range(n-1):
		print(i+1,"",i+2)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,i,s,t,l;
    cin>>n;
    for(i=sqrt(n);i>0;i--){
    if(n%i==0){
    t=i;
	l=n/i;
    s=1;
    while(l>=10){
    s++;
    l/=10;
    }
    cout<<s<<endl;
    return 0;
    }}
    return 0;
}

Measured memory_bytes: 256
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
signed main()
{
    tezz
    
    int n, k;
    cin>>n>>k;

    string s;
    cin>>s;

    for(int i=0;i<n;i++){
    	if(i == k-1) cout<<(char)(tolower(s[i]));
    	else cout<<s[i];
    }
} 

Measured memory_bytes: 256
#include <iostream>
#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>
#include <math.h>
#define int long long
using namespace std;
signed main() {
    int H,W;
    cin>>H>>W;

    vector<vector<string>> S(H, vector<string>(W));
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> S.at(i).at(j);
        }
    }
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if(S.at(i).at(j)=="snuke"){
                H=i;
                W=j;
                break;
            }
        }
    }
    cout<<char('A'+W)<<H+1<<endl;
    
    
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector <int>
#define vl vector <ll>
#define all(v) (v).begin(),(v).end()
#define pb push_back
 
ll power(ll a, ll b){//a^b
    ll res=1;
    while(b>0){
        if(b&1){res=(res*a);b--;}
        a=(a*a);
        b>>=1;
    }
    return res;
}
vector < vl > dp(100005,vl (4,-1));
vector < vl > a(100005,vl (4,0));


ll jump(ll i,ll p){
	if(dp[i][p]!=-1)
		return dp[i][p];
	if(i==1){
		ll ma=0;
		for(ll j=1;j<4;j++)
			if(j!=p){
				ll temp=a[i][j];
				ma=max(ma,temp);
			}
		dp[i][p]=ma;
		return ma;
	}
	ll ma=0;
	for(ll j=1;j<4;j++)
			if(j!=p){
				ll temp=a[i][p]+jump(i-1,j);
				ma=max(ma,temp);
			}
	dp[i][p]=ma;
	return ma;


} 	
 
 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	for(ll i=1;i<=n;i++)
		cin>>a[i][1]>>a[i][2]>>a[i][3];
	ll ans=max(jump(n,1),jump(n,2));
	ans=max(ans,jump(n,3));
	cout<<ans<<"\n";
}

Measured memory_bytes: 22144
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int main(){
    int n,ans=0;
    in(n);
    vector<int> vec(n);
    int maxv=0;
    rep(i,n){
        in(vec[i]);
        maxv=max(maxv,vec[i]);
    }
    while(maxv!=0){
        for(int i=0;i<n;i++){
            if(vec[i]==maxv){
                ans++;
                while(vec[i]==maxv){
                    vec[i]--;
                    i++;
                }
            }
        }
        maxv--;
    }
    out(ans);
}

Measured memory_bytes: 3748
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>

const long INF = (1l << 30);
const long LINF = (1l << 60);

long n;

int main(){
    scanf("%ld", &n);
    if(n % 2){
        printf("%.10lf\n", (float)(n+1)/(2*n));
    }else{
        printf("0.5\n");
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <list>
#include <math.h>
using namespace std;

typedef pair<int, int> P;
//#define int long long
#define ll long long
#define mod 1000000007


signed main(){

	int N, odd = 0, even = 0;
	cin >> N;
	for (int i = 0; i < N; i++){
		int a;
		cin >> a;
		if (a % 2 == 1) odd++; else even++;
	}

	int one = odd % 2;
	int zero = min(1, min(odd / 2, 1) + min(even, 1));

	if (one + zero == 1) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
def input():
	return sys.stdin.buffer.readline()[:-1]
n = int(input())
ans = n * (n+1) * (n+2) // 6
for _ in range(n-1):
	u, v = map(int, input().split())
	u, v = min(u, v), max(u, v)
	ans -= u * (n+1-v)
print(ans)

Measured memory_bytes: 68508
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int a = in.nextInt();
        int b = in.nextInt();
        int k = in.nextInt();
        List<Integer> list = new ArrayList<>();
        int count = 0;
        for (int i = a; i <= b; i++){
            if( !list.contains(i) ) list.add(i);
            count++;
            if (count == k) break;
        }
        count = 0;
        for (int i = b; i >= a; i--){
            if (!list.contains(i)) list.add(i);
            count++;
            if (count == k) break;
        }
        Collections.sort(list);
        for (int i = 0; i < list.size(); i++){
            System.out.println(list.get(i));
        }
    }

}

Measured memory_bytes: 21844
h,w,k=map(int,input().split())
dp=[[0]*(w+1) for i in range(h+2)]
dp[1][1]=1
p=10**9+7
line=[1]*(101)
line[2]=2
for i in range(3,101):
  line[i]=line[i-1]+line[i-2]
for i in range(1,h+1):
  for j in range(1,w+1):
    dp[i+1][j]+=dp[i][j]*line[j-1]*line[w-j]
    dp[i+1][j]%=p
    if 2<=j:
      dp[i+1][j]+=dp[i][j-1]*line[j-2]*line[w-j]
      dp[i+1][j]%=p
    if j+1<=w:
      dp[i+1][j]+=dp[i][j+1]*line[j-1]*line[w-j-1]
      dp[i+1][j]%=p
print(dp[h+1][k])

Measured memory_bytes: 3064
N=int(input())
S=input()
cnt=0
for i in range(1000):
    c=[i//100,(i//10)%10,i%10]
    f=0
    for j in range(N):
        if S[j]==str(c[f]):
            f+=1
        if (f==3):
            break
    if f==3:
        cnt+=1
print(cnt)    

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

using namespace std;
typedef long long lint;

#define RPT(i, b, e) for (int i = (b); i <= (e); i++)
#define RPT0(i, n) RPT(i, 0, n - 1)
#define RPT1(i, n) RPT(i, 1, n)
#define EACH(it, v) for (const auto& it : v)
#define ALL(v) v.begin(), v.end()

bool f(lint n, lint x)
{
    while (1) {
        if (n % x == 1) return true;
        if (n % x != 0) return false;
        n /= x;
    }
    return true;
}

vector<lint> Yakusu(lint n)
{
    vector<lint> r;
    for (lint i = 1; i * i <= n; i++) {
        if (n % i != 0) continue;
        r.push_back(i);
        if (i * i != n) r.push_back(n / i);
    }
    return r;
}

void resolve()
{
    lint N;
    cin >> N;

    lint cnt = 0;
    for (lint x : Yakusu(N)) {
        if (x == 1) continue;
        lint tmp = N;
        while (tmp % x == 0) tmp /= x;
        tmp %= x;
        if (tmp == 1) cnt++;
    }
    cnt += Yakusu(N - 1).size() - 1;

    cout << cnt << endl;
}

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

/*
#include <chrono>
int main()
{
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();

    resolve();

    end = chrono::system_clock::now();
    double time = static_cast<double>(
        chrono::duration_cast<chrono::microseconds>(end - start).count() /
        1000.0);
    cout << "resolve(): " << time << "[ms]" << endl;

    return 0;
}
*/


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<ll> A(n), B(n);
  rep(i, n) cin >> A[i] >> B[i];
  sort(all(A));
  sort(all(B));
  if(n%2) {
    cout << B[n/2]-A[n/2]+1 << endk;
  } else {
    ll a = A[n/2]+A[n/2-1];
    ll b = B[n/2]+B[n/2-1];
    cout << b-a+1 << endk;
  }
  return 0;
}


Measured memory_bytes: 6368
while True:
   n, x = map(int, input().split())
   if n == 0 and x == 0:
       break
   ans = 0
   for i in range(1, n + 1):
       for j in range(1, i):
           for k in range(1, j):
               if i + j + k == x:
                   ans += 1
   print(ans)


Measured memory_bytes: 5596
#include<iostream>
#include<string>
#include<algorithm>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <set>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef long long LL;
const int INF = int(1e9);
const int MAX  =  10000;

int main()
{
    int N;
    cin>>N;
    for(int i = N;i>=0;i--)
    {
        if(int(sqrt(i))*sqrt(i)==i){
            cout<<i<<endl;
            return 0;
        }

    }


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
template <class T>
inline void chmin(T &a, const T &b) { a = min(a, b); }
template <class T>
inline void chmax(T &a, const T &b) { a = max(a, b); }
template <class T>
inline bool kbit(const T &x, const int &k) { return ((x >> k) & 1LL); }
inline int popcount(const int &n) { return __builtin_popcount(n); }
inline ll popcountll(const ll &n) { return __builtin_popcountll(n); }
inline ll mask(const ll &k) { return (1LL << k) - 1LL; }
template <class T>
void zip(V<T> &v) {
    sort(all(v));
    v.erase(unique(all(v)), v.end());
}
template <class T>
int lwb(V<T> &v, const T &x) { return lower_bound(all(v), x) - v.begin(); }
void dump() {
    cerr << '\n';
}
template <class Head, class... Tail>
void dump(Head &&head, Tail &&... tail) {
    cerr << head << (sizeof...(Tail) == 0 ? " " : ", ");
    dump(std::move(tail)...);
}
template <class T>
void print(const vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
}
template <class T>
void read(vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}
constexpr char sp = ' ', newl = '\n';
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 1e9 + 7;
//////////////////////////////////////////////INSERT ABOVE HERE
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a;
    cin >> a;
    cout << a + a * a + a * a * a << newl;
}

Measured memory_bytes: 3632
from collections import defaultdict


def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    d = defaultdict(int)
    d[0] = 1
    s = 0
    for i in range(n):
        s += a[i]
        d[s] += 1
    print(sum([v * (v - 1) for v in d.values()]) // 2)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 39264