akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
// lint mod = 998244353;
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); }

lint f(int a, int b){
  lint a2=a*a;
  lint a3=a2*a;
  lint a4=a3*a;
  lint b2=b*b;
  lint b3=b2*b;
  lint b4=b3*b;
  return (a-b)*(a4+a3*b+a2*b2+a*b3+b4);
}

void app() {
  int x;
  cin>>x;

  rep(a,120){
    if(x<=(lint)a*a*a*a*a){
      rep_range(b,0,a){
        lint r=f(a,b);
        //printf("%d %d = %d\n",a,b,r);
        if(r==x){
          printf("%d %d\n",a,b);
          return;
        }
        if(r<x) break;
      }
    }else{
      rep_range(b,0,a){
        lint r=f(a,-b);
        //printf("%d %d = %d\n",a,b,r);
        if(r==x){
          printf("%d %d\n",a,-b);
          return;
        }
        if(r>x) break;
      }
    }
  }
}

int main(){app();return 0;}


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

using namespace std;

#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORD(i, m, n) for (int i = m; i >= n; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REP1(i, n) for (int i = 0; i <= n; ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

using ll = long long;
using ull = unsigned long long;
using ld = long double;

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

	int a[9];
	REP(i,9)cin>>a[i];
	int n;
	cin>>n;
	vector<int> b(n);
	REP(i,n){
		cin>>b[i];
		REP(j,9){
			if(b[i]==a[j])a[j]=0;
		}
	}
	if(a[0]==0&&a[1]==0&&a[2]==0)cout << "Yes" << endl;
	else if(a[0]==0&&a[4]==0&&a[8]==0)cout << "Yes" << endl;
	else if(a[0]==0&&a[3]==0&&a[6]==0)cout << "Yes" << endl;
	else if(a[6]==0&&a[7]==0&&a[8]==0)cout << "Yes" << endl;
	else if(a[6]==0&&a[4]==0&&a[2]==0)cout << "Yes" << endl;
	else if(a[2]==0&&a[5]==0&&a[8]==0)cout << "Yes" << endl;
	else if(a[3]==0&&a[4]==0&&a[5]==0)cout << "Yes" << endl;
	else if(a[1]==0&&a[4]==0&&a[7]==0)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

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

int N, M, cnt;
vector<int> es[10];
bool used[10];

void dfs(int now)
{
  used[now] = true;
  for (int i = 1; i <= N; i++) {
    if (!used[i]) break;
    if (i == N) {
      cnt++;
      used[now] = false;
      return;
    }
  }

  for (int i = 0; i < es[now].size(); i++) {
    if (used[es[now][i]]) continue;
    dfs(es[now][i]);
  }
  used[now] = false;
}

int main()
{
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    int v1, v2; cin >> v1 >> v2;
    es[v1].push_back(v2);
    es[v2].push_back(v1);
  }

  dfs(1);
  cout << cnt << endl;
}



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

using namespace std;

void solve() {
    string s;
    cin >> s;
    string ans;
    for (char ch: s) {
        ans += ch == '?' ? 'D' : ch;
    }
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    solve();
}



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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  string s; std::cin >> s;
  if (s[2] == s[3] && s[4] == s[5])
    std::cout << "Yes" << "\n";
  else
    std::cout << "No" << "\n";
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int M = 1_000_000_007;
		
		long[][][] dp = new long[N+2][K+2][2];
		dp[0][0][0] = 1;
		for (int i = 0; i <= N; i++) {
			for (int j = 0; j <= K; j++) {
				dp[i + 1][j + 1][1] = (dp[i + 1][j + 1][1] + dp[i][j][0]) % M; //r -> b
				dp[i + 1][j][0] = (dp[i + 1][j][0] + dp[i][j][0]) % M; // r -> r
				dp[i + 1][j][0] = (dp[i + 1][j][0] + dp[i][j][1]) % M; // b -> r
			}
		}
		long[][] bb = new long[K+1][K+1];
		bb[0][0] = 1;
		long[] bit = new long[K + 2];
		add(bit, 0, 1);
		for (int i = 1; i <= K; i++) {
			long[] nbit = new long[K + 2];
			for (int j = 0; j <= K; j++) {
				bb[i][j] = sum(bit, j + 1) % M;
				add(nbit, j, bb[i][j]);
			}
			bit = nbit;
		}
		for (int i = 1; i <= K; i++) {
			System.out.println((dp[N + 1 - (K - i)][i][0] * bb[i][K - i]) % M);
		}
	}
	static void add(long[] vs, int k, long a) {
		for (int i = k + 1; i < vs.length; i += i & -i) {
			vs[i] += a;
		}
	}
	static long sum(long[] vs, int t) {
		long res = 0;
		for (int i = t; i > 0; i -= i & -i) {
			res += vs[i];
		}
		return res;
	}
}

Measured memory_bytes: 259168
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	string s;
	cin>>s;
	int dp[300][300]={0};
	dp['b']['d']=dp['d']['b']=dp['q']['p']=dp['p']['q']=1;
	bool h=true;
	rep(i,s.size()/2){
		char a=s[i],b=s[s.size()-i-1];
		if(dp[a][b]==0)h=false;
	}
	if(h&&s.size()%2==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}









Measured memory_bytes: 896
n = $stdin.gets.chomp.to_i
alp = "abcdefghijklmnopqrstuvwxyz".split('')

ans = ""
while true do
  kotae = n.divmod(26) #商,あまりの順
  if kotae[1] == 0
    kotae[0] -= 1
    ans =  "z" + ans
  else
  	ans = alp[kotae[1]-1] + ans
  end
  if kotae[0] == 0
    break
  end
  n = kotae[0]
end
puts ans

Measured memory_bytes: 14420
#include<iostream>
#include<cstring>
using namespace std;
const int G=0;
const int L=1;
const int E=2;
char ans [ 3][10]{
	"GREATER\n",
		"LESS\n",
		"EQUAL\n"
};
int main(){
	char s1[200];
	char s2[200];
	cin>>s1>>s2;
	int l1=strlen(s1);
	int l2=strlen(s2);
	if(l1>l2)cout<<ans[G];
	else if(l1<l2)cout<<ans[L];
	else {
		for(int i =0;i<l1;i++){
			if(s1[i]>s2[i]){
				cout<<ans[G];
				exit(0);
			}
			else if(s1[i]<s2[i]){
				cout<<ans[L];
				exit(0);
			}
		}
		cout<<ans[E];
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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 DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    V<int> h(n);
    for (int i = 0; i < n; i++) cin >> h[i];
    V< V<int> > edges(n);
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        a--, b--;
        edges[a].emplace_back(b);
        edges[b].emplace_back(a);
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        bool g = true;
        for (int e: edges[i]) {
            if (h[i] <= h[e]) g = false;
        }
        if (g) ans++;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 8744
from sys import stdin,setrecursionlimit
from copy import deepcopy
import heapq

n,m = map(int,stdin.readline().rstrip().split())

li = [[0 for i in range(n+1)]for j in range(n+1)]

inf = 10**10

def all_pairs_shortest_paths(W):
    # 頂点の数
    n = len(W)
    # 結果を格納する行列を用意する
    res = [[0] * n for i in range(n)]
    # 用意した行列を初期化する
    for i in range(n):
        for j in range(i, n):
            if i == j:
                val = 0
            elif W[i][j]:
                val = W[i][j]
            else:
                val = inf
            res[i][j] = res[j][i] = val
    # 動的計画法ですべての超点間の最短距離を求める
    for k in range(n):
        for u in range(n):
            for v in range(n):
                res[u][v] = min(res[u][v], res[u][k] + res[k][v])
    return res

lin = [list(map(int,stdin.readline().rstrip().split())) for _ in range(m)]

true = [True]*(n+1)
point = 0

for j in range(m):
    lis = []
    for num,i in enumerate(lin):
        if num != j:
            lis.append(i)
    liv = [[0 for e in range(n+1)]for o in range(n+1)]
    for kp in lis:
        liv[kp[0]][kp[1]] = 1
        liv[kp[1]][kp[0]] = 1
    kota = all_pairs_shortest_paths(liv)[1:]
    flag = True
    for kk in kota:
        if inf in kk[1:]:
            flag = False
    if flag:
        point += 1

print(m-point)

Measured memory_bytes: 47344
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 998244353
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True

g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル


# MOD 組み合わせ
def cmb(n, r, mod):
    if r < 0 or r > n:
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


def main():
    N, M, K = MI()

    for i in range(2, N + 1):
        g1.append((g1[-1] * i) % MOD)
        inverse.append((-inverse[MOD % i] * (MOD//i)) % MOD)
        g2.append((g2[-1] * inverse[-1]) % MOD)

    ans = 0
    for k in range(K+1):
        group_color = M * pow(M - 1, N - k - 1, MOD)
        group_number = cmb(N-1, k, MOD)
        ans += (group_color * group_number) % MOD

    print(ans % MOD)


if __name__ == '__main__':
    main()


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

int main(){
  int r,g,b;
  cin>>r>>g>>b;
  int n=100*r+10*g+b;
  if(n%4==0){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}

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

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

    sort(A.begin(), A.end());

    vector<bool> is_divisible(1000001, false);
    vector<bool> already_has(1000001, false);

    for (int i = 0; i < N; ++i) {
        int A_i_multiple = A[i];
        if (is_divisible[A_i_multiple]) {
            continue;
        }
        if (already_has[A_i_multiple]) {
            is_divisible[A_i_multiple] = true;
            continue;
        }
        already_has[A_i_multiple] = true;
        A_i_multiple += A[i];
        while (A_i_multiple < 1000001) {
            is_divisible[A_i_multiple] = true;
            A_i_multiple += A[i];
        }
    }

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        if (!is_divisible[A[i]]) {
            ++ans;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 4312
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int maxn =300005;
ll a[maxn][61][2]={0};
ll num[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;++i){
        scanf("%lld",&num[i]);
    }
    for(int i=n-1;i>=0;--i)
    {
        ll d = num[i];
        for(int j=0;j<61;j++){
            a[i][j][0]=a[i+1][j][0];
            a[i][j][1]=a[i+1][j][1];
            if(d%2)
                a[i][j][1]++;
            else
                a[i][j][0]++;
            d/=2;
            //cout << d << " ";
        }
        //cout << endl;
    }
//    for(int i=n-1;i>=0;i--){
//        for(int j=0;j<2;j++)
//            cout << a[i][j][0] << " ";
//        cout << endl;
//        for(int j=0;j<2;j++)
//            cout << a[i][j][1] << " ";
//        cout << endl;
//    }
    ll aa[64]={0};
    aa[0]=1;
    for(int i=1;i<61;i++)
        aa[i]=aa[i-1]*2%mod;
    ll ans = 0;
    for(int i=0;i<n-1;++i)
        for(int j=0;j<61;++j){
            if(num[i]%2)
                ans=(ans+a[i+1][j][0]*aa[j])%mod;
            else
                ans=(ans+a[i+1][j][1]*aa[j])%mod;
        num[i]/=2;
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 288512
/*
 * test.cpp
 *
 *
 *      Author: Fireworks
 */

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<cmath>
#include<bitset>
#include<set>
#include<iomanip>
#include<fstream>
#include<bitset>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<list>
#include<sstream>

using namespace std;

typedef pair<int,int> ii;
typedef pair<int,long long> il;
typedef pair<long long,long long> ll;
typedef pair<ll,int> lli;
typedef pair<long long,int> li;
typedef pair<double,double> dd;
typedef pair<ii,int> iii;
typedef pair<double,int> di;
long long mod = 1000000007LL;
long long base = 10000007;
long long large = 1000000000000000000LL;


void gcdE(long long a,long long b,long long& d,long long& x,long long& y){
	if(!b){
		d=a;
		x=1;
		y=0;
	}else{
		gcdE(b,a%b,d,y,x);
		y-=x*(a/b);
	}
}

//to calculate (a/b) mod n, change it to ((a mod n)*inv(b,n)) mod n
long long inv(long long a,long long n){
	long long d,x,y;
	gcdE(a,n,d,x,y);
	return d==1?(x+n)%n:-1;
}

vector<long long> p;


long long mul(long long x,long long y){
	return (x*y)%mod;
}

long long c(long long n,long long m){
	return mul(p[n],inv(mul(p[m],p[n-m]),mod));
}
int main(){
	int h,w,a,b;
	cin>>h>>w>>a>>b;
	p.assign(1000010,1LL);
	for(int i=1;i<1000010;i++) p[i] = (1LL*i*p[i-1])%mod;
	long long ans = c(h+w-2,w-1);
	for(int i=1;i<=b;i++){
		ans+=mod-mul(c(h-a-1+i-1,i-1),c(a-1+w-i,a-1));
		ans%=mod;
	}
	cout<<ans<<endl;


	return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <climits>

typedef long long ll;
const int MOD = pow(10,9)+7;
const ll LMAX = 100000000000000000;

using namespace std;
int in(){
    int temp;
    scanf("%d",&temp);
    return temp;
}

ll lin(){
    ll temp;
    scanf("%lld",&temp);
    return temp;
}


int main() {

    int N = in();
    
    vector<int> vec;
    
    int ans = 0;
    int temp;
    for(auto i = 0; i<N; i++){
        temp = in();
        
        if(temp%10 == 0){
            ans+= temp;
        }else{
            vec.push_back(temp);
            ans += temp;
        }
    }
    
    if(vec.size() == 0){
        cout << 0 << endl;
        return 0;
    }
    
    sort(vec.begin(),vec.end());

    if(ans%10 == 0){
        cout << ans - vec[0] << endl;
    }else{
        cout << ans << endl;
    }
    
    
    return 0;
    
    
}





Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int n, a[200003] = { 0 }, i, j;
	scanf("%d", &n);

	for (i = 2; i <= n; i++) {
		scanf("%d", &j);
		a[j]++;
	}
	for (i = 1; i <= n; i++) {
		printf("%d\n", a[i]);
	}
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  long long sum = 0;
  for(int i = 0; i < n; i++){
    cin >> a[i];
    sum += a[i];
  }
  int ma = *max_element(a.begin(), a.end());
  sum -= ma;
  if(ma < sum) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3632
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int N = scanner.nextInt();
        int K = scanner.nextInt();
        int[] A = new int[N];
        int one = 0;
        int ret = 0;
        for (int i = 0; i < N; i++) {
            A[i] = scanner.nextInt();
            if (A[i] == 1) {
                one = i;
            }
        }

        if (one != 0) {
            int i = 0;
            while (i < one) {
                ret++;
                for (int j = 0; j < K && i < N; j++) {
                    A[i] = 1;
                    i++;
                }
                if (i <= one) {
                    i--;
                }
            }
        }

        // update
        for (int i = 0; i < N; i++) {
            if (A[i] == 1) {
                one = i;
            }
        }

        if (one != (N-1)) {
            int i = N -1;
            while (i > one) {
                ret++;
                for (int j = 0; j < K && i >= 0; j++) {
                    A[i] = 1;
                    i--;
                }
                if (i >= one) {
                    i++;
                }
            }
        }
        System.out.println(ret);
    }

    private class MyScanner {
        String[] s;int i;BufferedReader br;String reg = " ";
        MyScanner () { s = new String[0];i = 0;br = new BufferedReader(new InputStreamReader(System.in)); }
        public String next() {
            try {
                if (i < s.length) return s[i++]; String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0); i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}


Measured memory_bytes: 35548
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
	string s;
	cin >> s;
	if((s[0] == s[1]) && (s[0] == s[2])){
			cout << "Yes" << endl;
			return 0;
	}
	if((s[1] == s[2]) && (s[1] == s[3])){
			cout << "Yes" << endl;
			return 0;
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define PRINT(v) for (auto x : (V)) cout <<x <<" " <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


struct UnionFind{
  vector<int> par;  // 親ノードを格納
  vector<int> rank; // 木の深さを格納

  UnionFind(int N = 1) : par(N), rank(N, 0) { // N要素で初期化する
    for (int i=0; i<N; i++) par[i] = i;
  }

  int root(int x){ // 木の根を求める。自分じゃなかったら親の根を調べていき調べたノードの親はすべて根に
    return par[x] == x ? x : par[x] = root(par[x]); // 経路圧縮も行う
  }

  bool same(int x, int y){ // x,yの木が同じかどうか
    return root(x) == root(y);
  }

  bool unite(int x, int y){ // xとyの木を併合
    x = root(x); y = root(y); // ここでx,yのroot同士の扱いにする
    if (x == y) return false; // 元々同じならそのまま
    if (rank[x] < rank[y]) swap(x, y); // rank[x] >= rank[y]になるようにswap
    if (rank[x] == rank[y]) rank[x]++; // 元のrankが同じなら親になる方のrankは1増える
    par[y] = x;
    return true;
  }
};

int main() {
  int N,M; cin >>N >>M;
  UnionFind uf(N);
  rep(i, M){
    int x,y,z; cin >>x >>y >>z; x--; y--;
    uf.unite(x, y);
  }
  set<int> S;
  rep(i, N){
    S.insert(uf.root(i));
  }
  int res = S.size();
  cout <<res <<endl;
}


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

int main() {
    int N,x=1000000000;
    cin>>N;
    for(int i=0;i<N;i++){
        int A=0,y=0;
        cin>>A;
        for(;A%2==0;A/=2){
            y++;
        }

        if(x>y)
        x=y;

    }
    cout<<x<<endl;

}


Measured memory_bytes: 256
h, w, k = map(int, input().split())
# h, w, k = 15, 8, 5
# h, w, k = 2, 3, 1
# h, w, k = 2, 3, 3
# h, w, k = 1, 3, 2
p = 10**9+7
# DP[i][j]=i段目まで見て0からjに着くパターン数
# 最終的にDP[h][k-1]を求める
DP = [[0 for j in range(w+1)] for i in range(h+1)]
DP[0][0] = 1
F = [1, 1, 2, 3, 5, 8, 13, 21]
for i in range(h):
    for j in range(w):
        a = DP[i][j-1]*F[j-1]*F[w-1-j]
        b = DP[i][j+1]*F[j]*F[w-2-j]
        c = DP[i][j]*F[j]*F[w-1-j]
        DP[i+1][j] = (a+b+c) % p
print(DP[h][k-1])


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

int main(void) {
  int a, b, c, d, time;
  cin >> a >> b >> c >> d;
  time = -max(a, c) + min(b, d);
  if (time < 0)
    time = 0;

  cout << time << endl;
  return 0;
}


Measured memory_bytes: 256
void solve();

int main() {
	solve();
	return 0;
}

//////////////////////////////////////////////////
//////////////////////////////////////////////////
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <iomanip>
#include <string>

using namespace std;

void solve() {
	int N, A, B;
	cin >> N >> A >> B;
	cout << min(A*N,B) << endl;
	return;
}

Measured memory_bytes: 256
from collections import defaultdict
N = int(input())
A = [int(i) for i in input().split()]
D = defaultdict(int)

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

delete = 0
for d in D:
    if d < D[d]:
        delete += D[d] - d
    elif d > D[d]:
        delete += D[d]
print(delete)


Measured memory_bytes: 18676
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if (a%2==0){
      cout<<"Even"<<endl;
    }
  else {
    if (b%2==0)
      cout<<"Even"<<endl;
    else
      cout<<"Odd"<<endl;
  }
}

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

int main()
{
    long long n;
    cin>>n;
    string res="";
        while(n)
        {
            int rem=n%26;
            if(rem==0)
            {
                res+='z';
                n=n/26-1;
            }
            else
            {
                res+=char(rem-1+'a');
                n/=26;
            }
        }
        reverse(res.begin(),res.end());
        cout<<res<<endl;
}

Measured memory_bytes: 3628
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;


using ll = long long;

//#define int ll

using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;



const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int m, n, a[111];
main() {
  file("threesum");
  ios;
  cin >> n >> m;
  int sum = 0;
  fo(i, 1, n, 1) cin >> a[i], sum += a[i];
  int cnt = 0;
  fo(i, 1, n, 1) cnt += (a[i] * (4 * m) >= sum);
  cout << (cnt >= m ? "Yes" : "No");
  return 0;
}
/**

*/


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            while (sc.hasNextInt()) {
                int a = sc.nextInt();
                int b = sc.nextInt();
                System.out.println(a*a - b);
            }
        }
    }
}

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

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

map< ll, int > prime_factor(ll n) {
    map< ll, int > ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
        ret[i]++;
        n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}


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

    map<ll,int> mp;
    mp = prime_factor(n);
    int cnt = 0;

    for(auto e : mp){
        //cout <<e.first << " " << e.second << endl;
        int tmp = 0;
        
        reps(i,1,100){
            tmp += i;
            if(tmp <= e.second){
                cnt++;
            }else{
                break;
            }
        }

        //cout << cnt << endl;
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define FOR(i,s,e) for (int i=s;i<e;i++)
#define FOE(i,s,e) for (int i=s;i<=e;i++)
#define FOD(i,s,e) for (int i=s;i>=e;i--)
#define SET(a,e) memset(a,e,sizeof(a))
#define LL long long
#define LD long double
#define pb push_back
#define x first
#define y second
#define PII pair<int,int>
#define PLI pair<LL,int>
#define PIL pair<int,LL>
#define PLL pair<LL,LL>
#define eps 1e-9
#define mp make_pair

int h,w,a[10005],n,x,y,pnt,cnt;
int ans[105][105];

int main () {
	scanf("%d %d",&h,&w);
	scanf("%d",&n);
	FOE(i,1,n) {
		scanf("%d",&a[i]);	
	}
	x=1;
	y=1;
	pnt=1;
	cnt=0;
	while (cnt!=h*w) {
		if (a[pnt]==0) ++pnt;
		else {
			--a[pnt];
			ans[x][y]=pnt;
			++cnt;
			if (x%2==1) {
				if (y==w) ++x;
				else ++y;	
			}
			else {
				if (y==1) ++x;
				else --y;
			}
		}
	}
	FOE(i,1,h) {
		FOE(j,1,w) {
			if (j==w) {
				printf("%d\n",ans[i][j]);
			}
			else printf("%d ",ans[i][j]);
		}
	}
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;


int main(){
    ll K;
    cin >> K;
    if (K % 2 == 0) {
        cout << -1 << endl;
        return 0;
    }
    ll ans = 1, mod = 7 % K, n = 7 % K;

    while (true) {
        if (mod % K == 0) break;
        n = 10 * n % K;
        mod = mod + n;
        mod %= K;
        ans++;
        if (ans >= 10000000) break;
    }

    if (ans < 10000000) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int T[100005];

int main()
{
    ll N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    T[0] = 0;
    REP(i, N)
    {
        T[i + 1] = T[i];
        T[i + 1] += S[i] - '0';
    }

    int k = 0;
    int l = 0;
    ll max = 0;
    REP(i, N)
    {
        if (S[i] == '0')
        {
            if (i == 0 || S[i - 1] == '1')
            {
                k++;
            }
        }
        while (k > K)
        {
            l++;
            if (l >= N)
                break;
            if (S[l] == '1' && S[l - 1] == '0')
                --k;
        }
        max = std::max(max, i - l + 1);
       // cout << l << "-" << i << ":" << max << endl;
    }
    cout << max << endl;
    return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100010;

// ──────────────────────────────────────────────────────────────────────────────

int func(int n) { return (n * (n + 1) / 2); }

int main() {
	int n, k;
	cin >> n >> k;
	vd p(n);
	rep(i, n) cin >> p[i];

	double ans = 0;
	vd q(n + 1);
	rep(i, n) {
		double tmp = func(p[i]) / p[i];
		q[i + 1] = q[i] + tmp;
	}
	rep(i, q.size() - k) {
		ans = max(ans, q[i + k] - q[i]);
	}
	cout << std::fixed << std::setprecision(15) << ans << endl;
}

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

using namespace std;

#define F first
#define S second

int x[1002], y[1002], r[1002];
double w[1002][1002];
bool vis[1002];
double dis[1002];

int main() {
    int xs, ys, xt, yt; scanf("%d %d %d %d", &xs, &ys, &xt, &yt);
    int N; scanf("%d", &N);
    fill_n(dis, N+2, 1e30);
    for(int i = 1; i<=N; ++i) scanf("%d %d %d", x+i, y+i, r+i);
    x[0] = xs;
    y[0] = ys;
    x[N+1] = xt;
    y[N+1] = yt;
    for(int i = 0; i<=N+1; ++i) {
        for(int j = 0; j<=N+1; ++j) {
            w[i][j] = w[j][i] = max(0., hypot(abs(x[i]-x[j]), abs(y[i]-y[j]))-r[i]-r[j]);
        }
    }
    priority_queue< pair<double, int>, vector< pair<double, int> >,
        greater< pair<double, int> > > pq;
    dis[0] = 0;
    pq.emplace(0, 0);
    for(int ii = 0; ii<=N+1; ++ii) {
        int a = -1;
        while( !pq.empty() && vis[ a = pq.top().S ] )
            pq.pop();
        if( a == -1 ) break;
        vis[a] = 1;
        for(int i = 0; i<=N+1; ++i) {
            if( !vis[i] && dis[a]+w[a][i] < dis[i] ) {
                dis[i] = dis[a] + w[a][i];
                pq.emplace(dis[i], i);
            }
        }
    }
    /*
    for(int i = 0; i<4; ++i) {
        cerr << i << " " << dis[i] << endl;
    }
    */
    printf("%.9f\n", dis[N+1]);
}   



Measured memory_bytes: 12272
from itertools import groupby, chain, islice
 
def pairs(t):
    a = True
    while a:
        a =[sum(1 for _ in g) for k, g in islice(t, 2)]
        if a:
            yield sum(x * (x - 1) // 2 for x in a) + max(a)
 
s = input()
t = groupby(s)
if s[0] == '>':
    t = chain([(0, ())], t)
print(sum(pairs(t)))


Measured memory_bytes: 4468
n, x = map(int, input().split())
ans = [None]*(2*n-1)
if x == 2*n-1 or x == 1:
    print("No")

elif n == 2:
    print("Yes")
    for i in range(1, 4):
        print(i)
else:
    print("Yes")
    if x == 2*n-2:
        num = 1
        for i in range(n+1, 2*n-1):
            ans[i] = num
            num += 1
        for i in range(n+1):
            ans[i] = num
            num += 1

    else:
        ans[n-1] = x
        ans[n] = x-1
        ans[n+1] = x+2
        ans[n-2] = x+1
        num = 1
        for i in range(2*n-1):
            if x-1 <= num <= x+2:
                num = x+3
            if n-2 <= i <= n+1:
                continue
            ans[i] = num
            num += 1
    for i in range(2*n-1):
        print(ans[i])


Measured memory_bytes: 80184
#include <algorithm> // std::sort(begin,end)
#include <iostream>
#include <queue>
#include <string>
#include <unordered_map>
#include <utility> // std::swap
#include <vector>

using namespace std;

int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  string s = "";
  if (n == 0) {
    s = string("0");
  } else {
    while (n != 0) {

      if (n % 2) {
        s = string("1") + s;
        n -= 1;
      } else {
        s = string("0") + s;
      }

      if (n== 0)
        break;

      bool flag = true;
      switch (n % 4) {

        case 3:
           flag = true; break;// 3 = 4 - 2 +1
        case 2:
           flag = true; break;// 2 = 4 - 2
        case 1:
           flag = false; break;// 1 = 1 
        case 0:
           flag = false; break;// 0 = 0 
        case -1:
           flag = true; break;// -1 = -2 + 1 
        case -2:
           flag = true; break;// -2 = -2 
        case -3:
           flag = false; break;// -3 = -8 + 4 + 1 
      }
      if(flag){
        s = string("1") + s; 
        n -= -2;
      }else{
        s = string("0") + s;
      }

      n /= 4;
    }
  }
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <tuple>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#define rep(i,n) for(int i=0; i<n; i++)
#define all(v) v.begin(),v.end()
using namespace std;

int main(){
	int n,b;
	cin>>n;
	vector<int>vec(n);
	for(int i=1; i<n+1; i++){
		cin>>b;
		vec[b-1]=i;
	}
	rep(i,n){
		cout<<vec[i]<<endl;
	}
}

Measured memory_bytes: 1152
N = int(input())
A_list = list(map(int, input().split()))

L_dict = {}
R_dict = {}

for i, v in enumerate(A_list):
    l = i + v
    r = i - v
    if not l in L_dict.keys():
        L_dict[l] = [i]
    else:
        L_dict[l].append(i)
    
    if not r in R_dict.keys():
        R_dict[r] = [i]
    else:
        R_dict[r].append(i)

res = 0
for r in R_dict.keys():
    if r in L_dict.keys():
        res += len(R_dict[r]) * len(L_dict[r])
print(res)



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

int main(){
    while(1){
        int a,b;
        char op;
        cin >> a >> op >> b;
        if (op=='+') cout << a+b << endl;
        else if (op=='-') cout << a-b << endl;
        else if (op=='*') cout << a*b << endl;
        else if (op=='/') cout << a/b << endl;
        else if (op=='?') break;
    }
}


Measured memory_bytes: 3100
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)       for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define CtoI(c)         int((c)) - int('0')

//functions=============
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); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    string s; cin >> s;
    int a = CtoI(s[0]);
    int b = CtoI(s[1]);
    int c = CtoI(s[2]);
    int d = CtoI(s[3]);

    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: 3640
#include<stdio.h>
int main()
{
	int i,j,H,W;
	while(1)
	{
		scanf("%d%d",&H,&W);
		if(H==0||W==0){break;}
		for(i=0;i<H;i++)
		{
			for(j=0;j<W;j++)
			{
				if((i+j)%2==0){printf("#");}
				else {printf(".");}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

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

if N % 4 == 0 or N % 7 == 0:
	print('Yes')
else:
	i = N // 7
	for count in range(i):
		temp = N - 7*(count+1)
		if temp % 4 == 0:
			print('Yes')
			exit()
	print('No')

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

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

  long long cnt = 0;
  for(int i = 1; i < N ; i++){
    cnt += i;
  }
  
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define alint(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

lint n,s,ans=0;

void solve(lint n,lint sum,lint max){
	if(n){
		rep(i,max+1,10){
			solve(n-1,sum+i,i);
		}
	}else if(sum==s){
		ans++; return;
	}
	return;
}


int main(){
	while(1){
		cin>>n>>s;
		if(n==0 && s==0) break;
		ans=0;
		solve(n,0,-1);
		o(ans);
	}
}

Measured memory_bytes: 1156
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll mod=998244353;

const ll INF=1e9;

int main(){
    vector<ll> a(3);
    bool even=false;
    rep(i,3){
        cin >> a[i];
        if(a[i]%2==0) even=true;
    }
    sort(a.begin(),a.end());
    if(even) cout << 0 << endl;
    else{
        cout << a[0]*a[1] << endl;
    }
    return 0;
}

Measured memory_bytes: 3556
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int s,hour,min,sec;
    scanf("%d",&s);
    hour=s/60/60;
    min=(s-(hour*3600))/60;
    sec=(s-(hour*3600))%60;
    printf("%d:%d:%d\n",hour,min,sec);
    return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <string>

using namespace std;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

void solve() {
    int x;
    cin >> x;
    while(true){
        if(IsPrime(x)){
            cout << x;
            return;
        } else {
            x++;
        }
    }
}

int main() {
    solve();
    return 0;
}

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

int main(){
  ll a,b,n,c,d,e,ans;
  cin >> n >> a >> b;
  c=max(a,b)-min(a,b);
  if(c%2==0)ans=c/2;
  else{
    d=n-max(a,b);
    e=min(a,b)-1;
    c+=1;
    ans=min(d,e)+c/2;
  }
  cout << ans;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  if(a <= 5){
    cout << "0" << endl;
  }
  if(6 <= a && a <= 12){
    cout << b / 2 << endl;
  }
  if(13 <= a){
    cout << b << endl;
  }
}


Measured memory_bytes: 256
# Your code here!
h,w = gets.chomp.split.map &:to_i
if(w == 1 or h == 1)
  puts 1
  exit
end
if(w.even?)
  puts w*h/2
else
  if(h.even?)
    puts w*h/2
  else
    puts w*(h/2) + (w+1)/2
  end
end


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

int main() {
  
  int A=0, B=0, C=0;
  cin >> A >> B >> C;
  
  if((A==B && B!=C) || (A==C && A!=B) || (B==C && C!=A)) {
    
    cout << "Yes" << endl;
    
  } else {
    
    cout << "No" << endl;
    
  }
  
  return 0;
  
}

Measured memory_bytes: 256