akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#define ull unsigned long long
using namespace std;
const int nmax = 510;
int ans[nmax];
int c[nmax],s[nmax],f[nmax];
int N;
int main()
{
    cin >> N;
    --N;
    for(int i = 0 ; i < N; ++i)
    {
        cin >> c[i] >> s[i] >> f[i];
    }
    for(int i = N-1;i>=0;--i)
    {
        ans[i] = s[i] + c[i];
        for(int j = i+1;j<N;++j)
        {
            if(ans[i]<=s[j]) ans[i] = s[j];
            else             ans[i] += ans[i]%f[j]==0? 0 : (f[j]-(ans[i]%f[j]));
            ans[i]+=c[j];
        }
    }
    for(int i = 0 ; i < N; ++i)
    cout << ans[i] << endl;
    cout << 0 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i > 0; i--)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
template <typename Iter> std::string join(Iter begin, Iter end, std::string const& separator){ std::ostringstream result; if (begin != end){ result << *begin++; }; while (begin != end){ result << separator << *begin++; }; return result.str(); }
using namespace std;
typedef long long ll;
void solve() {
  ll a; cin >> a;
  string s; cin >> s;
  if(a >= 3200) {
    cout << s << endl;
  } else {
    cout << "red" << endl;
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
 int i,n,s[100000],q,t[50000],left,right,mid,ans=0;

 scanf("%d",&n);

 for(i=0;i<n;i++){
  scanf("%d",&s[i]);
 }

 scanf("%d",&q);

 for(i=0;i<q;i++){
  scanf("%d",&t[i]);
 }

 for(i=0;i<q;i++){

  left=0;
  right=n;

  while(left<right){

   mid=(left+right)/2;
   if(s[mid]==t[i]){
    ans++;
    break;
   }else if(t[i]<s[mid]){
    right=mid;
   }else{
    left=mid+1;
   }
  }
 }

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

 return 0;
}

Measured memory_bytes: 2288
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m;
int main()
{
    ll t;
    scanf("%lld",&t);
    n=0;
    m=0;
    ll a,b;
    while(t--)
    {
        scanf("%lld%lld",&a,&b);
        if(a==b)
        {
            n++;
        }
        else
        {
            n=0;
        }
        if(n>=3)
        {
            m=1;
        }
    }
    if(m)
        printf("Yes\n");
    else
        printf("No\n");
}


Measured memory_bytes: 3756
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && b == c)cout << 1 << endl;
    else if (a == b || b == c || a == c)cout << 2 << endl;
    else cout << 3 << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <iostream>
#include <queue>
#include <limits>
#include <math.h>
#include <string>
#include <map>

using namespace std;

int main() {
  int n, p;
  cin >> n >> p;
  map<int, int> m;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    m[a % 2]++;
  }
  if (p == 0 && m[0] == n) {
    long long ans = pow(2, (long long)n);
    cout << ans << endl;
  } else if (p == 1 && m[0] == n) {
    cout << 0 << endl;
  } else {
    long long ans = pow(2, (long long)(n - 1));
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
# python3

#===============================================================================
from collections import defaultdict, Counter
from functools import lru_cache
from heapq import heappush, heappop
from math import gcd, floor, ceil
from sys import stdin, stdout

def ilist():
    return [int(x) for x in stdin.readline().strip().split(" ")]
def iint():
    return int(stdin.readline().strip())
def istr():
    return stdin.readline().strip()
#===============================================================================


def solve(A):
    N = len(A)
    res = 0
    X = [A[i] + i for i in range(N)]
    Y = [A[i] - i for i in range(N)]
    #print(X, Y)
    d1 = Counter(X)
    d2 = Counter(Y)
    #print(d1, d2)
    for k in d1:
        res += d1[k] * d2[-k]
    return res


if __name__ == '__main__':
    N = iint()
    A = ilist()
    print(solve(A))


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

#include <atcoder/all>
#define repp(i, l, r) for (long long i = (l); i < (r); i++)
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define per(i, n) for (long long i = (n); i >= 0; --i)
#define all(v) v.begin(), v.end()
const int INF = 1 << 30;
const long long LINF = 1LL << 60;
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
//ミョ(-ω- ?)
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    ll n, m;
    cin >> n >> m;
    atcoder::dsu uf(n);

    rep(i, m) {
        ll a, b;
        cin >> a >> b;
        uf.merge(a - 1, b - 1);
    }
    cout << uf.groups().size() - 1<< "\n";

    return 0;
}

Measured memory_bytes: 9004
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 1000001;
const int MOD = 1000000007;
   
        signed main() {
           int a,b,c;
          cin>>a>>b>>c;
          if((a<c&&c<b)||(b<c&&c<a))cout<<"Yes";
          else cout<<"No";
           return 0;

        }


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

//解説AC
int N,M;
char s[110][110];

int dp[110][110];

int dx[2]={1,0};
int dy[2]={0,1};

signed main(){
	cin>>N>>M;
	REP(i,N){
		cin>>s[i];
	}
	REP(i,N)REP(j,M){
		dp[i][j]=INF;
	}
	if(s[0][0]=='#'){
		dp[0][0]=1;
	}
	else{
		dp[0][0]=0;
	}
	REP(i,N){
		REP(j,M){
			REP(k,2){
				int nx=i+dx[k],ny=j+dy[k];
				if(nx>=N||ny>=M)continue;
				int cost=0;
				if(s[i][j]=='.'&&s[nx][ny]=='#'){
					cost=1;
				}
				dp[nx][ny]=min(dp[nx][ny],dp[i][j]+cost);
			}
		}
	}
	cout<<dp[N-1][M-1]<<endl;
	return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize("O3")
#include <atcoder/all>
using namespace atcoder;
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

using mint = modint998244353;
const int P = 998244353;
ostream& operator<<(ostream& out, mint m){
  out << m.val();
  return out;
}

struct classcomp {
  bool operator() (const vector<int>& lhs, const vector<int>& rhs) const
  {return SZ(lhs)<SZ(rhs);}
};

multiset<vector<int>, classcomp> secik;
int n;
vector<mint> sko,sil;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> n;n*=2;
  map<int,int> il;
  sko.resize(n+1);
  sil.resize(n+1);
  sko[0] = 1;
  sko[1] = 1;
  sil[0] = 1;
  R(i,n){
    if(i){
      sko[i+1] = sko[i] + sko[i-1] * 2 * i * (2 * i-1);
    }
    sil[i + 1] = sil[i] * (i+1);
    int pom;
    cin >> pom;
    il[pom]++;
  }
  debug(sko);
  for(PII el:il){
    vector<int> pom(el.SE/2+1);
    R(i,el.SE/2+1){
      pom[i] = (sil[el.SE] / sil[i*2] / sil[el.SE - 2 * i]  * sko[i]).val();
    }
    secik.insert(pom);
  }
  while(SZ(secik)!=1){
    vector<int> a = *secik.begin();
    secik.erase(secik.begin());
    vector<int> b = *secik.begin();
    secik.erase(secik.begin());
    secik.insert(convolution(a, b));
  }
  vector<int> t = *secik.begin();
  mint res = 0;
  R(i,SZ(t)){
    if(i & 1){
      res -= sko[n/2 - i] * t[i];
    }else{
      res += sko[n/2 - i] * t[i];
    }
  }
  cout << res << "\n";
}


Measured memory_bytes: 19576
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#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)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    string S;
    cin >> S;
    if(S.compare("Sunny")==0) cout << "Cloudy";
    if(S.compare("Cloudy")==0) cout << "Rainy";
    if(S.compare("Rainy")==0) cout << "Sunny";

    cout << endl;
}


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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ODD(x) (((x)&1)==0?(0):(1))
#define sign(x) ((x > 0) - (x < 0))
std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }


void READ(bool _local){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    if (_local)
        freopen ("in.txt", "r", stdin);
#endif
}

int main() {
    READ(0);
    int n,k,q;cin>>n>>k>>q;
    vi cnt(n,k-q);
    FOR(i,q){
        int x;cin>>x;
        cnt[x-1]++;
    }
    FOR(i,n) cout << (cnt[i]>0?"Yes":"No") << '\n';
    return 0;
}



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

int main(){
  int N;
  cin>>N;
  vector<int> vec(N);
  for(int i=0;i<N;i++)
    cin>>vec.at(i);
  sort(vec.begin(),vec.end());
  int alice=0;
  int bob=0;
  reverse(vec.begin(),vec.end());
  for(int i=0;i<N;i++){
    if(i%2==0)
      alice+=vec.at(i);
    else
      bob+=vec.at(i);
  }
  cout<<alice-bob<<endl;
}

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

int D[35][35];
int G1[35], G2[35], G3[35];

int main() {
    int N, C, c;
    scanf("%d %d", &N, &C);
    for (int i = 1; i <= C; i++) {
        for (int j = 1; j <= C; j++) scanf("%d", &D[i][j]);
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            scanf("%d", &c);
            if ((i + j) % 3 == 0) G1[c]++;
            else if ((i + j) % 3 == 1) G2[c]++;
            else if ((i + j) % 3 == 2) G3[c]++;
        }
    }
    int ans = 1000000000;
    for (int i = 1; i <= C; i++) {
        for (int j = 1; j <= C; j++) {
            if (j == i) continue;
            for (int k = 1; k <= C; k++) {
                if (k == i || k == j) continue;
                int sum = 0;
                for (int l = 1; l <= C; l++) {
                    sum += G1[l] * D[l][i] + G2[l] * D[l][j] + G3[l] * D[l][k];
                }
                ans = min(ans, sum);
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

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

int main() {
  int N; cin >> N; // 頂点の個数
  int X; cin >> X; // 追加線の点１
  int Y; cin >> Y; // 追加線の点２

  map<int,int> M; // 最短距離と経路数のマップ

  int wk_d; // ２点間の距離
  rep(i,N-1){     // 左側の点
    for(int j=i+1;j<N;j++){
      // ２点間の距離を求めて、マップでカウント
      wk_d = min(abs(j-i),abs(X-1-i)+abs(Y-1-j)+1);
      M[wk_d]++;
//      cout << "i:" << i << " j:" << j << " wk_d:" << wk_d << " M[wk_d]:" << M[wk_d] << endl;
    }
  }
  rep(i,N-1){
    cout << M[i+1] << endl;
  }  
  
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <set>
#include <functional>
#include <cmath>
#include <set>
#include <map>


//マクロ
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
#define All(a) (a).begin(),(a).end()
#define RAll(a) (a).rbegin(),(a).rend()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define INFL 1e18
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;
using Graph = vector<vector<int>>;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数

//使用する関数
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 (a > b) { a = b; return 1; }
	return 0;
}

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

	int n;
	cin >> n;
	ll max = (ll)1e18;
	ll a;
	cin >> a;
	bool f = false;
	REP(i, n - 1) {
		ll b;
		cin >> b;
		//cout << a << " " << b<<endl;
		if (b == 0) {
			cout << 0 << endl;
			return 0;
		}
		if (!f && max / a < b) {
			f = true;
			continue;
		}

		a *= b;
	}
	if (f) {
		cout << -1 << endl;
	}
	else {
		cout << a << endl;
	}
}

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

int main(){
	int n;
  	cin>>n;
	vector<vector<long long>> dp(n);  	
	vector<vector<long long>> v;
  
  for(int i=0;i<n;i++){
  	long long a,b,c;
    cin>>a>>b>>c;
    v.push_back({a,b,c});
  }
  dp[0]=v[0];
  for(int i=1;i<n;i++){
  	dp[i]={0,0,0};
  	for(int j=0;j<3;j++){
    	for(int k=0;k<3;k++){
          if(j==k)
            continue;
          dp[i][j]=max(dp[i][j],v[i][j]+dp[i-1][k]);
        }
    }
  }
  cout<<max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2])<<endl;
  return 0;
}

Measured memory_bytes: 14076
#include <bits/stdc++.h>
#define     mod             1000000007
#define     IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define     endl            "\n" 
#define     ll              long long int 
#define     vi              vector<int> 
#define     vvi             vector<vector<int>>
using namespace std;

int gcd(int a,int b){
	return b==0 ? a : gcd(b,a%b);
}


void solve(){
	ll n;
	cin>>n;

	string str;
	while(n){
		n--;
		ll r = n%26;
		str += 'a' + r;
		n/=26ll;
	}
	reverse(str.begin(),str.end());
	cout<<str<<endl;
}
 

int32_t main()
{
    IOS;

    solve();

}

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

int main(void){
  int n, k;
  cin >> n >> k;
  int x, i, sum = 0;
  for(i = 0; i < n; i++){
    cin >> x;
    sum += min(x, abs(k-x))*2;
  }
  cout << sum << endl;
  return 0;
}


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

#define MAXN 100010

int n,a[MAXN];

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		scanf("%d",a+i);
	}
	for(int i=1;i<=n;++i)
	{
		if(a[i-1]<a[i])--a[i];
		if(a[i-1]>a[i])return puts("No"),0;
	}
	puts("Yes");
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

int H, N, a[100000];

int main() {
  cin >> H >> N;
  int res = 0;
  rep(i, N) {
    cin >> a[i];
    res += a[i];
  }
  if(res >= H) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

double PI = 3.14159265358979323846264338327950288;

void solve() {
  double r;
  cin >> r;
  cout << PI * r * r << " " << PI * r * 2 << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}



Measured memory_bytes: 3268
fn main() {
    let r: i32 = read_line_as_value();
    println!("{}", r.pow(2));
}

fn read_line_as_value<T: std::str::FromStr>() -> T {
    let mut input = String::new();
    let res = std::io::stdin().read_line(&mut input);
    if let Err(error) = res {
        panic!("io error at stdin.read_line: {}", error);
    };
    match input.trim().parse() {
        Ok(val) => val,
        _ => panic!("error while parsing input: {}", input)
    }
}


Measured memory_bytes: 2120
#include<iostream>
using namespace std;
int main()
{
    int n,t,a,b,num=1005;
    cin>>n>>t;
    while(n--)
    {
        cin>>a>>b;
        if(b<=t)
        {
            if(num>a)
                num=a;
        }
    }
    if(num==1005)
        cout<<"TLE"<<endl;
    else
        cout<<num<<endl;
    return 0;
}


Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0]);
    const l = String(N).length;
    
    const num = ["3", "5", "7"];
    const X   = [3, 5, 7];
    
    let answer = 0;
    let n      = 0;
    
    // まず、3,5,7から成る数字を全て列挙する
    for(let i=0; i<l-1; i++) {
        let Xl = X.length;
        for(let j=0; j<3; j++) {
            for(let k=n; k<Xl; k++) {
                X.push(parseInt(num[j] + X[k]));
            }
        }
        
        n = Xl;
    }
    
    // 3,5,7からなる数字の配列から、それぞれが1回以上登場するものに絞る
    for(let i=0; i<X.length; i++) {
        if(X[i] > N) break;
        
        let digits = String(X[i]).split("");
        
        if(digits.indexOf("3") !== -1 && digits.indexOf("5") !== -1 && digits.indexOf("7") !== -1) {
            answer++;
        }
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 12928
#include <iostream>
#include <map>
#include <iterator>
using namespace std;
map<long long,long long> m1;
int main(){
    long long q;
    cin>>q;
    long long q1,q2,q3;
    cin>>q1>>q2>>q3;
    m1[q2]++;
    long long val = q3;
    auto it = m1.find(q2);
    long long cnt = 1;
    long long lcount = 0;
    long long rcount = 0;
    long long lsum = 0;
    long long rsum = 0;
    q--;
    
    while(q--){
        long long type;
        cin>>type;
       
        if(type == 2){
            cout<<((*it)).first<<" "<<val+lsum+rsum<<endl;
        }else{
            long long a,b;
            cin>>a>>b;
            val+=b;
            cnt++;
            if(a == ((*it)).first){
                m1[a]++;
            }else if(a<(*it).first){
                
                lcount++;
                lsum+=((*it).first-a);
               
                if(m1.find(a)!=m1.end()){
                    m1[a]++;
                }else{
                    m1[a]++;
                }
               // cout<<(*it).first<<endl;
               
                if(2*lcount == cnt){
                     it--;
                    auto hold =it;
                    it++;
                    
                    lsum -= lcount * ((*it).first-(*hold).first);
                    lcount -= (*hold).second;
                    rcount += (*it).second;
                    rsum += rcount * ((*it).first - (*hold).first);
                    it--;
                }
                //cout<<1234<<" "<<lcount<<" "<<rcount<<endl;
            }else{
                
                rcount++;
                rsum+=(a-(*it).first);
                if(m1.find(a)!=m1.end()){
                    m1[a]++;
                }else{
                    m1[a]++;
                }
            //    cout<<123<<" "<<lsum<<" "<<rsum<<endl;
                if(2*rcount > cnt){
                    it++;
                    auto hold = it;
                    it--;
                    rsum-=rcount*((*hold).first-(*it).first);
                    rcount-=((*hold).second);
                    lcount+=((*it).second);
                    lsum+=lcount*((*hold).first-(*it).first);
                    it++;
                }
              //  cout<<(*it).first<<endl;
            }
        }
    }
}

Measured memory_bytes: 8832
#include <stdio.h>
int main()
{ 
 int a,b,c,d,e;     
 scanf("%d %d%d",&a,&b,&c);
 d=abs(a-b);
 e=abs(a-c);
 if(e>d)
   printf("A");
 else
   printf("B");
 
 return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;

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;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    double r;
    cin>>r;
    double PIE=acos(-1);
    printf("%.10lf",PIE*2*r);
    return 0;
}




Measured memory_bytes: 3764
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        StringBuilder output = new StringBuilder();
        int n = scan.nextInt();
        for (int i = 3; i <= n; i++) {
            if ((i % 3) == 0) {
                output.append(" ").append(i);
            } else  {
                int x = i;
                while (x != 0) {
                    if ((x % 10) == 3) {
                        output.append(" ").append(i);
                        break;
                    }
                    x /= 10;
                }
            }
        }
        System.out.println(output);
    }
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> B(N);
    vector<int> A(N);

    REP(i, N-1) { cin >> B[i]; }

    int ans = B[0] + B[N-2];
    for(int i = 1; i < N - 1; ++i) {
        ans += min(B[i], B[i-1]);
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        n,w,h = LI()
        a = [LI() for _ in range(n)]
        b = []
        c = []
        for x,y,ww in a:
            b.append((x-ww,x+ww))
            c.append((y-ww,y+ww))
        b.sort()
        c.sort()
        f = False
        mi = b[0][0]
        ma = b[0][1]
        for l,r in b[1:]:
            if l > ma:
                break
            ma = max(r,ma)
        if mi <= 0 and ma >= w:
            f = True
        mi = c[0][0]
        ma = c[0][1]
        for l,r in c[1:]:
            if l > ma:
                break
            ma = max(r,ma)
        if mi <= 0 and ma >= h:
            f = True

        if f:
            rr.append('Yes')
        else:
            rr.append('No')
        break

    return '\n'.join(map(str, rr))


print(main())




Measured memory_bytes: 56892
#include<stdio.h>

void selectionSort(int A[],int n);

int main(){
  int A[100], n, i, j, t, cnt = 0, minj;

  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);

  for ( i = 0; i < n; i++ ){
    minj = i;
    for ( j = i; j < n; j++ ){
      if ( A[j] < A[minj] ) minj = j;
    }
    t = A[i];
    A[i] = A[minj];
    A[minj] = t;
    if ( i != minj ) cnt++;
  }

  selectionSort(A,n);
  
  printf("%d\n", cnt);

  return 0;
}

void selectionSort(int A[],int n){
  int i;
  
  for(i=0;i<n;i++){
    if(i)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}



Measured memory_bytes: 2104
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<bits/stdc++.h>
#define pii pair<int,int>
using namespace std;
queue<int>q[1010];
int n,ans=1;
bool vis[1010];
bool ck()
{
	for(int i=0;i<n;i++)
	{
		if(!q[i].empty())
		{
			return false;
		}
	}
	return true;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n-1;j++)
		{
			int x;
			scanf("%d",&x);
			q[i].push(x);
		}
	}
	for(int i=1;;i++)
	{
		memset(vis,false,sizeof(vis));
		if(ck())
		{
			cout<<i-1<<endl;
			return 0;
		}
		bool ok=false;
		for(int j=1;j<=n;j++)
		{
			if(!vis[j] && !q[j].empty())
			{
				int now=q[j].front();
				if(!vis[now] && !q[now].empty() && q[now].front()==j)
				{
					vis[j]=true;
					vis[now]=true;
					ok=true;
					q[j].pop();
					q[now].pop();
				}
			}
		}
		if(!ok)
		{
			cout<<-1<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 6784
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<tuple>
#include<vector>
#include<map>
using namespace std;

int main(void){
  //入力
  string S, T;
  string ans;
  int subNum = -1;
  cin >> S >> T;
  int t_len = T.size();
  int s_len = S.size();
  //cout << t_len << " " << s_len << endl;
  //文字列の照合：部分列を取り出して比較->代入できる場所をリスト化
  for(int i = 0; i < s_len; i++){
    string tempS = S.substr(i, t_len);
    bool canSub = true;
    for(int j = 0; j < t_len; j++){
      if(tempS[j] != T[j] && tempS[j] != '?'){
        canSub = false;
        break;
      }
    }
    if(canSub) subNum = i;//できるだけ後ろに代入する。
  }
  //cout << subNum << endl;
  //代入
  for(int i = 0; i < s_len; i++){
    if(i >= subNum && i < subNum + t_len) S[i] = T[i - subNum];
    else if(S[i] == '?') S[i] = 'a';
  }

  if(subNum != -1) cout << S << endl;
  else cout << "UNRESTORABLE" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c;
  cin >>a>>b>>c;
  if(a==1 && b==0 && c==0){
    cout <<"Close\n";
  }
  if(a==0 && b==1 && c==0) cout <<"Close\n";
  if(a==1 && b==1 && c==0) cout <<"Open\n";
  if(a==0 && b==0 && c==1) cout <<"Open\n";
  if(a==0 && b==0 && c==0) cout <<"Close\n";
  return(0);
}



Measured memory_bytes: 3208
def letternumber(S):
    alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
    s=[0 for i in range(0,26)]
    for i in range(0,10):
        s[alphabet.index(S[i])]+=1
    return s

def main():
    N=int(input())
    r=[]
    for i in range(0,N):
        r.append(letternumber(input()))
    r.sort()
    s=1
    ans=0
    for i in range(0,N-1):
        if r[i]==r[i+1]:
            s=s+1
        else:
            ans+=s*(s-1)//2
            s=1
    print(ans+s*(s-1)//2)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38732
#include<iostream>
#include <cstdlib>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#include<algorithm>
using namespace std;
#define cd cout<<"asd"<<endl;
const int PI=acos(-1);
const int N=2e2+7;
struct qujian{
    double l,r;
}a[N*2];
bool  cmp(const qujian &a,const qujian &b){
    return a.l<b.l;
}
int main(){
	int n,a[10];
	for(int i=0;i<10;i++)a[i]=pow(2,i);
	cin>>n;
	for(int i=0;i<10;i++){
		if(a[i]>n){cout<<a[i-1]<<endl;break;}
	}
}


Measured memory_bytes: 256
// AOJ 0574
#include<iostream>
#include<map>
#define REP(i,x) for (int i = 0; i < (x); i++)
#define TRI(a, b) nails[1+(((a)-1)*((a)+4))/2+1+(b)]
using namespace std;

typedef pair<int,int> P;

const int NMAX = 5008;
int nails[NMAX * (NMAX + 1) / 2];

int N, M;


void put(int a, int b, int x) {
  TRI(a, b)++;
  TRI(a, b + 1)--;
  TRI(a + x - 1, b)--;
  TRI(a + x, b + 1)++;
  TRI(a + x - 1, b + x)++;
  TRI(a + x, b + x)--;
}
/*
void show() {
  REP(a,N+1) {
    REP(b,a+2) {
      cout << TRI(a,b);
    }
    cout << endl;
  }
}*/

int count() {
  int sum = 0;
  for(int a = 1; a <= N; a++) {
    for(int b = 1; b <= a; b++) {
      if (TRI(a,b) > 0) {
        sum++;
      }
    }
  }

  return sum;
}

void accumulate() {
  // show();
  for (int a = 1; a <= N; a++)
    for (int b = 1; b <= a + 1; b++)
      TRI(a + 1, b) += TRI(a, b);

  // show();
  for (int a = 1; a <= N; a++)
    for (int b = 1; b <= a + 1; b++)
      TRI(a + 1, b + 1) += TRI(a, b);

  // show();
  for (int a = 1; a <= N; a++)
    for (int b = 1; b <= a + 1; b++)
      TRI(a, b + 1) += TRI(a, b);

  // show();
}

int main() {
  cin >> N >> M;
  REP(i, M) {
    int a, b, x;
    cin >> a >> b >> x;
    put(a, b, x + 2);
  }
  accumulate();
  cout << count() << endl;
}

Measured memory_bytes: 50076
#pragma region template 1.2
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a) \
    REP(i, (a).size()) { cout << (a[i]) << (i == (a).size() - 1 ? "\n" : " "); }
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    ll M1, D1;
    cin >> M1 >> D1;
    ll M2, D2;
    cin >> M2 >> D2;

    if (M1 < M2)
    {
        OUT(1);
    }
    else
    {
        OUT(0);
    }
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }
//V,P(大文字)使用不可

const ll INF=1e18;

signed main(){
    ll n,k;
    cin>>n>>k;
    Graph G(n);
    rep(i,n-1){
        ll a,b;
        cin>>a>>b;
        G[--a].push_back(--b);
        G[b].push_back(a);
    }
    ll ans=k;
    V<ll> dist(n,-1);
    queue<ll> que;
    V<set<ll>> st(n);
    dist[0]=0;
    que.push(0);
    while(!que.empty()){
        ll v=que.front();
        que.pop();
        for(ll nv:G[v]){
            st[nv].insert(v);
            st[v].insert(nv);
            if(dist[nv]!=-1) continue;
            ll m=st[v].size();
            if(k-m<0) ans=0;
            else ans=(ans*(k-m))%mod;
            dist[nv]=dist[v]+1;
            que.push(nv);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 21752
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<time.h>
#include<ctime>
#include<functional>
#define int long long
#define INT INT_MAX
#define LONG LLONG_MAX
#define f(i,n) for(int i=0;i<(n);i++)
#define P pair<int,int>
typedef long long ll;
using namespace std;

ll GCD(ll a, ll b) {
	if (b == 0)return a;
	return GCD(b, a%b);
}

ll LCM(ll a, ll b) {
	return a / GCD(a, b)*b;
}

ll mypow(ll a, ll b, ll c) {
	if (b == 0)return 1;
	if (b % 2)return mypow(a, b - 1, c)*a%c;
	else return mypow(a, b / 2, c)*mypow(a, b / 2, c) % c;
}

signed main() {
	int a;
	string s, t;
	cin >> a >> s >> t;
	f(i, a) {
		if (s.substr(i, a - i) == t.substr(0, a - i)) {
			cout << a + i << endl;
			return 0;
		}
	}
	cout << a * 2 << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define int unsigned long long
#define ll long long
#define pb push_back 
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod 1000000007
#define mod1 998244353
#define INT_MAX1 900000000

void solve()
{
    int n, m;
    cin >> n >> m;
    vi arr(n);
    inp(arr, n);
    int curr = arr[0];

     if(curr>2*m)
     {
        cout << 0 << endl;
        return;
     }

    for(int i=1; i<n; i++)
    {
     int gg = __gcd(curr, arr[i]);
     if(((double)curr/gg)*arr[i]>2*1e18)
     {
        cout << 0 << endl;
        return;
     }
     curr = (curr/gg)*arr[i];
     if(curr>2*m)
     {
        cout << 0 << endl;
        return;
     }
    }

    loop(arr)
    {
        if((curr/it)%2==0)
        {
            cout << 0 << endl;
                    return;

        }
    }
    curr/=2;
    int ans = m/curr;
    cout << (ans+1)/2 << endl;

}

signed main()
{
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

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

#define lli long long int

int main() {
	lli n, ans = LLONG_MAX;
	cin >> n;
    int raiz = sqrt(n);
	for(lli i = 1; i <= raiz; i++) {
		if(n % i == 0) {
			ans = min(ans, (i-1) + ((n/i)-1));
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Arrays;
import java.util.Scanner;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DScoreAttack solver = new DScoreAttack();
        solver.solve(1, in, out);
        out.close();
    }

    static class DScoreAttack {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt(), m = in.nextInt();
            BellmanFord bf = new BellmanFord(n);
            for (int i = 0; i < m; i++) {
                bf.addEdge(in.nextInt() - 1, in.nextInt() - 1, -in.nextInt());
            }
            try {
                out.println(-bf.shortestPath(0, n - 1));
            } catch (RuntimeException ex) {
                out.println("inf");
            }
        }

    }

    static class BellmanFord {
        int nodes;
        List<BellmanFord.Edge> edges;
        long[] distance;

        public BellmanFord(int n) {
            nodes = n;
            edges = new ArrayList<>();
            distance = new long[n];
        }

        public void addEdge(int from, int to, int cost) {
            edges.add(new BellmanFord.Edge(from, to, cost));
        }

        public long shortestPath(int src, int dst) {
            Arrays.fill(distance, Long.MAX_VALUE);
            distance[src] = 0;
            for (int i = 0; i < 2 * nodes; i++) {
                for (BellmanFord.Edge e : edges) {
                    if (distance[e.from] < Long.MAX_VALUE && distance[e.to] > distance[e.from] + e.cost) {
                        distance[e.to] = distance[e.from] + e.cost;
                        if (i == nodes - 1 && e.to == dst) {
                            throw new RuntimeException("negative loop");
                        }
                    }
                }
            }
            return distance[dst];
        }

        private static class Edge {
            int from;
            int to;
            long cost;

            public Edge(int from, int to, long cost) {
                this.from = from;
                this.to = to;
                this.cost = cost;
            }

        }

    }
}



Measured memory_bytes: 30044
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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;
}

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

signed main() {
  ll N;
  cin >> N;

  ll ans = 0;
  rep(i, N + 1) {
    if (i == 0) {
      continue;
    }
    ll d = getDigit(i);
    if (d % 2 == 1) {
      ans++;
    }
  }
  COUT(ans);
  return 0;
}

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

ans = 0
j = 0
B = list(map(abs,A))

for a in A:
    if a < 0:
        j += 1
ans = sum(B)
if j%2 == 1:
    k = min(B)
    ans -= 2*k
print(ans)

Measured memory_bytes: 14332
d = gets.chomp.split
n = gets.to_i

matrix =
  [[0], [4], [2], [5], [3], [0]],
  [[3], [0], [6], [1], [0], [4]],
  [[5], [1], [0], [0], [6], [2]],
  [[2], [6], [0], [0], [1], [5]],
  [[4], [0], [1], [6], [0], [3]],
  [[0], [3], [5], [2], [4], [0]]

n.times do
  f1, f2 = gets.chomp.split.map(&:to_s)
  s1 = d.find_index f1
  s2 = d.find_index f2
  u = matrix[s2][s1]
  puts d[u[0] - 1]
end

__END__

全パターン
1    2    3    4    5    6
2 3  4 6  1 2  1 5  1 3  2 4
3 5  6 3  2 6  5 6  3 6  4 5
5 4  3 1  6 5  6 2  6 4  5 3
4 2  1 4  5 1  2 1  4 1  3 2



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

using namespace std;

const int N = (int) 1e5 + 7;
int n, k, q, f[N];

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

    cin >> n >> k >> q;

    for (int i = 1; i <= q; i++)
    {
        int x;
        cin >> x;
        f[x]++;
    }

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

}


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

int main(){
    int k; cin >> k;
    int odd = 0, even = 0;
    
    for(int i=1;i<=k;i++){
        if(i % 2 == 0){even++;}
        else{odd++;}
    }
    cout << even * odd << endl;
}

Measured memory_bytes: 256
n1, n2 = [int(i) for i in input().split()]
n3, n4, n5= [int(i) for i in input().split()]
s6 = input()

r8 = 0
a9 = [0] * n1
for i7 in range(n1):
    if i7 >= n2:
        if s6[i7] == s6[i7 - n2]:
            if a9[i7 - n2] == 0:
                a9[i7] = 1
                continue
    if s6[i7] == "r":
        r8 += n5
    elif s6[i7] == "s":
        r8 += n3
    else:
        r8 += n4
print(r8)

Measured memory_bytes: 4084