akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

func call(n int) {
	var i int
	for i = 1 ;i <= n ;i++ {
		x := i
		if x % 3 == 0 {
			fmt.Printf(" %d", i)
		} else {
			for {
				if x%10 == 3 {
					fmt.Printf(" %d", i)
					break
				}
				x /= 10
				if x == 0 {
					break
				}
			}
		}
		if (1 + i) > n {
			break
		}
	}
	fmt.Print("\n")

}
func main() {
	var n int
	fmt.Scan(&n)
	call(n)
}

// void call(int n){
//  int i = 1;
// CHECK_NUM:
//  int x = i;
//  if ( x % 3 == 0 ){
//   cout << " " << i;
//   goto END_CHECK_NUM;
//  }
// INCLUDE3:
//  if ( x % 10 == 3 ){
//   cout << " " << i;
//   goto END_CHECK_NUM;
//  }
//  x /= 10;
//  if ( x ) goto INCLUDE3;
// END_CHECK_NUM:
//  if ( ++i <= n ) goto CHECK_NUM;
//
//  cout << endl;
// }


Measured memory_bytes: 1164
function solve()
    X, K, D = parse.(Int, split(readline()))
    if X < 0 X *= -1 end

    N = Int(ceil(X/D))

    if N > K
        println(X - D*K)
        return 0
    end

    if (K - N)% 2 == 0
        println(abs(X - D*N))
    else
        println(abs(X - D*N + D))
    end
end

solve()


Measured memory_bytes: 172704
require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def pr?(num);              Prime.prime?(num)                          end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end

n = gif

a = gi

b = Hash.new
a.each do |aa|
b[aa] ||= 0
b[aa] += 1
end
ans = 0
b.each do |key,value|
  if value >= key
  ans += value - key
else
  ans += value
end
end

puts ans


Measured memory_bytes: 14828
#include <bits/stdc++.h> //library
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //for-loop (from 0)
#define reps(i,n) for(int i = 1; i <= (int)(n); i++) //for-loop (from 1)
#define all(x) (x).begin(),(x).end() //start-to-end iteration, mainly in upper_bound, lower_bound
#define SZ(x) ((int)(x).size()) //unsigned to signed

using namespace std;
using ll = long long; //long long
ll M = 1000000000 + 7;
const ll INF = 1LL << 60;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; } //compare a,b and replace by greater
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; } //compare a,b and replace by smaller
ll qp(int a, ll b) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; } //power
ll qp(int a, ll b, ll Mod) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a%Mod; a = 1ll * a*a%Mod; } while (b >>= 1); return ans; } //power(mod)
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; } //gcd
int dx[4] = { 1,0,-1,0 }; //path
int dy[4] = { 0,1,0,-1 }; //path
ll RS(ll N, ll P) { if (P == 0)return 1; else if (P % 2 == 0) { ll sq = RS(N, P / 2); return sq*sq; } else { return N*RS(N, P - 1); } } //power(repeat-square,fast)
ll nPr(ll n, ll r) { ll ans = 1; rep(i, r) { ans = ans * (n - i); } return ans; } //permutation
ll nCr(ll n, ll r) { ll bunbo = 1; ll bunshi = 1; rep(i, r) { bunbo = bunbo * (i + 1); bunshi = bunshi * (n - i); } return bunshi / bunbo; } //combination
ll RS(ll N, ll P, ll Mod) { if (P == 0)return 1; else if (P % 2 == 0) { ll sq = RS(N, P / 2, Mod); return sq*sq%Mod; } else { return N*RS(N, P - 1, Mod) % Mod; } } //power(mod)(repeat-square,fast)
ll nPr(ll n, ll r, ll Mod) { ll ans = 1; rep(i, r) { ans = ans * (n - i) % Mod; } return ans; } //permutation
ll nCr(ll n, ll r, ll Mod) { ll bunbo = 1; ll bunshi = 1; rep(i, r) { bunbo = bunbo * (i + 1) % Mod; bunshi = bunshi * (n - i) % Mod; } return bunshi * RS(bunbo, Mod - 2, Mod) % Mod; } //combination

int N,K;

int main(void) {
  cin >> N >> K;
  cout << ceil((double)(N-1)/(double)(K-1)) << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll=long long;

int main(){
    ll N;
    cin >> N;
    vector<ll> X, Y;
    for(int i = 0; i < N; ++i){
        ll tmp;
        cin >> tmp;
        X.push_back(tmp);
        Y.push_back(tmp);
    }
    sort(Y.begin(), Y.end());
    ll med = (Y[(N-1)/2] + Y[N/2]) / 2;
    for(int i = 0; i < N; ++i){
        if(X[i] == Y[N/2]) cout << Y[(N-1)/2] << endl;
        else if(X[i] == Y[(N-1)/2]) cout << Y[N/2] << endl;
        else if(X[i] >= med) cout << Y[(N-1)/2] << endl;
        else  cout << Y[N/2] << endl;
    }
    return 0;
}

Measured memory_bytes: 5476
import java.util.*;

public class Main {

    private static int A;
    private static int B;
    private static int C;
    private static int D;

    private static Map<Long,Long> memo;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        StringBuilder ans = new StringBuilder();
        int T = sc.nextInt();
        while (T-- > 0) {
            long N = sc.nextLong();
            A = sc.nextInt();
            B = sc.nextInt();
            C = sc.nextInt();
            D = sc.nextInt();
           
            memo = new HashMap<>();
            long min = dfs(N);
            ans.append(min).append('\n');
        }

        System.out.print(ans);
    }


    private static long dfs(long n) {

        Long cached = memo.get(n);
        if (cached != null) {
            return cached;
        }

        if (n == 0) return 0;

        if (n == 1) return D;

        long l2 = n/2*2;
        long r2 = (n+1)/2*2;
        long l3 = n/3*3;
        long r3 = (n+2)/3*3;
        long l5 = n/5*5;
        long r5 = (n+4)/5*5;

        long min = 1_000_000_000_000_000_000L;
        if (n < min/D) min = n*D;
        min = Math.min(min, Math.abs(l2-n)*D+A+dfs(l2/2));
        min = Math.min(min, Math.abs(r2-n)*D+A+dfs(r2/2));
        min = Math.min(min, Math.abs(l3-n)*D+B+dfs(l3/3));
        min = Math.min(min, Math.abs(r3-n)*D+B+dfs(r3/3));
        min = Math.min(min, Math.abs(l5-n)*D+C+dfs(l5/5));
        min = Math.min(min, Math.abs(r5-n)*D+C+dfs(r5/5));

        memo.put(n,min);

        return min;
    }
}


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

int main() {
  int n, a, b; cin >> n >> a >> b;
  if(a*n > b){
    cout << b << endl;
  } else {
    cout << a*n << endl;
  }
}

Measured memory_bytes: 256
import java.io.IOException
import java.lang.NumberFormatException
import java.lang.StringBuilder
import kotlin.math.absoluteValue
import kotlin.math.min

object CMain{
    fun solve(){
        val div = 1000000007L
        val n = nextInt()
        val a = LongArray(n){ nextLong()}
        val sum = LongArray(n){0}
        sum[n-1] = a[n-1]
        for(i in n-2 downTo 0){
            sum[i] = sum[i+1] + a[i]
            sum[i] %= div
        }

        var ans = 0L
        for(i in 0 until n-1){
            ans += a[i] * sum[i+1]
            ans %= div
        }

        println(ans)

    }





    // Scanner based on uwi-san's Java code
    val stream = System.`in`
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0

    fun hasNextByte(): Boolean{
        if(ptr < buflen){
            return true
        }else{
            ptr = 0
            try{
                buflen = stream.read(buffer)
            }catch (e: IOException){
                e.printStackTrace()
            }
            if(buflen <= 0){
                return false
            }
        }
        return true
    }

    fun readByte() =
        if(hasNextByte()) buffer[ptr++]
        else -1

    fun isPrintableChar(c: Byte) = c in 33..126

    fun hasNext(): Boolean{
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++
        return hasNextByte()
    }

    fun next(): String{
        if(!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while(isPrintableChar(b)){
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }

    fun nextLong(): Long{
        if(!hasNext()) throw NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if(b == '-'.toByte()){
            minus = true
            b = readByte()
        }
        if(b !in '0'.toByte()..'9'.toByte())
            throw NumberFormatException()
        while(true){
            if(b in '0'.toByte()..'9'.toByte()){
                n *= 10
                n += b - '0'.toByte()
            }else if(!isPrintableChar(b)){
                return if(minus) -n else n
            }else{
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    fun nextInt(): Int{
        val n1 = nextLong()
        if(n1 !in Int.MIN_VALUE..Int.MAX_VALUE)
            throw NumberFormatException()
        return n1.toInt()
    }

    fun NextDouble() = next().toDouble()
}

fun main(){
    CMain.solve()
}



Measured memory_bytes: 39476
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = 998244353;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main() {
    cin>>N;
    vec a(N);
    rep(i,N) cin>>a[i];
    vec kind(N,0);
    rep(i,N) ++kind[a[i] - 1];
    sort(ALL(kind));
    vec ans(N,0), sum(N+1,0);
    rep(i,N) sum[i+1] = sum[i] + kind[i];
    rep(i,N){
        ll max_num = (kind.end() - lower_bound(ALL(kind), i+1)) + sum[lower_bound(ALL(kind), i+1) - kind.begin()]/(i+1);
        rep(j,max_num) ans[j] = i + 1;
    }
    rep(i,N) cout<<ans[i]<<endl;
}

Measured memory_bytes: 10240
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
    int n,k;
    cin >> n >> k;
    vector <int> a(n);
    for(int i=0;i<n;++i) cin >> a[i];
    sort(a.begin(),a.end());
    int sum=0;
    for(int i=1;i<n;++i) {
        if(a[0]!=a[i]) ++sum;
    }
    if(sum%(k-1)==0) cout << sum/(k-1) << endl;
    else cout << (sum/(k-1))+1 << endl;
}


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

using namespace std;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    const double pi=3.14159265358979323846;
    double a,b,h,m;
    cin >> a >> b >> h >> m;
    double one=((60*h+m)/720)*(2*pi);
    double two=(m/60)*(2*pi);
    double x=abs(one-two);
    if(x>pi) x=2*pi-x;
    cout << fixed << setprecision(20) << sqrt(a*a+b*b-2*a*b*cos(x)) << "\n";
    return 0;
}


Measured memory_bytes: 4184
# -*- coding: utf-8 -*-
s = str(input())
q = int(input())  
st = s
sth = s
sth2 = ""
stm = ""
stm2 = ""
count = 0
flagh = 0
flagm = 0
for i in range(q):
  k = input().split()
  if(k[0] == '1'):
    count = (count + 1) % 2
  else:
    c = count - 2
    d = int(k[1]) 
    e = k[2]
    if(c + d != 0):
      sth = e + sth
      if(len(sth) > 5000 and flagh == 0):
        flagh = 1
        sth2 = sth
        sth = ""
    else:
      stm = stm + e
      if(len(stm) > 5000 and flagm == 0):
        flagm = 1
        stm2 = stm
        stm = ""
      

st = sth + sth2 + stm2 + stm
if(count == 1):
  st = st[::-1]
  
print(st)

Measured memory_bytes: 4620
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long count = Long.parseLong(sc.next());
      	long suuzi = 1;
      	final long limit = 1000000000000000000L;
      	boolean flg = false;
      	for (int i=0; i<count; i++){
          	long item = Long.parseLong(sc.next());
          	if (item == 0){
              System.out.println("0");
              return;
            }
          	if (item <= limit/suuzi){
          		suuzi = item * suuzi;
            }else{
             	flg = true; 
            }
        }
        
      	if(flg && suuzi != 0){
          	suuzi = -1;
        }
      	System.out.println(suuzi);
    }

}

Measured memory_bytes: 58564
N,K = map(int, input().split(' '))

cache={}
log=[]
A = list(map(lambda x:int(x)-1, input().split(' ')))

now=0

while(True):
  log.append(now)
  cache[now]=1
  now=A[now]
  if(cache.get(now)):break

loop_start=log.index(now)
loop_end=len(log)
loop=loop_end-loop_start

if K<len(log):
  print(log[K]+1)
else:
  print(log[(K-loop_start)%loop+loop_start]+1)


Measured memory_bytes: 35760
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

class UnionFind {
public:
	vector<int> par;//親の番号
  vector<int> rank;//木の深さ
  vector<int> size;//各グループの要素数uf.size[uf.find(1)]みたいな感じでfind経由忘れずに
 
	UnionFind(int n){//全ての要素に対して自身が根となるように初期化, 木の深さは0になる
		rep(i,n){
            par.push_back(i);
            rank.push_back(0);
            size.push_back(1);
        }
	}
 
	int find(int x) {//木の根を求める
		if(par[x]==x){
            return x;
        }else{
            return par[x]=find(par[x]);
        }
	}
 
	void unite(int x,int y){//xとyの属する集合を併合
        x=find(x);
        y=find(y);
        if(x==y) return;
        if(rank[x]<rank[y]){//木の深さが小さい方を大きい方へ繋げる
            par[x]=y;
            size[y]+=size[x];
        }else{
            par[y]=x;
            size[x]+=size[y];
            if(rank[x]==rank[y]) rank[x]++;
        }
    }

    bool same(int x,int y){//xとyが同じ集合に属するか否か
        return find(x)==find(y);
    }
};

typedef pair<ll,ll> P;

struct edge{
  ll to,cost;
};

ll n,m;
vector<edge> g[200010];
vector<bool> vis(100010,false);
vector<ll> d(100010,mod);

bool dfs(ll st){
  if(vis[st]||g[st].empty()){
    return true;
  }
  //cout<<' '<<st<<'\n'; 
  vis[st]=true;
  bool flag=true;
  for(auto itr:g[st]){
    if(d[itr.to]!=d[st]+itr.cost && d[itr.to]!=mod){
      flag=false;
    }else{
      d[itr.to]=d[st]+itr.cost;
      //cout<<' '<<d[itr.to]<<'\n';
      if(!dfs(itr.to)){
        flag=false;
      }
    }
  }
  return flag;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n>>m;
    UnionFind uf(n+1);
    ll now;
    rep(i,m){
      ll l,r,d;
      cin>>l>>r>>d;
      g[l].push_back({r,d});
      g[r].push_back({l,-d});
      uf.unite(l,r);
      now=l;
    }
    //cout<<now<<'\n';
    d[now]=0;
    ll flag=true;
    if(!dfs(now)){
      flag=false;
    }
    FOR(i,1,n+1){
      if(!uf.same(now,i)){
        now=i;
        d[now]=0;
        if(!dfs(now)){
          flag=false;
        }
      }
    }
    /*
    FOR(i,1,n+1){
      cout<<d[i]<<' '; 
    }
    */
    //cout<<'\n';
    if(flag){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
}

Measured memory_bytes: 20072
p = 10**9+7
def combmod(x, n):
    X = 1
    Y = 1
    for i in range(x):
        X = X * (n-i)%p
        Y = Y * (i+1)%p
    return X*pow(Y, p-2, p)%p
def main():
    n, a, b = list(map(int, input().split()))
    numall = pow(2, n, p) - 1 
    numa = combmod(a, n)
    numb = combmod(b, n)
    print((numall-numa-numb)%p)
main()

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <ctype.h>
#include <stdlib.h>
#include <map>
using namespace std;

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

	if (N % 2 == 0) {
		cout << N / 2 << endl;
	}
	else {
		cout << N / 2 + 1<< endl;
	}

}



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

using namespace std;
using ll = long long;

class BIT {
public:
    explicit BIT(ll N, ll v) : V_NUM(N) {
        data.resize(N);
        fill(data.begin(), data.end(), v);
    }

    ll query(ll i) {
        ll ret = 0;
        while (i > 0) {
            ret = max(ret, data[i]);
            i -= (i & -i);
        }
        return ret;
    }

    void update(ll i, ll v) {
        while (i < V_NUM) {
            data[i] = max(data[i], v);
            i += (i & -i);
        }
    }

    ll V_NUM;
    vector<ll> data;
};

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

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

    ll a[N];
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
    }

    BIT bit(N + 1, 0);
    for (int i = 0; i < N; ++i) {
        bit.update(h[i], bit.query(h[i]) + a[i]);
    }

    cout << bit.query(N) << endl;
    return 0;
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb emplace_back
int main()
{
   
    int n,w;
    cin >>n>>w;
    ll wt[n];
    ll val[n];
    for(int i=0;i<n;i++)
    {
    cin>>wt[i];
   
    cin>>val[i];
    }
    ll maxval=0;
    for(int i=0;i<n;i++)
    maxval+=val[i];
    ll dp[maxval+1];
    for(int i=0;i<maxval+1;i++)
    dp[i]=INT_MAX;
    dp[0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=maxval-val[i];j>=0;j--)
        {
            
            dp[j+val[i]]=min(dp[j+val[i]],dp[j]+wt[i]);
          //  cout<<i<<" "<<j<<" "<<dp[j]<<endl;
        }
    }
    
    ll ans=0;
    for(long long int i=0;i<maxval+1;i++)
    {
        if(dp[i]<=w)
        ans=max(ans,i);
    }
    cout<<ans;
}

Measured memory_bytes: 1024
using System;

class Program
{
    static void Main()
    {
        for (; ; )
        {
            var line = Console.ReadLine().Split(' ');
            int H = int.Parse(line[0]);
            int W = int.Parse(line[1]);
            if (H == 0 && W == 0) break;
            for (var i = 1; i <= H; i++)
            {
                if ((i - 1) * (i - H) == 0) Print("#", "#", W);
                else Print("#", ".", W);
            }
            Console.WriteLine();
        }
    }

    static void Print(string s, string t, int n) 
    {
        for (var i = 1; i <= n; i++) Console.Write("{0}", (i - 1) * (i - n) == 0 ? s : t);
        Console.WriteLine();
    }
    
}
    


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

using namespace std;

using int64 = long long;

template<typename T>
vector<vector<T>> Make2DVector(int d1, int d2, T default_value) {
  return vector<vector<T>>(d1, vector<T>(d2, default_value));
}

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

  int k;
  cin >> k;

  if (k == 1) {
    cout << 1 << endl;
    cout << 1 << endl;
    return 0;
  }

  int n = (k + 4 - 1) / 4 * 4 / 2;
  auto table = Make2DVector(n, n, 0);
  for (int r = 0; r < n; r++) {
    for (int c = 0; c < n; c++) {
      if (r % 2 == 0) {
        table[r][c] = (r + c) % n;
      } else {
        table[r][c] = (r + c) % n + n;
        if (table[r][c] >= k) {
          table[r][c] -= n;
        }
      }
    }
  }

  cout << n << endl;
  for (int r = 0; r < n; r++) {
    for (int c = 0; c < n; c++) {
      cout << table[r][c] + 1 << " ";
    }
    cout << endl;
  }
}

Measured memory_bytes: 2176
#include<bits/stdc++.h> 
using namespace std;
int main()
{
int n,count=0,count1=0,count2=0,count3=0;
cin>>n;
string p,q,r,t;
 p="AC";
 q="WA";
  r="TLE";
  t="RE";
while(n--){
    string s;
    cin>>s;
    if(s==p)
    count++;
    else if(s==q)
    count1++;
    else if(s==r)
    count2++;
    else
    count3++;
}
cout<<p<<" "<<'x'<<" "<<count<<endl;
cout<<q<<" "<<'x'<<" "<<count1<<endl;
cout<<r<<" "<<'x'<<" "<<count2<<endl;
cout<<t<<" "<<'x'<<" "<<count3<<endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
 
vector<int> v;
vector<string> u;
void solve(int i, int n, string ans) {
    if(i==4) {
        if(n==7) {
            u.push_back(ans);
        }
        return;
    }
    for(int j=0; j<2; ++j) {
        solve(i+1, n+v[i], ans+"+");
        solve(i+1, n-v[i], ans+"-");
    }
}
 
signed main() {
    string s;
    cin >> s;
    for(int i=0; i<s.size(); ++i) v.push_back(s[i]-'0');
    solve(1, v[0], "");
    string ans = u[0];
    cout << v[0] << ans[0] << v[1] << ans[1] << v[2] << ans[2] << v[3] << "=7" << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

#define MAXN ((ll)2e5+5)
#define MOD ((ll)1e9 + 7) 
#define ll long long
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"

ll n,m,t,k;
vector <ll> v[MAXN];
ll dw[MAXN];
ll db[MAXN];

ll add(ll&a,ll b)
{
	a+=b;
	if(a>MOD)
		a-=MOD;
}
ll mul(ll&a,ll b)
{
	a*=b;
	a-=(a/MOD)*MOD;
}


ll g(ll x,ll par);

ll f(ll x,ll par)
{
	if(dw[x]) return dw[x];
	ll ret=1;
	for (ll i = 0; i < (ll)v[x].size(); ++i)
		if(v[x][i] != par)
		{
			ll tmp=0;
			add(tmp,g(v[x][i],x));
			add(tmp,f(v[x][i],x));
			mul(ret,tmp);
		}
	return dw[x] = ret;
}
ll g(ll x,ll par)
{
	if(db[x]) return db[x];
	ll ret=1;
	for (ll i = 0; i < (ll)v[x].size(); ++i)
		if(v[x][i] != par)
			mul(ret,f(v[x][i],x));

	return db[x] =ret;
}

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

	cin >> n;
	for (ll i = 0; i < n-1; ++i)
	{
		ll a,b;
		cin >> a >> b;
		v[a].pb(b);
		v[b].pb(a);
	}
	ll ans=0;
	add(ans,f(1,-1));
	add(ans,g(1,-1));

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 15232
// ---------- begin snipet ----------
pub trait MoOperator {
    type Answer;
    fn size(&self) -> usize;
    fn insert(&mut self, x: usize);
    fn delete(&mut self, x: usize);
    fn answer(&self) -> Self::Answer;
}

pub struct MoSolver {
    query: Vec<(usize, usize)>,
}

impl MoSolver {
    fn new() -> Self {
        MoSolver {
            query: vec![],
        }
    }
    fn add(&mut self, l: usize, r: usize) {
        self.query.push((l, r));
    }
    fn solve_with_size<State: MoOperator>(&mut self, mut state: State, answer: &mut [State::Answer], batch: usize) {
        let size = state.size();
        let mut q = vec![vec![]; size / batch + 1];
        for (k, &(l, r)) in self.query.iter().enumerate() {
            q[l / batch].push((r, l, k));
        }
        let mut x = 0;
        let mut y = 0;
        for (i, mut q) in q.into_iter().enumerate() {
            q.sort_unstable_by_key(|p| p.0);
            if i % 2 == 1 {
                q.reverse();
            }
            for (r, l, k) in q {
                while l < x {
                    x -= 1;
                    state.insert(x);
                }
                while y < r {
                    state.insert(y);
                    y += 1;
                }
                while x < l {
                    state.delete(x);
                    x += 1;
                }
                while r < y {
                    y -= 1;
                    state.delete(y);
                }
                answer[k] = state.answer();
            }
        }
    }
}
// ---------- end Mo algorithm ----------

struct State {
    c: Vec<usize>,
    cnt: Vec<u32>,
    ans: u32,
}

impl MoOperator for State {
    type Answer = u32;
    fn size(&self) -> usize {
        self.c.len()
    }
    fn insert(&mut self, x: usize) {
        let c = &mut self.cnt[self.c[x]];
        if *c == 0 {
            self.ans += 1;
        }
        *c += 1;
    }
    fn delete(&mut self, x: usize) {
        let c = &mut self.cnt[self.c[x]];
        if *c == 1 {
            self.ans -= 1;
        }
        *c -= 1;
    }
    fn answer(&self) -> Self::Answer {
        self.ans
    }
}

fn solve(c: &[usize], ask: &[(usize, usize)]) -> Vec<u32> {
    let mut solver = MoSolver::new();
    for &(l, r) in ask {
        solver.add(l, r);
    }
    let state = State {
        c: c.iter().cloned().collect(),
        cnt: vec![0; c.len()],
        ans: 0,
    };
    let mut ans = vec![0; ask.len()];
    solver.solve_with_size(state, &mut ans, 1024);
    ans
}

use proconio::*;
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        q: usize,
        c: [Usize1; n],
        ask: [(Usize1, usize); q],
    }
    let ans = solve(&c, &ask);
    for a in ans {
        println!("{}", a);
    }
}


Measured memory_bytes: 55536
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	for (;;) {
		int h, w; cin >> h >> w;
		if (h == 0) break;
		vector<string> a(h);
		for (int i = 0; i < h; i++) cin >> a[i];
		map<string, int> m;
		for (int i = 0; i < h; i++)
			for (int j = 0; j < w; j++)
				for (int di = -1; di <= 1; di++)
					for (int dj = -1; dj <= 1; dj++) {
						if (!di && !dj) continue;
						string s;
						int _i = i, _j = j;
						for (;;) {
							s += a[_i][_j];
							m[s]++;
							_i = (_i + di + h) % h;
							_j = (_j + dj + w) % w;
							if (_i == i && _j == j) break;
						}
					}
		string ans;
		for (map<string, int>::iterator it = m.begin(); it != m.end(); it++) {
			string s = it->first;
			int x = it->second;
			if (x <= 1) continue;
			if (s.length() > ans.length() || (s.length() == ans.length() && s < ans))
				ans = s;
		}
		if (ans.length() < 2) ans = "0";
		cout << ans << endl;
	}
}

Measured memory_bytes: 36028
#include <iostream>
#include <stdio.h>
#include <utility>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
string num[10]={
	"* = ****",
	"* =* ***",
	"* =** **",
	"* =*** *",
	"* =**** ",
	" *= ****",
	" *=* ***",
	" *=** **",
	" *=*** *",
	" *=**** ",
};
int main()
{
    int n;
	int a[5];
	bool first=true;
	while(cin>>n){
		if(!first)cout<<endl;
		a[0]=n/10000;
		a[1]=(n/1000)%10;
		a[2]=(n/100)%10;
		a[3]=(n/10)%10;
		a[4]=n%10;
		for(int i=0;i<8;i++){
			for(int j=0;j<5;j++){
				cout<<num[a[j]][i];
			}
			cout<<endl;
		}
		first=false;
	}
    return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
constexpr uint64_t INF = 1e18;

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

  int N;
  cin >> N;
  unordered_map<string, int> um;
  um["AC"] = 0;
  um["TLE"] = 0;
  um["WA"] = 0;
  um["RE"] = 0;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    um[s]++;
  }
  cout << "AC x " << um["AC"] << endl;
  cout << "WA x " << um["WA"] << endl;
  cout << "TLE x " << um["TLE"] << endl;
  cout << "RE x " << um["RE"] << endl;

  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> pii;
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define SZ(x) x.size()
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

LL sum[N];
int main() {
    int n;
    cin >> n;
    rep(i, 1, n) {
        LL x; cin >> x;
        sum[i] = sum[i-1] + x;
    }
    LL ans = INF;
    rep(i, 1, n-1) ans = min(ans, abs(sum[i]-(sum[n]-sum[i])));
    cout << ans << endl; 

    return 0;
}

Measured memory_bytes: 1792
// https://atcoder.jp/contests/abc127/tasks/abc127_d

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF (1e9)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
// int gcd(long a, long b) { return b ? gcd(b, a % b) : a; }
// int lcm(long a, long b) { return a * b / gcd(a, b); }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, a, b, c;
    cin >> n >> m;
    vector<PII> v;
    REP(i, n) {
        cin >> a;
        v.push_back(PII(a, 1));
    }
    REP(i, m) {
        cin >> b >> c;
        v.push_back(PII(c, b));
    }
    sort(ALLR(v));
    ll sum = 0;
    int cnt = n;
    for (auto x : v) {
        if (x.second < cnt) {
            cnt -= x.second;
            sum += (ll)x.first * x.second;
        } else {
            sum += (ll)x.first * cnt;
            break;
        }
    }
    cout << sum << '\n';

    return 0;
}

Measured memory_bytes: 2420
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
#include <functional>
#include <stack>
#include <numeric>
#include <cassert>
#include <sstream>

using namespace std;

struct edge {
    int u, v, d;
};

class arc090_e {
private:
    static constexpr int MOD = 1'000'000'007;
    void dijkstra(int s, const vector<vector<pair<int, int>>> &g,
                  vector<long long> &d, vector<int> &dp)
    {
        priority_queue<pair<long long, int>> pq;
        pq.emplace(-0, s);
        d[s] = 0;
        dp[s] = 1;
        while (!pq.empty()) {
            long long cur_d = -pq.top().first;
            int u = pq.top().second;
            pq.pop();
            if (cur_d > d[u]) {
                continue;
            }
            for (const pair<int, int> &p : g[u]) {
                int v = p.first, dist = p.second;
                if (d[v] == -1 || d[v] > cur_d + dist) {
                    d[v] = cur_d + dist;
                    dp[v] = dp[u];
                    pq.emplace(-d[v], v);
                } else if (d[v] == cur_d + dist) {
                    dp[v] += dp[u];
                    dp[v] %= MOD;
                }
            }
        }
    }
public:
    void solve(istream& in, ostream& out) {
        int N, M, S, T;
        in >> N >> M >> S >> T;
        --S;
        --T;
        vector<edge> edges(M);
        vector<vector<pair<int, int>>> g(N);
        for (int i = 0; i < M; ++i) {
            in >> edges[i].u >> edges[i].v >> edges[i].d;
            g[edges[i].u - 1].emplace_back(edges[i].v - 1, edges[i].d);
            g[edges[i].v - 1].emplace_back(edges[i].u - 1, edges[i].d);
        }
        vector<long long> d1(N, -1), d2(N, -1);
        vector<int> dp1(N, 0), dp2(N, 0);
        dijkstra(S, g, d1, dp1);
        dijkstra(T, g, d2, dp2);
        int total_path = 1LL * dp1[T] * dp1[T] % MOD;
        int meet_vert = 0, meet_edge = 0;
        for (int u = 0; u < N; ++u) {
            if (d1[u] == d1[T] / 2 && d1[T] % 2 == 0 && d1[u] == d2[u]) {
                meet_vert += 1LL * dp1[u] * dp1[u] % MOD * dp2[u] % MOD * dp2[u] % MOD;
                meet_vert %= MOD;
            }
        }
        for (int u = 0; u < N; ++u) {
            for (const auto &p : g[u]) {
                int v = p.first, c = p.second;
                if (d1[u] < (d1[T] + 1) / 2 && d2[v] < (d1[T] + 1) / 2
                    && d1[u] + d2[v] + c == d1[T])
                {
                    meet_edge += 1LL * dp1[u] * dp1[u] % MOD * dp2[v] % MOD * dp2[v] % MOD;
                    meet_edge %= MOD;
                }
            }
        }
        out << ((total_path - meet_vert + MOD) % MOD - meet_edge + MOD) % MOD << "\n";
    }
};


int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	arc090_e solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 16724
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)

#define endl "\n"
#define pb push_back
#define elif else if
#define cout_db cout << fixed

#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};

typedef long long ll;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

int n;
const int N = 1010;

vector<bool> chpri(N);
vector<int> prime;

void eratosthenes(){
    for (int i = 0; i < N; i++) chpri[i] = 1;
    chpri[0] = chpri[1] = 0;
    for (int i = 2; i <= sqrt(N); i++) {
        if(chpri[i]){
            for (int j = 2*i; j <= N; j+=i) {
                chpri[j] = 0;
            }
        }
    }
    for (int i = 1; i < N; i++) {
    	if(chpri[i]) prime.push_back(i);
    }
}

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

	eratosthenes();
	
	cin >> n;
	ll ans = 1;
	for (int i = 0; i < prime.size(); i++) {
		if(prime[i] > n) break;
		int num = n, cnt = 1;
		while(num / prime[i] != 0){
			num /= prime[i];
			cnt += num;
		}
		// cout << prime[i] << ": " << cnt << endl;
		ans *= (ll)cnt;
		ans %= (ll)MOD;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int a[2][101];
int sum[101];
int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < 2; i++) {
		for (int y = 1; y <= n; y++)
			scanf("%d", &a[i][y]);
	}
	int dap = 0;
	for (int i = 1; i <= n; i++)
	{
			sum[i] = sum[i - 1]+a[1][i];
	}
	int x = 0;
	for (int i = 1; i <= n; i++)
	{
		x += a[0][i];
		dap = max(dap, sum[n] - sum[i - 1] + x);
	}
	printf("%d", dap);
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
 
int main()
{
  int N;
  int K;
  int p;
  std::vector<int> p_list;
  int sum = 0;
  
  std::cin >> N;
  std::cin >> K;
  
  for (int i = 0; i < N; i++){
    std::cin >> p;
    p_list.push_back(p);
  }
  
  sort(p_list.begin(),p_list.end());
  
  for (int i = 0; i < K; i++)
    sum += p_list[i];
  
  std::cout << sum;
}

Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)

/* exchange */
#define chmin(a, b) (a) = min((ll)(a), (ll)(b))
#define chmax(a, b) (a) = max((ll)(a), (ll)(b))

/* output */
#define I(x) cin >> x;
#define D(x) cerr << (x) << " ";
#define BR cerr << "\n";
#define P(x) cout << (x) << endl;
#define FIX cout << fixed << setprecision(10);

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll Q;
ll ret = 0;

vl table(100005, 0);

int main(void){
  
  I(N);
  REP(i, N) {
    ll tmp;
    I(tmp);
    table[tmp] += 1;
    ret += tmp;
  }
  I(Q);
  REP(i, Q) {
    ll B, C;
    I(B);
    I(C);
    ll b = table[B];
    ret -= B * b;
    ret += C * b;
    table[B] = 0;
    table[C] += b;
    P(ret);
  }
}


Measured memory_bytes: 3868
def get_primes(n):
    primes = []
    for i in range(2, n+1):
        flag = True
        for j in range(2, i+1):
            if i % j == 0 and i != j:
                flag = False
                break
        if flag:
            primes += [i]
    return primes

def main():
    n = int(input())

    primes = get_primes(n)
    cnt = len(primes)

    exps = [0] * cnt
    for i in range(2, n+1):
        k = i
        for j in range(cnt):
            while k % primes[j] == 0:
                exps[j] += 1
                k /= primes[j]

    ans = 0

    for i in range(cnt):
        if exps[i] >= 74:
            ans += 1

    for i in range(cnt):
        for j in range(cnt):
            if i == j:
                continue
            if exps[i] >= 2 and exps[j] >= 24:
                ans += 1
            if exps[i] >= 4 and exps[j] >= 14:
                ans += 1

    for i in range(cnt):
        for j in range(cnt):
            for k in range(j+1, cnt):

                if i == j or i == k or j == k:
                    continue
                if exps[i] >= 2 and exps[j] >= 4 and exps[k] >= 4:
                     ans += 1

    print(ans)

main()

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>
#include <bitset>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define Sort(x) sort((x).begin(),(x).end())
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef std::pair<int,int> pii;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;


int main(){
    int n,m;
    cin>>n>>m;
    cout<<(n+m)/2<<endl;
    return 0;
}




Measured memory_bytes: 3072
from bisect import bisect_right

X = int(input())
rating = [400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000]
grade = [8, 7, 6, 5, 4, 3, 2, 1]

idx = bisect_right(rating, X)
print(grade[idx - 1])



Measured memory_bytes: 9016
# -*- coding: utf-8 -*-

a,b,c,d = map(int, list(input()))

for i in range(2):
    for j in range(2):
        for k in range(2):
            ops = ['-'] * 3
            r = a
            if i % 2 == 0:
                r += b
                ops[0] = '+'
            else:
                r -= b

            if j % 2 == 0:
                r += c
                ops[1] = '+'
            else:
                r -= c

            if k % 2 == 0:
                r += d
                ops[2] = '+'
            else:
                r -= d
            
            if r == 7:
                print(str(a) + ops[0] + str(b) + ops[1] + str(c) + ops[2] + str(d) + '=7')
                exit()






Measured memory_bytes: 9132
mod = 10 ** 9 + 7
def main():
    n, k = map(int,input().split())
    res = 0
    for i in range(k, n + 2):
        mis = i *(i-1)//2
        mas = n*(n+1)//2 - (n-i)*(n-i+1)//2
        res += mas - mis +1
        res %= mod
    print(res)
if __name__ == '__main__':
    main()
    

Measured memory_bytes: 63612
MOD = 10 ** 9 + 7
fac = [1] * (10 ** 5 + 10)
for i in range(len(fac) - 1):
    fac[i + 1] = fac[i] * (i + 1) % MOD


def comb(n, k):
    if n < 0:
        return 1
    if k < 0 or k > n:
        return 0
    return fac[n] * pow(fac[n - k], MOD - 2, MOD) * pow(fac[k], MOD - 2, MOD) % MOD


n, k = map(int, input().split())
for i in range(1, k + 1):
    ans = 0
    for j in range(i - 1, n - k + 1):
        ans += comb(j - 1, i - 2) * (n - k - j + 1)
    print(ans * comb(k - 1, i - 1) % MOD)


Measured memory_bytes: 46044
import java.util.*;
 
class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int mod = 1000000007;
        int[] broken = new int[n + 1];
        for (int i = 0; i < m; i++) {
            broken[scan.nextInt()] = 1;
        }
        long[] dp = new long[n + 1];
        dp[0] = 1;
        if (broken[1] == 0) {
            dp[1] = 1;
        } else {
            dp[1] = 0;
        }
        for (int i = 2; i < n + 1; i++) {
            if (broken[i] == 1) {
                continue;
            }
            dp[i] = (dp[i - 1] + dp[i - 2])%mod;
        }
        System.out.println(dp[dp.length - 1]);
    }
}

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

#define mp make_pair
#define ff first
#define ss second
#define pii pair <int,int>
#define pb push_back
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std ;
typedef long long ll ;


int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string s,t ;
	int x=0 ;
	cin >> s >> t ;
	for(int i =0 ; i<s.size() ; i++){
		if(s[i] != t[i]){
			x++ ;
		}
	}
	cout << x ;
	return 0 ;
}


Measured memory_bytes: 3864
//code by lynmisakura.wish to be accepted!
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(void){
    string ans = "";
    for (int i = 0; i < 3; ++i)
    {
        string s;cin >> s;
        ans += s[i];
    }
    cout << ans << endl;
}

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

using namespace std;
#define rep(i, n) for (int64_t i = 0; i < n; i++)

const double PI = 3.14159265358979323846;

int main()
{
	int64_t n, k, counter = 0;
	
	cin >> n >> k;
	auto aa = vector<int64_t>(n, 0);
	for (int64_t i = 0; i < k; i++)
	{
		int64_t d = 0;
		cin >> d;
		int64_t temp = 0;
		for (int64_t j = 0; j < d; j++)
		{
			cin >> temp;
			aa[temp - 1]++;
		}
	}
	for (int64_t i = 0; i < n; i++)
	{
		if (aa[i] == 0)
		{
			counter++;
		}
	}
	cout << counter << endl;
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()

using ll = long long;
using ld = long double;
using namespace std;

const ll inf = 2e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 5;

int n, k, x;

void code() {
    cin >> n >> k >> x;
    cout << (ll)ceil((ld)n / k)*x << "\n";
}

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

    int t = 1;

    while (t-- > 0) {
        code();
    }
}

Measured memory_bytes: 3648
#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;
  int c[n], v[n];
  rep(i,n)
    cin >> v[i];
  rep(i,n)
    cin >> c[i];
  int ans = 0;
  rep(i,n)
    ans += max(0, v[i] - c[i]);
  cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const int maxn=(2e5)+10;
int n,k,cnt[maxn];
ll ans;
int main() {

	read(n); read(k);
	for (int i=1;i<=n;i++) cnt[i%k]++;
	for (int a=0,b,c;a<k;a++) {
		b=c=(k-a)%k;
		if ((b+c)%k==0) ans+=(ll)cnt[a]*cnt[b]*cnt[c];
	}
	printf("%lld\n",ans);
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Interger overflow?
  
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/

Measured memory_bytes: 4020
#include<stdio.h>

int main(void)
{
  int n, a[100], i, j, alice=0, bob=0, x;

  scanf("%d", &n);

  for (i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }

  for (i = 0; i < n; ++ i) {
    for (j = 0; j < n-1; ++ j) {
      
      if (a[j] < a[j+1]) {
        x = a[j];
        a[j] = a[j + 1];
        a[j + 1] = x;
      }
    }
  }

  for (i = 0; i < n; i++) {
    if(i % 2 == 0){
      alice += a[i];
    }else{
      bob += a[i];
    }
  }

  printf("%d", alice - bob);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, m;
string str;

int main(){
	cin >> str;
	
	ll ans = 0;
	ll cnt = 0;
	for(ll i = 0; i < str.size(); i++){
		char c = str[i];
		if(c == 'S'){cnt++;}
		else{
			if(cnt == 0){ans++;}
			else{cnt--;}
		}
	}
	ans += cnt;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
 
typedef long long ll;
typedef long double ld;
using namespace std;
//mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
#define ii for(int i=1;i<=n;++i)
#define ji for(int j=1;j<=n;++j)
#define jj for(int j=1;j<=m;++j)
#define ij for(int i=1;i<=m;++i)
#define sz(x) ((ll)x.size())
#define all(x) x.begin(),x.end()
#define al(x) x+1,x+1+n
#define asd cout<<"ok"<<endl;
#define asdd cout<<"okok"<<endl;
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define pr(v) for(auto i:v) cout<<i<<" ";cout<<endl
#define prt(a, l, r) for(auto i=l;i<=r;++i) cout<<a[i]<<" ";cout<<endl;
#define pc(x) __builtin_popcount(x)
#define pb push_back
 
int main() {
    ll n;
    cin >> n;
    string ans;
    while(n) {
        ans += ('a' + (n-1) % 26);
        n = (n-1)/26;
    }
    reverse(all(ans));
    cout << ans << endl;
}

Measured memory_bytes: 3648
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L
#define PI 3.141592653589793238462643383279502884L

#define long long long int

using std::vector;
using std::map;
using std::set;
using std::string;
using std::pair;
using std::cin;
using std::cout;
using std::cerr;

// @author: pashka

int main() {
    std::ios::sync_with_stdio(false);

    int n;
    cin >> n;
    if (n == 3) {
        cout << "2 5 63\n";
        return 0;
    }
    int j = 1;
    int s = 0;
    for (int i = 0; i < n - 2; i++) {
        while (j % 2 != 0 && j % 3 != 0) j++;
        s = (s + j) % 6;
        cout << j << " ";
        j++;
    }
    for (int q = j; q < j + 20; q++) {
        if (q % 2 != 0 && q % 3 != 0) {
            continue;
        }
        for (int w = q + 1; w < j + 20; w++) {
            if (w % 2 != 0 && w % 3 != 0) {
                continue;
            }
            if (((s + q + w) % 6) == 0) {
                cout << q << " " << w << "\n";
                return 0;
            }
        }
    }

    return 1;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
int main(void){
  int c,f,i;
  char s[101];
  scanf("%s",s);
  c=f=-1;
  for(i=0;i<strlen(s);i++){
    if(s[i]=='C')
      c=i;
    if(s[i]=='F')
      f=i;
  }
  if(c>-1&&f>-1&&c<f)
    puts("Yes");
  else
    puts("No");
  return 0;
}


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

string S;

int main(){
  cin >> S;

  int ans = 1000;
  rep(i, S.size()){
    string s = S.substr(i, 3);
    ans = min(ans, abs(753-stoi(s)));
  }
  cout << ans << endl;
}


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

int main(){    
    
    // 変数の定義
    string a;

    // 標準入力
    cin >> a;

    int counter = 0;

    if (a[0] == '1') counter++;
    if (a[1] == '1') counter++;
    if (a[2] == '1') counter++;

    cout << counter << endl;

}

Measured memory_bytes: 256