akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#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 LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#define ALL(a) (a).begin(),(a).end()

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>que;

int main() {
  ll N;
  cin>>N;
  ll num=0;
  FOR(i,3,50000){
    if(isPrimeNum(i)){
      if(i%5==1){
        num++;
        cout<<i;
        if(num==N)break;
        cout<<" ";
      }
    }
  }
  cout<<endl;
return 0;
 
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A___B_Problem
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> results = new List<int>();

            while (true)
            { 
                string input = Console.ReadLine();
                if (input == "" || input == null)
                {
                    break;
                }

                string[] temp = input.Split(' ');

                int a = int.Parse(temp[0]);
                int b = int.Parse(temp[1]);

                results.Add(a + b);
            }

            foreach (int item in results)
            {
                Console.WriteLine(item);
            }


        }
    }
}



Measured memory_bytes: 15984
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;   
#define ll long long
#define ull unsigned long long
#define ld long double
// #define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> 
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define inf 9e18
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// Comment this out for interactive problem
// #define endl '\n'
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output

int main(){ 
    fastio;
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);

    ll s;
    cin>>s;
    ll dp[s+1];
    for (int i = 0; i < s+1; ++i)
    {
        dp[i]=0;
    }
    dp[0]=1;

    if(s<3){
        cout<<0;
        return 0;
    }

    for (int i = 3; i < s+1; ++i)
    {
        // these are elements
        for (int j = 3; j < s+1; ++j)
        {
            if((i-j)>=0){
                dp[i] = (dp[i] + dp[i-j])%mod;
            }
        }
    }
    cout<<dp[s]%mod;

    return 0;
}

Measured memory_bytes: 3680
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
#define mkp make_pair
#define pii pair<int,int>
typedef long long ll;
const int inf=0x3f3f3f3f;
const int maxn=2e5+200;
ll a[maxn];
int main(){
	ll n,m;
	cin>>n>>m;
	ll sum=0;
	for(int i=1;i<=n;i++)cin>>a[i],sum+=a[i];
	int cnt=0;
	for(int i=1;i<=n;i++){
		if(1*sum<=a[i]*4*m)cnt++;
	}
	if(cnt>=m)printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int n;
  cin >> n;
  int S[n+1];
  for(int i=0;i<n;i++){
    cin >> S[i];
  }
  int q;
  cin >> q;
  int T[q];
  for(int i=0;i<q;i++){
    cin >> T[i];
  }

  int cnt = 0;
  int si;
  for(int ti=0;ti<q;ti++){
    S[n] = T[ti];
    si = 0;
    while(S[si] != T[ti]){
      si++;
    }
    if(si != n) cnt++;
    // for(int si=0;si<n;si++){
    //   if(T[ti] == S[si]){
    //     cnt++;
    //     break;
    //   }
    // }
  }
  cout << cnt << endl;
  return 0;
}



Measured memory_bytes: 3092
import math as m

n,k = map(int, input().split())

b = []
for i in range(n):
    b.append(0)

for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(len(a)):
        b[a[j]-1] += 1

ans=0
for i in range(n):
    if b[i] == 0:
        ans += 1

print(ans)

Measured memory_bytes: 9204
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()

ans = 0
for i in range(1,n+1):
    ans += (i*(n//i)*(n//i + 1))//2
print(ans)



Measured memory_bytes: 63092
import java.util.*;

public class Main{
	public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      
      int[][] array = new int[N][2];
      for (int i = 0; i < N; ++i) {
          // i番目のx座標
          array[i][0] = sc.nextInt();
          // i番目のy座標
          array[i][1] = sc.nextInt();
      }
      
      double total = 0.0d;
      
      // 全道の長さの和を求める
      for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
          if (i == j) continue;
          total += Math.sqrt(nijo(array[i][0] - array[j][0]) + nijo(array[i][1] - array[j][1]));
        }
      }
      
      System.out.println(total / N);
      
    }
  
  private static int nijo(int x) { return x * x;}
}

Measured memory_bytes: 23636
#include <iostream>
using namespace std;int main(){    
int x,y,h1,h2,k1,k2,a,b,c,d;    
cin>>h1>>h2>>k1>>k2>>a>>b>>c>>d;    
x=(a*h1)+(b*h2)+(h1/10*c)+(h2/20*d);    
y=(a*k1)+(b*k2)+(k1/10*c)+(k2/20*d);    
if (x==y){    
    cout<<"even"<<endl;
    }else if (x>y){
        cout<<"hiroshi"<<endl;
    }else {
        cout<<"kenjiro"<<endl;
    }
}


Measured memory_bytes: 3100
#include "bits/stdc++.h"
using namespace std;
int main(){
    map<int,int> m;
    m[1]=1;m[2]=3;m[3]=1;m[4]=2;m[5]=1;m[6]=2;m[7]=1;m[8]=1;m[9]=2;m[10]=1;m[11]=2;m[12]=1;
    int x,y;
    cin>>x>>y;
    if(m[x]==m[y])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;

#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()
#define int long long
typedef long long ll;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;

const int mod = 1e9 + 7;

int pw(int a, int b) {
    int res = 1;
    while (b) {
        if (b % 2) {
            res *= a;
            res %= mod;
        }
        b /= 2;
        a *= a;
        a %= mod;
    }
    return res;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    int mx = 1, gcd = 0;
    vector <int> v(n);
    map <int, int> mp;
    for (auto &it : v) {
        cin >> it;
        int x = it, i = 2;
        while (i * i <= x) {
            int e = 0;
            while (x % i == 0) {
                e++;
                x /= i;
            }
            mp[i] = max(mp[i], e);
            i++;
        }
        if (x != 1) {
            mp[x] = max((ll)1, mp[x]);
        }
    }
    for (auto it : mp) {
        for (int i = 0; i < it.second; i++) {
            mx *= it.first;
            mx %= mod;
        }
    }
    int ans = 0;
    for (auto it : v) {
        ans += mx * pw(it, mod - 2) %mod;
        ans %= mod;
    }
    cout << ans;

    return 0;
}


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

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n), ans(n, 0);

    rep(i, n - 1) {
        cin >> a[i];
        ans[a[i] - 1]++;
    }

    rep(i, n) cout << ans[i] << endl;


    return 0;
}


Measured memory_bytes: 4840
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static List<HashSet<long>> memo;
        static long[] prime;
        static long min;
        static long minA;
        static long minB;
        static void Main(string[] args)
        {
            var N = long.Parse(Console.ReadLine());

            prime = PrimeFactors(N).ToArray();

            min = long.MaxValue;
            minA = 0;
            minB = 0;
            memo = new List<HashSet<long>>();
            Dfs(0, 1, 1);

            Console.WriteLine(minA + minB - 2);

        }

        static void Dfs(int n, long total1, long total2)
        {
           if (n <= memo.Count - 1) {
              if (memo[n].Contains(total1)) return;
              else memo[n].Add(total1);
           }
           else
               memo.Add(new HashSet<long>() {total1});

           if (n == prime.Length) {
              var t = Math.Abs(total1 - total2);
              if (min > t) {
                 min = t;
                 minA = total1;
                 minB = total2; 
              }
              return;
           }
           
           Dfs(n + 1, total1 * prime[n], total2);
           Dfs(n + 1, total1, total2 * prime[n]);
        }
        
        static IEnumerable<long > PrimeFactors(long n)
        {
            long i = 2;
            long tmp = n;

            while (i * i <= n)
            {
                if (tmp % i == 0)
                {
                    tmp /= i;
                    yield return i;
                }
                else
                {
                    i++;
                }
            }
            if (tmp != 1) yield return tmp;
        }
    }
}


Measured memory_bytes: 13404
N = int(input())
W = []
for i in range(N):
    W.append(input())
flag = True

for i in range(N):
    roop = True
    for j in range(i + 1, N):
        if W[i] == W[j]:
            flag = False
            roop = False
    if not roop:
        break

for i in range(N - 1):
    if W[i][-1] != W[i + 1][0]:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")





Measured memory_bytes: 3064
import sys
input = lambda: sys.stdin.readline().rstrip()

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

light_list = []
for i in range(M):
    k = list(map(int, input().split()))
    k = k[1:]
    light_list.append(k)

p = list(map(int, input().split()))

ans = 0
for i in range(2 ** N):
    on_list = []
    for j in range(N):
        if ((i>>j) & 1):
            on_list.append(j+1)
    for k in range(M):
        if p[k] == 0:
            flg = True
        else:
            flg = False    
        for l in range(len(light_list[k])):
            if light_list[k][l] in on_list:
                flg = not flg
        if not flg:
            break
    if flg:
        ans += 1
print(ans)

Measured memory_bytes: 41840
#include <cstdio>

const int INF = 0x3f3f3f3f;
int ans = INF, n, m, k;
int a[15][1005], s[15][1005];
int divide[15], tot;

inline int val(int x, int y, int xx, int yy)
{
    return s[xx][yy] - s[x - 1][yy] - s[xx][y - 1] + s[x - 1][y - 1];
}

void calc()
{
    int cut = tot - 1, beg = 1;
    if(cut >= ans) return;
    for(int i = 1; i <= m; i++)
    {
        int need_cut = 0;
        for(int j = 1; j <= tot; j++)
        {
            if(val(divide[j - 1] + 1, i, divide[j], i) > k) return;
            if(!need_cut && val(divide[j - 1] + 1, beg, divide[j], i) > k)
            {
                need_cut = 1;
                beg = i;
            }
        }
        cut += need_cut;
        if(cut >= ans) return;
    }
    ans = cut;
}

void dfs(int x)
{
    if(x == n)
    {
        divide[++tot] = n;
        calc();
        tot--;
        return;
    }
    dfs(x + 1);
    divide[++tot] = x;
    dfs(x + 1);
    tot--;
}

int main()
{
    //freopen("a.in", "r", stdin);
    scanf("%d%d%d\n", &n, &m, &k);
    for(int i = 1; i <= n; i++, getchar())
    for(int j = 1; j <= m; j++)
    {
        a[i][j] = getchar() - '0';
        s[i][j] = s[i - 1][j] + s[i][j - 1] -s[i - 1][j - 1] + a[i][j];
    }
    dfs(1);
    printf("%d\n", ans);
    return 0;
}

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

typedef long long ll;
typedef vector < ll > vl;
typedef vector < int > vi;
typedef vector < bool > vb;
typedef vector < vl > vvl;
typedef vector < vi > vvi;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < pll > vpll;
typedef vector < pii > vpii;
typedef vector < vpll > vvpll;
typedef vector < vpii > vvpii;

#define pb push_back
#define eb emplace_back
#define pf push_front
#define all(c) (c).begin(), (c).end()
#define ff first
#define ss second
#define mp(x,y) make_pair((x), (y))
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)



void solve(){
    
    int n; cin >> n;
    vi a(n);
    for(int& u : a) cin >> u;
    sort(all(a));
    ll sum = 0;
    sum += a[n - 1];
    int pos = n - 2;
    for(int i = n - 3; i >= 0; i--){
        sum += a[pos];
        i--;
        if(i >= 0) sum += a[pos];
        pos--;
    }
    
    cout << sum << '\n';
}


int main(){
	boost;
	int t = 1;
// 	cin >> t;
// 	precompute();
	for(int i = 1; i <= t; i++){
	   // cout << "Case #" << i << ": ";
		solve();
	}
	return 0;
}

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

int main()
{
    int n = 0;
    set<int> colors;
    int score = 0;
    int champ = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> score;

        switch (score / 400)
        {
        case 0:
            colors.insert(0);
            break;
        case 1:
            colors.insert(1);
            break;
        case 2:
            colors.insert(2);
            break;
        case 3:
            colors.insert(3);
            break;
        case 4:
            colors.insert(4);
            break;
        case 5:
            colors.insert(5);
            break;
        case 6:
            colors.insert(6);
            break;
        case 7:
            colors.insert(7);
            break;
        default:
            champ++;
            break;
        }
    }
    if (colors.size() == 0)
        cout << 1 << " " << champ << endl;
    else
        cout << colors.size() << " " << colors.size() + champ << endl;

    return 0;
}

Measured memory_bytes: 256
#include <memory.h>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>
#include<set>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<cmath>
#include<stack>
#include<fstream>

typedef long long LL;
const int INF=0x3f3f3f3f;
const int MAXN=1e5+5;
int a[MAXN];
int G[105][105];

int main()
{
    int h,w;
    while(scanf("%d%d",&h,&w)!=EOF)
    {
        int n;
        scanf("%d",&n);
        for(int i=1;i<=n;++i)
            scanf("%d",&a[i]);
        int cnt=1;
        for(int i=1;i<=h;++i)
        {
            if(i&1)
            {
                for(int j=1;j<=w;++j)
                {
                   if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                   else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }else
            {
                for(int j=w;j>=1;--j)
                {
                    if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                    else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }
        }
        for(int i=1;i<=h;++i)
        {
            for(int j=1;j<=w;++j)
            {
                if(j!=w) printf("%d ",G[i][j]);
                else printf("%d\n",G[i][j]);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 384
h,w= map(int,input().split())
odd = w//2 + (1 if w%2==1 else 0)
even = w//2
oddn = h//2 + (1 if h%2==1 else 0)
evenn = h//2
if h==1 or w==1:
    print(1)
else:
    print(odd*oddn + even*evenn)

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

int main(){
    int a, b;
    cin >> a >> b;
    string s;
    if (a > b){
        s = "a > b";
    } else if (a < b){
        s = "a < b";
    } else {
        s = "a == b";
    }
    cout << s << endl;
}

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

using namespace std;
// using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<double,double> pd;
typedef priority_queue<int, vector<int>, greater<int>> min_heap;

// template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const double PI = 4*atan(1);
const ll INF = 1e18;
const int MX = 100001;

const int maxn = 2e5 + 5;

const ll mod = 998244353;
ll fac[maxn];

ll add(ll a, ll b) {
  return (((a + b) % mod) + mod ) % mod;
}

ll prod(ll a, ll b) {
  return (((a * b) % mod) + mod) % mod;
}

ll modpow(ll a, ll pw) {
  if (pw == 0) return 1;
  if (pw % 2 == 1) return prod(a, modpow(a, pw - 1));
  ll res = modpow(a, pw / 2);
  return prod(res, res);
}

ll inv(ll a) {
  return modpow(a, mod - 2);
}

void process_fac() {
  fac[0] = 1;
  for (int i = 1; i < maxn; i++) {
    fac[i] = prod(fac[i - 1], i);
  }
}

ll binom(ll a, ll b) {
  ll num = fac[a];
  ll den = prod(fac[a - b], fac[b]);
  return prod(num, inv(den));
}
int n, m, k;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m >> k;
    ll ans = 0;
    process_fac();
    for (int i = 0; i <= k; i++) {
        ll ans1 = prod(m, modpow(m - 1, n - 1 - i));
        ans1 = prod(ans1, binom(n - 1, i));
        ans = add(ans, ans1);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 5188
S = input()
n = len(S)-1
n_list = []
total = 0

for i in range(2**n):
    op = [""] * n
    for j in range(n):
        if((i >> j) & 1):
            op[n-1-j] = "+"
    formula=""
    for x,y in zip(S,op + [""]):
        formula += (x + y)
    total += eval(formula)
print(total)

Measured memory_bytes: 3064
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

s=s0()
t=s0()
if s==t[:-1]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9152
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 1000000009

LL l[100002];
LL r[100002];

int main() {
	int n;
	LL c, ret=0;
	scanf("%d%lld", &n, &c);
	auto xv = vector<pair<LL, LL> >(n+2);
	xv[0] = MP(0, 0);
	REP(i, n) {
		LL x, v;
		scanf("%lld%lld", &x, &v);
		xv[i+1] = MP((LL)x, (LL)v);
	}
	xv[n + 1] = MP(c, 0);
	LL sum = 0;
	//l
	FOR(i, 1, n+1) {
		sum += xv[i].second;
		l[i] = max(l[i - 1], sum - xv[i].first);
		ret = max(ret, l[i]);
	}
	reverse(xv.begin(), xv.end());
	//r
	sum = 0;
	FOR(i, 1, n + 1) {
		sum += xv[i].second;
		r[i] = max(r[i - 1], sum - (c - xv[i].first));
		ret = max(ret, r[i]);
	}
	//r
	FOR(i,1,n+1) {
		ret = max(ret, r[i] - (c - xv[i].first) + l[n - i]);
	}
	//l
	reverse(xv.begin(), xv.end());
	//r
	FOR(i, 1, n + 1) {
		ret = max(ret, l[i] - xv[i].first + r[n - i]);
	}
	cout << ret << endl;
	return 0;
}

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

int util(vector<vector<int>> & dp,const string & a,const string & b,int m,int n)
{
    if(m==0 || n==0)
    return 0;
    
    if(dp[m][n]!=-1)
    return dp[m][n];
    
    if(a[m-1]==b[n-1])
    dp[m][n]=util(dp,a,b,m-1,n-1)+1;
    
    else
    dp[m][n]=max(util(dp,a,b,m-1,n),util(dp,a,b,m,n-1));
    
    return dp[m][n];
}

int main() {
        string a,b;
        cin>>a>>b;
        int m=a.length();
        int n=b.length();
        
        vector<vector<int>> dp(m+1,vector<int>(n+1,-1));
        
       int  len=util(dp,a,b,m,n);
       //cout<<len<<endl;
       string ans="";
      
       while(m>0 && n>0)
       {
           if(a[m-1]==b[n-1])
           {
               ans+=a[m-1];
               m--;
               n--;
           }
           else if(dp[m-1][n]>=dp[m][n-1])
           m--;
           else
           n--;
           
       }
       
       int i=0;
       int j=len-1;
       while(j>i)
       {
           char c=ans[i];
           ans[i]=ans[j];
           ans[j]=c;
           i++;
           j--;
       }
       cout<<ans;
       
        return 0;
}

Measured memory_bytes: 35968
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
const int N=200005,M=35;
const int INF=1000000001;
int n,T;
struct Node
{
	int a,b;
}s[N];
int f[N][M];
vector<int>d;
long long sum[N];
int main()
{
	scanf("%d%d",&n,&T);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&s[i].a,&s[i].b);
		if(s[i].a==0)
		{
			d.push_back(s[i].b);
			n--,i--;
		}
	}
	sort(s+1,s+n+1,[](const Node &x,const Node &y){return (double)x.a/(x.b+1)>(double)y.a/(y.b+1);});
	memset(f,63,sizeof(f));
	f[0][0]=0;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=min(i,30);j++)
		{
			if(f[i-1][j]<INF) f[i][j]=f[i-1][j];
			if(j>=1)
			{
				if(f[i-1][j-1]+(1+1LL*s[i].a*(f[i-1][j-1]+1)+s[i].b)<INF) f[i][j]=min(f[i][j],f[i-1][j-1]+(1+s[i].a*(f[i-1][j-1]+1)+s[i].b));
			}
		}
	sort(d.begin(),d.end());
	for(int i=1;i<=d.size();i++)
		sum[i]=sum[i-1]+d[i-1]+1;
	int res=0;
	for(int i=0;i<=n;i++)
		for(int j=0;j<=min(i,30);j++)
			if(f[i][j]<=T)
			{
				int t=T-f[i][j];
				int l=1,r=d.size(),ans=0;
				while(l<=r)
				{
					int mid=(l+r)/2;
					auto check=[=](int x){return sum[x]<=t;};
					if(check(mid)) ans=mid,l=mid+1;
					else r=mid-1;
				}
				res=max(res,j+ans);
			}
	printf("%d",res);
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  int a[n], b[n], c[n];
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  rep(i, n) cin >> c[i];
  sort(a, a+n); sort(b, b+n); sort(c, c+n);
  
  ll sum[n+1];
  sum[n] = 0;
  for (int i = n-1; i >= 0; --i) {
    sum[i] = sum[i+1];
    sum[i] += distance(upper_bound(c, c+n, b[i]), c+n);
  }
  ll ans = 0;
  rep(i, n) {
    ans += sum[distance(b, upper_bound(b, b+n, a[i]))];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2176
/*
ID: richard124
PROB: kimbits
LANG: C++11
*/


#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <chrono>
#include <algorithm>
#include <bitset>

using namespace std;
using namespace std::chrono;

typedef pair<int, int> pii;
#define pb push_back;

int N;
int K;
int ans = 0;

int main() {
	high_resolution_clock::time_point t1 = high_resolution_clock::now();
	
	cin >> N >> K;
	if (N == K) {
	    cout << 1;
	    return 0;
	}
	else {
	    N -= K;
	    ans++;
	}
    while (N > 0) {
        N -= K-1;
        ans++;
    }
    cout << ans;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define _READ freopen("input.txt", "r", stdin);
#define _FAST                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

int32_t main()
{
   // _READ
    int n, m, k;
    cin >> n >> m >> k;
    vector<string> grid(n);
    for (auto &i : grid)
        cin >> i;
    int ans=0;
    for (int i = 0; i < (1ll << n); i++)
    {
        set<int> rows;
        for (int j = 0; j < n; j++)
            if ((i & (1ll << j)) != 0)
                rows.insert(j);
        for(int i1=0;i1<(1ll<<m);i1++)
        {
            set<int> cols;
            for(int j1=0;j1<m;j1++)
            if ((i1 & (1ll << j1)) != 0)
                cols.insert(j1);
            int blacks=0;
            for(int x=0;x<n;x++)
            {
                for(int y=0;y<m;y++)
                {
                    if((rows.count(x) || cols.count(y))==false && grid[x][y]=='#')
                        ++blacks;
                }
            }    
            if(blacks==k)
                ++ans;
        }
    }
    cout<<ans;
    return 0;
}

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

int main(){
   int H, N;
   cin >> H >> N;
   vector<int> A(N);
   for (int i=0; i<N; i++)
      cin >> A.at(i);

   long long sum=0;
   sum = accumulate(A.begin(), A.end(), 0);
   if (sum >= H)
      cout << "Yes" << endl;
   else
      cout << "No" << endl;
}



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

using namespace std;

const int MAX_N = 3e5 + 10;

void No() { printf("No\n"); exit(0); }
void Yes() { printf("Yes\n"); exit(0); }

int N, P[MAX_N];
bool diff[MAX_N];

int main() {
    scanf("%d", &N);
    for (int i = 1; i <= N; i++) scanf("%d", &P[i]);
    for (int i = 1; i <= N; i++) diff[i] = P[i] != i;
    int curr = N;
    while (curr) {
        if (!diff[curr]) {
            curr--;
            continue;
        }
        int fir = curr;
        while (fir - 2 > 0 && diff[fir - 2]) {
            fir -= 2;
        }
        for (int i = curr - 1; i >= fir; i -= 2)
            if (diff[i])
                No();

        for (int i = fir; i <= curr; i++) {
            if (P[i] < fir || P[i] > curr)
                No();
        }

        int last = 0;

        for (int i = fir; i <= curr; i += 2) {
            if (P[i] < i) continue;
            if (P[i] < last)
                No();
            last = P[i];
        }

        last = 0;

        for (int i = fir; i <= curr; i += 2) {
            if (P[i] > i) continue;
            if (P[i] < last)
                No();
            last = P[i];
        }

        curr = fir - 1;
    }
    Yes();
}

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


int main()
{
    double x1,x2,y1,y2;
    cin >> x1 >> y1 >> x2 >> y2; 

    double ans=sqrt(pow(x1-x2,2)+pow(y1-y2,2));

    printf("%.7f\n",ans);

    return 0;

}


Measured memory_bytes: 3164
#include<iostream>
using namespace std;
#include<map>
#include<vector>
#include<cmath>
#include<set>
#include<algorithm>
#define int long long int
#define mod 1000000007
int binary_search(int arr[],int start,int end,int val)
{
	if(start>end)
	     return -1;
	else
	{
		int mid=(start+end)/2;
		if(arr[mid]<=val)
		    return binary_search(arr,mid+1,end,val);
		else
		{
			int x=mid;
			int y=binary_search(arr,start,mid-1,val);
			if(y==-1)
			    return x;
			else
			    return y;
		}
	}
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	int j,arr1[n],arr2[n],arr3[n];
	for(j=0;j<n;j++)
	   cin>>arr1[j];
	for(j=0;j<n;j++)
	    cin>>arr2[j];
	for(j=0;j<n;j++)
	     cin>>arr3[j];
	sort(arr1,arr1+n);
	sort(arr2,arr2+n);
	sort(arr3,arr3+n);
	int value[n]={0};
	for(j=0;j<n;j++)
	{
		int index=binary_search(arr3,0,n-1,arr2[j]);
		if(index!=-1)
		{
			value[j]=(n-index);
		}
	}
	int suffix[n]={0};
	suffix[n-1]=value[n-1];
	for(j=n-2;j>=0;j--)
	{
		suffix[j]=value[j]+suffix[j+1];
	}
	int answer=0;
	for(j=0;j<n;j++)
	{
		int index=binary_search(arr2,0,n-1,arr1[j]);
		if(index!=-1)
		{
			answer+=suffix[index];
		}
	}
	cout<<answer<<endl;
}


Measured memory_bytes: 7576
#include "bits/stdc++.h"

using namespace std;

using ull = unsigned long long;

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

	int n;
	cin >> n;
	ull tl, al;
	cin >> tl >> al;

	for (int i = 1; i < n; i++) {
		ull tc, ac;
		ull t, a;
		cin >> t >> a;
		if (t == a) {
			tc = max(tl, al);
			ac = tc;
		}
		else if (t > a) {
			if (al % a != 0)
				ac = al + a - (al % a);
			else
				ac = al;
			tc = ac / a * t;
			if (tl > tc) {
				if (tl % t != 0)
					tc = tl + t - (tl % t);
				else
					tc = tl;
				ac = tc / t * a;
			}
		}
		else{
			if (tl % t != 0)
				tc = tl + t - (tl % t);
			else
				tc = tl;
			ac = tc / t * a;
			if (al > ac) {
				if (al % a != 0)
					ac = al + a - (al % a);
				else
					ac = al;
				tc = ac / a * t;
			}
		}
		al = ac;
		tl = tc;
	}

	cout << al + tl << endl;

	return 0;

}

Measured memory_bytes: 384
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int x = 0;
        int max = 0;
        String S = sc.next();
        for(int i = 0;i < N;i++){
            if(S.charAt(i) == 'I'){
                x++;
            }
            if(S.charAt(i) == 'D'){
                x--;
            }
            max = Math.max(max,x);
        }
        System.out.println(max);
    }
}


Measured memory_bytes: 21844
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  auto n = readln.chomp.to!int;
  writeln(n/2+(n%2>0));
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	int N;
	scanf("%d", &N);
	long long A[N], K = 0, pfx = 0;
	for (int i = 0; i < N; ++i) scanf("%lld", &A[i]);
	for (int i = 0; i < N; ++i) K += A[i];
	for (int i = 0; i < N; ++i) {
		pfx += A[i];
		if (pfx > K / 2) {
			if (i == 0) printf("%lld", pfx * 2 - K);
			else printf("%lld", min(pfx * 2 - K, K - (pfx - A[i]) * 2));
			return 0;
		} else if (pfx == K / 2) {
			printf("0");
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl;

typedef long long ll;
const ll INF = 99999999999999;
const ll MOD = 1000000007;

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll number1, ll number2)
{
    return number1 * number2 / gcd(number1, number2);
}
template <class T>
bool contain(const std::string &s, const T &v)
{
    // contain(to_string(N), '3')
    return s.find(v) != std::string::npos;
}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
        return c - '0';
    return 0;
}
using namespace std;

void transpose(vector<vector<char>> &b)
{
    if (b.size() == 0)
        return;

    vector<vector<char>> trans_vec(b[0].size(), vector<char>());

    for (int i = 0; i < b.size(); i++)
    {
        for (int j = 0; j < b[i].size(); j++)
        {
            trans_vec[j].push_back(b[i][j]);
        }
    }

    b = trans_vec; // <--- reassign here
}

// C++ゆるさねえリスト
// accumulate(all(a), 0LL);
// 二分探索

int main()
{

    ll n, a, b, ans, ans1, ans2, ans3;

    cin >> n >> a >> b;
    if ((b - a) % 2 == 0)
    {
        ans = (b - a) / 2;
    }
    else
    {
        ans1 = (n - b) + (b - a + 1) / 2;
        ans2 = (a - 1) + (b - a + 1) / 2;
        ans3 = min(b - 1, n - a);
        ans = min(ans1, min(ans2, ans3));
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// (setq-default c-basic-offset 2)

bool check(vector<pair<int, int>> d, int i) {
  // bool cond = true;
  // for (int j = i; j < i + 3; ++j) {
  //   cond &= (d[j].first == d[j].second);
  // }
  // return cond;
  if ((i + 2) >= d.size()) return false;
  return (d[i].first == d[i].second) && (d[i + 1].first == d[i + 1].second) &&
         (d[i + 2].first == d[i + 2].second);
}

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

  bool ret = false;
  // for (int i = 0; i < n - 3; ++i) {
  for (int i = 0; i < n; ++i) {
    ret |= check(d, i);
  }
  if (ret) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3628
N=int(input())

alist=[0]
for i in range(N):
  alist.append(int(input()))
#print(alist)

answer=0
pos=1
while True:
  if answer>N:
    print(-1)
    break
  elif pos==2:
    print(answer)
    break
  else:
    pos=alist[pos]
    answer+=1

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

void solve() {
    string s, t;
    cin >> s >> t;
    if (t.substr(0, s.size()) == s)
        puts("Yes");
    else
        puts("No");
}

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

    solve();
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

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

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

struct BinomialCoefficient  {
    BinomialCoefficient() {
        
    }
    
    BinomialCoefficient(int n) : fac(n + 2), finv(n + 2), inv(n + 2) {
        initialize(n, false);
    }
    
    void initialize(int n, bool resize = true) {
        if (resize) {
            fac.resize(n + 2);
            finv.resize(n + 2);
            inv.resize(n + 2);
        }
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i <= n; i++) {
            fac[i] = fac[i - 1] * i % mod;
            inv[i] = mod - inv[mod % i] * (mod / i) % mod;
            finv[i] = finv[i - 1] * inv[i] % mod;
        }
    }
    
    ll factorial(int n) {
        return fac[n];
    }
    
    ll combination(int n, int r) {
        if ((n < r) || (n < 0) || (r < 0)) return 0;
        return fac[n] * (finv[r] * finv[n - r] % mod) % mod;
    }
    
    ll permutation(int n, int r) {
        if ((n < r) || (n < 0) || (r < 0)) return 0;
        return fac[n] * finv[n - r] % mod;
    }
    
private:
    int mod = 1e9 + 7;
    vector<ll> fac, finv, inv;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll mod = 1e9 + 7;
    ll n, k;
    cin >> n >> k;
    vector<vector<ll>> g(n);
    rep(i, n - 1) {
        ll a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<bool> seen(n, false);
    queue<ll> q;
    q.push(0);
    ll ans = k;
    BinomialCoefficient bc(max(n, k));
    while(!q.empty()) {
        ll v = q.front(); q.pop();
        seen[v] = true;
        set<ll> s;
        for(auto u : g[v]) {
            if (seen[u]) continue;
            s.insert(u);
        }
        if (sz(s) == 0) continue;
        if (v == 0) ans = (ans * bc.permutation(k - 1, sz(s))) % mod;
        else ans = (ans * bc.permutation(k - 2, sz(s))) % mod;
        for(auto x : s) q.push(x);
    }
    cout << ans << endl;
    return 0;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int k,t,a[111];

int main(){
	cin.sync_with_stdio(false);
	cin>>k>>t;
	priority_queue<P> que;
	rep(i,t){
		cin>>a[i];
		que.push(P(a[i],i));
	}
	que.push(P(0,t));
	int pre=-1;
	ll res=0;
	rep(i,k){
		P p1=que.top(); que.pop();
		P p2=que.top(); que.pop();
		if(p2.fi==0){
			if(pre==p1.se)res++;
			else pre=p1.se;
		}else{
			if(p1.se==pre){
				pre=p2.se;
				p2.fi--;
			}else{
				pre=p1.se;
				p1.fi--;
			}
		}
		que.push(p1); que.push(p2);
	}
	cout<<res<<endl;
	return 0;
}


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

using i64 = int64_t;

int calc_digits(i64 n){
    int res = 0;
    while(n > 0){
        n /= 10;
        res++;
    }
    return res;
}

int main(){
    i64 n;
    cin >> n;
    int ans = 20;
    for(i64 i=1;i*i<=n;++i){
        if(n%i != 0)continue;
        i64 a = i, b = n/i;
        ans = min(ans, max(calc_digits(a), calc_digits(b)));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
/* ex3_4
    riverstone*/


#include <stdio.h>
 
int main(void){
    int number=0, i=0, j=0;

    // number の入力を取得
    scanf("%d",&number);

    // iを総当たり
    // 割り切れるものがあればyes、なければNoを出力
    for(i=1;i<10;i++){
        //numberがiで割り切れてかつ商が9以下ならいい。
        if(number % i == 0 && number/i < 10){
          printf("Yes");
          return 0;
        } 
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

int N, M;
vector<vector<int>> adj;
vector<bool> seen;

void input(){
    cin >> N >> M;
    adj.resize(N, vector<int>());
    seen.resize(N, false);
    rep(i, M){
        int a, b; cin >> a >> b;
        --a; --b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
}

int dfs(int i){
    if(all_of(seen.begin(), seen.end(), [](auto val){ return val == true; })) return 1;

    int res = 0;
    for(auto j : adj[i]){
        if(seen[j] == false){
            seen[j] = true;
            res += dfs(j);
            seen[j] = false;
        }
    }

    return res;
}

void solve(){
    seen[0] = true;
    cout << dfs(0) << endl;
}

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

    input();
    solve();
    
    return 0;
}

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

int main(){
  int k;
  cin>> k;
  
  /*
  777.../k の筆算の特別版
  余りは0~k-1のk種類しかないので、k回余り出して1度も0にならないなら同じ余りが2回以上出ている→ループする、割り切れない
  */
  int r=7%k,n=1;
  while(r!=0 && n<k){
    r=(r*10+7)%k;
    n++;
  }
  if(r==0) cout<< n <<endl;
  else cout<< -1 <<endl;
}

Measured memory_bytes: 3640
import java.util.Scanner;
public class Main{
	static long mod;
	static long ans;
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		long n=sc.nextLong();
		long m=sc.nextLong();
		mod=1000000007;
		ans=1;
		for(long i = 2; i<=m; i++){
			long count=0;
			while(m%i==0){
				m/=i;
				count++;
			}
			if(count>0){
				for(long j=1; j<=count; j++){
					ans*=((n+count-j)%mod);
					ans%=mod;
				}
				for(long k=2; k<=count; k++){
					pow(k,mod-2);
				}
			}
		}
		System.out.println(ans);
	}
	public static void pow(long a,long p){
		while(p>0){
			if((p & 1)==1){
				ans*=a;
				ans%=mod;
			}
			
			a*=a;
			a%=mod;
			p>>=1;
		}
	}
}


Measured memory_bytes: 22608
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define   sz(s)         s.size()
#define   ll            long long int
#define   ull           unsigned ll
#define   ld            long double
#define   print(v)      for(ll i=0;i<v.size();i++)cout<<v[i]<<" "
#define   printpair(v)  for(ll i=0;i<v.size();i++)cout<<v[i].first<<" "<<v[i].second<<"\n"
#define   bmd           1000000007
#define   bmd1          998244353
#define   umll          unordered_map<ll,ll>
#define   mll           map<ll,ll>
#define   mcl           map<char,ll>
#define   pll           pair<ll,ll>
#define   F             first
#define   S             second
#define   setp(x)       setprecision(x)
#define   pb            push_back
#define   all(v)        v.begin(),v.end()
#define   tr(a)         for(auto it=a.begin();it!=a.end();it++)
#define   trr(a)        for(auto it1=a.begin();it1!=a.end();it1++)
#define   vll           vector<long long int>
#define   sorty(v)      sort(v.begin(),v.end())
#define   rsort(v)      sort(v.rbegin(),v.rend())
#define   unik(v)       v.erase(unique(all(v)),v.end())
#define   PI            3.1415926535897932384626
#define   db()          cout<<"\n"<<"here"<<"\n"
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;


//---------------------------------------------------------------------------
const int MOD = bmd;
const int N=2e5+100;
inline  ll sqr(ll x){return x*x;}
inline  void normal(ll &a) { a = (a+MOD)%MOD; }
inline  ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline  ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline  ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline  ll modPow(ll b, ll p) { ll r = 1;b=b%MOD; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline  ll modInv(ll a) { return modPow(a, MOD-2); }
inline  ll modDiv(ll a,ll b) { return modMul(a, modInv(b)); }
//---------------------------------------------------------------------------
void solve()
{
    char c;
    cin>>c;
    if(c>='A' && c<='Z'){
        cout <<"A"<<"\n";
    }
    else cout <<"a"<<"\n";
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);//first give all input then gives output
    ll t=1;
    //cin>>t;
    while(t--){
        solve();
    }

    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;
static const int MAX_N = 200000;
 
int N;
ll A[MAX_N];
 
int main(){
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> A[i];
		A[i] -= (ll)(i + 1);
	}
	sort(A, A + N);
	ll sum = 0;
	for(int i = 0; i < N; i++){
		sum += abs(A[i] - A[N / 2]);
	}
	cout << sum << endl;
}


Measured memory_bytes: 1792
/// !(i love you) && !( i hate programming)
#include<bits/stdc++.h>

#define fread freopen("in.txt","r",stdin)
#define PI acos(-1)
#define ll long long

using namespace std;

int main()
{
    int n , i = 0;
    string s;
    cin>>n;
    cin>>s;
    while(s[i]!='\0')
    {
        int l = n;
        int t = (int)s[i]+l;
        if(t>90)
        {

            int x = abs((int)s[i]-90);
            l = l-x-1;
//            cout<<n<<endl<<x<<endl;
            s[i] = 'A'+l;
        }
        else
        s[i]+=l;
        i++;
    }
    cout<<s<<endl;
    return 0;
}



Measured memory_bytes: 256