akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int checkNum(int, int);

int main(void)
{
    char *result = "NO";
    int sum = 0;
    int x, y, z;

    scanf("%d%d%d", &x, &y, &z);

    sum = checkNum(x, sum);
    sum = checkNum(y, sum);
    sum = checkNum(z, sum);

    if (sum == 17)
    {
        result = "YES";
    }
    puts(result);
    return 0;
}

int checkNum(int a, int b)
{
    switch (a)
    {
    case 5:
    case 7:
        b += a;
        break;
    defailt:
        break;
    }
    return b;
}

Measured memory_bytes: 1624
n, c = map(int, input().split())
XR = [list(map(int,input().split())) for i in range(n)]
XL = [[c-XR[i][0], XR[i][1]] for i in range(n)]
XL.sort()

CR = []
cal = 0
for i in range(n):
    dis = XR[i][0]
    cal += XR[i][1]
    CR.append([cal-dis, dis])


CSR = [CR[0][0]]
for i in range(n-1):
    CSR.append(max(CSR[i], CR[i+1][0]))

CL = []
cal = 0
for i in range(n):
    dis = XL[i][0]
    cal += XL[i][1]
    CL.append([cal-dis, dis])


CSL = [CL[0][0]]
for i in range(n-1):
    CSL.append(max(CSL[i], CL[i+1][0]))


# print(CSR)
# print(CSL)
# print(CR)
# print(CL)

ans = max(max(CSR), max(CSL))
for i in range(n-1):
    # print(CL[i][0]-CL[i][1]+CSR[n-2-i], CL[i][0],CL[i][1],CSR[n-2-i])
    ans = max(ans, CL[i][0]-CL[i][1]+CSR[n-2-i])
    ans = max(ans, CR[i][0]-CR[i][1]+CSL[n-2-i])

print(max(ans, 0))


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

int main() {
  int A,B,C,D,N,c;
  char n;
  A=0;
  string S,T;
  cin >> N >> S;
  vector<int>d(N);
  
  c=0;
  n=S.at(0);
  for(int i=0;i<(N-1);i++){
    if(S.at(c+1)==n){
      S.erase(c+1,1);
    }else{
      c++;
      n=S.at(c);
    }
  }
  
  A=S.size();
  cout << A << endl;

}





Measured memory_bytes: 896
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
	double d;
	int m, n, f, mold;
	cin >> m >> n;
	d = m / static_cast<double>(n);
	mold = m % n;
	f = m / n;
	cout << f << " " << mold << " ";
	cout.setf(ios::fixed);
	cout.setf(ios::showpoint);
	cout.precision(5);
	cout << d << endl;
	return 0;
}


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

//Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type / Class / Struct Definitions:
using ll = long long;
using ull = unsigned long long;

//Constants:
const int INF = (1ll << 30) - 1;  //nearly 1.07e9
const ll INFLL = 1ll << 60;       //nearly 1.15e18
const int MOD = 1e9 + 7;

//Global Variables:

//Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

//================ Main Loop ================
int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll lval = 4 * a * b;
    ll rvalsq = c - a - b;
    if(rvalsq > 0 && (ll)lval - rvalsq * rvalsq < 0ll)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}
//===========================================

//Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

template <class T>
inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}


Measured memory_bytes: 256
#dp

#dp[T] T分での最大幸福 幸福度B、時間A

N,T = map(int,input().split())

li = [list(map(int,input().split())) for _ in  range(N)]

li = sorted(li,key=lambda x: x[0])

dp = [0]*T
counter = 0
for i in range(N-1):
    A,B = li[i]
    counter = max(counter,max(dp)+B)
    if A>T-1:
        continue
    for t in range(T-A-1,-1,-1):
        dp[t+A]=max(dp[t]+B,dp[t+A])

print(max(max(dp)+li[N-1][1],counter))


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

int main(void)
{
    long long a, b, c, d, e;
    cin >> a >> b >> c;
    cin >> d;
    e = max(a, b);
    e = max(e, c);
   if(e == a)
   {
       long long sum = e;
       while(d--)
       {
           e = e*2;
       }
       cout << b+c+e;
   }
   else if(e == b)
   {
       long long sum = e;
       while(d--)
       {
           e = e*2;
       }
       cout << a+c+e;
   }
   else if(e == c)
   {
       long long sum = e;
       while(d--)
       {
           e = e*2;
       }
       cout << b+a+e;
   }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int a,b;
  while(cin>>a>>b,a+b){
    if(a%2&&b%2)cout<<"no"<<endl;
    else cout<<"yes"<<endl;
  }


}

Measured memory_bytes: 1152
s = raw_input()
t = raw_input()
sl = len(s)
tl = len(t)
p = -1
for i in range(sl-tl, -1, -1):
    for j in range(0, tl):
        if s[i+j] != '?' and s[i+j] != t[j]:
            break
    else:
        p = i
        break
if p == -1:
    print 'UNRESTORABLE'
else:
    u = s[0:p] + t + s[p+tl:]
    print u.replace('?', 'a')


Measured memory_bytes: 2568
#include<algorithm>
#include<cctype>
#include<cmath>
#include<iostream>
#include<map>
#include<vector>
using namespace std;
int main(){
    string S;cin >> S;

    if(S.size() != 4)
        return 0;

    if (!all_of(S.cbegin(), S.cend(), ::isdigit))
        return 0;

    bool ans = false;
    for(int i=0;i<=S.size()-1;i++){
        if(S[i] == S[i+1]){
            ans = true;            
        }
    }
    if(ans)
        cout << "Bad" << endl;
    else
        cout << "Good" << endl;
}

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

using namespace std;

const int N = 123456, mod = 1e9 + 7;

void add(int& x, int y) {
  x += y;
  if (x >= mod) {
    x -= mod;
  }
}

void sub(int& x, int y) {
  x -= y;
  if (x < 0) {
    x += mod;
  }
}

int n, f[N], g[N];
long long a, b, s[N];

class bit {
  int a[N];

 public:
  void modify(int x, int y) {
    while (x <= n) {
      add(a[x], y);
      x += x & -x;
    }
  }

  int sum(int x) {
    int result = 0;
    while (x) {
      add(result, a[x]);
      x -= x & -x;
    }
    return result;
  }

  int sum(int l, int r) {
    return (!l ? sum(r) + 1 : sum(r) - sum(l - 1) + mod) % mod;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> b;
  for (int i = 1; i <= n; ++i) {
    cin >> s[i];
  }
  s[n + 1] = 2e18;
  bit ftree, gtree;
  for (int i = 1, j1 = 1, j2 = 1, k1 = 1, k2 = 1; i <= n; ++i) {
    if (i != 1 && s[i] - s[i - 1] < a) {
      j1 = i;
    }
    while (k2 < i && s[i + 1] - s[k2] >= b) {
      gtree.modify(k2, g[k2]);
      ++k2;
    }
    f[i] = gtree.sum(j1 - 1, i - 1);
    if (i != 1 && s[i] - s[i - 1] < b) {
      j2 = i;
    }
    while (k1 < i && s[i + 1] - s[k1] >= a) {
      ftree.modify(k1, f[k1]);
      ++k1;
    }
    g[i] = ftree.sum(j2 - 1, i - 1);
  }
  cout << ((f[n] + g[n]) % mod) << '\n';
  return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using M = map<int, int>;
 
int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
 
  ll cntR = 0, cntG = 0, cntB = 0;
  rep(i, n) {
    if (s[i] == 'R') cntR++;
    else if (s[i] == 'G') cntG++;
    else if (s[i] == 'B') cntB++;
  }
 
  ll ans = cntR * cntG * cntB;
 
 
  rep(i, n) {
    repI(j, i+1, n) {
      int k = 2*j - i;
      if (k >= n) break;
      if (s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) ans--;
    }
  }
 
  cout << ans << endl;
 
  return 0;
}

Measured memory_bytes: 3636
fun main(args: Array<String>) {
    while(true)
    {
        var list = readLine()!!.split(" ")//.map(String::toDouble)
        var a = list[0].toInt()
        var b = list[2].toInt()

        if (list[1] == "+")
        {
            println("%d".format((a+b).toInt()))
        }
        else if (list[1] == "-")
        {
            println("%d".format((a-b).toInt()))
        }
        else if (list[1] == "*")
        {
            println("%d".format((a*b).toInt()))
        }
        else if (list[1] == "/")
        {
            println("%d".format((a/b).toInt()))
        }
        else
        {
            return
        }
    }
}


Measured memory_bytes: 31980
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define se cout << "test ok" << endl;
#define sp << " " <<
#define enl "\n";
using namespace std;
using ll=long long;
using ld=long double;
ll mod = ll(1e9)+7;
ll inf = ll(1e18);
void bl(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void bl2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(a>b){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

#include <iostream>
#include <vector>
#include <map>
using namespace std;

namespace dbg {
    using ll = long long;

    class Debug {
    public:
        Debug(){}
        template<typename T>
        void vd(vector<T> vec);
        template<typename T>
        void vd2(vector<vector<T>> vec);
        template<typename T>
        void ad(T *arr, ll n);
        template<typename T, size_t N>
        void ad2(T (&arr)[N], ll n);
        template<typename T>
        void md(T mp);
    };

    template<typename T>
    void Debug::vd(vector<T> vec) {
        for (auto vv : vec) cout << vv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::vd2(vector<vector<T>> vec) {
        for (auto vv : vec) for (auto vvv : vv) cout << vvv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::ad(T *arr, ll n) {
        for (int i = 0; i <= n; i++) cout << arr[i] << " ";
        cout << endl;
    }

    template<typename T, size_t N>
    void Debug::ad2(T (&arr)[N], ll n) {
        for (int i = 0; i <= N; i++) for (int j = 0; j <= n; j++) cout << arr[i][j] << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::md(T mp) {
        cout << "key : value" << endl;
        for (auto const &m : mp) cout << m.first << " : " << m.second << endl;
        cout << endl;
    }

}

#endif //INCLUDE_DEBUG_HPP

using dbg::Debug;
Debug debug;

class DFiveFiveEverywhere {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int n;
	    in >> n;
	    vector<ll> p;
        for(int i=2; i<=55555; i++){
            bool flg = true;
            for(int j=2; j*j<=i; j++){
                if(i%j == 0) flg = false;
            }
            if(flg && i%5 == 1) p.push_back(i);
        }

        for(int i=0; i<n; i++){
            out << p[i] << " ";
        }
        out << endl;
	}
};


int main() {
	DFiveFiveEverywhere solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main(){
  int a,b;
  cin>>a>>b;
  int count=0;
  for(int i=0;i<=a;i++){
    for(int j=0;j<=a;j++){
      if(b-i-j>=0&&b-i-j<=a)
        count++;
    }
  }
  cout<<count<<endl;
}

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

void kock(int n,double p1[],double p2[]){
  double th=M_PI*60.0/180.0;
  if(n==0) return;
  double s[2]={(p1[0]*2+p2[0])/3,(p1[1]*2+p2[1])/3};
  double t[2]={(p2[0]*2+p1[0])/3,(p2[1]*2+p1[1])/3};
  double u[2];
  u[0]=(t[0]-s[0])*cos(th)-(t[1]-s[1])*sin(th)+s[0];
  u[1]=(t[0]-s[0])*sin(th)+(t[1]-s[1])*cos(th)+s[1];
  kock(n-1,p1,s);
  cout<<s[0]<<" "<<s[1]<<endl;
  kock(n-1,s,u);
  cout<<u[0]<<" "<<u[1]<<endl;
  kock(n-1,u,t);
  cout<<t[0]<<" "<<t[1]<<endl;
  kock(n-1,t,p2);
}


int main(){
  int a;
  double p1[2]={0,0},p2[2]={100,0};
  cin>>a;
  cout<<p1[0]<<" "<<p1[1]<<endl;
  kock(a,p1,p2);
  cout<<p2[0]<<" "<<p2[1]<<endl;
  return 0;
}



Measured memory_bytes: 3252
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>

typedef long long int64;

int main(void) {
  int n, m;
  std::cin >> n >> m;
  std::cout << n * (n - 1) / 2 + m * (m - 1) / 2 << std::endl;
  return 0;
}


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

#define ll long long

void solve() {
  ll n;
  cin >> n;
  ll ans = 0;
  for (ll i = 1; i <= n; ++i)
    for (ll j = 1; i * j < n; ++j)
      ++ans;
  cout << ans << endl;
}

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

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	int n;cin>>n;
	int h[n+1];
	rep(i,n) cin>>h[i];h[n]=0;

	int ans=0,b[n+1];rep(i,n+1) b[i]=0;
	rep(i,n){
		if(h[i]>h[i+1])	b[i+1]=h[i]-h[i+1];
	}

/*	rep(i,n+1) cout<<b[i]<<" ";
	cout<<"\n";
*/
	rep(i,n+1) ans+=b[i];
	cout<<ans<<endl;
}

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

#define for0(i, n) for (ll i = 0; i < (ll)(n); ++i) // 0 based indexing
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (ll i = (ll)(l); i <= (ll)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (ll i = (ll)(n); i >= 1; --i) // reverse 1 based

#define ff first
#define ss second
#define pb push_back

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n,k;
	cin >> n >> k ;
	// k-n+1 to k + n-1 
	for(ll i = max((ll)-1000000,k-n+1);i<= min(k+n-1,(ll)1000000);i++){
		cout << i << " ";
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
 
//container util
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
 
int main(void){
 
	string s; cin >> s;
 
  ll N = s[0] - '0';
	REP(i,s.length()-1){
		N *= 10;
		N += 9;
	}
 
	int ans = 0;
	if(stol(s) == N){
		ans = s[0] - '0' + 9 * (s.length()-1);
	}else{
		ans = s[0] - '0' + 9 * (s.length()-1) - 1;
	}
 
	cout << ans << endl;
 
	
 
 
	return 0;
 
}

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

int main() {
	
	int a, b, c, ans;
	cin >> a >> b >> c;
	ans = c - (a-b);
	if(ans > 0)	cout << ans << endl;
	else cout << "0" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long int
#define endl "\n"
const int MOD=1e9+7;
#ifndef HOME
#define cerr if(0)cerr
#endif

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x,y,n1,n2,n3;
    cin>>x>>y>>n1>>n2>>n3;
    int a[n1],b[n2],c[n3];
    vector<pair<int,int>>v;
    for(int i=0;i<n1;i++){
        cin>>a[i];
        v.push_back({a[i],2});
    }
    for(int i=0;i<n2;i++){
        cin>>b[i];
        v.push_back({b[i],3});
    }
    for(int i=0;i<n3;i++){
        cin>>c[i];
        v.push_back({c[i],1});
    }
    sort(v.rbegin(),v.rend());
    int cnt = 0;
    int l,r;
    int ans = 0;
    l = r = 0;
    for(int i=0;i<v.size();i++){
        if(v[i].second == 1){
            if(l == x){
                r++;
            }else if(r == y){
                l++;
            }else{
                cnt++;
            }
            
            
        }
        if(v[i].second == 2){
            if(l == x){
                continue;
            }
            l++;
        }
        if(v[i].second == 3){
            if(r == y){
                continue;
            }
            r++;
        }
        // cerr<<v[i].first<<endl;
        ans += v[i].first;
        if(cnt + l + r == x + y){
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
    
}



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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
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; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
//template end

int dp[22][100010];

int main(){
    int n; scanf("%d",&n);
    vector<int> a(n);
    rep(i,0,n)scanf("%d",&a[i]);
    int l; scanf("%d",&l);
    rep(i,0,n)dp[0][i]=lower_bound(ALL(a),a[i]+l+1)-a.begin()-1;
    rep(i,0,20)rep(j,0,n)dp[i+1][j]=dp[i][dp[i][j]];
    int q; scanf("%d",&q);
    rep(rot,0,q){
        int l,r; scanf("%d%d",&l,&r); l--; r--;
        if(l>r)swap(l,r);
        int ans=1;
        rrep(i,19,-1)if(dp[i][l]<r){
            cerr<<l<<r<<endl;
            l=dp[i][l]; ans+=1<<i; 
        }
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 9472
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int a, b; cin >> a >> b;
    if (a > b) swap(a, b);
    string res, s = to_string(a);
    for (int i = 0; i < b; ++i)
        res += s;
    cout << res << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using ld = long double;
const int maxn = 1<<18;
void bad() {
	cout << "No";
	exit(0);
}
const int fu = -(1<<30);
array<int, 2> dp[maxn];
int n, c[maxn];
vector<int> g[maxn];
array<int, 2> merge(array<int, 2> a, array<int, 2> b) {
	if(a[0] == fu && b[0] == fu) return a;
	if(a[0] == fu || b[0] == fu) return b[0] == fu ? array<int, 2>{a[0], a[1]} : array<int, 2>{b[0]-1, b[1]+1};
	if((a[0]^b[0]^1)&1) bad();
	return {max(a[0], b[0]-1), min(a[1], b[1]+1)};
}
void dfs(int v, int p) {
	for(auto i : g[v]) if(i != p) {
		dfs(i, v);
		dp[v] = merge(dp[v], dp[i]);
	}
	if(dp[v][0] > dp[v][1]) bad();
}
bool can(int v, int x) {
	return (dp[v][0] == fu) || (((dp[v][0]^x)&1) == 0 && x >= dp[v][0] && x <= dp[v][1]);
}
void rec(int v, int p) {
	for(auto i : g[v]) if(i != p) {
		c[i] = c[v]-1;
		if(!can(i, c[i])) c[i] += 2;
		if(!can(i, c[i])) bad();
		rec(i, v);
	}
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	for(int f, t, i = 1; i < n; i++) {
		cin >> f >> t;
		g[f].push_back(t);
		g[t].push_back(f);
	}
	for(int i = 1; i <= n; i++) dp[i] = {fu, fu};
	int m, v, p;
	cin >> m;
	while(m--) {
		cin >> v >> p;
		dp[v] = {p, p};
	}
	dfs(1, 1);
	c[1] = dp[1][0];
	rec(1, 1);
	cout << "Yes\n";
	for(int i = 1; i <= n; i++) cout << c[i] << '\n';
}


Measured memory_bytes: 18560
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

typedef double P_type;
typedef double G_real; //実数の戻り値(float or double or long double)
const G_real P_eps = 1e-8; //整数の時はゼロ

struct P3{
  P_type x, y, z;
  P3(P_type x = 0, P_type y = 0, P_type z = 0): x(x), y(y), z(z) {}

  P3 operator-() const {
    return P3(-x, -y, -z);
  }

  P3 operator+(const P3 &B) const {
    return P3(x + B.x, y + B.y, z + B.z);
  }

  P3 operator-(const P3 &B) const {
    return P3(x - B.x, y - B.y, z - B.z);
  }

  P3 operator*(P_type a) const {
    return P3(x * a, y * a, z * a);
  }

  P3 operator/(P_type a) const {
    return P3(x / a, y / a, z / a);
  }

  P3& operator+=(const P3 &B) {
    x += B.x; y += B.y; z += B.z;
    return *this;
  }

  P3& operator-=(const P3 &B) {
    x -= B.x; y -= B.y; z -= B.z;
    return *this;
  }

  P3& operator*=(P_type a) {
    x *= a; y *= a; z *= a;
    return *this;
  }

  P3& operator/=(P_type a) {
    x /= a; y /= a; z /= a;
    return *this;
  }

  bool operator<(const P3 &b){
    if (abs(x - b. x) > P_eps) return x + P_eps < b.x;
    if (abs(y - b. y) > P_eps) return y + P_eps < b.y;
    return z + P_eps < b.z;
  }
};

P_type dot(P3 a, P3 b) {
  return a.x * b.x + a.y * b.y + a.z * b.z;
}

P3 cross(P3 a, P3 b) {
  P_type x = a.y * b.z - a.z * b.y;
  P_type y = a.z * b.x - a.x * b.z;
  P_type z = a.x * b.y - a.y * b.x;
  return P3(x, y, z);
}

double abs(P3 a) {
  return sqrt(dot(a, a));
}

double distanceSP(P3 a, P3 b, P3 c) {
  if (dot(b-a, c-a) < P_eps) return abs(c-a);
  if (dot(a-b, c-b) < P_eps) return abs(c-b);
  return abs(cross(b-a, c-a))/ abs(b-a);
}

int main(){
  int N, Q;
  int x[50], y[50], z[50], r[50];
  ll l[50];
  P3 p[50];

  scanf("%d%d", &N, &Q);

  for (int i=0; i<N; i++) {
    scanf("%d%d%d%d%lld", x+i, y+i, z+i, r+i, l+i);
    p[i] = P3(x[i], y[i], z[i]);
  }

  int ans = 0;

  for (int i=0; i<Q; i++) {
    int x, y, z;
    P3 s, d;

    scanf("%d%d%d", &x, &y, &z);
    s = P3(x, y, z);
    scanf("%d%d%d", &x, &y, &z);
    d = P3(x, y, z);

    ll sum = 0;

    for (int j=0; j<N; j++) {
      if (distanceSP(s, d, p[j]) < r[j] + P_eps)
        sum += l[j];
    }

    cout << sum << endl;
  }

  return 0;
}



Measured memory_bytes: 3228
S = input()
a = list(S)
if a[0] == a[1] and a[2] == a[3] and a[0] != a[2]:
    print("Yes")
elif a[0] == a[2] and a[1] == a[3] and a[0] != a[1]:
    print("Yes")
elif a[0] == a[3] and a[1] == a[2] and a[0] != a[1]:
    print("Yes")
else:
    print("No")


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

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define repr(i, N) for (ll i = N-1; i >= 0; i--)
#define repr1(i, N) for (ll i = N; i > 0; i--)

#define MOD 998244353

using ll = long long;
using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<P> vpi;
typedef pair<ll,ll> Pl;
typedef vector<ll> vl;
typedef vector<Pl> vpl;

ll gcd(ll a, ll b){
    if(a < b) swap(a, b);
    if(b <= 0) return -1;
    ll r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

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


int main() {
    int N, K;
    cin >> N >> K;
    vi p(N);
    rep(i, N) cin >> p[i];
    double ans = 0;
    
    rep(i, K) {
        ans += (p[i]+1)/2.0;
    }
    double tmp = ans;
    for(int i = K; i < N; i++) {
        tmp = tmp - (p[i-K]+1)/2.0 + (p[i]+1)/2.0;
        ans = max(ans, tmp);
    }

    //string ans = ( flag ? "Yes" : "No" );
    printf("%.8lf\n", ans);
    //cout << ans << "\n";
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  int s[N];
  rep(i,N){
    int W;
    cin >> W;
    s[i]=i==0?W:s[i-1]+W;
  }
  int ans=1000100;
  rep(i,N){
    ans=min(ans,abs(s[N-1]-s[i]*2));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import math
from operator import mul
from functools import reduce

s = int(input())
m = 10 ** 9 + 7

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

if s < 3:
    print(0)
else:
    element = math.floor(s / 3)
    ans = 0
    for i in range(1, element + 1):
        n = (s - 3 * i) + (i - 1)
        r = i - 1
        c = cmb(n, r)
        ans += c
    print(ans % m)


Measured memory_bytes: 9652
N = int(input())
A = list(map(int, input().split()))
ap = 0
xp = 0
xcount = 0
 
for i in range(N):
    a = A[i]
    x = (ap+xp)-a
    if x <= 0:
        xp = 0
    else:
        xp = x
    xcount = xcount + xp
    ap = a
print(xcount)

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

int main() {
    vector<string> s(3);
    vector<int> pos(3, 0);

    for (int i = 0; i < 3; i++) cin >> s[i];

    // Start the game from A
    // turn A = 0, turn B = 1, turn C = 2
    int turn = 0;
    while (pos[turn] != s[turn].size()) {
        turn = s[turn][pos[turn]++] - 'a';
    }

    cout << (char)(turn + 'A') << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
	int a,b;
	cin >> a >> b;
	if(a > 9 || a < 1 || b > 9 || b < 1){
		cout << "-1" << endl;
		return 0;
	}
	else cout << a*b << endl;
	return 0;

}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>

using namespace std;

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

    vector<string> S(N);

    vector<char> list = {'a', 'i', 'u', 'e', 'o'};

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

    for (int k=1; k<=50; k++) {
      set<string> code;
      bool ok=true;

      for (int i=0; i<N; i++) {
        string tmp;
		 tmp += S[i][0];
		 
        for (int j=0; j<S[i].size(); j++) {
          if (tmp.size() == k) break;

          if (j+1<S[i].size() && find(list.begin(), list.end(), S[i][j]) != list.end()) {
            tmp+=S[i][j+1];
          }
        }

        if (code.count(tmp)) {
          ok=false;
          break;
        } else {
          code.insert(tmp);
         // cerr << tmp << endl;
        }
      }

      if (ok) {
        cout << k << endl;
        goto end;
      }
    }
    cout << -1 << endl;
end:;
  }
}

Measured memory_bytes: 3160
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,M,X,Y;cin>>N>>M>>X>>Y;
  int mxx=X,miy=Y;
  repeat(i,N){
    int x;cin>>x;
    mxx=max(mxx,x);
  }
  repeat(j,M){
    int y;cin>>y;
    miy=min(miy,y);
  }
  cout << (miy-mxx>0? "No War":"War")<<endl;
  return 0;
}


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

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

const int INF = 100000000;
const double PI=acos(-1);

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) {
        cin >> A[i];
    }

    sort(A.begin(),A.end());
    
    ll A_max = A.back();
    ll A_min = A.front();

    ll B[N-2][2];
    rep(i,N-2) {
        if (A[i+1]>0) {
            B[i][0] = A_min;
            B[i][1] = A[i+1];
            A_min -= A[i+1];
        }
        else {
            B[i][0] = A_max;
            B[i][1] = A[i+1];
            A_max -= A[i+1];
        }
    }
    cout << A_max - A_min << endl;
    rep(i,N-2) {
        cout << B[i][0] << " " << B[i][1] << endl;
    }

    cout << A_max << " " << A_min << endl;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define DBG(v) cerr << #v << " = " << (v) << endl;

const int MxN = (int) 2e5 + 9;
int nxt[MxN + 9];
int dist[MxN + 9];

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);

	int n;
	ll K;
	cin >> n >> K;
	vector<int> a(n);
	for (int &x : a)
		cin >> x;

	vector<int> dp(n + 1, 0);
	map<int, int> mp;
	for (int i = n - 1; i >= 0; --i) {
		if (mp.count(a[i]))
			dp[i] = dp[mp.at(a[i]) + 1];
		else
			dp[i] = a[i];
		mp[a[i]] = i;
	}

	nxt[0] = dp[0];
	for (int x = 1; x <= MxN; ++x) {
		if (mp.count(x))
			nxt[x] = dp[mp.at(x) + 1];
	}

	memset(dist, -1, sizeof dist);
	int cLen;
	for (int d = 0, x = 0;; x = nxt[x], ++d) {
		if (dist[x] == -1)
			dist[x] = d;
		else {
			cLen = d - dist[x];
			break;
		}
	}

	K -= 4 * MxN;
	if (K > 0)
		K %= cLen;
	K += 4 * MxN;

	int x = 0;
	for (; K > 1; K--)
		x = nxt[x];

	vector<int> v;
	set<int> s;
	if (x) {
		v.push_back(x);
		s.insert(x);
	}

	for (const int x : a) {
		if (!s.count(x)) {
			s.insert(x);
			v.push_back(x);
		} else
			while (s.count(x)) {
				assert(!v.empty());
				s.erase(v.back());
				v.pop_back();
			}
	}
	for (int x : v)

		cout << x << ' ';
	return 0;
}


Measured memory_bytes: 24180
function Main(input) {
	var line = input.split('\n');
	var line1 = line[1].split(' ');
	var n = parseInt(line[0], 10);
	var num = new Array(n);
	var f = 0;
	for(var i=0; i<n; i++){
		num[i] = parseInt(line1[i], 10);
		if(num[i]%2 == 0){
			if(!(num[i]%3 == 0 || num[i]%5 == 0)){
				f = 1;
			}
		}
	}
	if(f == 0){
		console.log('APPROVED');
	}else{
		console.log('DENIED');
	}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
import collections

s=list(input())
t=list(input())
s = collections.Counter(s)
t = collections.Counter(t)
sc=s.most_common()
tc=t.most_common()
ans = True
for i in range(min(len(sc), len(tc))):
    if sc[i][1] != tc[i][1]:
        ans = False

if(ans):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 6832
a,b,c,d=map(int,input().split())
judg=True
while(judg==True):
    c-=b
    if c<=0:
        judg = False
        break
    a-=d
    if a<=0:
        judg = False
        break
if a<=0:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 9156
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n, p = 0, lst = 1;
	cin >> n;
	vector<int> a(n);
	for(auto &i : a) cin >> i;
	sort(a.begin(), a.end());
	for(auto i : a) {
		if(lst == 0) lst = 1;
		else lst = (i-p)&1;
		if(p && n-- == 1) return cout << (lst ?"First":"Second"), 0;
		else if(n <= i-p) return cout << ((n%2!=(i-p)%2)?"First":"Second"), 0;
		n -= i-p;
		if(i != p) lst = 0;
		p = i;
	}
}


Measured memory_bytes: 640
#include<iostream>
#include<math.h>
#include<string.h>
using namespace std;

int main(){
    int N;
    string S;
    cin >> N>>S;
    if( N % 2 == 0 ){
        string a=S.substr(N/2);
        string b=S.substr(0,N/2);
        if(strcmp(a.c_str(),b.c_str())==0){
            cout<<"Yes"<<endl;

        }
        else{
            cout<<"No"<<endl;
        }
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
/*package whatever //do not write package name here */

import java.io.*;
import java.util.*;
public class Main {
	public static void main (String[] args) {
	     Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    //String ss=s.next();
    long sum=0;
    for(int i=1;i<=n;i++){
        if(i%3!=0&i%5!=0)
        sum+=i;
    }
    //if(ss.contains("7"))
    System.out.println(sum);
    
	}
}

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

int main() {
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;

    string ans = "Yay!";
    if(e - a > k)
      ans = ":(";

    cout << ans << endl;

    return 0;  

}

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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef pair<string,string> string2;
vector<string2> classInfo;
vector<string2> teacher[110],student[110];
int numTeacher,numStudent;

string2 split(string s){
  string2 ret;
  s[5] = ' ';
  stringstream ss;
  ss << s;
  ss >> ret.first >> ret.second;
  return ret;
}

int main(){
 string s;
  int n;
  cin >> n;
  rep(i,n) {
    cin >> s;
    classInfo.push_back(split(s));
  }
  cin >> numTeacher;
  rep(i,numTeacher) {
    cin >> n;
    rep(j,n) {
      cin >> s;
      teacher[i].push_back(split(s));
    }
  }

  cin >> numStudent;
  rep(i,numStudent) {
    cin >> n;
    rep(j,n) {
      cin >> s;
      student[i].push_back(split(s));
    }
  }

  int maxi = 0;
  rep(i,classInfo.size()){
    int enableTeacher = 0, enableStudent = 0;
    rep(j,numTeacher) {
      bool enable = false;
      rep(k,teacher[j].size()) if( teacher[j][k].first <= classInfo[i].first && classInfo[i].second <= teacher[j][k].second ) { enable = true; break; }
      if( enable ) { ++enableTeacher; }
    }
    rep(j,numStudent) {
      bool enable = false;
      rep(k,student[j].size()) if( student[j][k].first <= classInfo[i].first && classInfo[i].second <= student[j][k].second ) { enable = true; break; }
      if( enable ) { ++enableStudent; }
    }
    maxi += min(enableTeacher,enableStudent);
  }
  cout << maxi << endl;

  return 0;
}

Measured memory_bytes: 3548
import sys

input_methods=['clipboard','file','key']
using_method=1
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	#a = int(input())
	n, a, b = tin()
	#s = input()
	if n < a+b-1:
		return -1
	if n > a*b:
		return -1
	if a == 1:
		print(*list(range(n,0,-1)))
		return 
	if b==1:
		print(*list(range(1, n+1)))
		return 
	
	al = list( range(1, n+1))
	cc = (n - a) // (b-1)
	amari = (n - a) % (b-1)
	ret = al[-a:]
	st=n-a
	for bi in range(b-1):
		na = cc + (1 if bi < amari else 0)
		st -= na
		for ai in range(na):
			ret.append(al[st+ai])
	print(*ret)
		
		
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 101748
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
int main()
{
    string s;
    cin >> s;
    long long int k;
    cin >> k;
    int i = 0;
    while(i < s.size() &&s[i] == '1')
        i++;
    cout << (i>=k?'1':s[i]);
	return 0;
}	


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

inline bool check(const string &s, const string &ans, int p){
  int n = s.size();
  if( (s[p]=='x') xor (ans[p]=='S') ) return ans[(p+n-1)%n] == ans[(p+1)%n];
  else return ans[(p+n-1)%n] != ans[(p+1)%n];
}

inline string solve(const string &s, int start){
  string ans = "";
  ans += (start%2 ? "S" : "W");
  ans += (start/2 ? "S" : "W");

  for(int i=1;i<(int)s.size()-1;i++){
    if( (s[i]=='x') xor (ans[i]=='S') ) ans += ans[i-1];
    else if(ans[i-1] == 'S') ans += 'W';
    else ans += 'S';
  }
    
  if( check(s,ans,0) and check(s,ans,s.size()-1) ) return ans;
  return "-1";
}

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

  rep(i,4){
    string tmp = solve(s,i);
    if(tmp != "-1"){
      cout << tmp << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define f0(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
#define f2(i,a,b) for(int i=a;i>b;i--)
#define f3(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define int long long
#define fi first
#define se second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test int t;cin>>t;while(t--)

signed main(){
    fast

    int n;
    cin>>n;
    int a[n];
    f0(i,0,n)cin>>a[i];sort(a,a+n);int c=0;
   f0(i,0,n-2)
   {
       f0(j,i+1,n-1)
       {
          f0(k,j+1,n)
          {if(a[i]==a[j]||a[j]==a[k])continue;
              if(a[i]+a[j]>a[k])c++;
              //cout<<a[i]<<a[j]<<a[k]<<endl;
          }
       }
   }cout<<c<<endl;
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a, b) accumulate(all(a), b)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
typedef unsigned long long ull;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
ll const INF = 1e18;

template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    ll n;
    cin >> n;
    ll ans = 0;
    for(ll i=1; i*(i+1)<n; i++){
        if(n%i == 0){
            ans += n/i - 1;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

typedef long long ll;

ll gcd(ll a,ll b) {
	return b?gcd(b,a%b):a;
}

inline bool solve(ll k,ll x,ll m,ll n) {
	if(x<k||k>n) return false;
	if(m>=k) return true;
	ll a=m-k,b=gcd(n,k),c=x%b;
	ll d=(a/b-1)*b+c;
	while(d<a) d+=b;
	return d>=0;
}

int main() {
	int T; scanf("%d",&T);
	while(T--) {
		ll a,b,c,d;
		scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
		puts(solve(b,a,c+1,d)?"Yes":"No");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define dll(x) scanf("%I64d",&x)
#define xll(x) printf("%I64d\n",x)
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define gg(x) getInt(&x)
#define db(x) cout<<"== [ "<<x<<" ] =="<<endl;
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll powmod(ll a,ll b,ll MOD){ll ans=1ll;while(b){if(b&1)ans=ans*a%MOD;a=a*a%MOD;b>>=1;}return ans;}
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/

int main()
{
	//    freopen("C:\\Users\\DH_M\\Desktop\\code_io\\in.txt.txt","r",stdin);
	//    freopen("C:\\Users\\DH_M\\Desktop\\code_io\\out.txt.txt","w",stdout);
	ll x;
	cin>>x;
	if(x<1200)
    {
        cout<<"ABC"<<endl;
    }else{
        cout<<"ARC"<<endl;
    }

    return 0;
}

inline void getInt(int* p) {char ch;do {ch = getchar();}
while (ch == ' ' || ch == '\n');if (ch == '-') {*p = -(getchar() - '0');
while ((ch = getchar()) >= '0' && ch <= '9') {*p = *p * 10 - ch + '0';}}
else {*p = ch - '0';while ((ch = getchar()) >= '0' && ch <= '9')
{*p = *p * 10 + ch - '0';}}}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
int main(){
    int n;
    cin >> n;
    if(n % 1000 == 0) cout << 0 << endl;
    else cout << 1000 - (n%1000) << endl;
    return 0;
}


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

#define IOS                               \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);                      \
	cin.exceptions(cin.failbit);
#define int long long int //Comment when Unnecessary
#define sz(a) (int)((a).size())
#define all(a) a.begin(), a.end()
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define pii pair<int, int>
#define vi vector<int>
#define F first
#define S second
#define endl "\n" // Remove on Interactive

const int N = 59;
const int mod = 1000000007;

int dis[N][N];
int n, m, a, b;
vector<pii> gp;
vector<pii> G;
vi z;

int pow2(int a)
{
	if (a == 0)
		return 1;
	int x = pow2(a / 2);
	x *= x;
	if (a % 2)
		x *= 2;
	return x;
}

void pre()
{
	rep(i, 0, N)
	{
		rep(j, i + 1, N)
		{
			dis[i][j] = dis[j][i] = mod;
			dis[i][i] = 0;
		}
	}
}

int32_t main()
{
	IOS;
	pre();
	cin >> n;
	rep(i, 1, n)
	{
		cin >> a >> b;
		a--, b--;
		dis[a][b] = dis[b][a] = 1;
		G.push_back({a, b});
	}
	cin >> m;
	rep(i, 0, m)
	{
		cin >> a >> b;
		a--, b--;
		gp.push_back({a, b});
	}
	rep(k, 0, N)
	{
		rep(i, 0, N)
		{
			rep(j, 0, N)
			{
				dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
			}
		}
	}
	int prev = 0;
	rep(i, 0, m)
	{
		int x = 0;
		rep(j, 0, (n - 1))
		{
			int see = dis[G[j].F][gp[i].F] + dis[gp[i].S][G[j].F];
			int see1 = dis[gp[i].F][gp[i].S];
			int see2 = dis[G[j].S][gp[i].S] + dis[gp[i].F][G[j].S];
			if (see1 == see && see1 == see2)
			{
				x += (pow2(j));
			}
		}
		z.push_back(x);
	}
	int ans = 0;
	rep(i, 1, pow2(m))
	{
		int cnt = __builtin_popcountll(i);
		int sg = -1;
		if (cnt & 1)
		{
			sg = 1;
		}
		int x = 0;
		rep(j, 0, m)
		{
			if (((pow2(j)) & i) != 0)
			{
				x |= z[j];
			}
		}
		cnt = __builtin_popcountll(x);
		ans += (sg * (pow2(n - 1 - cnt)));
	}
	ans = (pow2(n - 1)) - ans;
	cout << ans << endl;
	return 0;
}

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

int main(){
  int a,b,c,d; cin>>a >>b >>c >>d;
  if(abs(a-c)<=d){
    cout<<"Yes"<<endl;
  }else if(abs(a-b)<=d && abs(b-c)<=d){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
"use strict";
main(
  require("fs")
    .readFileSync("/dev/stdin", "UTF-8")
    .trim()
    .split("\n")
);

/**
 *
 * 英大文字からなる文字列S(長さN)
 * 連続する文字列'ABC'がいくつ含まれているかを回答
 */

function main(input) {
  const N = Number(input.shift());
  input = input[0];

  let count = 0;

  for (let i = 0; i < N - 2; i++) {
    if (input[i] === "A") {
      if (input[i + 1] === "B" && input[i + 2] === "C") {
        count++;
        i += 2;
      }
    }
  }

  console.log(count);
}


Measured memory_bytes: 7372
package main
import (
  "fmt"
)
func main() {
  var s string
  fmt.Scan(&s)
  var result string
  if s == "Sunny" {
    result = "Cloudy"
  } else if s == "Cloudy" {
    result = "Rainy"
  } else {
    result = "Sunny"
  }
  fmt.Println(result)
}

Measured memory_bytes: 512
def main(n):
	r = 0
	if(n[0] =="0"):
		# zero mode
		return sum((((i % 2 == 0) and (n[i] == "1")) or ((i % 2 != 0) and n[i] == "0")) for i in range(1, len(n)))
	else:
		# one mode
		return sum((((i % 2 == 0) and (n[i] == "0")) or ((i % 2 != 0) and n[i] == "1")) for i in range(1, len(n)))

print(main(input()))
#assert(1 == main("000"))
#assert(3 == main("10010010"))
#assert(0 == main("0"))

Measured memory_bytes: 3188