akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define mp make_pair
#define ff first
#define ss second

using namespace std;
using vi=vector<int>;
using pii=pair<int, int>;
using ull=unsigned long long;

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
	int k, x; cin >> k >> x;

	for (int i = x-k+1; i <= x+k-1; i++)
		cout << i << " ";
	cout << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
		using namespace std;
		typedef long long ll;
		#define PRINT(x,y) cout<<"Case #"<<(int)x<<": "<<(int)(y)<<endl;
		ll exp(ll x, ll y) {
			if(y==0) return 1;
			if(y==1) return x;
			if(y%2==0) return exp(x,y/2)*exp(x,y/2);
			else return x*exp(x,y/2)*exp(x,y/2);
		}
		ll gcd(ll a , ll b) {
			if(b==0) return a;
			return gcd(b , a%b);
		}
		ll lcm(ll a , ll b) {
			return (a*b)/gcd(a,b);
		}
		#define vec(n) vector<int> v((int)(n),0);
		#define vecl(n) vector<ll> v((ll)(n),0);
		#define sq(a) ((int)(a))*((int)(a));
		#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
		int l;
		ll fact(ll x) {
			if(x==1) return 1;
			else return x*fact(x-1);
		}
		bool isPrime(int x) {
			int ans  = 0;
			for(int i=2;i<=sqrt(x);++i) {
				if(x%i==0) {
					ans = 1; i=x;
				}  
			}
			if(ans==0) return true;
			else return false;
		}
		ll isPerfect(ll x) {
			double y = sqrt(x);
			return (floor(y)==ceil(y));
		} 

		int z = 0;
		void ask(int x, int y) {
			cout<<"? "<<x<<" "<<y<<endl;
			}

		void solve() {
			int n,x,t; cin>>n>>x>>t;
			if(n%x==0) cout<<(n/x)*t;
			else cout<<(n/x+1)*t;
			


		}			



		int main() {
			io
			
		
		 solve();
		}
		    
		

Measured memory_bytes: 3568
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD  998244353
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	s[k - 1] += 'a' - 'A';
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n';
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod2 = 1000000007;
constexpr ll mod = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

int main(){
  int N,T;
  cin >> N >> T;
  vector<P> p(N);
  for(int i=0; i<N; i++){
    cin >> p[i].first >> p[i].second;
  }
  sort(p.begin(),p.end());
  vector<vector<int>> dp(N+1, vector<int> (T+1,0));
  for(int i=0; i<N; i++){
    for(int j=0; j<=T; j++){
      chmax(dp[i+1][j],dp[i][j]);
      if(j != T){
        chmax(dp[i+1][min(T,j+p[i].first)],dp[i][j]+p[i].second);
      }
    }
  }
  int ans = 0;
  for(int i=0; i<=T; i++){
    chmax(ans,dp[N][i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
 
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define f first
#define s second
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int len;
    cin >> len;
    map<int, int> freq;
    vector<long long> pos;
    for(int i = 0; i < len; i++) {
        int a;
        cin >> a;
        freq[a]++;
        if(freq[a] % 2 == 0) {
            pos.push_back(a);
        }
    }
    if(pos.size() == 0)
        cout << 0;
    else {
        sort(pos.begin(), pos.end());
        cout << pos[pos.size() - 1] * pos[pos.size() - 2];
    }
}

Measured memory_bytes: 8276
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
L,R,D = map(int,input().split())
ans = 0
for i in range(L,R+1):
    if i % D == 0:
        ans += 1

print(ans)
    

Measured memory_bytes: 10568
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
 
int main(){
    int a,b;
    cin>>a>>b;
    if(a<10 && b<10) cout << a*b << endl;
    else cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import deque

N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
# print(N, M, K)
# print(A)
# print(B)


consumptions_A = [0]
for i in range(len(A)):
    consumptions_A.append(consumptions_A[i] + A[i])

consumptions_B = [0]
for i in range(len(B)):
    consumptions_B.append(consumptions_B[i] + B[i])

answer = 0
j = M
for i in range(len(consumptions_A)):
    if (consumptions_A[i] > K): break

    remaining_time = K - consumptions_A[i]
    while consumptions_B[j] > remaining_time:
        j -= 1
    
    num_books = i + j
    answer = max(answer, num_books)

print(answer)


Measured memory_bytes: 47816
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}
//////////////

void solve() {
	LD R;
	cin >> R;
	cout << R * PI *2 << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 3812
def main():
    N, M = [int(n) for n in input().split()]
    paths = [[int(n) for n in input().split()] for _ in range(M)]
    paths.sort(key = lambda x: x[0])

    prev = (-1, -1)
    result = 0
    for l, r in paths:
        r = r - 1
        pl, pr = prev
        if pl <= l and r <= pr:
            prev = (l, r)
            continue
        elif pl <= l <= pr and pr < r:
            prev = (l, pr)
            continue
        elif pr < l :
            prev = (l, r)
            result += 1
            continue
        else:
            raise ValueError("aaa")
    print(result)
if __name__ == "__main__":
    main()

Measured memory_bytes: 64728
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n,a,b; cin>>n>>a>>b;
    int ans=0;
    for(int i=1; i<=n; ++i){
        string s=to_string(i);
        int kari=0;
        for(auto &v: s){
            kari+=v-'0';
        }
        if(a<=kari && kari<=b) ans+=i;
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))

#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define concat(xs, ys) (xs).insert((xs).end(), (ys).begin(), (ys).end())

const int mod = 1000000007;

int cnts[100005];

struct mint {
    ll x;
    mint(ll x=0):x(x%mod){}

    mint& operator+=(const mint a) {
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint& operator-=(const mint a) {
        if (x < a.x) {
          x += mod;
        }
        x -= a.x;
        return *this;
    }

    mint& operator*=(const mint a) {
        x = (x * a.x) % mod;
        return *this;
    }

    mint& operator/=(const mint a) {
        *this *= a.inv();
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }

    mint pow(ll n) const {
        mint a(*this);
        mint res = 1;
        while (n > 0) {
            if (n & 1) res *= a;
            a *= a;
            n >>= 1;
        }
        return res;
    }

    mint inv() const {
        return pow(mod - 2);
    }
};

const int MAX_V = 100005;

mint fac[MAX_V];
mint inv[MAX_V]; 

void initFact() {
  fac[0] = 1;
  inv[0] = 1;
  for (int i = 1; i <= MAX_V; i++) {
    fac[i] = (fac[i - 1] * i);
    inv[i] = fac[i].inv();
  }
}

mint combi(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * inv[k] * inv[n - k];
}

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

  long n;
  cin >> n;

  vector<P> machi;
  vector<int> idx;
  rep(i, n) {
    long x, y;
    cin >> x >> y;
    machi.push_back({x, y});
    idx.push_back(i);
  }
  
  double res = 0;
  long len = 0;

  do {
    len++;
    rep(i, n-1) {
      P m1 = machi[idx[i]];
      P m2 = machi[idx[i+1]];

      res += sqrt(pow(m2.first - m1.first, 2) + pow(m2.second - m1.second, 2));
    }
  } while(next_permutation(idx.begin(), idx.end()));

  printf("%.10f\n", res/len);
  // cout << (isOk?"Yes":"No") << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <utility>
#define llint long long

using namespace std;
typedef pair<llint, llint> P;

llint n;
llint d1, d2;
llint color1[605][605], color2[605][605];
llint cnt[2][2];
vector<P> G[605][605];
int sq[400005];

void make(llint x, llint y, llint d)
{
	for(int i = -605; i <= 605; i++){
		if(x+i < 0 || x+i >= 2*n) continue;
		int j = d-i*i;
		if(j < 0 || sq[j] == -1) continue;
		
		int nx = x+i, ny = y + sq[j];
		if(ny >= 0 && ny < 2*n) G[x][y].push_back(make_pair(nx, ny));
		
		nx = x+i, ny = y - sq[j];
		if(ny >= 0 && ny < 2*n) G[x][y].push_back(make_pair(nx, ny));
	}
}

void dfs(int x, int y, int c, llint color[605][605])
{
	color[x][y] = c;
	for(int i = 0; i < G[x][y].size(); i++){
		P u = G[x][y][i];
		if(color[u.first][u.second]) continue;
		dfs(u.first, u.second, -c, color);
	}
}

void solve(llint d, llint color[605][605])
{
	for(int i = 0; i < 2*n; i++){
		for(int j = 0; j < 2*n; j++){
			G[i][j].clear();
		}
	}
	for(int i = 0; i < 2*n; i++){
		for(int j = 0; j < 2*n; j++){
			make(i, j, d);
		}
	}
	/*for(int i = 0; i < 2*n; i++){
		for(int j = 0; j < 2*n; j++){
			cout << "(" << i << "," << j << ") :";
			for(int k = 0; k < G[i][j].size(); k++) cout << "(" << G[i][j][k].first << "," << G[i][j][k].second << ") "; cout <<endl;
		}
	}
	cout << endl;*/
	for(int i = 0; i < 2*n; i++){
		for(int j = 0; j < 2*n; j++){
			if(color[i][j] == 0) dfs(i, j, 1, color);
		}
	}
	for(int i = 0; i < 2*n; i++){
		for(int j = 0; j < 2*n; j++){
			if(color[i][j] == -1) color[i][j] = 0;
		}
	}
}

int main(void)
{
	cin >> n >> d1 >> d2;
	
	for(int i = 0; i < 400005; i++) sq[i] = -1;
	for(int i = 0; i < 605; i++) sq[i*i] = i;
	
	solve(d1, color1);
	solve(d2, color2);
	
	for(int i = 0; i < 2*n; i++){
		for(int j = 0; j < 2*n; j++){
			cnt[color1[i][j]][color2[i][j]]++;
		}
	}
	for(int i = 0; i < 2; i++){
		for(int j = 0; j < 2; j++){
			if(cnt[i][j] < n*n) continue;
			int rem = n*n;
			for(int k = 0; k < 2*n; k++){
				for(int l = 0; l < 2*n; l++){
					if(rem > 0 && color1[k][l] == i && color2[k][l] == j){
						cout << k << " " << l << endl;
						rem--;
					}
				}
			}
			return 0;
		}
	}
	
	return 0;
}

Measured memory_bytes: 208896
/*
ABHIJEET BISWAS
CSE 4th SEM 
MNNIT ALLAHBAD
*/

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1e18
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pli pair<long long,int>
#define pll pair<long long,long long>
#define MAX 1000009
#define pb push_back
#define mp map<int,int>
#define f first
#define s second
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ld pi=2.0*acos(0.0);
ll dp[MAX];
ll arr[MAX];
int n;
ll solve(int v)
{
	if(v>n)
	return INF;
	if(v==n)
	return 0;
	if(dp[v]!=-1)
	return dp[v];
	dp[v]=INF;
	for(int i=1;i<3;i++)
	if(v+i<=n)
	dp[v]=min(dp[v],abs(arr[v]-arr[v+i])+solve(v+i));
	return dp[v];
}
int main() {
	fastIO
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>arr[i];
	for(int i=0;i<=n;i++)
	dp[i]=-1;
	cout<<solve(1);
	return 0;
}

Measured memory_bytes: 9856
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    Int N; cin >> N;
    vector<Int> p(N);
    rep(i, 0, N) cin >> p[i];

    Int res = accumulate(p.begin(), p.end(), 0LL) - *max_element(p.begin(), p.end())/2;
    cout << res << endl;
}


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

int n;
set<int> s = {1,2,3,5,6,9,10,13,17,23,27};
int main() 
{ 

	ios::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    n%=28;
    if(s.count(n))
    	cout<<"No";
    else
    	cout<<"Yes";

} 


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
 
using namespace std;
typedef long long int lli;
 
int main(){
	int a,b;
	cin>>a>>b;
	if(0<a)cout<<"Positive"<<endl;
	else if(a==0)cout<<"Zero"<<endl;
	else if(0<=b)cout<<"Zero"<<endl;
	else{
		int x=(b-a+1)%2;
		if(x==0)cout<<"Positive"<<endl;
		else cout<<"Negative"<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dp[55][55][5000];
signed main() {
    vector<int>cnt(4);
    for(int i = 0; i < 3; i++) {
        int a,b;
        cin >> a >> b;
        cnt[a-1]++;
        cnt[b-1]++;
    }
    for(int i = 0; i < 4; i++) {
        if(cnt[i] == 3) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};


int main(){
	while(1){
		int n;
		cin>>n;
		if(n==0) break;
		for(int i=0;i<n;i++){
			int y,m,d;
			cin>>y>>m>>d;
			int t=0;
			while(y<1000){
				d++;
				if(y%3==0&&d==21){
					d=1;
					m++;
					if(m==11){
						y++;
						m=1;
					}
				}
				else if(y%3!=0&&(m%2==1&&d==21||m%2==0&&d==20)){
					d=1;
					m++;
					if(m==11){
						y++;
						m=1;
					}
				}
				t++;
			}
			cout<<t<<endl;
		}
		break;
	}
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    A.at(i)=a-1;
  }
  int i=0,j;
  for(;i<N;i++){
    j=A.at(j);
    if(j==1)
      break;
  }
  if(i==N)
    cout << -1 << endl;
  else
    cout << i+1 << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
//const long long MOD = ;
const long long INF_LL = 1e18+3; const int INF_int = 1e9+3;
#define ll long long
#define rep(i,n) for(int i = 0;i<n;i++)
#define lrep(i,n) for(long long i = 0;i<n;i++)
#define All(a) a.begin(),a.end()
#define Debug_Output_ALL(a) for(auto itr = a.begin();itr!=a.end();itr++) cout << *itr << " ";cout << endl;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int q;
    cin >> q;
    vector<ll> ansvec;
    rep(i,q){
        int dist;
        cin >> dist;
        ll ans = 0;
        ll d,m,dm;
        d = m = dm = 0;
        rep(j,n){
            if(s[j]=='D') d++;
            else if(s[j]=='M'){
                m++;
                dm+=d;
            }
            else if(s[j]=='C'){
                ans+=dm;
            }
            if(j>=dist-1){
                if(s[j-dist+1]=='D'){
                    d--;
                    dm-=m;
                }
                else if(s[j-dist+1]=='M'){
                    m--;
                }
            }
        }
        ansvec.push_back(ans);
    }
    rep(i,ansvec.size()) cout << ansvec[i] << endl;
}

Measured memory_bytes: 1412
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var a, b string
	fmt.Scan(&a, &b)

	result := "No"
	total, _ := strconv.Atoi(a + b)
	for i := 0; i < 10000; i++ {
		if i*i == total {
			result = "Yes"
			break
		}
	}

	fmt.Println(result)

}


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

int main(void) {
    int a, b, c;

    cin >> a >> b >> c;

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

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

// 1~N の整数で、0でない数字がちょうどk個あるものの個数
// dp[i][j][k]
// i　:　確定している桁数（最大100桁）0~100
// j　:　0でない数字が何個あるか（条件) 0~3
// k　:　N未満(0)か否(1)か(smaller) 0~1

int dp[111][5][2];

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

    int n = s.size(); // 桁数
    vector<int> data(n); rep(i,n) data[i] = s[i] - '0'; // 各桁の数字
    dp[0][0][0] = 1; // 初期化　（0桁目に0があると考える)

    rep(i,n){
        rep(j,4){
            dp[i+1][j][1] += dp[i][j][1]; // smaller 0 →smaller
            if(j+1 < 4) dp[i+1][j+1][1] += dp[i][j][1] * 9; // smaller 1~9 →smaller
            if(data[i] > 0){
                dp[i+1][j][1] += dp[i][j][0]; // bigger 0 →smaller
                if(j+1 < 4){
                    dp[i+1][j+1][1] += dp[i][j][0] * (data[i] -1); // bigger 1~data[i]-1 →smaller
                    dp[i+1][j+1][0] += dp[i][j][0]; // bigger data[i] →bigger
                }
            }
            else{
                dp[i+1][j][0] += dp[i][j][0]; // bigger 0 →bigger
            }
        }
    } // DP遷移

    int ans = dp[n][k][0] + dp[n][k][1];
    cout << ans << endl;
}

Measured memory_bytes: 3624
n=int(input())
INF=float('inf')

h=[]
for _ in range(n):
  a,b,c=map(int,input().split())
  h.append([a,b,c])

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

print(max(dp[n][0],dp[n][1],dp[n][2]))


Measured memory_bytes: 48572
//CazadorDivino
#include "bits/stdc++.h"
#include <cmath>
using namespace std;

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)

#define nl '\n'
#define ioi exit(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int,int> pii;
typedef pair<long,long> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};

string conv(int a){
	stringstream ss;
	ss << a;
	string str = ss.str();
	return str;
}

int conv(string a){
    stringstream geek(a); 
    int x = 0; 
    geek >> x;   
	return x;
}


int v[N];
int main(){
	int n, cont = 0; 
	cin>> n;
	int mini = inf, ind = 0;
	rep(i,1,n){
		cin>> v[i];
		if(mini > v[i]){
			mini = v[i];
			ind = i;
		}
	}
	
	while(cont <= n-1){
		
		int newmini = mini, newind = 0;
		rep(i,1,n){
			if(ind != i){
				v[i] = v[i] % mini;
				if(newmini > v[i] && v[i] != 0){
					newmini = v[i];
					newind = i;
				}
				if(v[i] == 0) cont++;
				if(cont == n-1) break;
			}
		}
		
		//~ rep(i,1,n)
			//~ cout<<v[i]<<" "; cout<<endl;
		
		mini = newmini;
		ind = newind;
	}
	cout<< mini;
	return 0;
}


Measured memory_bytes: 640
use std::io::Read;

fn main() {
    let mut buf = String::new();

    std::io::stdin().read_to_string(&mut buf).unwrap();

    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let t: i32 = iter.next().unwrap().parse().unwrap();
    let a: i32 = iter.next().unwrap().parse().unwrap();
    let h: Vec<i32> = (0..n).map(|_| iter.next().unwrap().parse().unwrap()).collect();

    let mut ans = 0;
    let mut min_diff = std::i32::MAX;

    for i in 0..n {
        let diff = (1000 * a - (1000 * t - 6 * h[i])).abs();
        if min_diff > diff {
            ans = i + 1;
            min_diff = diff;
        }
    }
    println!("{}", ans);
}


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

using namespace std;
#define ll long long
#define ld long double
#define PI 3.141592653L
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll INF = (ll)1e18;
const int N = 2e5 + 5;
const ll MOD = 1e9+7;

int parent[N];

int gcd(int a, int b) { 
    if (a == 0) 
        return b;  
    return gcd(b%a, a);  
} 
   
int lcm(int a, int b) {  
    return (a*b)/gcd(a,b);  
} 

ll pow(ll x, ll y, ll p) {
    if(y == 0) return 1;
    ll res = 1;
    x %= p;
    if(x == 0) return 0LL;
    while(y > 0) {
        if(y & 1) res = (res*x) % p;
        y >>= 1;
        x = (x*x) % p;
    }
    return res;
}

int find(int x) {
    return x == parent[x] ? x : parent[x] = find(parent[x]);
}

void Union(int x, int y) {
    int xPar = find(x), yPar = find(y);
    if(xPar != yPar) parent[xPar] = yPar;
}

void solve() {
    int n;
    cin >> n;
    map<string, int> mp;
    for(int i=0;i<n;i++) {
        string s;
        cin >> s;
        mp[s]++;
    }
    cout << "AC x" << " " << mp["AC"] << endl;
    cout << "WA x" << " " << mp["WA"] << endl;
    cout << "TLE x" << " " << mp["TLE"] << endl;
    cout << "RE x" << " " << mp["RE"] << endl;
    return;
} 

int main()
{
    IOS
    //int t;
    //cin >> t;
    //while(t--) 
    solve();
    return 0; 
}


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

int main() {
  int N, T, A;
  cin >> N >> T >> A;
  int ans = -1;
  float mindiff = 1000.0;

  for (int i = 0; i < N; ++i) {
    int h;
    cin >> h;
    float diff = abs(A - (T - h * 0.006));
    if (diff < mindiff) {
      ans = i + 1;
      mindiff = diff;
    }
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define TMP 1000000007

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int main() {
	ll n, ans = 1;
	scanf("%d", &n);
	for(int i = n; i > 0; --i) {
		ans *= i;
		ans %= TMP;
	}
	printf("%d\n", ans);
	return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
char map[8][8];
int start[2];
void explosion(int x,int y){
	int i;
	map[x][y]='0';
	int j,k;
	for(i=-3;i<4;i++){
		if((x+i>=0)&&(x+i<8)&&(map[x+i][y]=='1')){
			explosion(x+i,y);
		}
		if((y+i>=0)&&(y+i<8)&&(map[x][y+i]=='1')){
			explosion(x,y+i);
		}
	}
	return;
}
int main(){
	int n;
	scanf("%d",&n);
	int i,j,k;
	for(i=1;i<n+1;i++){
		for(j=0;j<8;j++){
			scanf(" %s",&map[j]);
		}
		scanf("%d %d",&start[0],&start[1]);
		if(map[start[1]-1][start[0]-1]=='1')explosion(start[1]-1,start[0]-1);
		printf("Data %d:\n",i);
		for(j=0;j<8;j++){
			for(k=0;k<8;k++){
				putchar(map[j][k]);
			}
			printf("\n");
		}
	}
}

Measured memory_bytes: 1200
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#define mod 1000007
using namespace std;                       
typedef long long ll;
 int main(){
 	 int n,t;
 	   cin>>n;
 	     t=n%10;
 	       if(t==3)
 	         cout<<"bon"<<endl;
			  else if(t==0||t==1||t==6||t==8)
			      cout<<"pon"<<endl;
				  else
				   cout<<"hon"<<endl; 
 }

Measured memory_bytes: 3632
/*s1190073  Rina Sato
  File name: prog11b.c
  This is a depth first search program.
*/

#include <stdio.h>

#define White 0
#define Gray -1
#define Black 1

int d[103],f[103];
int n,time,r;
int A[103][103];
int color[103];

typedef struct Input{
  int u;
  int k;
  int v[1000];
}input;

void DFSvisit(int u){
  int i,j,v;
  
  color[u] = Gray;
  time++;

  d[u] = time;

  for(v = 1 ; v <= n ; v++){
    if(A[u][v] == 1 && color[v] == White){
      DFSvisit(v);  
    }
  }
  
  color[u] = Black;
  time++;

  f[u] = time;
}

int main(void){
  int i,j;
  input Adj[103];
  
  time = 0;

  scanf("%d",&n);

  for(i = 1 ; i <= n ; i++){
    scanf("%d",&Adj[i].u);
    scanf("%d",&Adj[i].k);

    if(Adj[i].k != 0){
      for(j = 1 ; j <= Adj[i].k ; j++){
	scanf("%d",&Adj[i].v[j]);
      }
    }
    
  }

  for(i = 1 ; i <= n ; i++){
    for(j = 1 ; j <= n ; j++){
      A[i][j] = 0;
    }
  }

  for(i = 1 ; i <= n ; i++){
    for(j = 1 ; j <= Adj[i].k ; j++){
      A[Adj[i].u][Adj[i].v[j]] = 1;
    } 
  }
  

  for(i = 1 ; i <= n ; i++){
    color[Adj[i].u] = White;
  }

  for(i = 1 ; i <= n ; i++){
    for(j = 1 ; j <= n ; j++){
      if(A[i][j] == 1){
	if(color[j] == White)
	  DFSvisit(Adj[i].u);
      }
    }
  }
  
  for(i = 1 ; i <= n ; i++){
    printf("%d",Adj[i].u);
    printf(" %d %d\n",d[i],f[i]);
  }
  
  return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;




int main() {
  int a,b;
  cin >> a >> b;
  cout << a*b << endl;
}










Measured memory_bytes: 3160
from collections import deque

LARGE = 10 ** 9 + 7
N, K = map(int, input().split())

G = dict()
for i in range(1, N + 1):
    G[i] = dict()

for _ in range(N - 1):
    a, b = map(int, input().split())
    G[a][b] = 1
    G[b][a] = 1

root = 1
queue = deque([root])

depth = [N + 1] * (N + 1)
depth[root] = 0

c_list = [root]

while len(queue) > 0:

    p = queue.popleft()

    for q in G[p].keys():
        if depth[q] == N + 1:
            depth[q] = depth[p] + 1
            c_list.append(q)
            queue.append(q)


perm = [1]
for i in range(K - 2):
    perm.append((perm[-1] * (K - 2 - i)) % LARGE)


res = 1
for i in range(len(G[root].keys()) + 1):
    res = res * (K - i) % LARGE

for c in c_list[1:]:
    if len(G[c].keys()) >= K:
        res = 0
    else:
        res = res * perm[len(G[c].keys()) - 1] % LARGE

print(res)


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

long long n;

long long solve();

int main() {
  cin >> n;
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = (long long)1e17;
  for(long long i = 1; i * i <= n; ++i)
    if(n % i == 0) ans = min(ans, i + n / i - 2);
  return ans;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define mxn 1000010
#define db double
#define LL long long
#define ldb long double
#define ull unsigned long long
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pul pair<ull,LL> 
#define pii pair<int,int> 
#define mp make_pair
#define fr first
#define sc second
#define x1 faqx1
#define y1 faqy1
#define x2 faqx2
#define y2 faqy2
using namespace std;
const int N=(1<<14)-1,mod=998244353;
const LL inf=1e18;
template<typename T> void chkmin(T &x,T y) {if(y<x) x=y;}
template<typename T> void chkmax(T &x,T y) {if(y>x) x=y;}
template<typename T> void upd(T &x,T y) {if((x+=y)>=mod) x-=mod;}
int K,sl,fh,ans;
int rd()
{
	sl=0;fh=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch) {if(ch=='-') fh=-1; ch=getchar();}
	while('0'<=ch&&ch<='9') sl=sl*10+ch-'0',ch=getchar();
	return sl*fh;
}
int main()
{
	ios::sync_with_stdio(false);
	K=rd();
	ans=(K/500)*1000;
	K%=500;
	ans+=(K/5)*5;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int N,R,M,A,B;
    scanf("%d",&N);
    scanf("%d",&R);
    if(N<10){
        A=100*(10-N);
        B=R+A;
        printf("%d\n",B);
    }
    else{
    printf("%d\n",R);
    }
    return 0;
}


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

const ll mod = 1e9+7;

int main() {
    int n;
    cin >> n;
    vector<ll> arr(n);
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    stack<ll>s;
    s.push(arr[0]);

    ll sth = 0;
    for(int i = 1; i < n; i++){
        if(arr[i] < s.top()){
            sth += abs(arr[i] - s.top());
        }
        if(arr[i] > s.top()){
            s.push(arr[i]);
        }
    }
    cout << sth << endl;
}






Measured memory_bytes: 6208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n,m;
  cin>>n>>m;
  vector<P> a[n];
  rep(i,0,m){
    int l,r,d;
    cin>>l>>r>>d;
    a[l-1].push_back(P(r-1,d));
    a[r-1].push_back(P(l-1,-d));
  }
  int b[n];
  bool c[n];
  bool e=true;
  rep(i,0,n) c[i]=false;
  rep(i,0,n){
    if(c[i]) continue;
    queue<int> q;
    q.push(i);
    b[i]=0;
    c[i]=true;
    while(q.size()){
      int s=q.front();
      q.pop();
      for(P p:a[s]){
        if(!c[p.first]){
          q.push(p.first);
          b[p.first]=b[s]+p.second;
          c[p.first]=true;
        }
        else{
          if(b[p.first]!=b[s]+p.second) e=false;
        }
      }
    }
  }
  if(e) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

int main(){

  int n,  max=0, second_max=0, max_count=0;
  scanf("%d\n", &n);
  int a[n];

  rep(i,n){
    scanf("%d\n",&a[i]);
  }
  rep(i,n){
    if(max<a[i]){
      second_max = max;
      max=a[i];
      max_count=1;
    }else if(max==a[i]){
      max_count++;
    }else if (max>a[i]&&second_max<a[i]){
      second_max=a[i];
    }
  }

  if(max_count>1){
    rep(i,n){
      printf("%d\n",max );
    }
  }else{
    rep(i,n){
      if(max==a[i]){
        printf("%d\n",second_max );
      }else{
        printf("%d\n",max );
      }
    }
  }
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;




int main()
{
    
    int a,b,c;
    cin >> a >> b >> c;
    
    cout << min((min(abs(a-b)+abs(b-c), abs(a-c)+abs(c-b)), min(abs(b-a)+abs(a-c), abs(b-c)+abs(c-a))), min(abs(c-a)+abs(a-b), abs(c-b)+abs(b-a))) << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define reg register
typedef long long ll;
using namespace std;
int main(){
	string S,T,U;
	reg int n,m;
	cin>>S>>T;
	cin>>n>>m;
	cin>>U;
	if(U==S)n--;
	else m--;
	cout<<n<<" "<<m<<endl;
	return 0;
}

Measured memory_bytes: 256
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = long.Parse(line[0]);
        var b = long.Parse(line[1]);
        var c = long.Parse(line[2]);
        Console.WriteLine((a % 2 == 0) || (b % 2 == 0) || (c % 2 == 0) ? 0 : getMin(a, b, c));
    }
    public static long getMin(long a, long b, long c)
    {
        var w = new long[3];
        w[0] = getMin2(a, b, c);
        w[1] = getMin2(b, a, c);
        w[2] = getMin2(c, a, b);
        return w.Min();
    }
    public static long getMin2(long a, long b, long c)
    {
        var w = a / 2;
        return (a - 2 * w) * b * c;
    }
}


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

using namespace std;

#define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0)
typedef pair<int, int> P;
#define F first
#define S second
#define INF 0x3f3f3f3f
#define MP make_pair
#define PB push_back
#define LL long long

int main()
{
	string a,b,c;
	int aa,bb;
	while(cin >> a >> b)
	{
		cin >> aa >> bb;
		cin >> c;
		if(a == c)
		{
			aa -= 1;
		}
		if(b == c)
		{
			bb -= 1;
		}
		printf("%d %d\n",aa,bb);

	}

	return 0;
}

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

signed main() {
  string S;
  cin >> S;
  int A = count(S.begin(), S.end(), 'a');
  int B = count(S.begin(), S.end(), 'b');
  int C = count(S.begin(), S.end(), 'c');
  
  if( max({A, B, C}) - min({A, B, C}) >= 2 ){
    cout << "NO" << endl;
  }else{
    cout << "YES" << endl;
  }
}

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

void erase(int *ptr, int *last) {
    while (++ptr < last) {
        *(ptr - 1) = *ptr;
    }
}

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());

    int a;
    int b[100];

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

    int len = a;
    int ans[100];
    for (int j = 0; j < a; j++) {
        for (int i = len; i > 0; i--) {
            if (i == b[i-1]) {
                erase(begin(b) + i - 1, end(b));
                ans[j] = i;
                len -= 1;
                break;
            }
        }
    }
    if (len > 0) {
        cout << -1 << endl;
        return 0;
    }

    for (int i = a-1; i >= 0; i--) {
        cout << ans[i] << endl;
    }

}


Measured memory_bytes: 256
/*input
1
1

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int l, r, d;
  cin >> l >> r >> d;
  int ans = r / d - (l - 1) / d;
  cout << ans << endl;  

  return 0;
}

Measured memory_bytes: 3652
#include <iostream>
using namespace std;
#include <bits/stdc++.h>
int main() {
	// your code goes here
	int n,a,b;
	cin>>n>>a>>b;
	int s=n*a;
	if(s>b)
	cout<<b<<endl;
	else
	cout<<s<<endl;
	return 0;
}

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

const int mod = 1000000007;
typedef long long LL;
void reduce(int & x) { x += x >> 31 & mod; }
int mul(int a, int b) { return (LL) a * b % mod; }
int pow(int a, int b, int res = 1) {
	for (; b; b >>= 1, a = mul(a, a)) if (b & 1) res = mul(res, a);
	return res;
}
int remod(LL x) { x %= mod; return x + (x >> 63 & mod); }
const int MAXN = 310;
int f[MAXN][MAXN][MAXN];
int n, m;
std::vector<std::pair<int, int> > lim[MAXN];
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n >> m;
	for (int i = 1, l, r, v; i <= m; ++i)
		std::cin >> l >> r >> v, lim[r].emplace_back(l, v);
	f[0][0][0] = 1;
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j <= i; ++j)
			for (int k = 0; k <= i; ++k)
				if (int t = f[i - 1][j][k]) {
					reduce(f[i][j][k] += t - mod);
					reduce(f[i][i - 1][k] += t - mod);
					reduce(f[i][j][i - 1] += t - mod);
				}
		for (auto t : lim[i]) {
			for (int j = 0; j <= i; ++j)
				for (int k = 0; k <= i; ++k)
					if ((j >= t.first) + (k >= t.first) != t.second - 1)
						f[i][j][k] = 0;
		}
	}
	int ans = 0;
	for (int i = 0; i <= n; ++i)
		for (int j = 0; j <= n; ++j)
			reduce(ans += f[n][i][j] - mod);
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 112896
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define STARTUP {(cin.tie(0));\
 (ios::sync_with_stdio(false));}

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define CINVEC(vec) REP(i,(vec).size()) cin>>(vec)[i];

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
std::istream& operator>>(std::istream& is, std::pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

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

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    STARTUP;

    char a, b;
    cin >> a >> b;

    int ia, ib;
    ia = (a == 'H') ? 1 : 0;
    ib = (b == 'H') ? 1 : 0;
    YESNO(ia xor ib == 0, "H", "D");

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()

int const N = 1000001;
int n, fr[N];
char g[N];

int main(){
    scanf("%s", g);
    n = strlen(g);
    if(n == 2){
         if(g[0] == g[1])return puts("1 2"),0;
         return puts("-1 -1"),0;
    }
    for(int i = 0; i<n-2; ++i){
        if(i+1 < n && g[i] == g[i+1]){
            return printf("%d %d\n", i+1, i+3), 0;
        }
        if(i+2 < n && g[i] == g[i+2]){
             return printf("%d %d\n", i+1, i+3), 0;
        }
    }
    puts("-1 -1");
}

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

void push(int);
int pop(void);

int top,s[1000];

int main(){
  int x,a,b;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      a = pop();
      b = pop();
      push(a+b);
    } else if ( s[0] == '-' ){
      a = pop();
      b = pop();
      push(b-a);
    } else if ( s[0] == '*' ){
      a = pop();
      b = pop();
      push(a*b);
    } else {
      x = atoi(s);
      push(x);
    }
  }

  printf("%d\n",pop());

  return 0;
}

int pop(){

  top--;
  return s[top+1];
}

void push(x){

  top++;
  s[top] = x;
}

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

using namespace std;
using ll = long long;

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N + 1), B(N), C(N, 0);
  for (int i = 0; i < N + 1; ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < N; ++i) {
    cin >> B[i];
  }
  ll ret = 0;
  for (int i = 0; i < N; ++i) {
    ret += min(B[i], A[i] + A[i + 1]);
    if (A[i] < B[i]) {
      A[i + 1] -= min(A[i + 1], B[i] - A[i]);
    }
  }
  cout << ret;
}


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

using namespace std;

int main() {
        int n, ct = 0;
        cin >> n;
        int a[n], b[n];
        for (int i = 0; i < n; i++) { 
                cin >> a[i] >> b[i];
        }

        for (int i = 0; i < n; i++) {
                if (a[i] == b[i] && a[i+1] == b[i+1] && a[i+2] == b[i+2])
                        ct++;
        }

        if (ct >= 1)
                cout << "Yes" << endl;
        else
                cout << "No" << endl;

        return 0;
}


Measured memory_bytes: 3584