akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

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

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))

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()
{
    int N, A, B, ans;
    cin >> N >> A >> B;
    if(A + B <= N) { ans = 0; }
    else { ans = A + B - N; }
    printf("%lld %lld\n", min(A, B), ans);
    return 0;
}


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

typedef long long ll;
using namespace std;
int main()
{
  string s;
  cin>>s;
  ll max;

  if(s=="SSS"){
    max=0;
  }else if(s=="SSR"||s=="SRS"||s=="RSS"||s=="RSR"){
    max=1;
  }else if(s=="RRR"){
    max=3;
  }else{
    max=2;
  }
  cout<<max<<endl;
  return 0;
}


Measured memory_bytes: 3580
import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		String[] strs = str.split(" ");
		int a = Integer.parseInt(strs[0]);
		int b = Integer.parseInt(strs[1]);
		int c = Integer.parseInt(strs[2]);
		int[] ans = {a, b, c};
		for(int i = 0; i < ans.length; i++){
			for(int x = i; x < ans.length; x++){
				if(ans[x] < ans[i]){
					int w = ans[x];
					ans[x] = ans[i];
					ans[i] = w;
				}//if
			}//for
		}//for
		System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		br.close();
	}
}

Measured memory_bytes: 16916
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using ll = int64_t;
using ld = long double;
using ull = uint64_t;
using namespace std;
using namespace __gnu_pbds;

const int MAXN = 1000002;
ll fct[MAXN];
ll rfct[MAXN];

const ll MOD = 1e9 + 7;

ll pw(ll a, ll b) {
    if (!b) {
        return 1;
    }

    ll v = pw(a, b / 2);
    v = (v * v) % MOD;

    if (b & 1) {
        v = (v * a) % MOD;
    }

    return v;
}

ll cnk(int a, int b) {
    return fct[a + b] * rfct[a] % MOD * rfct[b] % MOD;
}

int main() {
#ifdef PAUNSVOKNO
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20);  
    int n;
    cin >> n;

    if (n == 2) {
        cout << "1\n";
        return 0;
    }

    fct[0] = 1;
    for (int i = 1; i <= n; ++i) {
        fct[i] = fct[i - 1] * i % MOD;
    }

    rfct[n] = pw(fct[n], MOD - 2);
    for (int i = n - 1; i >= 0; --i) {
        rfct[i] = (rfct[i + 1] * (i + 1)) % MOD;
    }

    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        ll tot = cnk(n - 1 - i, i);

        ll gd = 0;
        ll ln = n - 2;
        ll cn = i - 1;
        if (ln <= 2 * cn) {
            int bg = ln - cn;
            int sm = cn - bg;
            gd = cnk(bg, sm);
        }

        ll b = (tot - gd + MOD * MOD) % MOD;

        b = b * fct[i] % MOD;
        b = b * fct[n - 1 - i] % MOD;

        ans = (ans + b) % MOD;
    }

    cout << (ans + MOD * MOD) % MOD << "\n";
}

Measured memory_bytes: 15872
#include<iostream>
#include<string.h>
using namespace std;
long long a[100]={0};
int main()
{
	int i,d;
	scanf("%d",&d);
	a[0]=2;a[1]=1;
	if(d==1)
		printf("%d",1);
	else
	{
		for(i=2;i<=d;i++)
			a[i]=a[i-1]+a[i-2];
		printf("%lld",a[d]);
	}
	return 0;
} 

Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

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())

#define unordered_map __fast_unordered_map
template<class Key, class Value, class Hash = std::hash<Key>>
using unordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;

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


int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);

  int N;
  cin >> N;
  
  const int MaxCol = 3e5;
  vector<int> colors(N);
  for (int i = 0; i < N; ++i) { cin >> colors[i]; }

  colors.resize(unique(ALL(colors)) - colors.begin());
  N = SZ(colors);

  const int Mod = 1e9 + 7;

  vector<int> dp(N + 1);
  vector<int> color_dp(MaxCol);

  dp[0] = 1;

  for (int i = 1; i <= N; ++i) {
    dp[i] = (color_dp[colors[i - 1]] + dp[i - 1]) % Mod;
    color_dp[colors[i - 1]] = dp[i];
  }

  cout << dp.back() << "\n";
}



Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int main(){
int A,B,C,x,y,z;
cin>>A>>B>>C;
x=A+B;
y=A-B;
z=A*B;
-100<=A;
B<=100;
if(x>=z){
    if((x-y)>=0){
        cout<<x<<endl;
    }else if((x-y)<0){
        cout<<y<<endl;
    }
}
else if(x<z){
    if((z-y)>=0){
        cout<<z<<endl;
    }else{
        cout<<y<<endl;
    }
}

}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>
using namespace std;
int main(void)
{
	int i,n,flg,j,len;
	char s[100][11];
	scanf("%d",&n);
	for(i=0;i<n;i++)	scanf("%s",s[i]);
	flg=1;
	for(i=0;i<n-1;i++)	{
		for(j=i+1;j<n;j++)	{
			if(strcmp(s[i],s[j])==0)	{
				flg=0;	
			}
		}
	}
	
	for(i=1;i<n;i++)	{
		len=strlen(s[i-1]);
		if(s[i][0]!=s[i-1][len-1])	flg=0;
	}
	if(flg==1)	printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE


void solve (void)
{
  int N;cin>>N;
  map<pair<string,int>  ,int> mp;
  vector<pair<string,int> > vp;
  for (int i = 0; i < N; i++)
  {
    string A; int B;
    cin>>A>>B;
    B *= -1;
    vp.emplace_back(A,B);
    mp[vp[i]] = i+1;
  }
  sort(ALL(vp));
  for (int i = 0; i < N; i++)
  {
    // DEBUG(vp[i].first,vp[i].second);
    cout<<mp[vp[i]]<<endl;
  }
  
  

  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 256
S = input()
N = len(S)

result = (S == ''.join(list(reversed(S))) and
S[0:int((N-1)/2)] == ''.join(list(reversed(S[0:int((N-1)/2)]))) and
S[int((N+3)/2):-1] == ''.join(list(reversed(S[int((N+3)/2):-1]))))

print('Yes') if result == True else print('No')

Measured memory_bytes: 3064
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n;
  rrep(a, 1, n + 1) {
    rrep(b, 1, n + 1) {
      rrep(c, 1, n + 1) {
        cnt = __gcd(a, b);
        cnt = __gcd(cnt, c);
        ans += cnt;
      }
    }
  }
  Cout(ans);
  return 0;
}

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

int main(){
  int A, B, value;
  cin >> A >> B;
  for(int i=0;i<1000;i++){
    value = i + 1;
    if(floor(value * 0.08) == A && floor(value * 0.1) == B){
      //cout << "value * 0.08 =" << value * 0.08 << endl;
      //cout << "value * 0.1 =" << value * 0.1 << endl;
      cout << value << endl;
      break;
    }
    if(value == 1000){
      cout << -1 << endl;
    }
  }
  //cout << "25 * 0.1 =" << 25 * 0.1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main()
{
    INIT;
    string s;
    cin >> s;
    int ans = 10e8;
    int n = 0;
    for(int i=0; i< s.size() - 2; i = i+1){
        n =  (s.at(i) - '0') * 100 + (s.at(i+1) - '0') * 10 + (s.at(i+2) - '0');
        //cout << n << endl;/*デバッグ用*/
        ans = min(ans, abs( 753 - n ));
    }
    cout << ans << endl;

    return 0;
}

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

void solve () {

}

int main () {
	//int var;
	int vector[5];
	for(int i = 0; i < 5; i++) {
		cin >> vector[i];
	}
	for (int i = 0; i < 5; i++) {
		if (vector[i] == 0) {
			cout << vector[i] + i+1;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
typedef long long int ll; 
typedef long double ld; 


int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    ll n,k;
    cin>>n>>k;

    ll arr[n+1];

    for(ll i=1;i<=n;i++)
    {
        cin>>arr[i];
    }

    map <ll,ll> mp;

    mp[1] = 0;

    ll st = 1;
    ll nex = -1;
    while(k>0)
    {
        nex = arr[st];
        k--;
        if(mp.find(nex)!=mp.end())
        {
            break;
        }
        mp[nex] = mp[st]+1;
        st = nex;
        

    }
    //cout<<k<<endl;
    if(k==0)
    {
        cout<<nex<<endl;
    }
    else{
    //    cout<<st<<" "<<nex<<endl;
        ll dur = mp[st]-mp[nex]+1;
      //  cout<<dur<<endl;
        k = k%dur;
        st = nex;
        while(k>0)
        {
            nex = arr[st];
            k--;
            st = nex;
        }
        cout<<nex<<endl;
    }



}

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

int main() {
  long n;
  string s;
  unordered_set<string> a;
  cin >> n;
  for(long i=0;i<n;i++) {
    cin >> s;
    a.insert(s);
  }
  cout << a.size() << endl;
}

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

int main(){
    int s;
    cin >> s;
    int a = s/1000;
    int b = s%1000/100;
    int c = s%100/10;
    int d = s%10;
    if(a+b+c+d == 7){
        cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
        return 0;
    }
    if(a-b+c+d == 7){
        cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
        return 0;
    }
    if(a-b-c+d == 7){
        cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
        return 0;
    }
    if(a-b-c-d == 7){
        cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;
        return 0;
    }
    if(a-b+c-d == 7){
        cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
        return 0;
    }
    if(a+b-c-d == 7){
        cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
        return 0;
    }
    if(a+b-c+d == 7){
        cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
        return 0;
    }
    if(a+b+c-d == 7){
        cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<ll> Size;
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n + 1); rank.resize(n + 1); Size.resize(n + 1);
        for (int i = 0; i <= n; ++i) par[i] = i, rank[i] = 0, Size[i] = 1;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

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

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        Size[x] += Size[y];
        return true;
    }

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


int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    UnionFind uni(200050);
    for(int i = 1; i < N; i++) {
        int u, v, w;
        cin >> u >> v >> w;
        if(w % 2 == 0) {
            uni.merge(u, v);
            uni.merge(u+N, v+N);
        } else {
            uni.merge(u, v + N);
            uni.merge(u+N, v);
        }
    }
    for(int i = 1; i <= N; i++) {
        if(uni.issame(1, i)) cout << "0" << endl;
        else cout << "1" << endl;
    }
    return 0;
}


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

using namespace std;
const long long int big = 998244353;
const int MAX = 510000;
long long int fac[MAX], finv[MAX], inv[MAX];

long long int COM(long long int n, long long int k);
void COMinit();

long long int mpow(int m, int k);

int main()
{
    int n, m, k;
    cin >> n >> m >> k;
    long long int res = 0, temp;

    COMinit();
    // cout << mpow(m - 1, n - 0 - 1) << endl;
    // cout << COM(n - 1, n - 2) << endl;
    for (int i = 0; i <= k; i++)
    {
        temp = (COM(n - 1, i) * ((m * mpow(m - 1, n - i - 1)) % big)) % big;
        res = res + temp;

        res = res % big;
    }
    cout << res << endl;
}

long long int mpow(int m, int k)
{
    if (k == 1)
    {
        return m;
    }
    else if (k == 0)
    {
        return 1;
    }
    else
    {
        if (k % 2 == 1)
        {
            long long int a = mpow(m, k / 2);
            return (((a * a) % big) * m) % big;
        }
        else
        {
            long long int a = mpow(m, k / 2);
            return (a * a) % big;
        }
    }
}

void COMinit()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % big;
        inv[i] = big - inv[big % i] * (big / i) % big;
        finv[i] = finv[i - 1] * inv[i] % big;
    }
}

long long int COM(long long int n, long long int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    // long long int res = 1;
    // for (int i = 0; i < k; i++)
    // {
    //     res *= (n - i);
    //     res %= big;
    // }
    // return (res * (finv[k] % big)) % big;
    return (((fac[n] * (finv[n - k]) % big) * finv[k])) % big;
}

Measured memory_bytes: 15604
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007

//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}
//qsort(data, 10, sizeof(int), compare_int)

int main(){
	char rname[100], name[100];
	long long n;
	long long amari;
	char alp[] = "abcdefghijklmnopqrstuvwxyz";
	scanf("%lld", &n);
	n--;

	int i=0;
	for(i=0; i<100; i++){
		amari = n%26;
		rname[i] = alp[amari];
		n -= amari;
		if(n==0) break;
		n = n/26 -1;
		rname[i] = alp[amari];
	}
	
	for(int j=0; j<=i; j++){
		name[j] = rname[i-j];
	}
	
	
	for(int j=0; j<=i; j++){
		printf("%c", name[j]);
	}
	printf("\n");
	//printf("%s\n", name);
	
	return 0;
}


Measured memory_bytes: 1644
#include<bits/stdc++.h>
#define N (300009)
using namespace std;

struct Node
{
	int x,y;
	bool operator < (const Node &a) const {return x<a.x;}
}p[N];
struct Sgt{int add,max;}Segt[N<<2];
int w,h,n,ans;
int s1[N],s2[N],t1,t2;

void Pushdown(int now)
{
	Segt[now<<1].add+=Segt[now].add;
	Segt[now<<1|1].add+=Segt[now].add;
	Segt[now<<1].max+=Segt[now].add;
	Segt[now<<1|1].max+=Segt[now].add;
	Segt[now].add=0;
}

void Update(int now,int l,int r,int l1,int r1,int k)
{
	if (l>r1 || r<l1) return;
	if (l1<=l && r<=r1) {Segt[now].add+=k; Segt[now].max+=k; return;}
	int mid=(l+r)>>1; Pushdown(now);
	Update(now<<1,l,mid,l1,r1,k); Update(now<<1|1,mid+1,r,l1,r1,k);
	Segt[now].max=max(Segt[now<<1].max,Segt[now<<1|1].max);
}

void Solve()
{
	memset(Segt,0,sizeof(Segt));
	sort(p+1,p+n+1);
	s1[t1=1]=1; s2[t2=1]=1;
	Update(1,1,n,1,n,h);
	for (int i=2; i<=n; ++i)
	{
		Update(1,1,n,1,i-1,p[i].x-p[i-1].x); ans=max(ans,Segt[1].max*2);
		if (p[i].y>=h/2)
		{
			Update(1,1,n,s1[t1],i-1,p[i].y-h);
			while (t1>1 && p[s1[t1]].y>=p[i].y)
				Update(1,1,n,s1[t1-1],s1[t1]-1,p[i].y-p[s1[t1]].y), t1--;
			s1[++t1]=i;
		}
		else
		{
			Update(1,1,n,s2[t2],i-1,-p[i].y);
			while (t2>1 && p[s2[t2]].y<=p[i].y)
				Update(1,1,n,s2[t2-1],s2[t2]-1,p[s2[t2]].y-p[i].y), t2--;
			s2[++t2]=i;
		}
	}
}

int main()
{
	scanf("%d%d%d",&w,&h,&n);
	for (int i=1; i<=n; ++i)
		scanf("%d%d",&p[i].x,&p[i].y);
	p[++n]=(Node){0,0}; p[++n]=(Node){w,h};
	Solve();
	for (int i=1; i<=n; ++i) swap(p[i].x,p[i].y);
	swap(w,h); Solve();
	printf("%d\n",ans);
}

Measured memory_bytes: 12800
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    int N,M;
    cin>>N>>M;
    vector<int> A(M);
    REP(i,M) cin>>A[i];
    vector<int> B={-1,2,5,5,4,5,6,3,7,6};
    map<int,int> mp;
    REP(i,M){
        mp[B[A[i]]]=max(mp[B[A[i]]],A[i]);
    }
    auto dp=make_vec<ll>(N+100,10);
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        dp[itr->first][0]++;
        dp[itr->first][itr->second]++;
    }

    REP(i,N+1){
        if(dp[i][0]==0) continue;
        for(auto itr=mp.begin();itr!=mp.end();itr++){
            bool flag=false;
            if(dp[i][0]+1==dp[i+(itr->first)][0]){
                REPD2(j,9,0){
                    int tmp=dp[i][j];
                    if(j==(itr->second)) tmp++;
                    if(tmp>dp[i+(itr->first)][j]){
                        flag=true;
                        break;
                    }else if(tmp<dp[i+(itr->first)][j]){
                        break;
                    }
                }
            }
            if(dp[i][0]+1>dp[i+(itr->first)][0]||flag){
                REP(j,10){
                    dp[i+(itr->first)][j]=dp[i][j];
                }
                dp[i+(itr->first)][0]++;
                dp[i+(itr->first)][(itr->second)]++;
            }
        }
    }
    REPD2(i,9,0){
        REP(j,dp[N][i]) cout<<i;
    }
    cout<<endl;

    
    
}

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

int main(){
  int a;
  string s;
  cin >> a >> s;
  cout << (a >= 3200 ? s : "red") << endl;
}



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


ll fun(ll lo, ll hi,ll index, vector<pair<ll,ll>> &vec,map<pair<ll,ll>,ll> &ma)
{
    if(lo>hi)
    return 0;
    if(lo==hi)
    {
        ll temp=(vec[index].first)*abs(lo-vec[index].second);
        ma[make_pair(lo,hi)]=temp;
        return temp;
    }
    else
    {
        if(ma.find(make_pair(lo+1,hi))==ma.end())
        {
            fun(lo+1,hi,index+1,vec,ma);
        }
        
        if(ma.find(make_pair(lo,hi-1))==ma.end())
        {
            fun(lo,hi-1,index+1,vec,ma);
        }
        
        ll a=vec[index].first;
        ll b=vec[index].second;
        ll temp=std::max(a*abs(lo-b)+ma[make_pair(lo+1,hi)],a*abs(hi-b)+ma[make_pair(lo,hi-1)]);
        ma[make_pair(lo,hi)]=temp;
        return temp;
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    vector<pair<ll,ll>> vec(n);
    for(ll i=0;i<n;++i)
    {
        ll a;
        cin>>a;
        vec[i]=make_pair(a,i);
    }
    sort(vec.rbegin(),vec.rend());
    map<pair<ll,ll>,ll> ma;
    ll ans=fun(0,n-1,0,vec,ma);
    cout<<ans<<"\n";

}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF (1LL<<25)     //33554432
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

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

  ll ans = 1;
  REP(i, n) {
    ans = (ans * (i+1)) % MOD;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define fort(i,n) for (int i = 1; i <= n; ++i)
#define pi pair<int,int>
#define vi vector<int>
#define pb push_back
#define sz size()
#define er erase
#define fr first
#define sc second
#define rc(x) return cout << x, 0
using namespace std;

int n,a[100005],b[100005],c[100005],dp[100005][5];

int32_t main()
{
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n;
    fort (i,n)
        cin >> a[i] >> b[i] >> c[i];
    fort (i,n)
    {
        dp[i][1]=max(dp[i-1][2]+a[i],dp[i-1][3]+a[i]);
        dp[i][2]=max(dp[i-1][1]+b[i],dp[i-1][3]+b[i]);
        dp[i][3]=max(dp[i-1][2]+c[i],dp[i-1][1]+c[i]);
    }
    cout << max(dp[n][1],max(dp[n][2],dp[n][3]));
}


Measured memory_bytes: 3328
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		String c=s.next();
		n=n%26;
		for(int i=0;i<c.length();i++)
		{int k=(int)c.charAt(i)+n;
		 if(k>90)
		    {int l=k-90-1;
		    k=65+l;}
		    System.out.print((char)k);
		}}}

Measured memory_bytes: 27476
from sys import stdin
sN,sK = stdin.readline().rstrip().split()
N,K = int(sN), int(sK)
S = stdin.readline().rstrip()
# print(N,K)
# print(S)
nums = []
now = 1
cnt = 0
for itr in range(0,N):
    if S[itr] == str(now):
        cnt += 1
    else:
        nums.append(cnt)
        now = 1 - now
        cnt = 1
if(cnt != 0):
    nums.append(cnt)
if(len(nums)%2 == 0):
    nums.append(0)
add = 2*K+1
ans = 0
left = 0
right = 0
tmp = 0
for itr in range(0,len(nums),2):
    nextleft = itr
    nextright = min(itr + add, len(nums))
    while(right < N and right < nextright):
        tmp += nums[right]
        right += 1
    while(left < N and left < nextleft):
        tmp -= nums[left]
        left += 1
    ans = max(tmp, ans)
print(ans)

Measured memory_bytes: 4092
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

x, y = map(int, input().split())

if (x in a) and (y in a):
    print('Yes')
elif (x in b) and (y in b):
    print('Yes')
elif (x in c) and (y in c):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

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

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main() {
  int n;
  cin >> n;
  vector<int> v(n + 1);
  rep (i, n - 1) {
    int tmp;
    cin >> tmp;
    v[tmp]++;
  }
  for (int i = 1; i <= n; i++) {
    P(v[i]);
  }
  return 0;
}

Measured memory_bytes: 4052
def main():
    a = [int(i) for i in input()]
    b = [int(i) for i in input()]

    if len(a) > len(b):
        print("GREATER")
    elif len(a) < len(b):
        print("LESS")
    else:
        flag = 1
        for m, n in zip(a, b):
            if m > n:
                print("GREATER")
                flag = 0
                break
            elif m < n:
                print("LESS")
                flag = 0
                break
        if flag:
            print("EQUAL")


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = (LL)1e9+7;
const int SIZE = 2e5+5;
const LL INF = 1LL<<60;
const double eps = 1e-4;
const double PI=3.1415926535897932;

int ss[20][20]; // Product needs to be at least n

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int  n;
	cin >> n;
	LL ans = 0;
	REP(i,n){
		string s;
		cin >> s;
		LL v = 0;
		int pd = 0;//number of powers to subtract
		REP(j,SZ(s)){
			if(s[j]=='.'){
				pd = SZ(s)-1-j;
			}
			else{
				v=v*10;
				v+=s[j]-'0';
			}
		}
		int p2=-pd,p5=-pd;
		while(v%2==0){p2++;v/=2;}
		while(v%5==0){p5++;v/=5;}
		REPP(j,max(9-p2,0),20){
			REPP(k,max(9-p5,0),20){
				ans += ss[j][k];
			}
		}
		ss[min(p2+9,19)][min(p5+9,19)]++;
	}
	cout << ans;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;

int main()
{

    int N,A[110],ans=INT32_MAX,temp=0,s=100,e=-100;

    cin >> N;

    for(int i=1;i<=N;i++){
        cin >> A[i];
        if(A[i]<s)s=A[i];
        if(A[i]>e)e=A[i];
    }

    for(int j=s;j<=e;j++){
        temp=0;
        for(int k=1;k<=N;k++){
            int X = max(A[k],j) - min(A[k],j);
            X *= X;
            temp+=X;
        }
        if(temp<ans)ans = temp;    
    }

    cout << ans ;

    return 0;
}


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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) { cin1(x[i]); }
#define ncin2(n, x, y)      REP(i, 0, n) { cin2(x[i], y[i]); }
#define ncin3(n, x, y, z)   REP(i, 0, n) { cin3(x[i], y[i], z[i]); }
#define ncinp(n, p)         REP(i, 0, n) { lli p1,p2; cin >> p1 >> p2; p[i] = P(p1, p2); }
#define ncin1_1(n, x)       REPE(i, 1, n) { cin1(x[i]); }
#define ncin2_1(n, x, y)    REPE(i, 1, n) { cin2(x[i], y[i]); }
#define ncin3_1(n, x, y, z) REPE(i, 1, n) { cin3(x[i], y[i], z[i]); }
#define ncinp_1(n, p)       REPE(i, 1, n) { lli p1,p2; cin >> p1 >> p2; p[i] = P(p1, p2); }

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;
typedef vector<lli> vlli;

int main() {
    lli n;
    cin1(n);
    string s, t;
    cin2(s,t);
    REP(i,0,n) {
        cout << s[i];
        cout << t[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
N = int(input())
A = [input() for _ in range(N)]
dic = {}

for i in range(N):
  dic[A[i]] = 0
  
for i in range(N):
  dic[A[i]] += 1

k = max(dic.values())
dic = sorted(dic.items(), key=lambda x:x[0])
for el in dic:
  if el[1] == k:
    print(el[0])

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

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

  int n,k;
  cin >> n >> k;

  vector<int> a(n);
  rep(i,n) cin >> a[i];

  int ng = 0, ok = 1e9;
  while(ok - ng > 1) {
    int mid = (ok + ng) / 2;
    int sum = 0;
    for (int i = 0; i < n; i++) {
      int cnt = (a[i] + mid - 1) / mid - 1;
      sum += cnt;
      if(sum > k) break;
    }
    if(sum > k) {
      ng = mid;
    } else {
      ok = mid;
    }
  }

  cout << ok << endl;
}

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

// m個選ぶときの和としてあり得るものの個数
ll f(ll n, ll m, ll p) {
	ll ans = m * (n - m) + 1;
	return ans % p;
}

int main() {
	ll n,k;
	ll p = 1e9+7;
	cin >> n >> k;
	ll ans = 0;
	for (ll m=k;m<=n+1;m++) {
		ans += f(n+1,m,p);
		ans %= p;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    string str;
    cin >> str;
    int maxa = 0;
    int i;
    for(i=0;i<str.size();i++)
    {
        if(str[i] == 'R')
        {
            int j = i;
            while(j < str.size() && str[j] == 'R')
                j++;
            maxa = max(maxa, j-i);
            i = j-1;
        }
    }
    cout << maxa;
}

Measured memory_bytes: 3588
/*
    Mbak Sana Dong
    Mbak Chaeyoung Dong
*/
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int n;
double X, Y, d, e;
int x[55], y[55];
double dist(double a, double b) {
	return a*a + b*b;
}
int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d %d", &x[i], &y[i]);
		X += x[i]; Y += y[i];
	}
	X /= n; Y /= n;
	double P = 0.1;
	for (int i = 0; i < 30000; i++) {
		int f = 0;
		d = dist(X - x[0], Y - y[0]);
		for (int j = 1; j < n; j++) {
			e = dist(X - x[j], Y - y[j]);
			if (d < e) { d = e; f = j; }
		}
		X += (x[f] - X)*P;
		Y += (y[f] - Y)*P;
		P *= 0.999;
	}
	printf("%.15f\n", sqrt(d));
}


Measured memory_bytes: 256
/*Whose woods these are I think I know.
His house is in the village though;
He will not see me stopping here
To watch his woods fill up with snow.

My little horse must think it queer
To stop without a farmhouse near
Between the woods and frozen lake
The darkest evening of the year.

He gives his harness bells a shake
To ask if there is some mistake.
The only other sound’s the sweep
Of easy wind and downy flake.

The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
const int maxn= 100010;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a=0,b=0,c=0,d=0;
    cin>>a>>b>>c>>d;
    bool chance=true;
    while(a>0&&c>0)
    {
        if(chance)
        {
            c-=b;
            chance=false;
        }
        else
        {
            a-=d;
            chance=true;
        }
    }
    if(chance)
        cout<<"No";
    else
        cout<<"Yes";
    cout<<endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>

int main(){
  std::string S;
  std::cin >> S;
  int N = S.length();
  std::vector<int > A(N+1);
  A[0]=0;
  for (int i=1; i<=N; i++){
    A[i] = int(S[i-1])-int('0');
  }
  std::reverse(A.begin(), A.end());
  std::vector<std::vector<int> > dp(N+5, std::vector<int> (2, 100100100));
  dp[0][0] = 0;
  for (int i=0; i<=N; i++){
    dp[i+1][0] = A[i]+dp[i][0];
    if (A[i]!=9){
      dp[i+1][0] = std::min(dp[i+1][0], A[i]+1+dp[i][1]);
    }
    dp[i+1][1] = (9-A[i])+dp[i][1];
    if (A[i]!=0){
      dp[i+1][1] = std::min(dp[i+1][1], (10-A[i])+dp[i][0]);
    }
  }
  printf("%d\n", dp[N+1][0]);
  return 0;
}


Measured memory_bytes: 59892
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val s = sc.next()
  val t = sc.next()

  val ss = s.toCharArray().asList().sorted().joinToString("")
  val tt = t.toCharArray().asList().sorted().reversed().joinToString("")

  if (ss < tt) {
    println("Yes")
    return
  }
  println("No")

}


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

int main(){
	int track[100];
	int x;
	int counter=0;
	int exit[100];
	int exit_number=0;
	while(cin >> x){
		if(x==0){
			counter--;
			exit[exit_number]=track[counter];
			exit_number++;
			
		}
		else{
			track[counter]=x;
			counter++;
		}
	}
	for(x=0; x<exit_number;x++){
		cout << exit[x] << endl;
	}
}


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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
int A[220000];
map<int, int> mp;
signed main() {
    cin >> N;
    rep(i, N) { cin >> A[i]; }
    int ans = 0;
    rep(i, N) {
        ans += mp[i - A[i]];
        mp[i + A[i]]++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 27876
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    ll q; cin >> q;

    rep(i,q){
        ll a, b; cin >> a >> b;
        ll jud = sqrt(a*b);
        ll ans;

        //中心がjudとjudになる
        if(jud * (jud+1) >= a*b){
            ans = 2*jud - 1;
        }
        else{
            ans = 2*jud;
        }

        if(jud * jud == a * b && a != b){
            cout << ans - 2 << endl;
            continue;
        }

        cout << ans - 1 << endl;

    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#define mod 1000000007
#define ten5 100005
#define PI 3.1415926
using namespace std;

int num[201];

int main()
{
    //int m,n,o=0,i,j,k;
    long long int sum=0,sum2=0,n1=0,n2=0,n3;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=1,now=1;
    long long int a,a1,a2,a3,a4;
    //float f,g,h;
    //char now,pre;
    string s,s1;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>m;
        num[i]=m;
    }
    while(true)
    {
        for(i=0;i<n;i++)
        {
            if(num[i]%2==1)
            {
                cout<<sum;
                return 0;
            }
            else
                num[i]/=2;
        }
        sum++;
    }
    cout<<sum;
    return 0;
}



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

using namespace std;
#define int long long
const int MOD = 1000000007;
bool isprime(int N) {
	for (int i = 2; i * i <= N; i++) {
		if (N % i == 0) {
			return false;
		}
	}
	return true;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	while (!isprime(N)) N++;
	cout << N << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long takahashi = scanner.nextLong();
        long aoki = scanner.nextLong();
        long takahashikaisuu = scanner.nextLong();

       long takahashinokori = takahashi - takahashikaisuu;
       long aokinokori =0;
       if (takahashinokori < 0){
           aokinokori = aoki + takahashinokori;
           takahashinokori = 0;
           if (aokinokori <0){
               aokinokori = 0;
           }
       }
       else {
           aokinokori = aoki;
       }

            System.out.println(takahashinokori + " " + aokinokori);
        }
    }



Measured memory_bytes: 21844
#include <cstdio>
#include <vector>
using namespace std;
int main(){
	for(int n,q;~scanf("%d%d",&n,&q);){
		for(int i=1;;i*=2) if(i>=n){ n=i; break; }
		vector<int> val(n),idx(2*n);
		for(int i=0;i<n;i++) idx[n+i]=i;
		for(int i=n;--i;) idx[i]=idx[i*2];
		while(q--){
			int a,v; scanf("%d%d",&a,&v);
			val[--a]+=v;
			for(int i=(n+a)/2;i;i/=2)
				idx[i]=idx[i*2+(val[idx[i*2]]<val[idx[i*2+1]])];
			printf("%d %d\n",idx[1]+1,val[idx[1]]);
		}
	}
	return 0;
}

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	ll n,k; cin >> n >> k;
	ll cur = n/k;
	ll f1 = abs(n - (cur>0?cur-1:0)*k);
	ll f2 = abs(n - cur*k);
	ll f3 = abs(n - (cur+1)*k);
	cout << min(f1,min(f2,f3)) << endl;
}	
/*  Benq's (modified)
	stuff you should look for
	* ll, int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


Measured memory_bytes: 256
n, m = map(int,input().split())

a = list()
for i in range(n):
    a.append(0)
    a[i] = list(map(int, input().split()))
    a[i].pop(0)

ans = list()
for _ in range(1,m+1):
    if all(_ in a[i] for i in range(0,n)):
        ans.append(_)

print(len(ans))


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <list>
#include <map>
#include <set>
using namespace std;

int main(void) {
	char c;
	c = getchar();
	cout << (c == 'S' ? "Cloudy" : c == 'C' ? "Rainy" : "Sunny") << endl;
	return 0;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <map>
#include <math.h>
#include <algorithm> // std::sort, std::min, std::next_permutation, std::lower_bound
#include <iomanip> // std::setprecision
#include <cmath> // std::ceil
#include <numeric> // std::gcd, std::lcm
#include <limits> // std::numeric_limits<long int>::max()
#include <unordered_map>
#include <map>
#include <cmath> // std::atan2
#include <deque>
#include <queue>

using namespace std;
typedef long long ll;
#define INF 1999999999
#define MODA 1000000007 
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
    
ll K;
bool yes=false; 

bool judge (ll a, ll b, ll c, ll count) {
  cerr << a <<" "<< b <<" "<< c <<" "<< count << endl;
  if (count > K) {
    return false;
  }
  if(b > a && c > b) {
    yes = true;
    return true;
  } 
  judge (a*2, b, c, count+1);
  judge (a, b*2, c, count+1);
  judge (a, b, c*2, count+1);
  return false;
}
int main() {
  ll A, B, C;
  cin >> A >> B >> C;
  cin >> K;

  judge (A, B, C, 0);
  if(yes) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}
               

Measured memory_bytes: 3640
#include <iostream>
using namespace std;
const int M = 1000000007;
class mll {
public:
	long long x;
	mll(long long x = 0) : x((x% M + M) % M) {};
	void operator *= (const mll& a) {
		(x *= a.x) %= M;
	}
};
int main() {
	int colors[3] = { 0,0,0 };
	int N;
	cin >> N;
	mll ans = 1;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		int p = 0;
		for (int j = 0; j < 3; j++) {
			if (a == colors[j]) {
				if (p == 0) colors[j]++;
				p++;
			}
		}
		ans *= p;
	}
	cout << ans.x << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<ll> &v) {
    std::for_each(v.begin(), v.end(), [](ll x) { std::cout << x << " "; });
    std::cout << std::endl;
}
// http://drken1215.hatenablog.com/entry/2018/09/09/015414
int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    if((B - A) % 2 == 0) {
        cout << (B - A) / 2 << endl;
        return 0;
    }
    // Nで落ち合うのと
    ll a = N - B;
    a += (B - A - 1) / 2 + 1;
    // 1で落ち合うの
    ll b = A - 1;
    b += (B - A - 1) / 2 + 1;
    cout << min(a, b) << endl;
    return 0;
}

Measured memory_bytes: 256