akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 300000
#define M 100001
int n, m;
int x[N], x2[N];
int y[N];
int z[N];
int w[N], w2[N];
int main(){
	cin>>n>>m;
	rep(i, n) cin>>x[i];
	sort(x, x+n);
	rep(i, n) x2[x[i]]++;
	rep(i, M) w[i%m] += x2[i]/2;

	rep(i, n) y[x[i]%m]++;
	int res = 0;
	rep(i, m/2+1){
		if(i*2%m==0){
			z[i] = y[i]/2;
			res += z[i];
			z[i] *= 2;

		} else {
			z[i] = z[m-i] = min(y[i], y[m-i]);
			res += z[i];
		}
		//cerr<<i<<" "<<m-i<<" "<<z[i]<<endl;
	}
	//cerr<<res<<endl;
	rep(i, m){
		int t = min(w[i], (y[i]-z[i])/2);
		res += t;
		//cerr<<i<<" "<<t<<endl;
	}
	cout<<res<<endl;
	return 0;
}


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

int main(void){
    int n,q;
    cin>>n>>q;
    while(q--){
        int a,b;
        cin>>a>>b;
        if(n>1)while(a!=b){
            if(a>b)swap(a,b);
            b = (b-1 + n-1)/n;
        }
        cout<<a<<endl;
    }
}


Measured memory_bytes: 1280
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
    int i,j;
    int n, m, q;
    cin >> n >> m >> q;
    int v[505][505] = {};
    rep(i,m){
        int l, r;
        cin >> l >> r;
        v[l][r]++;
    }
    rep(i,503)rep(j,503) v[i][j+1]+=v[i][j];
    rep(i,q){
        int p,q;
        cin >> p >> q;
        int ans = 0;
        for(j = p; j <= q; j++)ans += v[j][q];
        cout << ans << endl;
    }
}


Measured memory_bytes: 1920
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
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; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

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


int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	int kkt = 89;
	while (kkt) {
		ll N, T, L, B; scanf("%lld %lld %lld %lld", &N, &T, &L, &B); if (N == 0 && T == 0 && L == 0 && B == 0) break;
		vector<ll> board(N + 1);
		for (int i = 0; i < L; i++) {
			ll x; scanf("%lld", &x);
			board[x] = 1;
		}
		for (int i = 0; i < B; i++) {
			ll x; scanf("%lld", &x);
			board[x] = 2;
		}
		vector<vector<double>> dp(T + 5, vector<double>(N + 1));
		dp[0][0] = 1;
		for (int i = 0; i < T; i++) {
			for (int j = 0; j < N; j++) {
				for (int k = 1; k <= 6; k++) {
					int nj = j + k;
					if (nj > N) nj = 2 * N - nj;
					if (board[nj] == 0) {
						dp[i + 1][nj] += dp[i][j] / 6.0;
					}
					if (board[nj] == 1) {
						dp[i + 2][nj] += dp[i][j] / 6.0;
					}
					if (board[nj] == 2) {
						dp[i + 1][0] += dp[i][j] / 6.0;
					}
				}
			}
			dp[i + 1][N] += dp[i][N];
		}
		printf("%.12f\n", dp[T][N]);
	}
	return 0;

}



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

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getval(_T& a) {
	std::cin >> a;
}
template<class _T> static void getval(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getval(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}

static void exec()
{
	int K;
	getval(K);

	std::string orgs;
	getval(orgs);

	int len = orgs.length();
	for (int i = 0; (i < K) && (i < len); i++) {
		putchar(orgs[i]);
	}
	if (len > K) {
		printf("...");
	}
	putchar('\n');
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll N;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	for(i=1;i<=101010;i++) {
		N-=i;
		if(N<=0) return _P("%d\n",i);
	}
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int n,m; cin>>n>>m;
    int cnt[m]={};
    rep(i,n){
        int k; cin>>k;
        rep(j,k){
            int a; cin>>a;
            cnt[--a]++;
        }
    }
    int ans=0;
    rep(i,m){
        if(cnt[i]==n) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	
	if(a>=-100&&a<=100)
	{
		if(b>=-100&&b<=100)
		{
			if(c>=-100&&c<=100)
			{
			
		
	if(a<=c&&c<=b)
	{
	printf("Yes");
	}
	else
	{
	printf("No");
	}
	}
}
}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define int long long
#define pb push_back
#define mod 1000000007
#define setbits(x) __builtin_popcountll(x)
#define zerobits(x) __builtin_ctzll(x)
#define inf 1e18
#define pre(x,y) fixed<<setprecision(y)<<x
#define pq priority_queue<int>
#define mpq priority_queue<int,vector<int>,greater<int>>
#define gcd(x,y) __gcd(x,y)
#define mp make_pair



int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,i,j,k;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++) cin>>a[i];
    int s[n];
    s[0]=a[0];
    for(i=1;i<n;i++) s[i]=s[i-1]+a[i];
    int dp[n][n];
    memset(dp,0,sizeof(dp));
    
    for(i=0;i<n;i++) dp[i][i]=a[i];
    for(i=1;i<n;i++) dp[i-1][i]=a[i]+a[i-1];

    for(i=2;i<n;i++)
    {
    	for(j=0;j+i<n;j++)
    	{
    		dp[j][j+i]=inf;
    		for(k=j;k<(i+j);k++)
    		{
    			int ans=dp[j][k]+dp[k+1][j+i]+s[k]-s[j]+a[j]+s[j+i]-s[k+1]+a[k+1];
    			if(k==j) ans-=a[k];
    			if(k+1==(i+j)) ans-=a[i+j];
    			dp[j][j+i]=min(dp[j][j+i],ans);
    		}
    	}
    }
    cout<<dp[0][n-1]<<endl;





	return 0;
}


Measured memory_bytes: 4876
#pragma GCC optimize("Ofast")

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

#define M 1000000007
#define MM 998244353 
#define ll long long 
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=a;i<b;i++)
#define F first
#define S second
#define PI 3.1415926536
#define INF 2e9
#define endl "\n"

ll power(ll b,ll e,ll m)
{
	if(e==0)
		return 1;
	if(e%2)
		return b*power(b*b%m,(e-1)/2,m)%m;
	else
		return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0)
		return 1;
	if(e%2)
		return b*power(b*b,(e-1)/2);
	else
		return power(b*b,e/2);
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,x,l,i;
	cin>>n;
	pair<ll,ll> p[n];
	for(i=0;i<n;i++)
	{
		cin>>x>>l;
		p[i].F=x+l;p[i].S=(x-l);
	}
	sort(p,p+n);
	ll ans=0;
	for(i=1;i<n;i++)
	{
		if(p[i].S<p[i-1].F)
		{
			ans++;
			p[i].F=p[i-1].F;p[i].S=p[i-1].S;
		}
	}
	cout<<n-ans;
	return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define POW_10_5 100000
#define POW_10_9 1000000000
#define INF (numeric_limits<int>::max()/2)
#define int long long

typedef pair<int, int> Pair;
typedef unordered_map<int, int> Hash;

// ---
const int Qlim = 2 * POW_10_5;
int N, Q;
string s;
char t[Qlim], d[Qlim];

bool LeftHamide(int pos) {
  REP(i, Q) {
    if (t[i] == s[pos]) {
      if (d[i] == 'L') {
        --pos;
        if (pos < 0) { return true; }
      } else {
        ++pos;
        if (pos >= N) { return false; }
      }
    }
  }
  return false;
}

bool RightHamide(int pos) {
  REP(i, Q) {
    if (t[i] == s[pos]) {
      if (d[i] == 'L') {
        --pos;
        if (pos < 0) { return false; }
      } else {
        ++pos;
        if (pos >= N) { return true; }
      }
    }
  }
  return false;
}

int Ans() {
  int ans = N;

  if (LeftHamide(0)) {
    int l = 0, r = N;
    while (l+1 != r) {
      int m = (l + r) / 2;
      if (LeftHamide(m)) {
        l = m;
      } else {
        r = m;
      }
    }
    ans -= l + 1;
  }

  // (l, r]
  if (RightHamide(N-1)) {
    int l = -1, r = N-1;
    while (l != r-1) {
      int m = (l + r) / 2;
      if (RightHamide(m)) {
        r = m;
      } else {
        l = m;
      }
    }
    ans -= N - r;
  }

  return ans;
}

signed main() {
  cin >> N >> Q;
  cin >> s;
  REP(i, Q) { cin >> t[i] >> d[i]; }

  auto ans = Ans();

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


Measured memory_bytes: 900
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.14159265358979323846;

void solve() {
    ld a, b, h, m;
    cin >> a >> b >> h >> m;
    ld xh = a * cos(PI * (h + m / 60.0) / 6.0);
    ld yh = a * sin(PI * (h + m / 60.0) / 6.0);
    ld xm = b * cos(PI * m / 30.0);
    ld ym = b * sin(PI * m / 30.0);
    ld ans = sqrt((xh-xm)*(xh-xm) + (yh-ym)*(yh-ym));
    cout << ans << endl;
    return;
}

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

Measured memory_bytes: 4188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
#define tl 1'000'000'007
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REREP(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, n) for (ll i = a; i < n; i++)
#define REFOR(i, n, a) for (ll i = n; i >= a; i--)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false); 
    ll n,a;
    cin >> n >> a;
    cout << (n+(a-1))/a << endl;
}


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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif


template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

#endif




void solve(){
    int A, B, C;
    cin >> A >> B >> C;

    int c[10]={0};
    c[A]++;
    c[B]++;
    c[C]++;
    rep(i,10){
        if(c[i]==2){ Yes; return ;}
    }
    No;
}

signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed << setprecision(18);
    solve();
}


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

int main() {
  int N, count = 0;
  cin >> N;

  for (int i = 1; i <= N; i++) {
    string str = to_string(i);
    if(str.size()%2 != 0){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
import java.util.*;

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

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();

        long result = 1;
        for (int i = 0; i < N; i++) {
            if (i == 0) result *= K;
            else result *= (K - 1);
        }

        System.out.println(result);

        return;
    }

}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
using namespace std;

vector<vector<int>> bingo(3, vector <int> (3));

void check(int v) {
	for (int i = 0;i<3;i++)
		for (int j = 0;j<3;j++)
			if (bingo[i][j] == v) {
				bingo[i][j] = -1;
				return;
			}
}
int main()
{
	for (int i = 0; i < 3; i++)
		for (int j = 0; j < 3; j++)
			cin >> bingo[i][j];
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		check(x);
	}
	for (int i = 0; i < 3; i++) {
		bool f = true;
		for (int j = 0; j < 3; j++)
			if (bingo[i][j] != -1)f = false;
		if (f) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	for (int i = 0; i < 3; i++) {
		bool f = true;
		for (int j = 0; j < 3; j++)
			if (bingo[j][i] != -1)f = false;
		if (f) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	bool f = true;
	for (int i = 0; i < 3; i++) {
		if (bingo[i][i] != -1)f = false;
	}
	if (f) {
		cout << "Yes" << endl;
		return 0;
	}
	f = true;
	for (int i = 0; i < 3; i++) {
		if (bingo[i][2 - i] != -1)f = false;
	}
	if (f) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void){
  int a,b,c,x,max;
  scanf("%d%d%d%d",&a,&b,&c,&x);
  int sum=a+b+c;
  max=fmax(a,fmax(b,c));
  sum-=max;
  for(int i=1;i<=x;i++){
    max*=2;
  }
  printf("%d",sum+max);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int ans = 0;
	FOR(i, a, b+1){
		if(c%i == 0) ans++;
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  string S; cin >> S;
  
  int ans = S.size();
  
  for (int i = 0; i < 2; ++i) {
    int cnt = 0;
    for (int j = 0; j < S.size(); ++j) {
      if (j % 2 == 0 && S[j] != (char) (i + '0')) cnt++;
      if (j % 2 == 1 && S[j] == (char) (i + '0')) cnt++;
    }
    
    ans = min(ans, cnt);
  }
  
  cout << ans << endl;
  
  return 0;
}

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

M = 10**5

memo = [0]*(M+1)

for a in A:
    memo[a] += 1

Q = int(input())

s = sum(i*c for i,c in enumerate(memo))
for _ in range(Q):
    b,c = map(int,input().split())

    cnt = memo[b]
    s += (c-b)*cnt
    memo[c] += memo[b]
    memo[b] = 0
    print(s)


Measured memory_bytes: 78596
#include "bits/stdc++.h"
using namespace std;
#define REP(i,a) for(int i = 0; i < (a);i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using Graph = vector < vector<int>>;
long int sum[200020] = {};
/*切り上げの計算！*/
int maxtime(int x) {
	return(x + 9) / 10 * 10;

}
int main() {
	int N, M,C;
	cin >> N >> M >> C;
	vector<vector<int>> S(N);
	vector<int>c;
	for (int i = 0; i < M; i++) {
		int a;
		cin >> a;
		c.push_back(a);
	}

	for (int j = 0; j < N;j++) {
		for (int i = 0; i < M; i++) {
			int b;
			cin >> b;
			S[j].push_back(b);
		}
	}
	int cnt = 0;
	int sum = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			sum = sum + c[j] * S[i][j];
		}
		sum = sum + C;
		if (sum > 0) {
			cnt++;
		}
		sum = 0;
	}
	cout << cnt;
}

Measured memory_bytes: 256
(function(input) {
    var lines = input.split('\n');
    for (var i = 0; i < lines.length; i++) {
        var items = lines[i].split(' ').map(Number);
        var h = items[0];
        var w = items[1];
        if (!h && !w) {
            break;
        }
        var r = '';
        for (var y = 1; y <= h; y++) {
            for (var x = 1; x <= w; x++) {
                r += y % 2 && x % 2 || !(y % 2) && !(x % 2) ? '#' : '.';
            }
            r += '\n';
        }
        console.log(r);
    }
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 10904
//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define itr         vector<int>::iterator
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define mem(a,b) memset(a,b,sizeof(a))
#define sz size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(int i=a;i<b;i++)
#define tr(ner,it) for(it=ner.begin();it!=ner.end();it++)
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const ll N=200005;
ll nn,mm,n;
ll p[N],pp[N],qq[N];
vector<pair<ll,ll> > v;
ll cmp(pair<ll,ll> p1,pair<ll,ll> p2){
	if(p1.first!=p2.first)return p1.first<p2.first;
	else return p1.second<p2.second;
}
ll power(ll x,ll y){
	ll re=1;
	while(y>0){
		if(y%2)re=re*x%hell;
		x=x*x%hell;
		y=y/2;
	}
	return re;
}
ll fun(ll x,ll y,ll X,ll Y){
	ll ans=p[abs(X+Y-x-y)];
	ans=ans*power(p[abs(X-x)],hell-2)%hell;
	ans=ans*power(p[abs(Y-y)],hell-2)%hell;
	return ans;
}
int main(){
	cin>>nn>>mm>>n;
	for(ll i=0;i<n;i++){
		ll x,y;cin>>x>>y;
		v.push_back({x,y});
	}
	sort(all(v),cmp);
	p[0]=1;
	for(ll i=1;i<N;i++)p[i]=i*p[i-1]%hell;
	ll ans=fun(1,1,nn,mm);
	for(ll i=0;i<n;i++){
		qq[i]=fun(1,1,v[i].first,v[i].second);
		pp[i]=fun(v[i].first,v[i].second,nn,mm);
		for(ll j=0;j<i;j++){
			if(v[j].first<=v[i].first && v[j].second<=v[i].second){
				ll z=fun(v[j].first,v[j].second,v[i].first,v[i].second);
				qq[i]=(qq[i]-(qq[j]*z)%hell+hell)%hell;
			}
		}
		//cout<<qq[i]<<" "<<pp[i]<<endl;
	}
	for(ll i=0;i<n;i++){
		//5cout<<ans<<endl;
		ans=(ans-qq[i]*pp[i]%hell+hell)%hell;
	}
	cout<<ans<<endl;	
}


Measured memory_bytes: 3072
package main

import (
	"fmt"
)

func main() {
	var n, k int
	fmt.Scanf("%d %d", &n, &k)
	hasSnack := make(map[int]bool, n)
	for i := 0; i < n; i++ {
		hasSnack[i] = false
	}
	for i := 0; i < k; i++ {
		var d int
		fmt.Scanf("%d", &d)
		for j := 0; j < d; j++ {
			var a int
			fmt.Scanf("%d", &a)
			hasSnack[a-1] = true
		}
	}
	answer := 0
	for i := 0; i < n; i++ {
		if !hasSnack[i] {
			answer++
		}
	}
	fmt.Println(answer)
}


Measured memory_bytes: 2516
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
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; }

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  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;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//



int main() {
  ll x, k, d;
  cin >> x >> k >> d;
  x = abs(x);
  ll a = x%d;
  ll b = abs(a - d);
  ll c = x/d;
  ll ans;
  if (c > k) ans = x - d*k;
  else {
    ll e = k - c;
    if (e%2) ans = b;
    else ans = a;
  } 
  cout << ans << endl;
}

Measured memory_bytes: 3576
from sys import stdin, setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    S = input()
    count = 0
    for c in S:
        count += int(c)
    if count % 9 == 0:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()


Measured memory_bytes: 74064
#!/usr/bin/env python3

from heapq import heappush, heappop
import numpy as np

HUGE = 10 ** 15

def main():
    n, m = map(int, input().split())
    dist_mat = [[HUGE for j in range(n)] for i in range(n)]
    for i in range(m):
        a1, b1, c = map(int, input().split())
        dist_mat[a1 - 1][b1 - 1] = c
        dist_mat[b1 - 1][a1 - 1] = c
    shortest_path_mat = [dijkstra(i, dist_mat) for i in range(n)]
    res = 0
    for i in range(n):
        for j in range(i + 1, n):
            if dist_mat[i][j] != HUGE and shortest_path_mat[i][j] < dist_mat[i][j]:
                res += 1
    print(res)

def dijkstra(root, dist_mat):
    # rootからの距離のリストを返す (TLE本 p302)
    n = len(dist_mat)
    sp = [(0 if i == root else HUGE) for i in range(n)]  # Shortest path from root
    color = [(2 if i == root else 0) for i in range(n)]  # 0: unknown. 1: one path is found. 2: shortest path is found
    pq = []
    heappush(pq, (sp[root], root))
    while len(pq) > 0:
        sp_i_when_queued, i = heappop(pq)
        color[i] = 2
        if sp[i] < sp_i_when_queued:
            continue
        for j in range(n):  # Use adjacent list for speedup
            if dist_mat[i][j] == HUGE:
                continue
            if color[j] != 2 and sp[i] + dist_mat[i][j] < sp[j]:
                sp[j] = sp[i] + dist_mat[i][j]
                color[j] = 1
                heappush(pq, (sp[j], j))
    return sp

main()


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

const int MOD = 1000000007;
int N;

vector<map<string, ll>> memo(N+1);
vector<string> ch = { "A", "C", "G", "T" };
vector<string> bad = { "AGC", "ACG", "GAC", "AGGC", "ATGC", "AGTC" };

bool ok(string str) {
    for (string target : bad) {
        if (str.find(target) != string::npos) return false;
    }
    return true;
}

ll dfs(int cur, string str) {
    if (memo[cur].count(str)) return memo[cur][str];
    if (cur == N) return 1;
    ll ret = 0;
    for (string c : ch) {
        if (ok(str + c)) {
            ret = (ret + dfs(cur+1, str.substr(1)+c)) % MOD;
        }
    }
    memo[cur][str] = ret;
    return ret;
}


int main() {
    cin >> N;
    rep(i, N+1) memo.push_back(map<string, ll>());
    cout << dfs(0, "TTT") << endl;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
//	freopen("cake.in","r",stdin);
//	freopen("cake.out","w",stdout);
int sum=0;
	cin>>s;
	int len=s.length();
	for(int i=0;i<len;i++){
		sum+=(s[i]-'0');
		if(sum>=9) sum-=9;
	}
	if(!sum){
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 3756
#include "bits/stdc++.h"
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define setp(x) setprecision(x)
#define nep(x) next_permutation(x);
using namespace std;
using ull = unsigned long long;
using ll = long long;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;

int main() {
    int N;
    cin >> N;
    vector<ll> Mon(N + 1);
    for(int i = 0; i < N + 1; i++) cin >> Mon[i];
    vector<ll> Hero(N);
    for(int i = 0; i < N; i++) cin >> Hero[i];

    ull sum = 0;
    for(int i = 0; i < N; i++){
        if(Mon[i] < Hero[i]){
            ll over;
            sum += Mon[i];
            over = Hero[i] - Mon[i];
            if(Mon[i + 1] < over){
                sum += Mon[i + 1];
                Mon[i + 1] = 0;
            }else{
                Mon[i + 1] -= over;
                sum += over;
            }
        }else{
            sum += Hero[i];
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int   ll;
#define INF             1e14
#define dd              double
#define MOD             1000000007
#define my_sizeof(type) ((char *)(&type+1)-(char*)(&type)) 
#define nl              cout<<endl
#define fill(a,val)     memset(a,val,sizeof(a))
#define mp              make_pair
#define endl            "\n"
#define pb              push_back
#define ff              first    
#define ss              second
#define SIZE            200005
#define all(v)          v.begin(),v.end()
#define s(ar,n)         sort(ar,ar+n)
#define rs(ar,n)        sort(ar, ar+n, greater<ll>()) 
#define oa(a,n)         for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n)         for(ll i=0;i<n;i++)cin>>a[i];
#define maxa(ar,N)      *max_element(ar,ar+N)
#define mina(ar,N)      *min_element(ar,ar+N)
#define fastio()        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define printclock      cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ll power(ll x, ll y){
    ll res=1;x=x;
    while(y>0){
        if(y&1)
            res = (res*x);
        y = y>>1;
        x = (x*x);
    }
    return res;
}  
ll logtwo(ll n){
    if(n==1)
        return 0;
    return logtwo(n/2)+1;
}
signed main()
{
    fastio();   
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int t=1;
    //cin>>t;
    while(t--)
    {
        string s,t;
        cin>>s>>t;
        for(ll i=0;i<s.size();i++)
        {
            if(s[i]!=t[i])
            {
                cout<<"No"<<endl;
                return 0;
            }
        }
        cout<<"Yes"<<endl;
    }
}

Measured memory_bytes: 3652
n = int(input())
h = [int(x) for x in input().split()]
dp = [float("inf")]*(n+10)
dp[0] = 0
for i in range(n):
    if i<n-1:
        dp[i+1] = min(dp[i+1],dp[i]+abs(h[i+1]-h[i]))
    if i<n-2:      
        dp[i+2] = min(dp[i+2],dp[i]+abs(h[i+2]-h[i]))
print(dp[n-1])

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

using namespace std;

using ll = int_fast64_t;
constexpr ll llmax = INT_FAST64_MAX; // std::numeric_limits<int_fast64_t>::max()
constexpr ll llmin = INT_FAST64_MIN; // std::numeric_limits<int_fast64_t>::min()
using ull = uint_fast64_t;
constexpr ull ullmax = UINT_FAST64_MAX; // std::numeric_limits<uint_fast64_t>::max()

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RFOR(i, b, e) for (int i = ((e) - 1); (b) <= i; --i)
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define RREP(i, N) for (int i = ((N) - 1); 0 <= i; --i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    string S;
    cin >> S;
    if (S == "ABC"){
        cout << "ARC" << endl;
    } else if (S == "ARC"){
        cout << "ABC" << endl;
    }
}


Measured memory_bytes: 3620
import java.util.Scanner;
import java.util.ArrayList;
public class Main{
public static void main(String[] args) {
    try(Scanner sc = new Scanner(System.in)) {
        while(sc.hasNextLine()){
            String line=sc.nextLine();
            String[] tokens = line.split("[,. ]");
            ArrayList<String> list = new ArrayList<>();
            for(String t: tokens) {
                if(t.length() >= 3 && t.length() <= 6) {
                    list.add(t);
                }
            }
            System.out.println(String.join(" ", list.toArray(new String[0])));
        }
    }
}
}


Measured memory_bytes: 25928
#include<stdio.h>
#define N 8
#define FREE 0
#define NOT_FREE 1
int row[N],col[N],dpos[2*(N-1)],dneg[2*(N-1)];
void printBoard(int (*G)[N]){//出力
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(G[i][j]==1){//もし同じ列にQがいたら
	if(row[i]!=j){//
	  return;
	}
      }
    }
  }
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j){
	printf("Q");
      }else printf(".");
    }
    printf("\n");
  }
}
void putQueen(int (*G)[N],int i){
  int j;
  if(i==N){
    printBoard(G);
    return;
  }
  for(j=0;j<N;j++){
    if(col[j]==NOT_FREE || dpos[i+j]==NOT_FREE || dneg[i-j+N-1]==NOT_FREE){
      continue;
    }
    col[j]=NOT_FREE;
    dpos[i+j]=NOT_FREE;
    dneg[i-j+N-1]=NOT_FREE;
    row[i]=j;
    putQueen(G,i+1);
    col[j]=FREE;
    dpos[i+j]=FREE;
    dneg[i-j+N-1]=FREE;
  }
}
int main(){
  int i,j;
  int k,r,c;
  int G[N][N];
  for(i=0;i<N;i++){//行と列の初期化
    row[i]=FREE;
    col[i]=FREE;
    for(i=0;i<2*N-1;i++){//斜めの初期化
      dpos[i]=FREE;
      dneg[i]=FREE;
    }
    for(i=0;i<N;i++){
      for(j=0;j<N;j++){
	G[i][j]=0;
      }
    }
    scanf("%d",&k);
    for(i=0;i<k;i++){
      scanf("%d%d",&r,&c);
      G[r][c]=1;
    }
    putQueen(G,0);
    return 0;
  }
}





Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define FASTIO std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

typedef long long ll;
const int N = 2e5 + 5, mod = 998244353;
int a[N];
map<int, int>mp, bp;
int main () {
  FASTIO
  int n, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mp[a[i]]++;
  }
  bool flag = false;
  for (int i = 0; i < n; i++) {
    if (bp[a[i]])continue;
    mp[a[i]]--;
    flag = true;
    for (int j = 1; j < sqrt(a[i]) + 1; j++) {
      if (a[i] % j == 0) {
        if (mp[j]){
          flag = false;
          break;
        }
        if (mp[a[i] / j]){
          flag = false;
          break;
        }
      }
    }
    if (flag) {
      ans++;
    }
    else {
      bp[a[i]]++;
    }
    mp[a[i]]++;
  }
  cout << ans << endl;

}


Measured memory_bytes: 42736
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

    if(d==25)cout << "Christmas" << endl;
    else if(d==24)cout << "Christmas Eve" << endl;
    else if(d==23)cout << "Christmas Eve Eve" << endl;
    else if(d==22)cout << "Christmas Eve Eve Eve" << endl;

    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mem(a,b) memset((a),(b),sizeof(a))
#define MP make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
using namespace std;
#define _GLIBCXX_PERMIT_BACKWARD_HASH
#include <ext/hash_map>
using namespace __gnu_cxx;
struct str_hash{size_t operator()(const string& str)const{return __stl_hash_string(str.c_str());}};
typedef long long ll;
typedef unsigned long long ull;
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDD pair<double,double>
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-8;
const int MAX=1e5+10;
const ll mod=1e9+7;
int main()
{
	int i,n,x;
	while(~scanf("%d",&n))
	{
		vector<int> ans;
		for(i=0;i<n;i++)
		{
			scanf("%d",&x);
			ans.pb(x);
		}
		sort(all(ans));
		ans.resize(unique(all(ans))-ans.begin());
		printf("%d\n",sz(ans));
	}
	return 0;
}

Measured memory_bytes: 256
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    println!("{}",1110-read::<i32>())
}

Measured memory_bytes: 4352
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
 
  //   String[] nyu=sc.nextLine().split(" ");

     String nyu=sc.nextLine();
//int A=Integer.parseInt(nyu[0]);
//int B=Integer.parseInt(nyu[1]);
//int C=Integer.parseInt(nyu[2]);
int D=Integer.parseInt(nyu);


     String nyu2=sc.nextLine();
int E=Integer.parseInt(nyu2);



//double A=Double.parseDouble(nyu[0]);
//double B=Double.parseDouble(nyu[1]);
/*
switch(C){
case 7:
case 5:
case 3:
System.out.println("YES") ;
break;
default:
System.out.println("NO") ;

break;
}
*/

//int res=Math.min((A*B),C);

//for(String tem:nyu){
//if(tem.equals("1"))res++;
//}
//int res=0;
//for(int i=0;i<300;i++){
//if(num[i]==1)res=i;
//}

//char[] c = nyu.toCharArray();


//System.out.println(nyu+"-"+line_r_2+"-"+nyu2+"-"+line_r_1);


//if(nyu.equals(line_r_2) && nyu2.equals(line_r_1)){
//double res=Math.ceil((AB)/2);

System.out.println(D*D-E);
//}else if((int)c[0]>(int)c[2]){
//System.out.println(">");

//}else{
//System.out.println("NO");

//}




	}
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pl;


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

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

  ll ans=0;
  for(i=0;i<n;i++){
    // cout<<"i "<<i<<endl;
    if(a[i]-b[i]<0){
      ans+=a[i];
      int c=b[i]-a[i];
      if(a[i+1]-c<0){
        // cout<<"syo"<<endl;
        ans+=a[i+1];
        a[i+1]=0;
        // cout<<ans<<endl;
      }else{
        a[i+1]-=c;
        ans+=c;
      }
    }else{
      ans+=b[i];
    }
  }
  cout<<ans<<endl;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N,M;
    cin >> N >> M;
    int A[N];
    int sum=0;
    rep(i,N) {
        cin >> A[i];
        sum+=A[i];
    }
    int cou=0;
    string ans="Yes";
    rep(i,N){
        if(A[i]*4*M/sum>=1) cou++; 
    }
    if(cou<M) ans="No";
    cout << ans << endl;
    




}


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

using namespace std;

using ll=long long;
ll w[12][12];

void solve() {
    int n; cin >> n;
    vector<int> a = {1, 2, 4, 7, 12, 20, 29, 38, 52, 73};
    memset(w, 0, sizeof w);
    w[1][0] = w[0][1] = 1;
    ll M = 1;
    auto upd = [&](int x){
        vector<int> v(x);
        iota(v.begin(), v.end(), 0);
        ll mx = 0;
        do {
            ll sum = 0;
            for (int i = 1; i < x; i++) {
                sum += w[v[i-1]][v[i]];
            }
            mx = max(mx, sum);
        } while (next_permutation(v.begin(), v.end()));
        M = mx;
    };
    for (int i = 2; i < n; i++) {
        for (int j = 0; j < i; j++) {
            w[i][j] = w[j][i] = (M+1) * a[j];
        }
        upd(i+1);
        //cout << M << ' ';
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << w[i][j] << ' ';
        }
        cout << "\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


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

#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define rev(v) reverse(v.begin(), v.end());
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin());
#define io() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);srand(time(NULL));
using namespace std;

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

signed main(){
	io();
	int n; cin >> n;
	set<int>s;
	for(int i = 0; i < n; ++i){
		int x; cin >> x;
		s.insert(x);
	}
	cout << (s.size() == n ? "YES" : "NO") << '\n';
	return 0;
}

Measured memory_bytes: 12940
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int main(void){
	long long a, b;
	long long c, d;
	int k;
	int n, m;
	long s, t;
	long long x, y, z;
	long long ans;


	scanf("%d %lld %lld %lld %lld", &n,&a,&b,&c,&d);
	x = b - a;
	n--;
	ans = 0;
	for (int i = 0; i <= n;i++){
		y = (n - i)*c - (i*d);
		z = (n - i)*d - (i*c);
		if (y <= x&&x <= z)ans = 1;
	}
	if (ans == 0) printf("NO\n");
	else printf("YES\n");
	return 0;
}


Measured memory_bytes: 128
#https://atcoder.jp/contests/panasonic2020/submissions/10897671
def max(a, b)
    a > b ? a : b
end

def dfs(str, mx=A-1)
    if str.length == N
        puts str
        return
    end
    (A..mx+1).each do |i|
        nstr = str + i.chr
        dfs(nstr, max(mx, i))
    end
end

N=gets.to_i
A='a'.ord

dfs("")


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

int main(){

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

	int a, b, t ;
	cin >> a >> b >> t ;
	if(t/a != (t+1)/a)
        t-- ;
	cout << b*((t+1)/a) ;

}


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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef pair<int, int> pii;

int main(){
    fcin;

    int n, r;
    cin >> n >> r;

    if(n >= 10) cout << r << endl;
    else cout << r + 100 * (10 - n) << endl;
    return 0;
}



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

int main()
{
	int H, W;
	string s[55];

	cin >> H >> W;
	for (int i = 0; i < H; ++i)
	{
		cin >> s[i];
	}

	const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
	const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

	for (int i = 0; i < H; ++i)
	{
		for (int j = 0; j < W; ++j)
		{
			if (s[i][j] == '#')
			{
				continue;
			}
			int count = 0;
			for (int k = 0; k < 8; ++k)
			{
				int ni = i + dy[k];
				int nj = j + dx[k];

				if (ni < 0 || ni > H-1 || nj < 0 || nj > W-1)
				{
					continue;
				}
				if (s[ni][nj] == '#')
				{
					count++;
				}
			}
			s[i][j] = char(count + '0'); //どういうこと？
		}
	}

	for (int i = 0; i < H; ++i)
	{
		cout << s[i] << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut pairs = vec![];
    for i in 0..n {
        let v = read_vec::<i64>();
        pairs.push((v[0] - 1, v[1]));
    }
    let r_min = pairs.iter().map(|&x| x.1).min().unwrap();
    let l_max = pairs.iter().map(|&x| x.0).max().unwrap();

    let length_max = pairs.iter().map(|&x| x.1 - x.0).max().unwrap();
    let mut ans = length_max + max(0, r_min - l_max);

    pairs.sort_by_key(|x| (x.0, -x.1));

    let mut br = vec![1000_000_000; n + 1];
    for j in (0..n).rev() {
        br[j] = min(br[j + 1], pairs[j].1);
    }
    for i in 1..n {
        let temp = max(0, br[i] - l_max) + max(0, r_min - pairs[i - 1].0);
        ans = max(ans, temp);
    }
    println!("{}", ans);
}
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

inline int read() {
    char c; int x; for (c = getchar(); !isdigit(c); c = getchar());
    for (x = 0; isdigit(c); c = getchar()) { x = x * 10 + c - '0'; } return x;
}

const int dx[4] = {0, 0, 1, -1};
const int dy[4] = {1, -1, 0, 0};

const int N = 505;

int n, ans, dis[N][N];
bool used[N][N];

int main() {
    n = read();
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            dis[i][j] = std::min(std::min(i - 1, n - i), std::min(j - 1, n - j));
        }
    }
    for (int i = 0; i < n * n; i++) {
        int p = read();
        int x = (p - 1) / n + 1, _x = x;
        int y = (p - 1) % n + 1, _y = y;
        used[x][y] = true;
        std::deque<std::pair<int, int>> que;
        for (que.push_back({x, y}); !que.empty(); ) {
            x = que.front().first;
            y = que.front().second;
            que.pop_front();
            if (used[x][y]) {
                for (int k = 0; k < 4; k++) {
                    int vx = x + dx[k];
                    int vy = y + dy[k];
                    if (vx < 1 || vy < 1 || vx > n || vy > n) { continue; }
                    if (dis[vx][vy] > dis[x][y]) {
                        dis[vx][vy] = dis[x][y];
                        que.push_front({vx, vy});
                    }
                }
            } else {
                for (int k = 0; k < 4; k++) {
                    int vx = x + dx[k];
                    int vy = y + dy[k];
                    if (vx < 1 || vy < 1 || vx > n || vy > n) { continue; }
                    if (dis[vx][vy] > dis[x][y] + 1) {
                        dis[vx][vy] = dis[x][y] + 1;
                        que.push_back({vx, vy});
                    }
                }
            }
        }
        ans += dis[_x][_y];
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 5368
#include <stdio.h>
#include <stdlib.h>
 
int comp(const void *a, const void *b){
    return *(int*)a-*(int*)b;
}

int main(void){
  int N,r;
  scanf("%d",&N);
  int A[N+1];
  for(int i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  qsort(A,N,sizeof(int),comp);
  r=A[0];
  while(A[0]!=A[N-1]){
    r=A[0];
    for(int i=1;i<N;i++){
      if(A[i]%A[0]==0){
        A[i]=A[0];
      }
      else{
        A[i]=A[i]%A[0];
      }
    }
    qsort(A,N,sizeof(int),comp);
  }

  printf("%d",r);
  return 0;
}



Measured memory_bytes: 892