akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define MAX 20010
#define inf 1<<29
#define linf 1e18
#define eps (1e-8)
#define mod 1000000007
#define pi M_PI
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,int> pdi;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int main()
{
  int n,m;
  int c[MAX]={};

  cin>>n>>m;
  FOR(i,0,m){
    string s;
    cin>>s;
    FOR(j,0,s.length())if(s[j]=='W')c[j]++;
  }

  int w=0,e=0;
  FOR(i,0,n)e+=c[i];
  pii ans(e,-1);
  FOR(i,0,n){
    w+=m-c[i];
    e-=c[i];
    if(w+e<ans.f)ans=mp(w+e,i);
  }
  cout<<ans.s+1<<" "<<ans.s+2<<endl;
  return 0;
}

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

int main() {
  int n;
  string s, t;
  cin >> n >> s >> t;
  REP(i, n) {
    cout << s[i] << t[i];
  }
  cout << endl;
  return 0;
}

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

const int N = 2005, MOD = 998244353;

string s;
int su = 0, f[2 * N][2 * N];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    f[0][0] = 1;
    cin >> s;
    for (int i = 1; i <= 2 * s.size(); i++)
    {
        su += (i <= s.size() ? s[i - 1] - '0' : 0);
        for (int j = max(0, i - 2 * min((int)s.size(), i) + su); j <= su && j <= i; j++)
        {
            (f[i][j] += f[i - 1][j]) %= MOD;
            if (j > 0)
                (f[i][j] += f[i - 1][j - 1]) %= MOD;
        }
    }
    cout << f[2 * s.size()][su];
}


Measured memory_bytes: 60544
N,T = map(int,input().split())
ts = list(map(int,input().split()))
t_diffs = [ts[i+1]-ts[i] for i in range(N-1)]
cnt = 0
for i in range(N-1):
    if t_diffs[i] <= T:
        cnt+=t_diffs[i]
    else:
        cnt+=T

print(cnt+T)


Measured memory_bytes: 25200
S = input()
words = ["dream", "dreamer", "erase", "eraser"]
i = len(S)

while i > 0:
    if S[i - 5 : i] in words:
        i = i - 5
    elif S[i - 6 : i] in words:
        i = i - 6
    elif S[i - 7 : i] in words:
        i = i - 7
    else:
        break

if i > 0:
    print("NO")
else:
    print("YES")


Measured memory_bytes: 3188
while True:
    s=""
    try:s=input()
    except EOFError:break
    c_joi=0
    c_ioi=0
    for i in range(len(s)-2):
        if s[i:i+3]=="JOI":c_joi+=1
        elif s[i:i+3]=="IOI":c_ioi+=1
    print(c_joi)
    print(c_ioi)

Measured memory_bytes: 7348
#include<iostream>
#include<vector>
#include<set>
#include<string>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
   // set<int> s;
    string s;
    
    cin >> s;
    
    if(s[0]==s[1] && s[1]==s[2]){
        cout << "Yes\n";
    }else if(s[1]==s[2] && s[2]==s[3]){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
    
    return 0;
}


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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main() {
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<mint> q(s+1);
  mint ans = 0;
  rep(i,n) {
    q[0] += 1; // q += 1
    { // q *= (1 + x^a[i])
      vector<mint> q2(s+1);
      rep(j,s+1) {
        q2[j] += q[j];
        if (j+a[i] <= s) q2[j+a[i]] += q[j];
      }
      q = q2;
    }
    ans += q[s];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	ll x;
	cin >> x;
	ll saving = 100;
	ll ans = 0;
	while (saving < x) {
		saving += saving / 100;
		ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3640
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N = int(input())
    P = list(map(int, input().split()))
    ans = 0
    i = 0
    while i < N:
        if P[i] == i + 1:
            ans += 1
            i += 2
        else:
            i += 1

    print(ans)


if __name__ == '__main__':
    main()


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

int main()
{
    long long int a,b,c;
    cin >> a;
    cin >> b;
    cin >> c;
    long long int ans = 0;
    if((a >= b)&&(a >= c)) ans = b * c;
    else if((b >= a)&&(b >= c)) ans = a * c;
    else ans = a * b;
    ans*=a%2;
    ans*=b%2;
    ans*=c%2;
    cout << ans << endl;
    return 0;
    }

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

int main() {
  int N,D,a,b;
  cin >> N >> D;
  a = N / (2 * D + 1);
  b = N % (2 * D + 1);
    
  if(b == 0)
  cout << a << endl;
  else
  cout << a + 1<< endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=1e5+5;

#define endl '\n'

int main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	char fw[3],aw[3];
	int sum=0;
	for(int i=0;i<3;i++) cin>>fw[i];
	for(int i=0;i<3;i++) cin>>aw[i];
	for(int i=0;i<3;i++) if(fw[i]==aw[i]) sum++;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <list>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

#define xx first
#define yy second
#define $1 first
#define $2 second

void solveCase() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	ll n, m; vector<ll> v;
	cin >> n >> m; v.resize(n);
	for (int i = 0; i < n; i++) cin >> v[i];
	ll total = 0;
	for (int i = 0; i < v.size(); i++)total += v[i];
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	double lb = (double)total / (4 * (double)m);
	bool ok = false;
	for (int i = 0; i < m; i++) {
		if (v[i] < lb)ok = true;
	}
	if (!ok) { cout << "Yes"; }
	else {
		cout << "No";
	}
}

int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	solveCase();
}

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

#define INF 100100100
#define MOD 1000000007

#define FOR(i,n) for(int i=0;i<n;i++)

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

struct edge{ll to,cost;};

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0);
   int N;
   cin >> N;
   if(N == 1){
      cout << "Hello World";
      return 0;
   }
   if(N == 2){
      int A,B;
      cin >> A >> B;
      cout << A+B << endl;
   }
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
 
using namespace std;
 
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-10;

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

int main(){
	string s = "a", t;
	char last;
	char c[100];
	set<string> st;
	st.insert(s);
	last = 'a';
	printf("?%s\n", s.c_str()); fflush(stdout);
	while(1){
		scanf("%s", c);
		s = string(c);
		if(c[0]!=last || st.count(s)){
			printf("!OUT\n");
			break;
		}
		st.insert(s);
		last = s[s.size()-1];
		t = "";
		t += last;
		while(t.size() < 10){
			t += 'a';
			if(st.count(t)==0){
				break;
			}
		}
		if(st.count(t)==0){
			printf("?%s\n", t.c_str()); fflush(stdout);
			st.insert(t);
			last = t[t.size()-1];
			continue;
		}
		for(int i = 1; i < 8; i++){
			for(int j = 1; j < 25; j++){
				t[i]++;
				if(st.count(t)==0){
					printf("?%s\n", t.c_str()); fflush(stdout);
					st.insert(t);
					last = t[t.size()-1];
					i = j = 100;
				}
			}
		}
	}
}

Measured memory_bytes: 1260
// code test
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using static System.Console;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        int[] NA = ReadLineParseIntArray();
        long N = NA[0];
        long A = NA[1];
        long[] X = ReadLine().Split(' ').Select(x => int.Parse(x) - A).ToArray();
        long max = X.Max();
        if (max < 0) {
            WriteLine(0);
            return;
        }

        long[] dp = new long[2 * max * N + 1];
        dp[N * max] = 1;
        for(int i = 0; i < N; i++)
        {
            long first = Max(0, X[i]);
            long last = Min(dp.Length, dp.Length + X[i]);
            if (X[i] <= 0)
                for (long t = first; t < last; t++)
                    dp[t] += dp[t - X[i]];
            else
                for (long t = last - 1; t >= first; t--)
                    dp[t] += dp[t - X[i]];
        }
        WriteLine(dp[N * max] - 1);
    }

    static int ReadLineParseInt() => int.Parse(ReadLine());
    static int[] ReadLineParseIntArray() => ReadLine().Split(' ').Select(int.Parse).ToArray();
}


Measured memory_bytes: 13496
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++ i)
#define rrp(i,a,b) for (int i = (a); i >= (b); -- i)
#define gc() getchar()
#define fir first
#define sec second
typedef pair<int,int> pii;
typedef long double db;
typedef long long ll;
template <typename tp>
inline void read(tp& x) {
  x = 0; char tmp; bool key = 0;
  for (tmp = gc(); !isdigit(tmp); tmp = gc())
    key = (tmp == '-');
  for (; isdigit(tmp); tmp = gc())
    x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x,tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x,tp y) {
  x = x < y ? y : x;
}

const int MOD = (int)(1e9 + 7);
inline void Add(int& x,int y) {
  x = x + y >= MOD ? x + y - MOD : x + y;
}
inline void Sub(int& x,int y) {
  x = x - y < 0 ? x - y + MOD : x - y;
}
int power(int a,int b) {
  int ret = 1;
  while (b) {
    if (b&1) ret = 1ll * ret * a % MOD;
    a = 1ll * a * a % MOD;
    b >>= 1;
  }
  return ret;
}

const int N = 5010;
struct edge {
  int la,b;
} con[N << 1];
int tot, fir[N];
void add_edge(int from,int to) {
  con[++tot] = (edge) {fir[from], to};
  fir[from] = tot;
}
int n;
int dp[N][N], sz[N], jc[N], ijc[N], ipw2[N], tmp[N];
int calc(int x) {
  int ret = 1ll * jc[x] * ijc[x / 2] % MOD;
  ret = 1ll * ret * ipw2[x / 2] % MOD;
  return ret;
}
void dfs(int pos,int fa) {
  dp[pos][1] = 1;
  sz[pos] = 1;
  for (int i = fir[pos]; i; i = con[i].la) {
    if (con[i].b == fa) continue;
    dfs(con[i].b, pos);
    memset(tmp, 0, sizeof tmp);
    rep (a, 0, sz[pos]) rep (b, 0, sz[con[i].b])
      Add(tmp[a + b], 1ll * dp[pos][a] * dp[con[i].b][b] % MOD);
    sz[pos] += sz[con[i].b];
    rep (a, 0, sz[pos]) dp[pos][a] = tmp[a];
  }
  rep (a, 1, sz[pos]) if (a % 2 == 0)
    Sub(dp[pos][0], 1ll * calc(a) * dp[pos][a] % MOD);
}
int main() {
  int x,y;
  read(n);
  rep (i, 1, n-1) {
    read(x), read(y);
    add_edge(x, y);
    add_edge(y, x);
  }
  jc[0] = 1;
  rep (i, 1, n) jc[i] = 1ll * jc[i-1] * i % MOD;
  ijc[n] = power(jc[n], MOD - 2);
  ipw2[0] = 1;
  ipw2[1] = power(2, MOD - 2);
  rep (i, 2, n) ipw2[i] = 1ll * ipw2[1] * ipw2[i-1] % MOD;
  rrp (i, n-1, 0) ijc[i] = 1ll * ijc[i+1] * (i+1) % MOD;
  dfs(1, 0);
  int ans = MOD - dp[1][0];
  ans = (ans % MOD + MOD) % MOD;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 97280
//I am so vegetable
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = 3.141593;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){x=1;y=0;return;}
    exgcd(b,a%b,x,y);
    ll X=x;
    x=y; y=X-a/b*y;
}
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }

int main() {
	//ofstream cout("E:\\acm dream\\out.txt",ios::out);
	FIO;
	int x;cin>>x;
    x%=10;
    switch(x){
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:cout<<"hon";break;
        case 0:
        case 1:
        case 6:
        case 8:cout<<"pon";break;
        case 3:cout<<"bon";break;
    }
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n, v, p; LL m;
  cin >> n >> m >> v >> p;
  vector<LL> a(n);
  for (LL& x: a) cin >> x;
  sort(a.rbegin(), a.rend());

  int lo = p - 1, hi = n;
  while (lo + 1 < hi) {
    int mid = (lo + hi) / 2;

    LL rem = max(0ll, v - (p - 1ll) - (n - mid));
    LL val = a[mid] + m;
    LL tot = 0;
    bool valid = true;
    for (int i = p - 1; i < mid; i++) {
      LL gap = val - a[i];
      if (gap < 0) {
        valid = false;
        break;
      }
      tot += min(gap, m);
    }
    if (tot < rem * m) valid = false;

    if (valid) {
      lo = mid;
    } else {
      hi = mid;
    }
  }

  cout << (lo + 1) << endl;

  return 0;
}

/*
n=10 m=4 v=8 p=5
7 6 6 6 5 | 5 4 | 3 2 1
 */

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

int main(){
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  vector<int> a(n), b(m);
  
  int xmax = -100, ymin = 100;
  for(int i = 0; i < n; i++){
  	cin >> a.at(i);
    xmax = max(xmax, a.at(i));
  }
  for(int i = 0; i < m; i++){
  	cin >> b.at(i);
    ymin = min(ymin, b.at(i));
  }
  
  if(xmax > x && y > ymin && xmax < ymin){
  	cout << "No War" << endl;
  }
  else{
  	cout << "War" << endl;
  }
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout << (x) << endl
#define watch2(x,y) cout << (x) << " " << (y) << endl
#define watch3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 3.14159265358979323846

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> oset;

// find_by_order(k) returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;

const int mod = 1e9 + 7;
const int inf = 9e18;
const int N = 1e5 + 5;

int a,b,n;

void solve(){
    cin>>a>>b>>n;
    if(b-1>n){
        cout<<floor(1.0*a*(n)/b)-a*(floor(1.0*n/b));
    }
    else{
        cout<<a+floor(-1.0*a/b);
    }
}

signed main(){
    fastio;
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 3800
import sys, math, collections, heapq, itertools
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0: a, b = b, a % b
    return b
  
def solve():
    file = sys.stdin.readline #single: int(file()), line: map(int, file().split())
    INF = 10 ** 25
    mod = 7 + 10 ** 9
    N, K = map(int, input().split())
    print(N % K)
    return 0
  
if __name__ == "__main__":
    solve()

Measured memory_bytes: 3700
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;

int main()
{
    char a[101], b[101];
    cin >> a >> b;
    int len_a=strlen(a), len_b=strlen(b);
    if(len_a>len_b){
        cout << "GREATER";
    }else if(len_a<len_b){
        cout << "LESS";
    }else{
        int i;
        for(i=0; i<len_a; i++){
            if(a[i]>b[i]){
                cout << "GREATER";
                break;
            }else if(a[i]<b[i]){
                cout << "LESS";
                break;
            }
        }
        if(i==len_a){
            cout << "EQUAL";
        }
    }
    cout << endl;
    
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  for (int i = 1; i <= n - 1; i++) {
    for (int j = 1; j * j <= i; j++) {
      if (i % j == 0 && i / j != j) ans += 2;
      if (i % j == 0 && i / j == j) ans += 1;
    }
  }

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

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);

		// 所持枚数の取得
		int count = scanner.nextInt();

		int carddesign[] = new int[count];
		int cardnum[] = new int[count];

		for (int i = 0; i < count; i++) {
			// 絵柄を取得
			String design = scanner.next();

			if (design.equals("S")) {
				carddesign[i] = 0;

			} else if (design.equals("H")) {
				carddesign[i] = 1;

			} else if (design.equals("C")) {
				carddesign[i] = 2;

			} else if (design.equals("D")) {
				carddesign[i] = 3;
			}

			// 持っているカードの数値を取得
			cardnum[i] = scanner.nextInt();

		}
		Card card = new Card(count, carddesign, cardnum);

		int designcategory = 4;
		int numbercategory = 13;

		for (int i = 0; i < designcategory; i++) {
			for (int j = 0; j < numbercategory; j++) {
				if (card.getCard(i, j) != true) {
					System.out.println(card.getDesign(i) + " " + card.getNum(j));
				}
			}
		}

	}
}

class Card {

	boolean card[][] = new boolean[4][13];

	Card(int have, int[] design, int[] num) {

		for (int i = 0; i < have; i++) {

			// 所持しているカードの値をtrueにする
			card[design[i]][num[i] - 1] = true;
		}
	}

	public boolean getCard(int design, int number) {

		return card[design][number];

	}

	public String getDesign(int design) {
		String carddesign = " ";

		if (design == 0) {
			carddesign = "S";

		} else if (design == 1) {
			carddesign = "H";

		} else if (design == 2) {
			carddesign = "C";

		} else if (design == 3) {
			carddesign = "D";
		}

		return carddesign;
	}

	public int getNum(int number) {
		return number + 1;
	}
}



Measured memory_bytes: 26436
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define debug(x) cerr << #x " = " << (x) << endl;
#define P(x) cerr << #x << endl;    
typedef long long ll;
//#define int long long
//#define int unsigned long long
const int mod = 1000000007;


int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(9);
    
    int n;
    cin >> n;
    
    multiset<double> s;
    
    for(int i = 0; i < n; ++ i)
    {
        double x;
        cin >> x;
        s.insert(x);
    }
    
    while(s.size() > 1)
    {
        auto it1 = s.begin();
        auto it2 = s.begin();
        ++ it2;
        double val = (*it1 + *it2) / 2.0;
//        debug(val);
//        debug(*it1);
//        debug(*it2);
//        debug(s.size());
        s.erase(it1);
        s.erase(it2);
        s.insert(val);
    }
    
    cout << *s.begin() << endl;
    
    return 0;
}






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

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100000;

ll A[N+10];

long long gcd(long long a, long long b) {
    if (b==0) return a;
    else return gcd(b,a%b);
}

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

int main() {	
	int n;ll m;cin>>n>>m;
	rep(i,n) {cin>>A[i];A[i]/=2;}
	ll tmp=1LL;
	rep(i,n) {
		tmp=lcm(tmp,A[i]);
		if(tmp>m) {cout<<0<<endl;return 0;}
	}
	rep(i,n) if((tmp/A[i])%2==0) {cout<<0<<endl;return 0;}
	ll ans=(m/tmp+1)/2;
	cout<<ans<<endl;
}


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

using namespace std;

int main(){
  
  long long  N, A, B;
  
  cin >> N >> A >> B;
  
  if(A == 0){
    cout << '0' << endl;
    return 0;
  }
  
  if(N%(A+B) < A){
  	cout <<  fixed << setprecision(0) << ((N/(A+B)))*A + (N%(A+B)) << endl;
  }
  else{
    cout << fixed << setprecision(0) <<((N/(A+B)))*A + A << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
#define endl '\n'
typedef double db;
typedef long long LL;
const db EPS = 1e-9;
const int N = 2e5 + 100,INF = 1 << 31 - 1;
int a[N],n;
int f(int mid) {
    int res = 0;
    for(int i = 0;i < n; ++i) {
        res += (a[i] - mid) * (a[i] - mid);
    }
    return res;
}
int main() {
    ios::sync_with_stdio(0),cout.tie(0),cin.tie(0);
    int lans,rans;
    cin >> n;
    for(int i = 0;i < n; ++i) cin >> a[i];
    int l = 1,r = 100;
    while(l < r) {
        int lmid = l + (r - l) / 3;
        int rmid = r - (r - l) / 3;
        lans = f(lmid),rans = f(rmid);
        if(lans <= rans) r = rmid - 1;
        else l = lmid + 1;
    }
    cout << min(lans,rans) << endl;
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i=0; i<n; i++) {
        cin >> p[i];
    }
    int k = 0;
    for(int i=0; i<n; i++) {
        if(p[i] != i+1) k++;
    }
    if(k<=2) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


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

int main()
{
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  for (auto & a : A)
    cin >> a;
  auto total = accumulate(A.begin(), A.end(), 0);
  int cnt = 0;
  for (auto & a : A)
    if (total <= 4*M*a)
      ++cnt;
  cout << ((M <= cnt) ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
/*

Single Source Shortest Path I(https://onlinejudge.u-aizu.ac.jp/problems/GRL_1_A)

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecll> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}


//最大の頂点数
const int MAX_V = 100010;
const ll INF = 1e18;

struct edge{ll to, cost;};

//V := number of nodes
//G := adj
int V;
vector<edge> G[MAX_V];
ll d[MAX_V];

void dijkstra(int s){
	priority_queue<P, vector<P>, greater<P> > que;
	fill(d, d+V, INF);
	d[s] = 0;
	que.push(P(0, s));

	while (!que.empty()) {
		P p = que.top(); que.pop();
		int v = p.second;
		if (d[v] < p.first) continue;
		rep((int)G[v].size(), i) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

void solve(void){
	int E, r;
	cin >> V >> E >> r;

	while(E--)
	{
		ll s, t, d;
		cin >> s >> t >> d;
		G[s].pb((edge{t, d}));
	}

	//rを始点とするダイクストラ
	dijkstra(r);

	rep(V, i)
	{
		if (d[i] == INF)
		{
			cout << "INF" << endl;
			continue;
		}
		cout << d[i] << endl;
	}


}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}



Measured memory_bytes: 19564
n=int(input())
if(n%2==0 or n%5==0):
    print(-1)
else:
    a=7 
    ans=1
    flag=1  
    while(flag):
        if(a%n==0):
            print(ans)
            flag=0
            break 
        else:
            ans+=1 
            s=str(a)
            s1='7'
            s2=int(s+s1)
            a=(int(s2))%n 
            

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

#define mem(arr, i) fill(arr, arr + sizeof(arr), i)
#define MEM(arr, i) memset(arr, i, sizeof(arr))
#define Push push_back
#define Pair make_pair
#define ALL(x) x.begin(), x.end()
#define X first
#define Y second
#define ACCEL ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef pair<pll,lli> p3l;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
typedef vector<p3l> v3L;
typedef vector<vcL> vvL;
//typedef priority_queue<T> prior_S<T>;
//typedef priority_queue< T, vector<T>, greater<T> > prior_B<T>;
const double PI = 3.141592653589793;
const lli I_MAX = 1LL << 60;
      lli   mod = 1000000007;

/// templates ///

const lli maxN = 2E5;

vcL inv(maxN+5, 1);
vcL fac(maxN+5, 1);

void ADD(lli &x, lli y) {
	x += y;
	if (x >= mod) x -= mod;
	if (x < 0) x += mod;
}

void MUL(lli &x, lli y) {
	x *= y;
	x = (x % mod + mod) % mod;
}

lli mypow(lli b, lli e) {
	lli ans = 1;
	while (e) {
		if (e & 1) MUL(ans, b);
		MUL(b, b);
		e >>= 1;
	}
	return ans;
}

lli modinv(lli n) {
	return mypow(n, mod - 2);
}

void calcInv(lli n) {
	for (int i = 2; i <= n; ++i) {
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	}
}

void calcFac(lli n) {
	for (int i = 2; i <= n; ++i) {
		fac[i] = fac[i - 1] * i % mod;
	}
}

lli cm(lli a, lli b) {
	lli ans = 1;
	if (a < b) return 0;

	MUL(ans, inv[fac[a - b]]);
	MUL(ans, inv[fac[b]]);
	MUL(ans, fac[a]);

	return ans;
}

lli Lucas(lli n, lli m) {
	if (m == 0) return 1;
	return cm(n % mod, m % mod) * Lucas(n / mod, m / mod) % mod;
}

lli doLucas(lli n, lli m) {
	calcInv(mod);
	calcFac(mod);
	return Lucas(n, m);
}

/// coding area ///

const lli maxn = 1E5 + 5;
vcL adj[maxn];
vcL ind(maxn, 0);
vcL wlk(maxn, 0);
vcL len(maxn, 0);

void precal() {

	return;
}

void dfs(lli now) {
	for (auto x : adj[now]) {
		len[x] = max(len[x], len[now] + 1);
		if (++wlk[x] == ind[x]) {
			dfs(x);
		}
	}
}

void solve() {
	lli n, m;
	cin >> n >> m;
	
	for (int i = 0; i < m; ++i) {
		lli a, b;
		cin >> a >> b;
		adj[a].Push(b);
		++ind[b];
	}
	
	for (int i = 1; i <= n; ++i) {
		if (ind[i] == 0) {
			dfs(i);
		}
	}
	
	lli maxA = 0;
	for (int i = 1; i <= n; ++i) {
		maxA = max(maxA, len[i]);
	}
	
	cout << maxA << '\n';
}

int main() {
	precal();
	int t = 1;
	#ifdef LOCAL
		t = INT_MAX;
	#else
		ACCEL;
	#endif
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		solve();
	}
	return 0;
}




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

int s[200001];
int a[200001];
int main()
{

    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> s[i];
        a[i] = s[i];
    }
    sort(s + 1, s + n + 1, greater<int>());
/*
    for (int i = 1; i <= n; ++i)
    {
        cout << s[i] << endl;
    }
//*/
    for (int i = 1; i <= n; ++i)
    {
        if (a[i] < s[n / 2])
            cout << s[n / 2] << endl;
        /*   else if (a[i] == s[n / 2])
        {
            if (s[n / 2 + 1] == s[n / 2] || s[n / 2 - 1] == s[n / 2])
                cout << s[n / 2] << endl;
            else
                cout << s[n / 2 + 1] << endl;
        }
        */
        else
            cout << s[n / 2 + 1] << endl;
    }
    return 0;
}

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

int main(){
	int n;
	scanf("%d",&n);
	vector <int> value(n);
	for(int i=0;i<n;i++) scanf("%d",&value[i]);
	vector <int> Xor(n+1,0);
	vector <lint> Plus(n+1,0LL);
	for(int i=0;i<n;i++){
		Xor[i+1]=Xor[i]^value[i];
		Plus[i+1]=Plus[i]+value[i];
	}
	lint result=0;
	for(int start=0;start<n;start++){
		int low=start,high=n-1;
		while(low<high){
			int mid=low+(high-low+1)/2;
			int sum1=Xor[mid+1]^Xor[start];
			int sum2=Plus[mid+1]-Plus[start];
			if(sum1==sum2) low=mid;
			else high=mid-1;
		}
		result+=low-start+1;
	}
	printf("%lld\n",result);
	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int> p(n);
  for(int i=0;i<n;i++)cin>>p[i];
  sort(p.begin(),p.end());
  int ans=0;
  for(int i=0;i<k;i++)ans+=p[i];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3600
public class Main {
	public static void main(String[] args) {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			String str = sc.next();
			int cntCommand = sc.nextInt();

			for (int i = 0; i < cntCommand; i++) {
				String command = sc.next();
				int begin = sc.nextInt();
				int end = sc.nextInt();

				if (command.equals("print")) {
					System.out.println(str.substring(begin, end + 1));
				} else if (command.equals("reverse")) {
					str = reverse(begin, end, str);
				} else if (command.equals("replace")) {
					str = replace(begin, end, str, sc.next());
				}
			}

		}
	}

	private static String reverse(int begin ,int end, String str) {
		char[] arr = str.toCharArray();
		int num = end - begin +1;
		
		for (int i = 0; i < (num / 2); i++) {
			char tmp = arr[begin + i];
			arr[begin + i] = arr[end - i];
			arr[end - i] = tmp;
		}
		return String.valueOf(arr);
	}

	private static String replace(int begin, int end, String target, String replacemant) {
		char work[] = target.toCharArray();
		char repl[] = replacemant.toCharArray();

		for (int i = begin; i <= end; i++) {
			work[i] = repl[i - begin];
		}
		return String.valueOf(work);
	}
}


Measured memory_bytes: 29440
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair

int main(){
	int N;
	cin >> N;
	vector<string> S(N);
	for(int i=0; i<N; i++){
		cin >> S[i];
		sort(S[i].begin(), S[i].end());
	}
	sort(S.begin(), S.end());
	LL ans = 0;
	for(int i=0; i<N; i++){
		ans += upper_bound(S.begin(), S.end(), S[i]) - S.begin() - i - 1;
	}
	cout << ans << endl;
}

Measured memory_bytes: 7296
import sys
from collections import Counter
input = sys.stdin.readline

N, M, K = map(int, input().split())
 
lstab = [[] for _ in range(N)]

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

visited = [0] * N
cnt = 0

for i in range(N):
    if visited[i] != 0: continue
    temp = [i]
    cnt += 1
    visited[i] = cnt
 
    while temp:
        x = temp.pop()
        for y in lstab[x]:
            if visited[y] != 0:continue
            temp.append(y)
            visited[y] = cnt

numcd = [ 0 ] * N
for _ in range(K):
    c, d = map(int, input().split())
    if visited[c-1] == visited[d-1]:
        numcd[c-1] += 1
        numcd[d-1] += 1    
    
ans = [0] * N
cnt = Counter(visited)

for i in range(N):
    ans[i] = cnt[visited[i]] - 1 - len(lstab[i]) - numcd[i]
 
print(*ans)

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    vector<int> s(n);
    int sum = 0;
    for(int i= 0; i < n; i++) {
        cin >> s[i];
        sum += s[i];
    }
    if(sum%10 != 0){
        cout << sum << endl;
        return 0;
    }

    sort(s.begin(), s.end());
    for(int i = 0; i < n; i++){
        if(s[i] % 10 != 0){
            cout << sum - s[i] << endl;
            return 0;
        }
    }
    cout << 0 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N;
  cin>>N;
  map<string,ll> mp;
  for(ll i=0;i<N;i++){
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    mp[s]++;
  }
  ll ans=0;
  for(auto a:mp){
    ll x=a.second;
    ans+=x*(x-1)/2;
  }
  cout<<ans<<endl;
}

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

per_dist = list(A[i+1]-A[i] for i in range(0,N-1))
last_dist = A[0] + K - A[N - 1]
type(last_dist)
per_dist.append(last_dist)
max_dist = max(per_dist)
print(K - max_dist)

Measured memory_bytes: 26444
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner t=new Scanner(System.in);
		int k=t.nextInt(), x=t.nextInt();
		for(int i=(x-k)+1;i<x;i++) {
			System.out.print(i + " ");
		}
		for(int i=x;i<x+k;i++) {
			if(i == (x+k)-1) {
				System.out.println(i);
			}else {
			
			System.out.print(i + " ");
		}
		}
	}
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define mod 1000000007
#define ALL(a) a.begin(),a.end()
 
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
 
int main(){
	int h, w;
	cin >> h >> w;
	string s[h];
	for (int i = 0; i < h; i++) cin >> s[i];

	bool no = false;
	for (int i = 0; i < h; i++){
		for (int j = 0; j < w; j++){
			if(s[i][j] == '#'){
				if(s[i][j+1] == '#' && j < w-1) continue;
				if(s[i][j-1] == '#' && j > 0) continue;
				if(s[i+1][j] == '#' && i < h-1) continue;
				if(s[i-1][j] == '#' && i > 0) continue;

				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>

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

using namespace std;

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

int main() {
    cin >> N;

    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            if (i * j == N) {
                cout << "Yes" << endl;
                exit(0);
            }
        }
    }
    cout << "No" << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>

const int continuity = 3;  //問より3連続なので3

int main() {
	bool flag=false;
	int num,k=0;
	std::vector<int> v;

	std::cin >> num;

	int tmp = num;

	while (tmp!=0) {  //((int tmp=num)!=0)とかしたかったけど無理そう
		v.push_back(tmp % 10);
		tmp /= 10;
	}

	for (int i = 0;i<v.size(); i++) {
		for (int j = i+1;j<v.size(); j++) {
			if (v[i] == v[j]) {
				k++;
				if (k == continuity) {
					flag = true;
				}
			}
			else {
				break;
			}
		}
	}

	std::cout << (flag ? "Yes" : "No") << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n;
    cin>>n;
    vector<pair<int,int>> v[n];
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        for(int j=0;j<x;j++){
            int p,q;cin>>p>>q;
            v[i].push_back({p,q});
        }
    }
    int nax=(1<<n);
    int ans=0;
    for(int i=0;i<nax;i++){
    //	cout<<i<<" ";
        int p=i;
        int h[n+1]={0};
        vector<int> a(n+1,-1);
        int l=1;
        int hj=0;
        while(p){
            if(p&1){
                h[l]=1;
                hj++;
            }
            l++;
            p/=2;
        }
      //  cout<<l-1<<","<<i<<endl;
        int gh=0;
        for(int j=1;j<=n;j++){
            if(h[j]==0) continue;
            for(auto x : v[j-1] ){
                if(x.second==0){
                    if(a[x.first]==-1) a[x.first]=0;
                    else{
                        if(a[x.first]==1){
                            gh=1; break;
                        }
                    }
                }
                else{
                    if(a[x.first]==-1) a[x.first]=1;
                    else{
                        if(a[x.first]==0){
                            gh=1; break;
                        }
                    }
                }
            }
            if(gh==1) break;
        }
        for(int j=1;j<=n;j++){
            if(a[j]==-1) continue;
            if(a[j]!=h[j]){
                gh=1; break;
            }
        }
        if(gh==1) continue;
        ans=max(ans,hj);
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    ll ret = 0;
    int cur = 1;
    ret += (A[0] - 1);
    cur = 2;
    repd(i, 1, N){
        if(cur == A[i]){
            cur++;
            continue;
        }
        ret += (A[i] - 1) / cur;
    }
    
    output(ret);
    return 0;
}

Measured memory_bytes: 640
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N = int(input())

ans = 0
for i in range(1, N+1):
    if i % 2 == 0:
        continue
    factor = factorization(i)
    c = 1
    for j in range(len(factor)):
        c *= (factor[j][1] + 1)
    if c == 8:
        ans += 1

print(ans)

Measured memory_bytes: 9400
#include<stdio.h>
int main(){
  int s;
  scanf("%d",&s);
  int L,R;
  L=s/100;
  R=s%100;
  
  if(1<=L && L<=12){
    if(1<=R && R<=12){
      printf("AMBIGUOUS");
    }
    else printf("MMYY");
  }else 
    if(1<=R && R<=12){
      printf("YYMM");
    }else printf("NA");
}
      


Measured memory_bytes: 1724
data = [
     "{0} {1}".format(s, r) 
      for s in ('S', 'H', 'C', 'D')
      for r in range(1, 13 +1)
        ]
count = int(input())
for c in range(count):
      card = input()
      data.remove(card)

for c in data:
   print(c)

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

int main(){
    string S;
    cin >> S;
    int i;
    for(i = 0; i < S.length(); i++){
        if(i % 2 == 0){
            if(S[i] == 'L') break;
        }else{
            if(S[i] == 'R') break;
        }
    }

    cout << (i == S.length() ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
l, r, fl, fr, gl, gr, ans= 0, 0, 0, A[0], 0, A[0], 0
while l < N:
    while r+1 < N and fr-fl+A[r+1] == gr^gl^A[r+1]:
        r += 1
        fr += A[r]
        gr ^= A[r]
    ans += r-l+1
    fl += A[l]
    gl ^= A[l]
    l += 1
print(ans)


Measured memory_bytes: 77772
import java.util.*;
import java.lang.*;

public class Main {
    
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();
        double ans = 0;
        for (int i = 1; i <= n; i++) {
            double p = 0;
            double x = 0;
            double score = i;
            while (score < k) {
                score *= 2;
                x++;
            }
            double d = 1.0 / n;
            p = d * Math.pow(0.5, x);
            ans += p;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include<iostream>
main(){int n,m,i,a,c[1000001];for(std::string s;std::cin>>n>>m>>s,n;printf("%d\n",a))for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)=="IOI"?c[i+2]+1:0;}

Measured memory_bytes: 5832
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <numeric>
#include <string>
#include <functional>

using namespace std;

vector<int> to[200001];
vector<int> ans;

void dfs(int v,int p=-1){
    for(int u : to[v]){
        if(u==p){continue;}
        ans[u]+=ans[v];
        dfs(u,v);
    }
}

int main(void){
    int N,Q;
    cin>>N>>Q;
    for(int i=0;i<N-1;i++){
        int a,b;
        cin>>a>>b;
        a--;b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    ans.resize(N);
    for(int i=0;i<Q;i++){
        int p,x;
        cin>>p>>x;
        p--;
        ans[p]+=x;
    }
    dfs(0);
    cout<<ans[0];
    for(int i=1;i<N;i++){
        cout<<" "<<ans[i];
    }
    cout<<endl;
    return 0;
}

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

int main(){
    int N,i;
    cin>>N;
    vector<double> A(N);
    double result=0;
    for(i=0;i<N;i++)cin>>A[i];

    for(i=0;i<N;i++){
        result+=1/A[i];
    }
    cout<<1/result<<endl;
    return 0;
}

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

int main()
{
	

	while (1) {
		int H, W;
		cin >> H >> W;

		if (H == 0 && W == 0)break;

		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (i==0||i==H-1||j==0||j==W-1)cout << "#";
				else cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
}

Measured memory_bytes: 3012
#include "bits/stdc++.h"
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<pair<int, int>> Apos(N);
    for (int i = 0; i < N; i++) {
        cin >> Apos[i].first;
        Apos[i].second = i;
    }

    sort(Apos.begin(), Apos.end());
    reverse(Apos.begin(), Apos.end());
    int pos = Apos[0].second;
    for (int i = 0; i < N; i++) {
        if (i != pos) cout << Apos[0].first << endl;
        else cout << Apos[1].first << endl;
    }
}

Measured memory_bytes: 3200
string = input()
raw = int(input())
for _ in range(raw):
    hoge = input().strip().split()
    if hoge[0] == 'print':
        print (string[int(hoge[1]):int(hoge[2])+1])
    elif hoge[0] == 'reverse':
        string = string[:int(hoge[1])] + string[int(hoge[1]):int(hoge[2])+1][::-1] + string[int(hoge[2])+1:]
    elif hoge[0] == 'replace':
        string = string[:int(hoge[1])] + hoge[3] + string[int(hoge[2])+1:]


Measured memory_bytes: 5620