akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define INF 0x3f3f3f3f
#define MOD 1000000007

using namespace std;
typedef long long ll;

mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

template <typename T> void read(T &x) {
  x = 0;
  char c = getchar();
  T sig = 1;
  for (; !isdigit(c); c = getchar())
    if (c == '-')
      sig = -1;
  for (; isdigit(c); c = getchar())
    x = (x << 3) + (x << 1) + c - '0';
  x *= sig;
}

class Solution {
public:
  void solve() {
    int n;
    read(n);
    string s;
    cin >> s;
    int cnt = 0;
    for (char c : s)
      if (c == 'R')
        cnt++;
    int ans = cnt;
    for (int i = 0; i < cnt; ++i)
      if (s[i] == 'R')
        ans--;
    printf("%d", ans);
  }
};

int main() {
  Solution solution = Solution();
  solution.solve();
}

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

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

H, W, N = map(int, input().split())
X = (H - 2) * (W - 2)

A = defaultdict(int)
for i in range(N):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    for p in range(3):
        for q in range(3):
            k, l = a - p, b - q
            if k < 0 or k >= H or l < 0 or l >= W:
                continue
            if k + 2 >= H or l + 2 >= W:
                continue
            A[(k, l)] += 1

ans = [0] * 10
for k, v in A.items():
    ans[v] += 1
ans[0] = X - sum(ans)

for a in ans:
    print(a)

Measured memory_bytes: 164572
#include <iostream>
#include <vector>
#include <queue>

using namespace std; 

int main(void) {
	int u,noe,nov;
	cin >> nov;
	vector< vector< pair<int,int> > > el(nov);
	for (int i = 0; i < nov; ++i) {
		cin >> u >> noe;
		el[u] = vector< pair<int,int> >(noe);
		for (int j = 0; j < noe; ++j) {
			cin >> el[u][j].first;
			cin >> el[u][j].second;
			el[u][j].second = -el[u][j].second;
		}
	}

	vector<int> res(nov,-(1 << 28));
	vector<int> check(nov,-1);
	res[0] = 0;
	pair<int,int> now,next;
	priority_queue< pair<int,int> > q;
	q.push({0,0});
	while (!q.empty()) {
		now = q.top();
		q.pop();
		if (check[now.second] < 0) {
			for (int i = 0; i < el[now.second].size(); ++i) {
				next = el[now.second][i];
				if (check[next.first] < 0 && res[next.first] < now.first+next.second) {
					res[next.first] = now.first+next.second;
					q.push({res[next.first],next.first});
				}
			}
		}
		check[now.second] = 1;
	}

	for (int i = 0; i < nov; ++i) {
		cout << i << " ";
		cout << -res[i] << endl;
	}

	return 0;
}



Measured memory_bytes: 7012
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))


def linear_search(series, key):
    for x in series:
        if key == x:
            return 1
    return 0

cnt = 0
for t in T:
    cnt += linear_search(S, t)
print(cnt)


Measured memory_bytes: 6544
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N, D, X;
    cin >> N >> D >> X;

    vector<int> A(N);
    rep(i, N) cin >> A[i];
    int ans = X;

    rep(i, N) {
        int j = 0;
        while (1) {
            if (1 + (j * A[i]) <= D) ans++;
            else break;
            j++;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
n, k, q = gets.chomp.split(' ').map(&:to_i)
arr = Array.new(n, 0)
q.times do
  i = gets.chomp.to_i
  arr[i - 1] += 1
end
arr.each do |v|
  puts v - q + k > 0 ? 'Yes' : 'No'
end

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

int main () {
  int n;
  cin >> n;
  
  int a;
  map<int,int> m;
  for(int i=0; i<n-1; i++) {
    cin >> a;
    m[a]++;
  } 
  
  for(int i=1; i<=n; i++) {
    if(m.count(i)) cout << m[i] << endl;
    else cout << 0 << endl;
  }
  
  return 0;
}

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

int main() {
    ll x, y; cin >> x >> y;
    int count = 1;
    ll val = x;
    while (true) {
        val *= 2;
        if (val > y) break;
        count ++;
    }
    cout << count << endl; 
}

Measured memory_bytes: 256
def main():
    a, b = map(str, input().split())
    intab = int(a + b)
    up = int((100100)**0.5)
    for i in range(1, up):
        if intab == i ** 2:
            print('Yes')
            exit()
    else:
        print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x)  (long long)(x).size()
#define sqr(x) (x)*(x)
#define sof sizeof
#define resz resize
#define ins insert
#define lowerB lower_bound
#define upperB upper_bound
#define mkp make_pair
#define mkt make_tuple
#define act(a,v) (get<(long long)a>(v))
#define mod 1000000007
#define mod1 998244353
#define N 1000003
#define inf 1e18
#define minf -1e18
#define min3(a,b,c) min(a,min(b,c));
#define max3(a,b,c) max(a,max(b,c));
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define sumall(v) accumulate(all(v),(ll)0)
#define sum accumulate
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION(n) std::cout.unsetf ( std::ios::floatfield );std::cout.precision((ll)n)
#define PI M_PI
#define fi first
#define se second
#define here cout<<"RSSB"<<endl
#define showzero cout<<std::showpoint
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define br "\n"
#define sp " "
#define zero (ll)0
using namespace  std ;
typedef double db;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
typedef vector<bool>vbool ;
void READ(vll &v, ll n){ll a ;for(ll i=0 ; i<n ; i=i+1){cin>>a ;v.pb(a);}}
void PRINT(vll &v , ll a = 0){for(ll i=a ; i<v.size() ; i=i+1){/*v[i] = max((ll)0,v[i]);*/cout<<v[i]<<" " ;}cout<<"\n" ;}
/*vbool isprime(N,true);
vll spf(N,0);
vll prime;
void sieve()
{
    isprime[0] = isprime[1] = false;
    for(ll i = 2 ; i<N ; i++)
    {
        if(isprime[i])
        {
            for(ll j=2*i ; j<N ; j+=i)
            {
                isprime[j] = false;
                if(spf[j]==0)
                {
                    spf[j] = i;
                }
            }
            prime.pb(i);
        }
    }
}*//*
ll nck(ll n , ll k ,ll m=1e18+7)
{
    ll i , j,b=1,c=1 ;
    if(n-k<k)
    {
        k = n-k ;
    }
    while(k)
    {
        b*=n ;
        c*=k ;
        ll g = __gcd(b,c) ;
        b/=g ;
        c/=g ;
        n--;
        k-- ;
    }
    return(b) ;
}*/
long long power(long long k , long long n , long long m=mod)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}
ll n,m,k;
int main()
{
    FastIO ;
    PRECISION(10) ;
    ll a,b,c,d,i,j,t,x,y,z;//,x1,y1,z1,e,f;
    db p,q,r,u,w ;
    char ch,chr ;
    string str,st,str1,str2,str3,str4;
    //ll a1=0,a2=0,b1=0,b2=0,c1=0 ;
    //cin>>str>>str1;
    cin>>str;
    if(str[2]==str[3] && str[4]==str[5])
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
const long INF=1000000000000000;
const long MOD=1000000007;

int main() {
    long N;
    cin>>N;
    vector<long> a(N);
    for(int i=0;i<N;i++)cin>>a.at(i);
    
    vector<long> sum(N,0);
    sum.at(0)=a.at(0);
    for(int i=1;i<N;i++)sum.at(i)=sum.at(i-1)+a.at(i);
    
    long ans=INF;
    
    for(int i=0;i<N-1;i++){
        ans=min(ans,abs(sum.at(N-1)-2*sum.at(i)));
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 3328
#[allow(unused_imports)]
use std::cmp::max;
#[allow(unused_imports)]
use std::fmt;
#[allow(unused_imports)]
use std::fmt::Debug;
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::str::FromStr;

fn main() {
    let mut s = get_string_input();
    let q: usize = get_vec_input()[0];
    for _ in 0..q {
        let input: Vec<String> = get_vec_input();
        let ord = &input[0].to_string();
        let a: usize = input[1].parse().unwrap();
        let b: usize = input[2].parse().unwrap();
        let len = s.len();

        if ord == "print" {
            println!("{}", &s[a..b + 1]);
        } else if ord == "reverse" {
            let prefix = s[0..a].to_string();
            let target = &s[a..b + 1].chars().rev().collect::<String>();
            let suffix = s[b + 1..len].to_string();
            s = prefix + &target + &suffix;
        } else {
            let p = input[3].to_string();
            let prefix = s[0..a].to_string();
            let suffix = s[b + 1..len].to_string();
            s = prefix + &p + &suffix;
        }
    }
}

#[allow(dead_code)]
fn sum_digit2(value: String) -> u32 {
    return value.chars().fold(0u32, |a, b| a + b.to_digit(10).unwrap());
}

#[allow(dead_code)]
fn sum_digit(value: i64) -> i64 {
    if value < 10 {
        return value;
    }
    return sum_digit(value / 10) + value % 10;
}

#[allow(dead_code)]
fn update_max<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left < right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn update_min<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left > right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn get_vec_input<T>() -> Vec<T>
where
    T: FromStr,
    T::Err: Debug,
{
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line");
    let vec: Vec<T> = input
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    vec
}

#[allow(dead_code)]
fn get_tuple_input() -> (u64, f32) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();
    let c: u64 = iter.next().unwrap().parse().unwrap();
    let n: f32 = iter.next().unwrap().parse().unwrap();
    (c, n)
}

#[allow(dead_code)]
fn get_string_input() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    s.trim().to_string()
}



Measured memory_bytes: 5040
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
//
int main(){
  int N,Q;
  set<int> S;
  cin>>N;
  FOR(i,0,N){
    int A;
    cin>>A;
    S.insert(A);
  }
  int ans=0;
  cin>>Q;
  FOR(i,0,Q){
    int A;
    cin>>A;
    if(S.find(A)!=S.end()){
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

int main(){
  string s,t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), greater<char>());
  if(s < t) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

#define pb            push_back
#define mp            make_pair
#define all(x)        x.begin(),x.end()
#define debug(X)      { cerr<<'\n'<<(#X)<<" = "<<(X)<<'\n'; }
//#define cerr if(0)cerr

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

bool comp(pair<int,char> a, pair<int,char> b) {
    return (a.first<b.first);
}

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n,m,p,i,prev=-1;
    int wa=0, watmp=0, ac=0;
    bool AC=0;
    vector< pair<int, char> > v;
    string S;

    cin>>n>>m;
    
    for (i=1; i<=m; ++i) {
        cin>>p>>S;
        v.push_back(make_pair(p, S[0]));
    }
    stable_sort(all(v),comp);
 
#define prob v[i].first
#define stat v[i].second
    for (i=0; i<m; ++i) {
        if (prob!=prev) {
            if (AC)
                wa+=watmp;
            watmp=0;
            AC=0;
            prev=prob;
        }
        
        if (!AC) {
            if (stat=='W')
                ++watmp;
            else {
                AC=1; ++ac; }
        }

    }
    if (AC) wa+=watmp;
        
/*
    for (auto &_:v) {
        cerr << _.first << ' ' <<_.second<<'\n';
    }
*/
    
    cout<<ac<<' '<<wa<<'\n';
}


Measured memory_bytes: 1908
#include <stdio.h>

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

    int x;
    for(int i=0; i<q; i++){
        scanf("%d", &x);
        a[x-1]+=1;
    }

    for(int i=0; i<n; i++){
        if(k-q+a[i]>0){
            printf("Yes\n");
        }else{
            printf("No\n");
        }
    }

    return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 2000000009
#define mod 1000000007
using namespace std;
int main()
{ 
ll n,t;
cin>>n>>t;

vector<pair<ll,ll> > dish(n);
for(ll i=0;i<n;i++)
  cin>>dish[i].ff>>dish[i].ss;

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

vector<ll> maxhappy(t+3000,0);
for(auto d:dish)
{
  for(ll i=t-1;i>=0;i--)
  {
    if(maxhappy[d.ff+i]<maxhappy[i]+d.ss)
      maxhappy[d.ff+i]=maxhappy[i]+d.ss;
  }
}
cout<<*max_element(maxhappy.begin(),maxhappy.end())<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;


int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	for (int i = 0; i < tx - sx; i++)
		cout << 'R';
	for (int i = 0; i < ty - sy; i++)
		cout << 'U';
	for (int i = 0; i < tx - sx; i++)
		cout << 'L';
	for (int i = 0; i < ty - sy; i++)
		cout << 'D';
	cout << 'D';
	for (int i = 0; i < tx - sx+1; i++)
		cout << 'R';
	for (int i = 0; i < ty - sy+1; i++)
		cout << 'U';
	cout << 'L' << 'U';
	for (int i = 0; i < tx - sx+1; i++)
		cout << 'L';
	for (int i = 0; i < ty - sy+1; i++)
		cout << 'D';
	cout << 'R';
	return 0;
}

Measured memory_bytes: 256
pub struct Scanner {
	handle: std::io::Stdin,
	buffer: std::collections::VecDeque<String>
}

impl Scanner {
	pub fn new() -> Scanner {
		Scanner {
			handle: std::io::stdin(),
			buffer: std::collections::VecDeque::new()
		}
	}
	pub fn next<T: std::str::FromStr>(&mut self) -> Result<T, T::Err> {
		if self.buffer.len() == 0 {
			loop {
				let mut available = String::new();
				self.handle.read_line(&mut available).unwrap();
				self.buffer = available.split_whitespace().map(String::from).collect();
				if self.buffer.len() > 0 {
					break;
				}
			}
		}
		T::from_str(&self.buffer.pop_front().unwrap())
	}
}

fn main() {
	let mut scanner = Scanner::new();
	let k: usize = scanner.next().unwrap();
	let s: String = scanner.next().unwrap();
	let l = s.len();
	if k >= l {
		println!("{}", s);
	} else {
		println!("{}...", &s[..k]);
	}
}


Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

string s;
int N, K;

int main(){
  cin >> N >> K;
  cin >>s;
  int n =  s[K-1];
  n += 32;
  s[K-1] = n;
  rep(i,N){
    cout << s[i];
  }
  return 0;
}



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

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }

const LL MOD = 1000000007;

LL score[1<<16];
LL dp[1<<16];
int a[16][16];

int main() 
{
	int N;
	cin >> N;
	rep(i, N) rep(j, N) cin >> a[i][j];

	rep(i, 1<<N) {
		for (int x = 0; x < N-1; ++x) {
			if (i&(1<<x)) {
				for (int y = x+1; y < N; ++y) {
					if (i&(1<<y)) {
						score[i] += a[x][y];
					}
				}
			}
		}
	}

	rep(group, 1<<N) {
		for (int subgroup = (1 << N) - 1; 0 <= subgroup; --subgroup) {
			subgroup &= group;
			dp[group] = max(dp[group], score[subgroup]+dp[group^subgroup]);
		}
	}

	cout << dp[(1<<N)-1] << endl;

	return 0;
}

Measured memory_bytes: 1280
// in the name of Allah

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

#define endl '\n'
#define pb push_back
#define ll long long
#define double long double
#define sz(x) ((int) (x.size()))

#define fr first
#define se second

#define inf 1e9
#define max_n 123456
#define mod 1000000007

ll add(ll a, ll b) {
	a += b;
	if(a >= mod) return a - mod;
	return a;
}

ll mul(ll a, ll b) {
	a *= b;
	if(a >= mod) return a % mod;
	return a;
}

ll power(ll a, ll b) {
	ll p = 1;
	while(b) {
		if(b&1) p = mul(p, a);
		a = mul(a, a);
		b /= 2;
	}
	return p;
}

int n;
int a[25][25];
ll dp[22][1<<21];

ll memo(int i, int msk) {
	if(i == n) return 1;
	if(dp[i][msk] != -1) return dp[i][msk];
	ll res = 0;
	for(int j=0; j<n; j++) {
		if(a[i][j] == 1 && (msk&(1<<j)) == 0) {
			res = add(res, memo(i+1, msk|(1<<j)));
		}
	}
	return dp[i][msk] = res;
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for(int i=0; i<n; i++) for(int j=0; j<n; j++) cin >> a[i][j];
	memset(dp, -1, sizeof dp);
	cout << memo(0, 0) << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

const int N = 1e6+5;

const int mod = 1e9+7;

int main(){
    int x;
    cin >> x;
    map < int , int > cnt;
    for(int i = 1; i <= x; i++){
        //I
        int cur_num = i;
        for(int j = 2; j*j <= cur_num; j++){
            while(cur_num % j == 0){
                cur_num /= j;
                cnt[j] ++;
            }
        }
        if(cur_num != 1){
            cnt[cur_num]++;
        }
    }
    ll ans = 1;
    map < int , int > :: iterator it = cnt.begin();
    for(; it != cnt.end(); it++){
        ans = (ans * ((it)->second + 1)) % mod;
        ans %= mod;

    }
    cout << ans << "\n";
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(ll (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(ll (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define mp make_pair
const ll MOD=1e9+7;
using namespace std;

int main(){
  ll N;
  cin >> N;
  vector<ll> a(3*N);
  for(ll i=0;i<3*N;i++){
    cin >> a[i];
  }
  sort(All(a));
  ll ans = 0;
  for(ll i=N;i<3*N;i+=2){
    ans += a[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = a; i < n; i++)
#define Repr(i, n, a) for (int i = n; i >= a; i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n, W;
    cin >> n >> W;
    vector<int> dp(W + 1);
    vector<int> w(n), v(n);
    rep(i, n) cin >> w[i] >> v[i];
    rep(i, n)
    {
        vector<int> nxt(W + 1);
        rep(j, W + 1)
        {
            if (j - w[i] < 0)
                nxt[j] = dp[j];
            else
                nxt[j] = max(dp[j], dp[j - w[i]] + v[i]);
        }
        rep(j, W + 1) dp[j] = nxt[j];
    }
    int ans = 0;
    rep(i, W + 1) ans = max(ans, dp[i]);
    cout << ans << endl;
}

Measured memory_bytes: 1804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+20;
ll gcd(ll a,ll b)
{
	return b==0?a:gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
	return a/gcd(a,b)*b;
}
ll n,a[N];
int main()
{
	while(cin>>n)
	{
		scanf("%lld",&a[0]);
		ll ans=a[0];
		for(int i=1;i<n;i++)
		{
			scanf("%lld",&a[i]);
			ans=lcm(ans,a[i]);
		}
		cout<<ans<<endl;
	}
	return 0;
} 

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

using namespace std;

int main(void) {
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<char>> c(h, vector<char>(w));
    for (int y = 0; y < h; ++y) {
        for (int x = 0; x < w; ++x) {
            cin >> c[y][x];
        }
    }
    int ans = 0;
    for (int y = 0; y < (1 << h); ++y) {
        for (int x = 0; x < (1 << w); ++x) {
            vector<int> sy, sx;
            for (int i = 0; i < h; ++i) {
                if (y & (1 << i)) { // i が bit に入るかどうか
                    sy.push_back(i);
                }
            }
            for (int i = 0; i < w; ++i) {
                if (x & (1 << i)) { // i が bit に入るかどうか
                    sx.push_back(i);
                }
            }
            int cnt = 0;
            for (int iy = 0; iy < h; ++iy) {
                for (int ix = 0; ix < w; ++ix) {
                    bool ex = distance(sx.begin(), find(sx.begin(), sx.end(), ix)) != sx.size();
                    bool ey = distance(sy.begin(), find(sy.begin(), sy.end(), iy)) != sy.size();
                    if (!ex && !ey && c[iy][ix] == '#') {
                        cnt++;
                    }
                }
            }
            if (cnt == k) {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

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

#define ll          long long
#define pb          push_back
#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 x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

void solve(){
    int r;
    cin>>r;
    cout<<fixed<<setprecision(10)<<2.0l*acos(-1)*r<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3732
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
using namespace std;
int inf = 1000000000;

int main(void) {

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

    int j = 0;
    int o = 32;
    int t = 0;
    while(o != 0){
      if( t%2 == 0 ) o -= (o-1)%5;
      else{
        o -= a[j];
        j++;
        j %= n;
      }
      if( o < 0 ) o = 0;
      cout << o << endl;
      t++;
    }

  }

  return 0;
}

// EOF

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

int main()
{
    int n,k=INT_MIN;
    cin>>n;
    int dp[n][3],ar[n][3];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i][0];
        cin>>ar[i][1];
        cin>>ar[i][2];
    }

    dp[0][0]=ar[0][0];
    dp[0][1]=ar[0][1];
    dp[0][2]=ar[0][2];
    for(int i=1;i<n;i++)
    {
        dp[i][0]=ar[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=ar[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=ar[i][2]+max(dp[i-1][1],dp[i-1][0]);

    }
    k=max(dp[n-1][0],dp[n-1][1]);
    k=max(k,dp[n-1][2]);
    cout<<k;
    return 0;
}


Measured memory_bytes: 5924
#include<bits/stdc++.h>
typedef long long ll;

using namespace std;
int n, p, a[55];
ll dp[2][55];

int main(){
cin >> n >> p;
for(int i=1;i<=n;i++){
	cin >> a[i];
}
dp[0][0] = 1;
for(int i=1;i<=n;i++){
	int cur = a[i] % 2;
	for(int j=0;j<2;j++){
		dp[j][i] = dp[j][i - 1] + dp[j ^ cur][i - 1];
	}
}
cout << dp[p][n];
return 0;
}


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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

// auto mod int
// source : https://github.com/atcoder-live/library
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int MOD = 1000000007;
const int mod = 1e9+7;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x=0):x((x%mod+mod)%mod){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
	mint operator+(const mint a) const { return mint(*this) += a;}
	mint operator-(const mint a) const { return mint(*this) -= a;}
	mint operator*(const mint a) const { return mint(*this) *= a;}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}
	
	// for prime mod
	mint inv() const { return pow(mod-2);}
	mint& operator/=(const mint a) { return *this *= a.inv();}
	mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

// combination mod prime
// source : https://github.com/atcoder-live/library
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
	vector<mint> fact, ifact;
	combination(int n):fact(n+1),ifact(n+1) {
		assert(n < mod);
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n]*ifact[k]*ifact[n-k];
	}
}; //c(a,b)と呼ぶとaCbを求める
// 500000は場合に応じて変更

void solve(){
	#define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル

	int k;
	cin >> k;
	string s;
	cin >> s;

	mint ans = 0;
	combination c(s.size() + k);

	// sの最終文字以前の文字数 : i
	rep(i,k+1){	// S_Nのすべての位置を探索
		/*
		mint prev = mint(26).pow(k-i);
		mint forward = mint(25).pow(i);
		mint comb = c(s.size()+i-1, s.size()-1);
		*/
		mint prev = mint(26).pow(i);
		mint forward = mint(25).pow(k-i);
		mint comb = c(s.size()+k-i-1, s.size()-1);
		ans += prev * forward * comb;
	}

	cout << ans << endl;
}

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

Measured memory_bytes: 35636
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main()
{
	long long int n,m;
	long long sum;
	scanf("%lld%lld", &n, &m);
	if (m >= 3&&n >= 3)
	{
		sum = (m - 2)*(n - 2);
		printf("%lld\n", sum);
	}
	else if (m >= 2 && n >= 2)
	{
		printf("0\n");
	}
	else if(m>1||n>1)
	{
		printf("%d", max(m, n)-2);
	}
	else
	{
		printf("1\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//g++ -std=c++11 

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7

ll N, M, P;

//          to, cost
vector<pair<ll, ll> >to[3000];
//
vector<pair<ll, ll> >from[3000];
bool ok0[3000];
bool okn[3000];
bool valid[3000];

void dfs(ll cur) {
	if(ok0[cur]) return;
	ok0[cur] = true;
	for(pair<ll, ll> item: to[cur]) {
		dfs(item.first);
	}
}


void dfs2(ll cur) {
	if(okn[cur]) return;
	okn[cur] = true;
	for(pair<ll, ll> item: from[cur]) {
		dfs2(item.first);
	}
}

// 頂点fromから頂点toへのコストcostの辺 
struct edge { int from, to, cost; };


int main(){
	cin >> N >> M >> P;
	rep(i, M) {
		ll a,b,c;
		cin >> a >> b >> c;
		a--;b--;c-=P;
		to[a].push_back(make_pair(b, -c));
		from[b].push_back(make_pair(a, -c));
	}


	//from 0
	dfs(0);
	//from N-1
	dfs2(N-1);


	rep(i, N) {
		valid[i] = ok0[i] & okn[i];
	}


	vector<edge> es;
	rep(i, N) {
		for(pair<ll, ll> item: to[i]) {
			if(valid[i] & valid[item.first]) {
				edge e = {i, item.first, item.second};
				es.push_back(e);
			}
		}
	}

	vector<ll> d(N+5, 10000000000);
	d[0] = 0;

	bool update = false;
	rep(_, 2 * N) {
		update = false;
		for (int i = 0; i < es.size(); i++) {
			edge e = es[i];
			if (d[e.from] != 10000000000 && d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				update = true; 
			}
		}
	}
	if (update) {
		cout << -1 << endl;
		return 0;
	}

	cout << max(0ll, -1 * d[N-1]) << endl;



}


Measured memory_bytes: 4172
n,t=gets.split.map(&:to_i)
keiros=[]
n.times do
  keiros << gets.split.map(&:to_i)
end
for i in 0..n-1 do
  if keiros[i][1] > t
    keiros[i]=nil
  end
end
keiros.compact!
if keiros==[] then
  puts 'TLE'
  exit
end
min = keiros[0][0]
for j in 1..keiros.count - 1 do
if min > keiros[j][0]
  min = keiros[j][0]
end
end
puts min

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
long long n,l,t,flag,x[23333333];
int main()
{
	cin>>n>>l>>t;
	int emm=0;
	for(int i=1;i<=n;i++)
	{
		cin>>x[i]>>flag;
		if(flag==2) flag=-1;
		emm+=(x[i]+flag*t)/l;
		x[i]=(x[i]+flag*t)%l;
		if(x[i]<0) x[i]+=l,emm--;
	}
	emm=(emm%n+n)%n;
	sort(x+1,x+n+1);
	for(int i=emm+1;i<=n;i++) cout<<x[i]<<endl;
	for(int i=1;i<=emm;i++) cout<<x[i]<<endl;
}

Measured memory_bytes: 1920
#include<iostream>
#include<cmath>
using namespace std;
unsigned long long X;
 
int main()
{
	cin >> X;
	
	int i = 0;
	unsigned long long Y = 100;	
	while (X > Y)
	{
		Y += 0.01 * Y;
		i++;
	}
	
			cout << i << endl;
			
	
}

Measured memory_bytes: 3604
N, Y = list(map(int, input().split(" ")))

if Y%1000!=0:
    print(-1,-1,-1)
    exit()
t = Y//1000 - N

i = 0
while True:
    tmp = (t-9*i)
    if tmp<0:
        print(-1,-1,-1)
        exit()
    if tmp%4==0:
        z = N-i-tmp//4
        if z >= 0:
            print(i, tmp//4, z)
        else:
            i += 1
            continue
        exit()
    i += 1


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;
const int INF = 0x3f3f3f3f;
using namespace std;

int a, b;
int main() {
    IOS
    cin >> a >> b;
    cout << (a<b ? 0 : 10) << endl;

    return 0;


}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

int main()
{
	int A, B, C;
	cin >> A >> B >> C;
	if (A + B >= C) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
n,k=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]

a.sort()

times=[0]*(n+1)
for i in a:
    times[i]+=1
times.sort()


for i in range(n+1):
    if times[i]!=0:
        j=i
        break

ans=0
if len(times)>k-j:
    for i in range(j,len(times)-k):
        ans+=times[i]
print(ans)

Measured memory_bytes: 32148
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}


int main(){
  int h,w;
  char s[1100][1100];
  queue<P> q;

  cin>>h>>w;



  int a[1100][1100];
  rep(i,h){
    rep(j,w){
      a[i][j]=inf;
    }
  }

  rep(i,h){
    cin>>s[i];
    rep(j,w){
      if(s[i][j]=='#'){
        a[i][j]=0;
        q.push(P(i,j));
      }
    }
  }


  while(!q.empty()){
    P p=q.front(); q.pop();
    rep(k,4){
      int x=p.S+vx[k],y=p.F+vy[k];
      if(!(0<=x&&x<w&&0<=y&&y<h)) continue;
      if(a[y][x]>a[p.F][p.S]+1){
        a[y][x]=a[p.F][p.S]+1;
        q.push(P(y,x));
      }
    }
  }

  int ans=-1;
  rep(i,h){
    rep(j,w){
      ans=max(ans,a[i][j]);
    }
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 13840
N = int(input())
h = list(map(int, input().split()))
H = h[::-1]
a = True
for i in range(N-1):
    if H[i]<=H[i+1]:
        if H[i]+1==H[i+1]:
            H[i+1] -= 1
        elif H[i+1]>=H[i]+2:
            a = False
            break

for i in range(N-1):
    if H[i]>=H[i+1]:
        a = True
    else:
        a = False
        break
if a:
    print('Yes')
else:
    print('No')
        

Measured memory_bytes: 63984
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) (v).begin(), (v).end()
#define fr(i, a, b) for (int i = (a); i <= (b); ++i)

void solve();
signed main () {
    clock_t beg = clock();
    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    #endif 
    int t=1; 
    // cin >> t;    
    int tt = t;
    while (t--) {
        // cout << "Case #" << tt - t << ": "; 
        // solve();
        int n;
        cin>>n;
        int cost[n];
        rep(i,0,n){
            cin>>cost[i];
        }
        int dp[n+1]={0};
        for( int i=2;i<=n;i++){
            int op1= INT_MAX;
            int op2= INT_MAX;
            if(i-1>0){
                op1 = dp[i-1]+abs(cost[i-1]-cost[i-2]);
            }
            if(i-2>0){
                op2 = dp[i-2]+abs(cost[i-1]-cost[i-3]);
            }
            dp[i]= min(op1,op2);
        }
        // for( int i=1;i<=n;i++){
        //     cout<<dp[i]<<" ";
        // }
        // cout<<endl;
        cout<<dp[n];

    }
    // cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
    return 0;
}


Measured memory_bytes: 5192
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = sc.nextInt();
        boolean ok = true;
        
        for (int i = 0; i < n - 1; i++) {
            int num = sc.nextInt();
            if (num > max) {
                max = num;
            } else if (max - num >= 2) {
                ok = false;
                break;
            }
        }
        
        if (ok) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 47860
#include <bits/stdc++.h>
#define nmax 10005
using namespace std;
ifstream f("aranjare3.in");
ofstream g("aranjare3.out");
double x,s,a[105],m;

int n,i,p;
bool comp(double x,double y)
{
    return x>y;
}
int main()
{
    cin>>n>>m;
    for(i=1;i<=n;i++)
    {
         cin>>a[i];

        s+=a[i];

    }
    sort(a+1,a+1+n,comp);
       x=(1/(4*m))*s;
       //cout<<x;
p=int(m);
       if(a[p]>=x)
        cout<<"Yes";
       else
        cout<<"No";
    return 0;
}


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

#define ll long long
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define repp(i,a,b) for(int i=a;i<b;i++)
#define repm(i,a,b) for(int i=a;i>b;i--)
#define debug_interval endl
#define dump_interval ' '
#define debug_toggle 0


inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
inline int gcd(int a,int b){return a?gcd(b%a,a):b;} //Don't use C++17
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cout<<endl;}
template<class...A> inline void debug_rest() {cout<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cout<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cout<<first,debug_rest(rest...);}






















int H,W;

main(){
    ios::sync_with_stdio(false);
    cin>>H>>W;
    char c [H+2][W+2];
    for(int i=0;i<H+2;i++){
        for(int j=0;j<W+2;j++){
            c[i][j]='#';
        }
    }
    for(int i=1;i<H+1;i++){
        for(int j=1;j<W+1;j++){
            cin>>c[i][j];
            debug(i,j);
        }
    }
    for(int i=0;i<H+2;i++){
        for(int j=0;j<W+2;j++){
            cout<<c[i][j];
        }
        cout<<endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=1e5+9;
int main()
{
    FASTINOUT;
    int x,k;
    cin>>x>>k;
    x*=x;
    cout<<x-k;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;

int main() {
    int N, M; cin >> N >> M;

    Graph G(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }

    vector<int> dist(N, -1); 
    vector<int> sirube(N);
    queue<int> que;

    dist[0] = 0;
    que.push(0);

    while (!que.empty()) {
        int v = que.front(); 
        que.pop();

        for (int nv : G[v]) {
            if (dist[nv] != -1) continue;
            dist[nv] = dist[v] + 1;
            sirube[nv]=v;
            que.push(nv);
        }
    }
    cout<<"Yes"<<endl;
    for (int v = 1; v < N; ++v) cout<<sirube[v]+1<< endl;
}

Measured memory_bytes: 10680
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

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

    rep(i,A,B+1){
        if(i<=A+K-1 || i>=B-K+1) cout<<i<<endl;
    }
}

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

using namespace std;

const int N = 1e5 + 10;

int n;
int a[N];
map <int, int> mp;

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    mp[a[i]] ++;
  }
  vector < pair <int, int> > v;
  for (auto kp : mp) {
    if (kp.second >= 2) {
      v.push_back({kp.first, 2});
      kp.second -= 2;
      if (kp.second >= 2) {
        v.push_back({kp.first, 2});
      }
    }
  }
  sort(v.begin(), v.end());
  int nn = v.size();
  if (nn < 2)
    puts("0");
  else
    printf("%lld\n", 1ll * v[nn - 1].first * v[nn - 2].first);
  return 0;
}


Measured memory_bytes: 5376
n = (int)(input())  # num of station
cost = []  # list of costed timeto next
s = []  # list of init train time
freq = []  # list of freq of train departure
for i in range(n-1):
  a, b, c = (list)(map(int, input().split()))
  cost.append(a)
  s.append(b)
  freq.append(c)


def t(num):  # return time will cost to go from (num)station to end
  time = 0
  for j in range(num, n-1):
    if time < s[j]:  # if init train has not departed
      time = s[j]
    elif time % freq[j]:  # if next train has not arrived
      time = wait_next(time, freq[j])
    time += cost[j]  # add time to next station
  return time


def wait_next(now, freq):  # calc time we will wait to get next train
  while(1):
    if not now % freq:
      break
    now += 1
  return now


for i in range(n):
  print(t(i))


Measured memory_bytes: 3188
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] len = new int[n];
        for(int i = 0; i < n; i++) {
            len[i] = sc.nextInt();
		}
		Arrays.sort(len);
		int[] t = new int[3];
		int count = 0;
        for(int a = 0; a < n; a++) {
            for(int b = 1; b < n; b++) {
                for(int c = 2; c < n; c++) {
                    if(len[a] == len[b] || len[b] == len[c] || len[c] == len[a])
					continue;
					if(a > b || b > c)
					continue;
                    t[0] = len[a];
                    t[1] = len[b];
                    t[2] = len[c];
					if(t[0] + t[1] > t[2]) {
					count++;
					}
                }
            }
		}
		int c = count;
		for(int j = 0; j < 3; j++) {
			
		}
		System.out.println(count);
    }
}

Measured memory_bytes: 36108
N = int(input())
a = list(map(int, input().split()))
colors = [0 for i in range(9)]
for r in a:
    if r < 3200:
        colors[r // 400] += 1
    else:
        colors[8] += 1

num = 0
diff = colors[8]
for i in range(8):
    if colors[i]:
        num += 1
print(max(num,1), num + diff)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long int ll;
#define MOD 1000000007
#define INF 1e18
#include <ctime>
#define rep(i, x, n) for (ll i = x; i < n; i++)
#define rev(i, n, x) for (ll i = n; i > x; i--)
#define all(c) (c).begin(), (c).end()
#define int long long int
#define endl "\n"
#ifdef mishra
#define debug(x) cout << " >> " << #x << ": " << x;
#define debugend() cout << endl;
#define print_time() cout << setprecision(6) << "time: " << (clock() - start) / (double)CLOCKS_PER_SEC << '\n';
#else
#define debug(x) ;
#define debugend() ;
#define print_time() ;
#endif

clock_t start;
void FAST(ll argc)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    start = clock();
    if (argc == 2)
        freopen("std2.txt", "r", stdin);
}

/*vector<ll> v;
void seive()
{
    v.pb(2);
    for (int i = 3; i < 100000; i += 2)
    {
        for (int j = 0; j < v.size(); j++)
        {
            if (i % v[j] == 0)
                break;
            if (v[j] * v[j] > i)
            {
                v.pb(i);
                break;
            }
        }
    }
}
/*
void prime_factor(ll x, vector<ll> &r)
{
    ll sqrt_x = sqrt(x);

    for (ll i : v)
    {
        if (i > sqrt_x)
            break;

        if (x % i == 0)
            r.pb(i);

        while (x % i == 0)
        {
            x /= i;
        }
    }

    if (x >= 2)
        r.pb(x);
}
*/
/*
ll power(ll x, ll y)
{
    ll res = 1;
    x = x % MOD;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % MOD;
        y = y >> 1;
        x = (x * x) % MOD;
    }
    return res;
}
*/
/*
inline void dfs(ll curr, ll prev)
{

    for (ll i : a[curr])
        if (i != prev)
            dfs(i, curr);
}
*/
/*
ll multi(ll a, ll b)
{
    return ((a * b) % MOD);
}
*/
//---------------------CODE STARTS HERE---------------------

signed main(char argc, char *argv[])
{
    FAST(argc);

    ll testcase = 1;
    // cin >> testcase;

    while (testcase--)
    {
        int h, w;
        cin >> h >> w;
        bool mat[h + 1][w + 1];
        rep(i, 1, h + 1)
        {
            rep(j, 1, w + 1)
            {
                char x;
                cin >> x;
                if (x == '.')
                    mat[i][j] = 1;
                else
                    mat[i][j] = 0;
            }
        }
        int dp[h + 1][w + 1];
        rep(i, 0, h + 1)
            dp[i][0] = 0;
        rep(j, 0, w + 1)
            dp[0][j] = 0;
        dp[0][1] = 1;
        rep(i, 1, h + 1)
        {
            rep(j, 1, w + 1)
                dp[i][j] = ((dp[i - 1][j] + dp[i][j - 1]) * mat[i][j]) % MOD;
        }
        cout << dp[h][w] << endl;

        //--------??--------CLEAR VECTORS--------??--------
    }

    //v.clear();
    print_time();
    return 0;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

long long n, k;
int main() {
    cin >> n >> k;
    long long aaa = abs(n-k);

    if(n < k) {
        if((k+2-1)/2 > n) {
            cout << n << endl;
        }else {
            cout << aaa << endl;
        }
    }else {
        if(n % k == 0) {
            cout << 0 << endl;
        }else {
            long long check = n/k;
            long long bans = abs(n-(k*check));
            long long cans = abs(n-(k*(check+1)));
            cout << min(bans, cans) << endl;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
	int a = 0;
	int b = 0;
	int c = 0;

	std::cin >> a >> b >> c;


	if (a + b == c || b + c == a || c + a == b)
	{
		std::cout << "Yes" << std::endl;
	}
	else
	{
		std::cout << "No" << std::endl;
	}


	return 0;
}

Measured memory_bytes: 256
process.stdin.setEncoding('utf-8');
process.stdin.on('data', input => {
  var arry = input.split(' ').map(Number);
  var a = arry[0]
  var b = arry[1]
  var c = arry[2]

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

  console.log(result);
})


Measured memory_bytes: 17344
#include <bits/stdc++.h>
using namespace std;
const int N = 16;
const int N2 = (1 << N);
int n, a[N][N];
long long cost[N2], dp[N2];

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

	cin >> n;

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

	int p2n = (1 << n);

	for (int bm = 0; bm < p2n; bm++) {
		for (int i = 1; i < n; i++) {
			if ((bm & (1 << i)) == 0) continue;
			for (int j = 0; j < i; j++) {
				if ((bm & (1 << j)) == 0) continue;
				cost[bm] += (long long) a[i][j];
			}
		}
	}

	for (int bm = 1; bm < p2n; bm++) {
		long long ans = 0;
		for (int sbm = bm; sbm > 0; sbm = (sbm - 1) & bm) {
			if ((sbm & bm) != sbm) continue;
			int cbm = bm ^ sbm;
			ans = max(ans, cost[sbm] + dp[cbm]);
		}
		dp[bm] = ans;
	}

	cout << dp[p2n - 1] << '\n';

	return 0;
}


Measured memory_bytes: 4672
n, a, b = map(int, input().split())
mod = 10**9 + 7
ans = pow(2, n, mod) - 1

def comb(m):
    x = 1
    y = 1
    for i in range(m):
        x = x*(n - i)%mod
        y = y*(i + 1)%mod
    return (x*pow(y, mod - 2, mod)%mod)

print((ans - comb(a) - comb(b))%mod)

Measured memory_bytes: 9160
#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define modbig (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int64 n;
  cin>>n;
  int64 h[n],dp[n];
  rep(i,n){
    cin>>h[i];
  }
  dp[0]=0;
  dp[1]=abs(h[0]-h[1]);
  for(int i=2;i<n;i++){
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
  }
  cout<<dp[n-1];
}

Measured memory_bytes: 1792