akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector< vector<int> > a(n, vector<int>(n));
    vector< long long > dp((1<<n), 0), cst((1<<n), 0);
    for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin >> a[i][j];

    for(int i=0;i<(1<<n);i++){
        cst[i] = 0;
        for(int j=0;j<n;j++){
            if(((i>>j)&1)==0) continue;
            for(int k=j+1;k<n;k++){
                if(((i>>k)&1)==1) cst[i] += a[j][k];
            }
        }
    }

    for(int i=0;i<(1<<n);i++){
        for(int j=i;j>0;j=((j-1)&i)){
            dp[i] = max(dp[i], dp[i-j]+cst[j]);
        }
    }
    cout << dp[(1<<n)-1] << endl;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main(){
    // ios_base::sync_with_stdio(0);
    // cin.tie(nullptr);
    long long a, b, d;
    cin>>a;
    scanf("%lld.%lld", &b, &d);
    b=b*100+d;
    cout<<(a*b)/100<<"\n";
    return 0;
}

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

int main(void){
    // Your code here!
    vector<int> a;
    for(int i=0;i<6;i++){
        int n;
        cin >> n;
        a.push_back(n);
    }
    int x = a[4]-a[0];
    if(x<=a[5]){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_variables)]

use itertools::Itertools;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: i32,
    }
    // annotate for rust-analyzer
    let n: i32 = n;

    println!("{}", if n >= 30 { "Yes" } else { "No" });
}


Measured memory_bytes: 2148
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iterator>
#include <cstring>

using namespace std;
const int INF = (1<<30);
typedef pair<int, int> P;
typedef long long ll;
#define PB push_back
#define rep(i, a) for (int i = 0; i < a; i++)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define mp make_pair

//出力チェック用
int qqq;

ll ans = 0;
int main() 
{
   int a,b,c;
	cin>>a>>b>>c;
    int cnt=0;
    rep(i,34){
    if(a%2||b%2||c%2) break;
    int s=a/2,t=b/2,u=c/2;
    a=t+u,b=u+s,c=s+t;
    cnt++;
    }
    if(cnt>=34) cnt=-1;
    cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
char s[10005];
int a,b;
bool f=true;
int main(){
	scanf("%d %d %s",&a,&b,s);
	for(int i=0;i<a;i++)
		if(s[i]<'0' or s[i]>'9')
			f=false;
	if(s[a]!='-')
		f=false;
	for(int i=a+1;i<=a+b;i++)
		if(s[i]<'0' or s[i]>'9')
			f=false;
	if(f)
		printf("Yes");
	else
		printf("No");
	return 0;
	
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
const int mod=1e9+7;

int main(){
    int n;cin>>n;
    double ans=0;
    rep(i,n){
        double tmp;cin>>tmp;
        ans+=(1/tmp);
    }
    cout<<setprecision(10)<<(double)1/ans<<endl;
}

Measured memory_bytes: 256
n, *a = map(int, open(0).read().split())
b = [0] * 60
ans = 0
for i in range(n):
    for j in range(60):
        ans += 2**j * (i - b[j] if a[i] >> j & 1 else b[j])
        ans %= 10**9 + 7
    for j in range(len(bin(a[i])) - 2):
        b[j] += a[i] >> j & 1
print(ans)

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

int main()
{
    int a, b;
    cin >> a >> b;
    int num = 0;
    int ans = 0;
    if(b < 10){
        num = a*10+b;
    }
    else if(b == 100){
        num = a*1000+100;
    }
    else{
        num = a*100+b;
    }
    for(int i=1;i<=10000;i++){
        if(i*i == num){
            ans++;
            break;
        }
        else if(num/2 == 0){
            break;
        }
    }
    if(ans == 1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

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[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
        }

        Arrays.sort(a);

        int max = a[n-1];

        int[] aa = new int[max + 1];
        Set<Integer> dup = new HashSet<>();
        for (int k : a) {
            if (aa[k] == 0) {
                for (int i = 2 * k; i < max + 1; i = i + k) {
                    aa[i] = 1;
                }
                aa[k] = 1;
                dup.add(k);
            } else {
                if (dup.contains(k)) dup.remove(k);
            }
        }

        System.out.println(dup.size());
    }
}

Measured memory_bytes: 61944
using System;

public class Hello
{
    public const int MAX = 7368792;
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var m = int.Parse(line[0]);
            var n = int.Parse(line[1]);
            if (m == 0 && n == 0) break;
            var a = new bool[MAX + 1];
            for (int i = 1; i * m <= MAX; i++) a[i * m] = true;
            var nextm = m;
            for (int i = 1; i < n; i++)
            {
                nextm = getM(a, nextm);
                for (int j = 1; j * nextm <= MAX; j++) a[j * nextm] = true;
            }
            var ret = getM(a, nextm);
            Console.WriteLine(ret);
        }
    }
    public static int getM(bool[] a, int m)
    {
        for (int i = m + 1; i < a.Length; i++)
            if (!a[i]) return i;
        return 0;
    }
}




Measured memory_bytes: 24632
N = int(input())
f = lambda x,y:len(str(x)) if x > y else len(str(y))
from math import floor, sqrt
ans = len(str(N))
for a in range(1,floor(sqrt(N))+1):
    if N % a == 0:
        ans = min(ans, f(a,N//a))
print(ans)

Measured memory_bytes: 9196
const input = require('fs').readFileSync('/dev/stdin', 'utf8').split(/\n/);

for (let i = 0; i < input.length; i++) {
     if (input[i] === '0') {
        break;
    }
    let ans = 0;
    let num = input[i].split('').map(Number);
   
    for (let j = 0; j < num.length; j++) {
        ans += num[j];
    }
  console.log(ans);
}




Measured memory_bytes: 16700
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
typedef long long ll;
using namespace std;
const int maxn = 1e5+500;  //数据范围

const ll mod = 1e9+7;
string str;
int p[maxn];
ll dp[maxn][20];

int main(){
    cin>>str;
    int len=str.size();
    p[0]=1;FOR(i,1,1e5)p[i]=p[i-1]*10%13;
    dp[0][0]=1;
    FOR(i,0,len-1){
        FOR(j,0,12){
            if(str[i]=='?'){
                FOR(k,0,9)dp[i+1][(j+k*p[len-1-i])%13]=(dp[i+1][(j+k*p[len-1-i])%13]+dp[i][j])%mod;
            }
            else{
                int digit=str[i]-'0';
                dp[i+1][(j+digit*p[len-1-i])%13]=(dp[i+1][(j+digit*p[len-1-i])%13]+dp[i][j])%mod;
            }
        }
    }
    cout<<dp[len][5]%mod<<endl;
}


Measured memory_bytes: 16512
/*Remember: The Struggle is Important*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

#include<bits/stdc++.h>
using namespace std;

#define     int          long long int
#define     ld           long double
#define     fast()       ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)       x.begin(),x.end()
#define     mem(a,b)     memset(a,b,sizeof(a))
#define     gcd(a,b)     (__gcd((a),(b)))
#define     lcm(a,b)     (((a)*(b))/gcd((a),(b)))
#define     pb           push_back
#define     ins          insert
#define     pii          pair<int,int>
#define     F            first
#define     S            second
#define     mt           make_tuple
#define     show(x)      for(auto c:x)cout<<c<<" ";cout<<"\n";
#define     show2(x)     for(auto c:x)cout<<c.F<<" "<<c.S<<"\n";

const int inf=1e18,M=1e9+7;
const int N=1e5+10;

int dp[N];          // (stones in the pile)

vector<int> v;
int n;

void solve()
{
    mem(dp,0);

    int k;
    cin>>n>>k;

    v.resize(n);
    for(int i=0;i<n;++i)
        cin>>v[i];

    for(int i=v[0];i<=k;++i)
    {
        for(auto c:v)
        {
            if(i-c>=0)
                dp[i]|=(!dp[i-c]);
        }
    }

//    for(int i=0;i<=k;++i)
//        cout<<dp[i]<<" ";
//    cout<<"\n";

    if(dp[k])
        cout<<"First";
    else
        cout<<"Second";
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}




Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define For(i,l,r) for(int i = (l),i##end = (r);i <= i##end;i++)
#define Fordown(i,r,l) for(int i = (r),i##end = (l);i >= i##end;i--)
#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long ll;

template <typename T> inline bool chkmin(T &x,T y) { return y < x ? x = y,1 : 0; }
template <typename T> inline bool chkmax(T &x,T y) { return x < y ? x = y,1 : 0; }

const int INF = 0x3f3f3f3f;
const int N = 4e5 + 10;

int a[N];
ll sum[N];

inline int read() {
	int x = 0,flag = 1;
	char ch = getchar();
	while(!isdigit(ch) && ch != '-') ch = getchar();
	if(ch == '-') flag = -1,ch = getchar();
	while(isdigit(ch)) x = (x << 3) + (x << 1) + (ch - '0'),ch = getchar();
	return x * flag;
}

int main() {

	int L = read(),n = read();
	For(i,1,n) a[i] = read(),sum[i] = sum[i - 1] + a[i];
	a[n + 1] = L,sum[n + 1] = sum[n] + L;
	For(i,n + 2,n + n + 1) a[i] = a[i - n - 1] + L,sum[i] = sum[i - 1] + a[i];
	ll ans = 0;
	For(i,0,n) {
		ll cur = 0,cnt = min(i,n - i); //zuo -> i + 1,you -> i + n + 1
		cur = abs(max(a[i + n + 1 - cnt] - L,L - a[i + cnt + 1]));
		int pos = (cur == a[i + n + 1 - cnt] - L) ? i + n + 1 - cnt : i + cnt + 1;
		cur += 2 * ((sum[i + n + 1] - sum[i + n + 1 - cnt]) - (sum[i + cnt] - sum[i]));
		cur -= min(a[pos] - a[i + 1],a[i + n + 1] - a[pos]);
//		cur = 2 * (sum[n + i + 1] - sum[n + i + 1 - cnt] - (sum[i + cnt] - sum[i]));
//		cout << cur << " " << i << " " << n - i << endl;
//		debug(cnt);
		chkmax(ans,cur);
	}

	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
long long n,a,b[100005],c,cnt=0,val1,val2;
vector<long long> v1,v2;
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a);
		v1.push_back(a);
	}
	sort(v1.begin(),v1.end());
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&b[i]);
	}
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&c);
		v2.push_back(c);
	}
	sort(v2.begin(),v2.end());
	for(int i=1;i<=n;i++)
	{
		val1=lower_bound(v1.begin(),v1.end(),b[i])-v1.begin();
		val2=n-(upper_bound(v2.begin(),v2.end(),b[i])-v2.begin());
		cnt+=val1*val2;
	}
	printf("%lld\n",cnt);
}

Measured memory_bytes: 6472
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll h,w,k ;
	cin >> h >> w >> k ;
	vvll g(h+1,vll(w+1,0)) ;
	for(int i=0;i<k;i++){
		ll a,b,c ;
		cin >> a >> b >> c ;
		g.at(a).at(b) = c ;
	}
	vector<vvll> dp(h+1,vvll(w+1,vll(4,0))) ;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			for(int l=0;l<=3;l++){
				dp.at(i).at(j).at(l) = max(dp.at(i-1).at(j).at(l),dp.at(i).at(j-1).at(l)) ;
				ll sub = 0 ;
				if(l!=0) sub = max(sub,dp.at(i).at(j-1).at(l-1)+g.at(i).at(j)) ;
				dp.at(i).at(j).at(l) = max(dp.at(i).at(j).at(l),sub) ;
			}
			for(int l=0;l<=3;l++){
				dp.at(i).at(j).at(1) = max(dp.at(i).at(j).at(1),dp.at(i-1).at(j).at(l)+g.at(i).at(j)) ;
			}
		}
	}
	ll ans = 0 ;
	for(int i=0;i<=3;i++) ans = max(ans,dp.at(h).at(w).at(i)) ;
	cout << ans << endl ;
//	for(int j=1;j<=w;j++){
//		for(int l=0;l<=3;l++) cout << dp.at(2).at(j).at(l) << " " ; cout << endl ;
//	}
}


Measured memory_bytes: 706616
SA = input()+'g'
SB = input()+'g'
SC = input()+'g'
cnta = 0
cntb = 0
cntc = 0
turn = 'A'
while cnta != len(SA) and cntb != len(SB) and cntc != len(SC):
    if turn == 'A':
        if SA[cnta] == 'b':
            turn = 'B'
        elif SA[cnta] == 'c':
            turn = 'C'
        cnta += 1
    elif turn == 'B':
        if SB[cntb] == 'a':
            turn = 'A'
        elif SB[cntb] == 'c':
            turn = 'C'
        cntb += 1
    else:
        if SC[cntc] == 'a':
            turn = 'A'
        elif SC[cntc] == 'b':
            turn = 'B'
        cntc += 1
if cnta == len(SA):
    print('A')
elif cntb == len(SB):
    print('B')
elif cntc == len(SC):
    print('C')

Measured memory_bytes: 3064
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
#define INF 0x3f3f3f3f
#define pb push_back
#define mk make_pair


int n,cont=0;
int main()
{
	bool flag = true;
	scanf("%d",&n);
	vector<int> v;
	for(int i=0;i<n;i++)
	{
		int a;
		scanf("%d",&a);
		v.pb(a);
		if(a%2==1)
			flag = false;
	}
	while(flag==true)
	{
		cont++;
		for(int i=0;i<n;i++)
		{
			v[i]/=2;
			if(v[i]%2==1)
			{
				flag = false;
				break;
			}
		}
	}
	printf("%d\n",cont );
	return 0;
}

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

namespace AtCoder
{
    class Program
    {
        public static void Main()
        {
            new Program().Solve();
        }

        void Solve()
        {
            int n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();
            Array.Sort(a);
            var ai = a[a.Length - 1];
            int aj = int.MinValue;
            for (int i = 0; i < a.Length - 1; i++)
            {
                int value = Math.Min(a[i], ai - a[i]);
                if (value > aj)
                {
                    aj = a[i];
                }
            }
            Console.WriteLine(ai + " " + aj);
        }



    }
}


Measured memory_bytes: 19680
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int a = Integer.parseInt(scanner.next());
        int b = Integer.parseInt(scanner.next());
        int c = Integer.parseInt(scanner.next());
        scanner.close();
 
        int res;
 
        res = (b / a) > c ? c : (int)(b / a);
 
        System.out.println(res);
    }
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define ENDL "\n"
#define PRINT(x) cout << (x) << ENDL

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

inline int in(int& a) {return scanf("%d", &a);}
inline void out(int n) {printf("%d\n", n);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


signed main(){
    int N;
    int p[20];
    cin >> N;
    REP(i, N) cin >> p[i];
    int cnt = 0;
    FOR(i, 1, N - 1){
        if((p[i - 1] - p[i]) * (p[i + 1] - p[i]) < 0) cnt++;
    }
    PRINT(cnt);
    return 0;
}

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

using namespace std;
using ll = long long;
using v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;
vector<int> R(41, 0);
int search(int s){
	int r = 41;
	int l = 0;
	while(l+1 < r){
		int m = (l+r)/2;
		if(R[m]>s){
			r = m;
		}else if(R[m]<s){
			l = m;
		}else{
			l = m;
			break;
		}
	}
	return l;
}

int main(){
	ll N;
	cin >> N;
	vector<pair<ll, int>> a(0);
	ll n = N;
	for(ll i = 2; i*i<=n; i++){
		if(N%i == 0){
			int count = 0;
			while(N%i == 0){
				count ++;
				N/=i;
			}
			a.push_back(make_pair(i, count));
		}
	}
	if(N != 1) a.push_back(make_pair(N, 1));
	for(int i = 1; i< 41; i++){
		R[i] = R[i-1]+i;
	}
	ll ans = 0;
	for(int i = 0; i < a.size(); i++){
		int s = a[i].second;
		if(s == 1 || s == 2) ans++;
		else if(s == 3) ans+= 2;
		else{
			ans += search(s);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3588
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(ll i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=200010;
const ll mod=1e9+7;


int main(){
  int n;
  cin >> n;
  vector<P> e;
  if(n%2){
    REP(i,1,n){
      e.emplace_back(n,i);
    }    
    n--;
  }
  REP(i,1,n/2+1)REP(j,i+1,n/2+1){
    e.emplace_back(i,j);
    e.emplace_back(i,n-j+1);
    e.emplace_back(n-i+1,j);
    e.emplace_back(n-i+1,n-j+1);
  }

  cout << e.size() << ln;
  for(auto it:e){
    cout << it.F << " " << it.S << ln;
  }
  return 0;
}

Measured memory_bytes: 3692
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>

using namespace std;
using lint = int64_t;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
#define repn(i, a, b) for(int i = (a); i < (b); ++i)
#define rep_inv(i, n) for (int i = (n); i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define cend printf("\n")

//constexpr lint mod = 998'244'353LL;
constexpr lint Mod = 1000'000'007LL;
constexpr lint Inf = 4'500'000'000'000'000'007LL; //4.5e18+7
constexpr double Pi = 3.141592653589793;

template<class T> using prique     = priority_queue<T>;
template<class T> using prique_inv = priority_queue<T, vector<T>, greater<T>>;
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& rhs) { return is >> rhs.first >> rhs.second; }
template<class T, class U>inline ostream& operator<<(ostream& os, const pair<T, U>& rhs) { return os << "(" << rhs.first << ", " << rhs.second << ")"; }
template<class InputIterator> void arrin(InputIterator first, InputIterator last) { for (; first != last; ++first) cin >> (*first); }
template<class InputIterator> void arrout(InputIterator first, InputIterator last) {
	for (; first != last; ++first) {
		cout << (*first) << ((first + 1) != last ? " " : "\n");
	}
}

void print(string a, string b, bool f) { cout << (f ? a : b) << endl; }

bool pri(lint x) { 
	for (lint i = 2; i * i <= x; ++i) {
		if (x % i == 0) return false;
	}
	return 1 < x; 
}

lint fact[3000000];
void fact_init(lint n, lint m = Mod) {
	if (3000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (lint i = 2; i <= n; ++i) {
		fact[i] = i * fact[i - 1] % m;
	}
}

lint modpow(lint x, lint n, lint m = Mod) {
	lint res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % m;
		x = x * x % m;
		n >>= 1;
	}
	return res;
}

lint intpow(lint x, lint n) {
	lint res = 1;
	while (n > 0) {
		if (n & 1) res *= x;
		x *= x;
		n >>= 1;
	}
	return res;
}

lint comb(lint n, lint r, lint m = Mod) {
	if (r == 0 || r == n) return 1;
	lint res = fact[n] * modpow(fact[n - r], m - 2, m) % m * modpow(fact[r], m - 2, m) % m;
	return res < 0 ? res + m : res;
}

map<lint, lint> factring(lint n) {
	map<lint, lint> res;
	for (lint i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++res[i];
		}
	}
	if (n != 1) ++res[n];
	return res;
}

int main() {
	int cnt = 0;
	string s;
	cin >> s;
	for (auto c : s) {
		cnt += c - '0';
	}
	print("Yes", "No", cnt % 9 == 0);
}

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

int main(){
  long long a, b;
  cin >> a >> b;
  if(a*b <= 0) cout << "Zero" << endl;
  else{
    if(min(a, b) > 0) cout << "Positive" << endl;
    else{
      if(abs(a-b)%2 == 1) cout << "Positive" << endl;
      else cout << "Negative" << endl;

    }
  }
    return 0;

}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>

using namespace std;

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


int main(){

	string str;
	map<string,int> freq;
	while(getline(cin,str,',')){
		string str2;
		cin >> str2;

		freq[str2]++;
	}

	cout << freq["A"] << endl;
	cout << freq["B"] << endl;
	cout << freq["AB"] << endl;
	cout << freq["O"] << endl;
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
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; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int n; scanf("%d",&n);
    rep(i,0,n)rep(j,i+1,n)printf("%d ",__builtin_ctz(i^j)+1);
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  int N;
  cin >> N;
  int ans = 0;
  for( int i = 1; i <= (N+1)/2; i++ ){
    if( i != (N+1)/2 ){
      ans++;
    }
  }
  
  cout << ans << endl;
            
}


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

ac = [False] * n
wa = [0] * n

for i in range( m ):
  p = input().split()
  prob_no =int( p[ 0 ])
  if p[ 1 ] == "WA":
    if not ac[ prob_no - 1 ]:
      wa[ prob_no - 1 ] += 1
  else:
    ac[ prob_no - 1 ] = True

wa_cnt = 0
for i in range( n ):
  if ac[ i ]:
    wa_cnt += wa[ i ]
ac_cnt = sum( ac )

print( ac_cnt, wa_cnt )

Measured memory_bytes: 4596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  rep(i, h) cin >> s[i];

  int ans = inf;
  for (int i2 = 0; i2 < (1 << h + 1); i2 += 2) {
    vector<int> v;
    v.eb(0);
    rep3(j, 1, h + 1) {
      if (i2 & (1 << j)) v.eb(j);
    }
    v.eb(h + 1);
    // cout << v << endl;

    // 縦, 横に見ていって, k を超えるとこ
    vector<vector<int> > table(h + 1, vector<int>(w + 1));

    int c = 0;
    rep(i, h) rep(j, w) if (s[i][j] == '1') table[i + 1][j + 1] = 1;
    // rep(i, h + 1) { rep(j, w + 1) cout << table[i][j] << " "; cout << endl; }
    // cout << endl;
    rep(x, sz(v) - 1) {
      // [v, v2)
      rep3(i, v[x], v[x + 1]) rep3(j, 1, w + 1) table[i][j] += table[i][j - 1];
      rep(j, w + 1) rep3(i, v[x] + 1, v[x + 1]) table[i][j] += table[i - 1][j];
    }
    // rep(i, h + 1) { rep(j, w + 1) cout << table[i][j] << " "; cout << endl; }
    [&]() {
      int x = 0;
      rep(j, w + 1) {
        rep3(i, 1, sz(v)) {
          int y = table[v[i] - 1][j] - table[v[i] - 1][x];
          if (y >= 2 * k + 1) return;
          if (y > k) {
            x = j - 1;
            c++;
          }
          // cout << y << " " << v[i] << " " << x << endl;
        }
      }
      // cout << c << endl;
      rep(i, sz(v)) if (v[i] - 1 >= 1 && v[i] - 1 <= h) c++;
      c--;
      // cout << c << endl;
      chmin(ans, c);
    }();
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int x, a, b; cin >> x >> a >> b;
    cout << (x - a) % b << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

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

  int a, b, k;

  cin >> a >> b >> k;

  std::set<int> ans;

  for (int i = a; i < a + k && i <= b; ++i) {
    ans.insert(i);
  }

  for (int i = b; i > b - k && i >= a; --i) {
    ans.insert(i);
  }

  for (auto itr = ans.begin(); itr != ans.end(); ++itr) {
    cout << *itr << endl;
  }


  return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
class Main {
    public static void main(String[] args) {
      
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
      	int h = sc.nextInt();
      	int w = sc.nextInt();
      	int sam = H*W;
        int a = h*W;
        int b = H*w;
        int c = h*w;
        int d = b-c;
          
      System.out.print(sam-(a+d));
      
      

    }
}

Measured memory_bytes: 21588
#include <stdio.h>
int main(void){
  int n,i,result[1000],a[1000],b[1000],c[1000];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d %d",&a[i],&b[i],&c[i]);
    result[i]=0;
  }
  for(i=0;i<n;i++){
    if(a[i]*a[i]==b[i]*b[i]+c[i]*c[i])result[i]=1;
    if(b[i]*b[i]==a[i]*a[i]+c[i]*c[i])result[i]=1;
    if(c[i]*c[i]==a[i]*a[i]+b[i]*b[i])result[i]=1;
  }
  for(i=0;i<n;i++){
    if(result[i]==1){
      printf("YES\n");
    }
    else{
      printf("NO\n");
    }
  }
  return(0);
}

Measured memory_bytes: 0
import java.util.*;


public class Main {
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a < b) {
		    System.out.println("a < b");
		} else if (a > b) {
		    System.out.println("a > b");
		} else {
		    System.out.println("a == b");
		}
    }
}


Measured memory_bytes: 26196
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
  int h, w, k, cnt, ans = 0;
  cin >> h >> w >> k;
  string s[6];
  for (int i = 0; i < h; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < (1 << (h + w)); i++) {
    cnt = 0;
    for (int j = 0; j < h; j++) {
      for (int k = 0; k < w; k++) {
        if (!(i & (1 << k)) && !(i & (1 << (w + j))) && s[j][k] == '#') {
          cnt++;
        }
      }
    }
    if (cnt == k) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include <queue>
#include <iostream>
#include <map>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(long long i = 0;(i) < (n);(i)++)
using namespace std;
using ll = long long;

ll A, B;

int main()
{
	cin >> A >> B;
	ll ans = (A - B * 2 >= 0) ? A - B * 2 : 0;
	cout << ans << endl;
	return 0;
}

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

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

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

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

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

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

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

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

int main() {
    lli n;
    cin1(n);
    lli dist[n+1][n+1];
    lli ans = 0;
    REPE(i,1,n) {
        REPE(j,1,n) {
            lli a;
            cin >> a;
            dist[i][j] = a;
            if (i > j)
                ans += a;
        }
    }
    //cout1(ans);
    // 3点選んで AB と BC の距離の和が AC と同じかそれより大きいことを確認していく。
    // 同じの場合は全ての合計からその長さを引く。
    bool done[n+1][n+1] = {false};
    REPE(i,1,n) {
        REPE(j,1,n) {
            if (i == j)
                continue;
            REPE(k,1,n) {
                if (i == k || j == k)
                    continue;
                if (dist[i][j] + dist[j][k] < dist[i][k]) {
                    cout << -1 << endl;
                    return 0;
                }
                else if (dist[i][j] + dist[j][k] == dist[i][k]) {
                    if (i < k && !done[i][k]) {
                        done[i][k] = true;
                        ans -= dist[i][k];
                        //cout3(i,k,dist[i][k]);
                    }
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
void solve()
{
  ll n;
  cin>>n;
  ll cnt=0;
  rep(i,1,n+1){
    ll x;
    cin>>x;
    if((i%2)&&(x%2)) cnt++;
  } 
  cout<<cnt<<endl;
}
signed main()
{
  
    /***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
    /***********************************/
 
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS=1;
//  cin>>TESTS;
  while(TESTS--)
  {
    solve();
    
  }
  TIME
  return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);
int vector_finder(std::vector<int> vec, int number)
{
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance(vec.begin(), itr);
    if (index != vec.size())
    { // 発見できたとき
        return 1;
    }
    else
    { // 発見できなかったとき
        return 0;
    }
}
int main()
{
    vector<int> res;
    while (1)
    {
        int N, M;
        cin >> N >> M;
        if (N == 0 && M == 0)
            break;
        vector<int> score(N);
        vector<int> S(M);
        vector<vector<int>> C(M);
        rep(i, M)
        {
            cin >> S[i];
            int k;
            cin >> k;
            rep(j, k)
            {
                int c;
                cin >> c;
                c--;
                C[i].push_back(c);
                score[c] += S[i];
            }
        }
        int ans_max = 0;
        int highest = 0;
        rep(i, N)
        {
            if (ans_max < score[i])
            {
                ans_max = score[i];
                highest = i;
            }
        }
        rep(i, N) score[i] = 0;
        rep(i, M)
        {
            if (vector_finder(C[i], highest))
                continue;
            if (C[i].size() == 1)
            {
                score[C[i][0]] += S[i];
            }
        }
        int ans_min = INF;
        int lowest = 0;
        rep(i, N)
        {
            if (ans_min > score[i] && i != highest)
            {
                ans_min = score[i];
                lowest = i;
            }
        }
        res.push_back(ans_max - ans_min + 1);
    }
    rep(i, res.size()) cout << res[i] << endl;
    return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s; cin >> s;
	int a = 0, b = 0, sc = 0;
	for(auto c : s){
		if(c == 'g'){
			if(a + 1 <= b) sc++, a++;
			else b++;
		} else {
			if(a + 1 <= b) a++;
			else b++, sc--;
		}
	}
	cout << sc << endl;
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 999999999999 //10^13-1
#define P pair<int,int>
#define prique priority_queue
int n,ans=1,cnt=0;
int a[200000];
signed main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	sort(a,a+n);
	reverse(a,a+n);
	rep(i,n-1){
		if(a[i]==a[i+1]){
			i++;
			cnt++;
			ans*=a[i];
		}
		if(cnt>=2)break;
	}
	if(cnt==2)cout<<ans<<endl;
	else cout<<0<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double ZKS(double x,double q){
	return (x - ((x * x * x) - q) / (3 * x * x));
}

int main(void){
	double q;

	while(cin >> q){
		if(q == -1) break;

		double x1 = q / 2;
		double x = x1;

		while(abs(x * x * x - q) > 0.00001 * q){
			x = ZKS(x,q);
		}

		cout << fixed;
		cout << setprecision(6) << x <<endl;
	}

	return 0;
}


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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int N;
    Scd(N);
    vector<int> c(N);
    Rep(i,N) Scd(c[i]);

    vector<int> mass(200002,0);
    vector<int> trans(N,0);

    int tmp = 0;
    for (int i = N-1; i >= 0 ; i-- ){
        if( tmp == c[i] ){
            mass[tmp] = i;
            continue;
        }
        tmp = c[i];
        trans[i] = mass[c[i]];
        mass[c[i]] = i;
    }

    ll mod = 1000000007;
    vector<ll> dp(N+1,0);
    dp[0] = 1;
    Rep(i,N){
        dp[i+1] += dp[i];
        if( trans[i] ){
            dp[trans[i]] += dp[i];
            dp[trans[i]] %= mod;
        }
        dp[i+1] %= mod;
    }
    printf ("%llu\n", dp[N]%mod );

    return 0;
}



Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V  = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class H> void rsz(V<T> &v, H h) { v.resize(h); }
template<class T, class H, class... R> void rsz(V<T> &v, H h, R... r) { v.resize(h); for (auto&& i : v) rsz(i, r...); }

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  string s; cin >> s;
  int k; cin >> k;
  int n = s.size();
  for (int i = 0; i < n - 1; i++) {
    int c = (26 - (s[i] - 'a')) % 26;
    if (k >= c) s[i] = 'a', k -= c;
  }
  s[n - 1] = 'a' + (s[n - 1] - 'a' + k) % 26;
  cout << s << '\n';
}

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

int main() {
    int x,y;
    cin >> x >> y;
    int tot=abs(abs(x)-abs(y));
    if ( (long long)x*y<0 ) {
        tot++;        
    } else {
        if ( x*y==0 ) {
            if ( x>y ) tot++;  
        }
        else {
            if ( x>y ) tot+=2;
        }
    }
    cout << tot << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(int argc, char* argv[])
{
	//ABC166 B
	int n,k;
	int d; // お菓子持ってる人数
	int a;
	int ans = 0;
	// N K
	// d
	// A A A A A
	//
	//
	// d
	// A A A A A

	// N人のすぬけ君
	// K 種類のお菓子

	// d番目のお菓子を持っている人数
	// A A A A←お菓子持っているすぬけ番号
	//cin >> x >> y >> a >> b >> c;

	cin >> n >> k;

	vector<int> snk(n,0);

	for (int i = 0; i < k; i++) {
		// k番目のお菓子
		cin >> d;

		for (int j = 0; j < d; j++) {
			cin >> a;
			snk[a-1]++;
		}
	}

	for (int i = 0; i < n; i++) {
		if (snk[i] == 0) {
			ans++;
		}
	}

	cout << ans;

	return 0;
}

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

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define repr(i, N) for (ll i = N-1; i >= 0; i--)
#define repr1(i, N) for (ll i = N; i > 0; i--)

#define INF 1000000007

using ll = long long;
using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<P> vpi;


int main() {
    int N,M;
    double sum=0;
    cin >> N >> M;

    vi A(N);
    rep(i,N) cin >> A[i];
    rep(i,N) sum += A[i];

    sort(A.begin(), A.end(), greater<int>());
    sum /= (4.0*M);

    bool flag = false;
    rep(i,M){
        if(A[i] < sum){
            flag = true;
            break;
        }
    }
    
    cout << ((flag)?("No"):("Yes"));
    //printf("%.15lf", ans);
    cout << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int n = S.length();
    int ans = 1000;
    rep(i, n - 2) {
        int num = (S[i] - '0') * 100 + (S[i + 1] - '0') * 10 + (S[i + 2] - '0');
        ans = min(ans, abs(753 - num));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	N := nextInt()
	A := make([]int, N)

	for i := 0; i < N; i++ {
		A[i] = nextInt()
	}
	sort.Ints(A)

	L := A[len(A)-1] + 1
	T := make([]int, L)

	for _, v := range A {
		for i := 0; i < L; i++ {
			cv := v * i
			if cv >= L {
				break
			}
			T[cv] += 1
		}
	}

	count := 0
	for _, v := range A {
		if T[v] == 1 {
			count++
		}
	}

	fmt.Println(count)
}

func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}

func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}

func nextString() string {
	return nextReader()
}

func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}

func Min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}

func Max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func MinA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Min(s, v)
	}
	return s
}

func MaxA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Max(s, v)
	}
	return s
}

func Abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}


Measured memory_bytes: 13204
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define ROF(i, a, b) for (int i = a; i >= b; i--)
using namespace std;

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<ll>; using vvll = vector<vll>;

int main() {
    ll n; cin >> n;
    ll sum = 0;
    FOR(i, 1, n)
        sum += (2 + n - i) * (n - i + 1) / 2;
    FOR(i, 1, n - 1) {
        ll u, v; cin >> u >> v;
        if (u > v) swap(u, v);
        sum -= u * (n - v + 1);
    }
    cout << sum << endl;
}

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

int main(){
	int n;
    cin>>n;
    long long ans=1,ex=1,ex2=1,mod=1000000007;
    for(int i=0;i<n;i++){
    	ans=(ans*10)%mod;
        ex=(ex*9)%mod;
        ex2=(ex2*8)%mod;
    }  
    cout<<(ans-2*ex+ex2+mod*3)%mod;
}


Measured memory_bytes: 3632