akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
//#include<bits/stdc++.h>
#include<cstring>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
typedef long long ll;
//ll a,b,c,x,y;

ll ex_gcd(ll a,ll b,ll& x,ll& y)
{
    if(b==0)
    {
        x=1;
        y=0;
        return a;
    }
    ll ans = ex_gcd(b,a%b,x,y);
    ll tmp = x;
    x = y;
    y = tmp-a/b*y;
    return ans;
}
int a[10];
int main()
{
    int n,m;
    int id,x;
    scanf("%d%d",&n,&m);
    map<int,int>mp;
    bool flag=true;
    while(m--)
    {
        scanf("%d%d",&id,&x);
        if(mp[id])
        {
            if(mp[id]!=x+'0')
            {
                flag=false;
                continue;
            }
        }
        else
        {
            mp[id]=x+'0';
            a[id]=x+'0';
        }

    }
    if(a[1]=='0'&& n>1)printf("-1\n");
    else if(!flag)printf("-1\n");
    else
    {
        if(n==1)
        {
            if(a[1])printf("%c",a[1]);
        else printf("0");
        }
        else
        {
            if(a[1])printf("%c",a[1]);
        else printf("1");
        for(int i=2;i<=n;i++)
        {
            if(a[i])printf("%c",a[i]);
            else printf("0");
        }
        printf("\n");
        }

    }

}


Measured memory_bytes: 256
#include <stdio.h>
#define FIELD(y, x) ((y) >= 0 && (x) >= 0 ? field[y][x] : 0)
#define SIZE 5

int field[SIZE][SIZE];

int main(void)
{
    int n, x, y, x2, y2, max, t1, t2;

    scanf("%d", &n);

    while(n--)
    {
        for(y = 0; y < SIZE; y++)
            for(x = 0; x < SIZE; x++)
                scanf("%d", &field[y][x]);

        /* top -> bottom */
        for(y = 1; y < SIZE; y++)
            for(x = 0; x < SIZE; x++)
                field[y][x] += field[y - 1][x];

        /* left -> right */
        for(x = 1; x < SIZE; x++)
            for(y = 0; y < SIZE; y++)
                field[y][x] += field[y][x - 1];

        /* search */
        max = 0;
        for(x = 0; x < SIZE; x++)
            for(y = 0; y < SIZE; y++)
                for(y2 = y; y2 < SIZE; y2++)
                    for(x2 = x; x2 < SIZE; x2++)
                    {
                        t1 = (x2 - x + 1) * (y2 - y + 1);
                        t2 = field[y2][x2]
                             - FIELD(y - 1, x2)
                             - FIELD(y2, x - 1)
                             + FIELD(y - 1, x - 1);
                        if(t2 != t1) break;
                        else if(max < t1) max = t1;
                    }

        printf("%d\n", max);
    }

    return 0;
}

Measured memory_bytes: 600
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#ifndef LOCAL
#define cerr if(0)cout
#endif
typedef long long ll;
//My i/o stream
struct fastio
{
	char s[100000];
	int it, len;
	fastio() {it=len=0;}
	inline char get()
	{
		if (it<len) return s[it++]; it=0;
		len=fread(s, 1, 100000, stdin);
		if (len==0) return EOF; else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while (c==' '||c=='\n') c=get();
		if (it>0) it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0; bool ng=0; char c; c=_buff.get();
	while (c!='-'&&(c<'0'||c>'9')) c=_buff.get();
	if (c=='-') ng=1, c=_buff.get();
	while (c>='0'&&c<='9') r=r*10+c-'0', c=_buff.get();
	return ng?-r:r;
}
template <class T> inline void putnum(T x)
{
	if (x<0) putchar('-'), x=-x;
	register short a[20]={}, sz=0;
	while (x) a[sz++]=x%10, x/=10;
	if(sz==0) putchar('0');
	for (int i=sz-1; i>=0; i--) putchar('0'+a[i]);
}
inline char getreal() {char c=_buff.get(); while (c<=32) c=_buff.get(); return c;}

const int mod = 998244353;
ll qpow(ll x, ll k) {return k==0? 1: 1ll*qpow(1ll*x*x%mod,k>>1)*(k&1?x:1)%mod;}


void FWT(ll a[],int n,int coef)
{
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<(1<<n);j++)
		{
			if(!((j>>i)&1))
			{
				ll tmp=a[j+(1<<i)];
				a[j+(1<<i)]=(a[j]-a[j+(1<<i)]+mod)%mod;
				a[j]=(a[j]+tmp)%mod;
			}
		}
	}
	ll inv=qpow(1<<n,mod-2);
	if(coef==-1)for(int i=0;i<(1<<n);i++)a[i]=a[i]*inv%mod;
}

const int maxn = 1<<17;
const int P = 1000000000ll*1000000000ll%mod;
int n;
ll A[maxn], B[maxn], C[maxn];
void calc(ll A[])
{
	int m;
	geti(m);
	static vector<int> con[maxn];
	for (int i=1; i<=n; i++) con[i].clear();
	for (int i=1; i<=m; i++)
	{
		int x, y;
		getii(x, y);
		if (x>y) swap(x, y);
		con[x].PB(y);
	}
	static int dp[maxn];
	for (int i=n; i>=1; i--)
	{
		static bool f[maxn];
		for (auto u : con[i])
		{
			f[dp[u]] = true;
		}
		int &x = dp[i];
		x = 0;
		while (f[x]) x++;
		for (auto u : con[i])
		{
			f[dp[u]] = false;
		}
		A[dp[i]] = (A[dp[i]]+qpow(P, i))%mod;
	}
}
int main()
{
	geti(n);
	calc(A);
	calc(B);
	calc(C);
	FWT(A, 17, 1);
	FWT(B, 17, 1);
	FWT(C, 17, 1);
	for (int i=0; i<maxn; i++) A[i] = A[i]*B[i]%mod*C[i]%mod;
	FWT(A, 17, -1);
	cout<<A[0]<<endl;
	return 0;
}


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

int main() {
	int n, m, l;
	cin >> n >> m >> l;
	int A[n][m], B[m][l];
	long C[n][l];
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			cin >> A[i][j];
	for (int i = 0; i < m; i++)
		for (int j = 0; j < l; j++)
			cin >> B[i][j];
	for (int i = 0; i < n; i++)
		for (int j = 0; j < l; j++) {
		    C[i][j] = 0;
			for (int k = 0; k < m; k++)
				C[i][j] += A[i][k] * B[k][j];
		}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l - 1; j++)
			cout << C[i][j] << ' ';
		cout << C[i][l - 1] << endl;
	}
	return 0;
}


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

int main(void){
   char c[3][3];
   for(int i=0;i<3;i++){
       for(int j=0;j<3;j++){
           cin>>c[i][j];
       }
   }
   cout<<c[0][0]<<c[1][1]<<c[2][2]<<endl;
   return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll                long long int
#define ld                long double
#define pb                push_back
#define pf                push_front
#define ppb               pop_back
#define ppf               pop_front
#define sz                size()
#define pi                acos(-1.0)
#define mod               1000000007
#define maxe              max_element
#define mine              min_element
#define F                 first
#define S                 second
#define C                 continue
#define G                 goto done
#define mem(a,b)          memset(a,b,sizeof(a))
#define all(a)            (a).begin(),(a).end()
#define gcd(a,b)          __gcd(a,b)
#define lcm(a,b)          ((a)*((b)/gcd(a,b)))
#define point(a)          fixed<<setprecision(a)
#define get(a)            for(auto &x:a) cin>>x
#define print(a)          for(auto x:a) cout<<x<<" "; cout<<endl
#define see(x)            cout<<#x<<" = "<<x<<endl
#define uniq(a)           sort(all(a)); (a).erase(unique((a).begin(),(a).end()),(a).end())
#define fast              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define tc                int test; cin>>test; while(test--)
using namespace std;
int main()
{
    vector<pair<ll,ll>>v;
    ll n; cin>>n; ll m=n; while(n--)
    {
        ll a,b; cin>>a>>b; v.pb({a,b});
    }
    ll a[m]; mem(a,0);
    ll c=0;
    for(ll i=0;i<v.sz;i++)
    {
        if(v[i].F==v[i].S) a[i]=1;
    }
    for(ll i=0;i<m-2;i++)
    {
        if(a[i]==1 && a[i+1]==1 && a[i+2]==1) c++;
    }
    if(c==0) cout<<"No";
    else cout<<"Yes";
}




















Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstdlib>

using namespace std;

int main()
{
  int N;
  string S;
  cin >> N;
  cin >> S;
  
  int count=0;
  for(int i=N-1; i>1; i--)
    {
      if(S[i-2]=='A')
	{	  
	  if( S[i-1]=='B' && S[i]=='C')
	    {
	      count++;
	    }
	  i-=2;
	}
    }

  cout << count << endl;
  return 0;
}



Measured memory_bytes: 256
str_inputs = input()
array_inputs = str_inputs.split(" ")

takahashi_num = int(array_inputs[0])
aoki_num = int(array_inputs[1])
loop_num = int(array_inputs[2])

for i in range(loop_num):
    if i % 2 == 0:
        if takahashi_num % 2 == 1:
            takahashi_num = takahashi_num-1
    
        takahashi_num = takahashi_num - takahashi_num/2
        aoki_num = aoki_num + takahashi_num
    else :
        if aoki_num % 2 == 1:
            aoki_num = aoki_num-1
      
        aoki_num = aoki_num - aoki_num/2
        takahashi_num = takahashi_num + aoki_num


print(str(int(takahashi_num)) + " " + str(int(aoki_num))+" ")

Measured memory_bytes: 3064
#C
S = input()
sum = 0
for i in range(1, 2**(len(S)-1) ):
    pos = format(i, 'b').zfill(len(S)-1)
    start = 0
    for (j, x) in enumerate(pos):
        if x == str(1):
            sum = sum + int(S[start:j+1])
            start = j+1
    sum = sum + int(S[start:len(S)])
print(sum+int(S))

Measured memory_bytes: 3064
#include<stdio.h>

int main(){
    int n;
    scanf("%d", &n);
    int m = n;
    int a[n];
    int j;
    
    for(j = 0;j < n;j++){
        scanf("%d", &a[j]);
    }
    
    for(j=0;j < m;j++){
        printf("%d", a[n-1] );
	if(m-j != 1){
	  printf(" ");
	}
        n--;
    }
    printf("\n");

    return 0;
}



Measured memory_bytes: 2140
{-# LANGUAGE BangPatterns #-}
import           Data.Int (Int64)

modulus :: Int64
modulus = 1000000007

newtype IntMod = IntMod Int64 deriving Eq

-- fromIntegral_Int64_IntMod :: Int64 -> IntMod
-- fromIntegral_Int64_IntMod n = IntMod (n `mod` modulus)
-- {-# RULES
-- "fromIntegral/Int->IntMod"
--     fromIntegral = fromIntegral_Int64_IntMod . (fromIntegral :: Int -> Int64)
-- "fromIntegral/Int64->IntMod"
--     fromIntegral = fromIntegral_Int64_IntMod
-- #-}

instance Show IntMod where
  show (IntMod x) = show x

instance Num IntMod where
  IntMod x + IntMod y = IntMod ((x + y) `mod` modulus)
  IntMod x - IntMod y = IntMod ((x - y) `mod` modulus)
  IntMod x * IntMod y = IntMod ((x * y) `mod` modulus)
  fromInteger n = IntMod (fromInteger (n `mod` fromIntegral modulus))
  abs = undefined
  signum = undefined

powMod :: IntMod -> Int64 -> IntMod
powMod !x 1 = x
powMod !x !k
  | even k = powMod (x * x) (k `div` 2)
  | otherwise = x * powMod (x * x) (k `div` 2)

invMod :: IntMod -> IntMod
invMod 0  = error "inverse of 0"
invMod !x = powMod x (modulus - 2)

nPkMod :: Int64 -> Int64 -> IntMod
nPkMod !n' !k' = go 1 n' k'
  where go :: IntMod -> Int64 -> Int64 -> IntMod
        go !a !_ 0  = a
        go !a !n !k = go (a * fromIntegral n) (n - 1) (k - 1)

nCkMod :: Int64 -> Int64 -> IntMod
nCkMod !n !k = nPkMod n k * invMod (nPkMod k k)

main :: IO ()
main = do
  [n,a,b] <- map read . words <$> getLine :: IO [Int64]
  let ala = powMod 2 n - 1
      nca = nCkMod n a
      ncb = nCkMod n b
  print $ ala - nca - ncb

-- 1000000000 141421 173205


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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// 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("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &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 (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N,C;
    Scd2(N,C);

    vector<vi> d(C,vi(C));
    Rep(i,C){
        Rep(j,C){
            Scd(d[i][j]);
        }
    }

    int a;
    vector<vi> col(3,vi(C));
    Rep(i,N)Rep(j,N){
        Scd(a);
        col[(i+j)%3][--a]++;
    }

    int ans = INF;
    int tmp = 0;
    Rep(c1,C)Rep(c2,C)Rep(c3,C){
        if( c1 == c2 || c2 == c3 || c3 == c1 ) continue;
        tmp = 0;
        Rep(ci,C){
            tmp += d[ci][c1] * col[0][ci];
            tmp += d[ci][c2] * col[1][ci];
            tmp += d[ci][c3] * col[2][ci];
        }
        ans = min( ans, tmp );
    }

    printf ("%d\n", ans );

    return 0;
}





Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n;
	int a[100];
	while(~scanf("%d",&n)){
        for(int i=0;i<n;i++)
            scanf("%d",a+i);
            int sum=0;
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                sum+=a[i]*a[j];
            }
        }
        printf("%d\n",sum);
	}
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int i = 1;
  do {
    int x = i;
    if (x % 3 == 0) {
      cout << " " << i;
    } else if (x % 10 == 3) {
      cout << " " << i;
    } else {
      do {
        x /= 10;
        if (x % 10 == 3) {
          cout << " " << i;
          break;
        }
      } while (x);
    }

  } while (++i <= n);
  cout << endl;
  return 0;
}



Measured memory_bytes: 3120
fun main(args:Array<String>) {
    val n:Long = readLine()!!.toLong()
    var ans:Long = 0
    for (x in 1L..n) {
        if (x % 15L != 0L && x % 5L != 0L && x % 3L != 0L) {
            ans += x.toLong()
        }
    }
    println(ans)
}

Measured memory_bytes: 34488
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, M: int, A: "List[int]", B: "List[int]", C: "List[int]"):
    A.sort()                    # 昇順 O(NlongN)
    BC = list(zip(B, C))
    BC.sort(key=lambda x: x[1])  # 昇順 MlogM

    s = 0
    Cs = []
    for i, a in enumerate(A):
        if len(Cs) == 0:
            if len(BC) == 0:
                s += sum(A[i:])
                break
            b, c = BC.pop(-1)
            Cs.extend([c]*b)
        s += max(Cs.pop(), a)
    print(s)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    B = [int()] * (M)  # type: "List[int]"
    C = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        B[i] = int(next(tokens))
        C[i] = int(next(tokens))
    solve(N, M, A, B, C)


if __name__ == '__main__':
    main()


Measured memory_bytes: 24312
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

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

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    int idx = -1;
    rep(i, n - m + 1) {
        bool flg = true;
        for (int j = i; j < i + m; ++j) {
            if (s[j] != '?' && s[j] != t[j-i]) {
                flg = false;
            }  
        }
        if (flg) {
            idx = i;
        }
    }
    //cout << idx << endl;
    if (idx < 0) {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    rep(i, m) {
        s[idx+i] = t[i];
    }
    rep(i, n) {
        if (s[i] == '?') {
            cout << 'a';
        }
        else {
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; cin >> n;
    int a[n];
    FOR(i,0,n-1){
        cin>>a[i];
    }

    sort(a, a+n);
    int x = a[0], y = a[n-1];
    vector<ii> mv;

    //a[0] - all pos
    //a[n-1] - all neg

    FOR(i,1,n-2){
        if (a[i] > 0) {
            mv.emplace_back(x, a[i]);
            x -= a[i];
        } else {
            mv.emplace_back(y, a[i]);
            y -= a[i];
        }
    }
    mv.emplace_back(y, x);

    cout << y-x << '\n';
    for (auto p : mv) {
        cout << p.fi << " " << p.sc << '\n';
    }
}



Measured memory_bytes: 3188
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
#include <vector>
//#include <string>
typedef long long LL;
using namespace std;

int main(){
    LL n;
    LL tmp_n;
    LL ans=0;
    LL ans_10=0;
    LL tmp_ans_x5=0;
    cin >> n;
    if(n>=2 && n%2==0){
        tmp_n = n;
        if(tmp_n>10){
            tmp_n /=10;
            ans_10 += tmp_n;
        }
    }
    ans += ans_10;
    tmp_ans_x5 = ans_10;
    while(tmp_ans_x5>=5){
        tmp_ans_x5 /= 5;
        ans += tmp_ans_x5;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    vector<long long> solve(vector<int>& A) {
        int n = A.size();
        vector<long long> cnts(n + 1, 0);
        for (auto x : A) {
            ++cnts[x];
        }
        long long total = 0;
        for (auto x : cnts) {
            total += x * 1LL * (x - 1) / 2;
        }

        vector<long long> res(n, 0);
        for (int i = 0; i < n; ++i) {
            int cnt = cnts[A[i]];
            res[i] = total - cnt * 1LL * (cnt - 1) / 2 + (cnt - 1) * 1LL * (cnt - 2) / 2;
        }

        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    Solution sol;
    int n;
    cin >> n;
    vector<int> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }

    auto res = sol.solve(A);
    for (auto r : res) {
        cout << r << "\n";
    }

    return 0;
}

Measured memory_bytes: 4964
#include<iostream>

using namespace std;

int main(){
    int A, B;
    cin >> A >> B;

    int cnt = 0;
    for (int i = A; i <= B;i++){
        int a, b, c, d, e;
        a = i / 10000;
        b = (i - a*10000)  / 1000;
        c = (i-a*10000 - b*1000) / 100;
        d = (i-a*10000 - b*1000 - c*100) / 10;
        e = i % 10;
        if(a==e&&b==d){
            cnt++;
        }
    }
    cout << cnt;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;
static const ll LOGN=55;




int main(void) {
  ll x, y, z, k;
  cin >> x >> y >> z >> k;
  ll a[1111], b[1111], c[1111];
  ll i, j;
  
  for(i=0; i<x; i++) cin >> a[i];
  for(i=0; i<y; i++) cin >> b[i];
  for(i=0; i<z; i++) cin >> c[i];
  
  vector<ll> ab;
  for(i=0; i<x; i++) {
    for(j=0; j<y; j++) {
      ab.push_back(a[i]+b[j]);
    }
  }
  sort(ab.rbegin(), ab.rend());
  
  vector<ll> abc;
  for(i=0; i<min(k, x*y); i++) {
    for(j=0; j<z; j++) {
      abc.push_back(ab[i]+c[j]);
    }
  }
  sort(abc.rbegin(), abc.rend());
  
  for(i=0; i<k; i++) pt(abc[i]);
  
}






Measured memory_bytes: 42596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public long[] A;
        public long MOD = 1000000007;

        public void Run()
        {
            N = Input.ReadInt();
            A = new long[N];
            for (int i = 0; i < N; i++)
            {
                A[i] = Input.ReadLong();
            }

            Array.Sort(A);

            long r1 = 0;
            long r2;
            {
                long[] R = new long[N];
                int u = N - 1;
                int d = 0;
            
                for (int i = 1; i < N - 1; i+= 2)
                {
                    R[i] = A[u];
                    u--;
                }
                for (int i = 2; i < N - 1; i += 2)
                {
                    R[i] = A[d];
                    d++;
                }

                R[0] = A[d];
                R[N - 1] = A[d + 1];

                long r = 0;
                for (int i = 0; i < N - 1; i++)
                {
                    r += Math.Abs(R[i + 1] - R[i]);
                }

                r1 = r;
            }

            {
                long[] R = new long[N];
                int u = N - 1;
                int d = 0;

                for (int i = 1; i < N - 1; i += 2)
                {
                    R[i] = A[d];
                    d++;
                }
                for (int i = 2; i < N - 1; i += 2)
                {
                    R[i] = A[u];
                    u--;
                }

                R[0] = A[d];
                R[N - 1] = A[d + 1];

                long r = 0;
                for (int i = 0; i < N - 1; i++)
                {
                    r += Math.Abs(R[i + 1] - R[i]);
                }

                r2 = r;
            }

            Console.WriteLine(Math.Max(r1, r2));
        }
    }

    // libs ----------


    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }

    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}


Measured memory_bytes: 19676
#include<cstdio>
#define mx 100005
#define For(n) for(int i;i<n;i++)
using namespace std;
int n,m,p[mx],b[mx],c[mx];
long long a[mx];
int f(int s){
  int t=p[s];
  if(t<0)return s;
  p[s]=f(t);
  return p[s];
}
long long g(int j){
  int x=f(b[j]),y=f(c[j]);
  if(x!=y){
    int s=p[x],t=p[y];
    if(s>t){
      p[x]=y;
      p[y]+=s;
    }
    else{
      p[y]=x;
      p[x]+=t;
    }
    return 1ll*s*t;
  }
  return 0ll;
}
int main(){
  scanf("%d%d",&n,&m);
  a[m-1]=1ll*n*(n-1)/2;
  For(m){
    scanf("%d%d",&b[i],&c[i]);
  }
  For(n)p[i]=-1;
  for(int i=m-2;i>=0;i--)a[i]=a[i+1]-g(i+1);
  For(m)printf("%lld\n",a[i]);
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool flag){
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}
void fp(bool flag, string s, string t){
    if(flag)cout << s << endl;
    else cout << t << endl;
}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl digit10(intl a){
    if(!a)return 1;
    intl b = 0;
    while(a){
        a /= 10;
        b++;
    }
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    string s,t;
    cin >> s >> t;
    intl a = s.length();
    intl b = t.length();
    if(a != b){
        fp(a > b,"GREATER", "LESS");
        return 0;
    }
    rep(i,a){
        if((s[i] - '0') > (t[i] - '0')){
            cout << "GREATER" << endl;
            return 0;
        }
        else if((s[i] - '0') < (t[i] - '0')){
            cout << "LESS" << endl;
            return 0;
        }
    }
    cout << "EQUAL" << endl;
    return 0;
}

Measured memory_bytes: 256
X, K, D = map(int,input().split(" "))

n = abs(X)//D

if n >= K :
    print( abs(X) - D*K )
else :
    X = abs(abs(X) - D*n)
    K -= n 
    if K%2 :
        print(abs(X-D))
    else :
        print(abs(X))
 


Measured memory_bytes: 9168
#include<stdio.h>


void mapping(int x,int y,int size);
int map[10][10]={{0}};

int main(){

	int i,j;
	int xp,yp,sizep,plank,max;

	while(scanf("%d,%d,%d",&xp,&yp,&sizep)!=EOF){
		mapping(xp,yp,sizep);

	}

	plank=0;
	max=0;
	for(i=0;i<10;i++){
		for(j=0;j<10;j++){
			if(map[i][j]==0) plank++;
			if(map[i][j]>max) max=map[i][j];
		}
	}
	printf("%d\n%d\n",plank,max);

	return 0;

}

void mapping(int x,int y,int size){

	map[x][y]++;
	switch(size){
		case 1:
			if(x!=0) map[x-1][y]++;
			if(x!=9) map[x+1][y]++;
			if(y!=0) map[x][y-1]++;
			if(y!=9) map[x][y+1]++;
			break;
		case 2:
			if(x!=0){
				map[x-1][y]++;
				if(y!=0) map[x-1][y-1]++;
			}
			if(x!=9){
				map[x+1][y]++;
				if(y!=9) map[x+1][y+1]++;
			}
			if(y!=0){
				map[x][y-1]++;
				if(x!=9) map[x+1][y-1]++;
			}
			if(y!=9){
				map[x][y+1]++;
				if(x!=0) map[x-1][y+1]++;

			}
			break;
		case 3:
			if(x!=0){
				map[x-1][y]++;
				if(y!=0) map[x-1][y-1]++;
				if(x!=1) map[x-2][y]++;
			}
			if(x!=9){
				map[x+1][y]++;
				if(y!=9) map[x+1][y+1]++;
				if(x!=8) map[x+2][y]++;
			}
			if(y!=0){
				map[x][y-1]++;
				if(x!=9) map[x+1][y-1]++;
				if(y!=1) map[x][y-2]++;
			}
			if(y!=9){
				map[x][y+1]++;
				if(x!=0) map[x-1][y+1]++;
				if(y!=8) map[x][y+2]++;

			}
			break;
	}


}

Measured memory_bytes: 600
H,W = map(int,input().split())
s = []

for i in range(H):
   s.append(list(input()))


for i in range(H):
   for j in range(W):

       count = 0
       if s[i][j] == "#":
          pass
    
       else :

           if i > 0 and j > 0 and s[i-1][j-1] == "#":
               count += 1
           
           if i > 0 and s[i-1][j] == "#":
               count += 1

           if i > 0 and j < W-1 and s[i-1][j+1] == "#":
               count += 1
           
           if j > 0 and s[i][j-1] == "#":
               count += 1
           if j < W-1 and s[i][j+1] == "#":
               count += 1
           if i < H-1 and j > 0 and s[i+1][j-1] == "#":
               count += 1
           if i < H-1 and s[i+1][j] == "#":
               count += 1
           if i < H-1 and j < W-1 and s[i+1][j+1] == "#":
               count += 1
           
           s[i][j] = str(count)    

for i in range(H):
    print("".join(s[i]))

Measured memory_bytes: 3188
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string card[3];
	char c;
	char answer[3] = { 'A', 'B', 'C' };

	for (int i = 0; i < 3; i++) {
		cin >> card[i];
	}
	int index = 0;

	while (1) {
		for (int i = 0; i < 3; i++) {
			if (card[i].empty() && c - 97 == i) {
				cout << answer[i] << endl;
				return 0;
			}
		}
		c = card[index].at(0);
		card[index].erase(card[index].begin());
		index = c - 97;
	}
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;
const int INF = 1 << 30;
const long long MOD = 1000000000 + 7;
const double PI = acos(-1);

long long calc1(string N) {
	return (long long)9 * (N.size() - 1) + ((long long)N[0] - '0');
}

long long calc2(string N) {
	long long ans = 0;
	rep(i, N.size() - 2)ans += 9 * ((long long)i + 1) * 9;
	ans += ((long long)N[0] - '0' - 1) * 9 * (N.size() - 1);
	rep(i, N.size() - 1) {
		if (N[i + 1] != '0') {
			ans += calc1(N.substr(i + 1));
			break;
		}
	}
	return ans;
}

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

	long long ans = 0;
	if (K == 1)ans = calc1(N);
	if (K == 2)ans = calc2(N);
	if (K == 3) {
		rep(i, N.size() - 3)ans += 9 * 9 * ((long long)i + 2) * ((long long)i + 1) * 9 / 2;
		if (N.size() >= 3) {
			long long num = 0;
			num = ((long long)N.size() - 1) * (N.size() - 2) / 2 * 9 * 9;
			ans += ((long long)N[0] - '0' - 1) * num;
			//cout << ans << endl;
			rep(i, N.size() - 1) {
				if (N[i + 1] != '0') {
					ans += calc2(N.substr(i + 1));
					break;
				}
			}
		}
	}
	cout << ans;
}


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

probability = 0
for i in range(1,n+1):
    p = 1/n
    p_head = 1/2
    flips = 0
    prob = p * p_head**flips
    score = i
    
    while score < k:
        flips += 1
        prob = p * p_head**flips
        score = score * 2

    probability += prob


print(probability)

Measured memory_bytes: 3188
/******* all required header files *******/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;

/*****All definitions*******/
#define w(t) int t; cin>>t; while(t--)
#define vi vector<int>
#define vs vector<string>
#define vc vector<char>
#define mp make_pair
#define ll long long int
#define pb push_back
#define F first
#define S second
/***************************/

int main()
{
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/

	ios_base::sync_with_stdio(0);
	cin.tie(0);

	string a, b;
	cin>>a>>b;

	if(a.size() > b.size())
	{
		cout<<"GREATER";
		return 0;
	}
	if(a.size() < b.size())
	{
		cout<<"LESS";
	}
	if(a.size() == b.size())
	{
		if(a > b)
			cout<<"GREATER";
		if(a < b)
			cout<<"LESS";
		if(a == b)
			cout<<"EQUAL";
	}
	
	return 0;
}


Measured memory_bytes: 256
from collections import Counter

n = int(input())
c = Counter(list(map(int, input().split())))

ans = 0
for k, v in c.items():
    if k == 0:
        if n%2==0 and v > 2:
            print(0)
            exit(0)
        elif n%2==1 and v > 1:
            print(0)
            exit(0)
    else:
        ans += 1
        if v > 2:
            print(0)
            exit(0)

print(pow(2, ans, 10**9+7))


Measured memory_bytes: 20588
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
int main(void){
	int N;
	scanf("%d",&N);    
	int A[N];
	int i,min;
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	//まずA[]をソートする
	qsort(A,N,sizeof(int),compare_int);
	int check(){
		int flag = 0;
		for(i=0;i<N;i++){
			if(A[i]>0){
				flag++;
			}
			if(flag>1){
				return 1;
			}
		}
		return 0;
	}
	//0を除く一番小さい数で全体を割った余りを配列に入れる
	while(check() >0){
		i=0;
		while(A[i]<=0 && i<N){
			i++;
		}
		min = i;
		for(i=i+1;i<N;i++){
			A[i]=A[i]%A[min];
		}
		qsort(A,N,sizeof(int),compare_int);
	}
	int ans = A[N-1];
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 952
#include <iostream>
#include<stdio.h>
using namespace std;
int main(void){
    char op;
    int a,b,x;
    for(;;){
        cin>>a>>op>>b;
        if(op == '?'){
            break;
        }
        if(op == '+'){
            x = a + b;
        }
        if(op == '-'){
            x = a - b;
        }
        if(op == '*'){
            x = a * b;
        }
        if(op == '/'){
            x = a / b;
        }
        cout<<x<<endl;
    }
}


Measured memory_bytes: 3116
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a = 0;

    for(int i=n ; i>0 ; i--){
      if(String.valueOf(i).length() %2 !=0){
        a++;
      }
    }
    System.out.println(a);
  }
}


Measured memory_bytes: 26196
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int a, b;
    char s;
    cin >> a >> s >> b;
    if ( s == '+' ) cout << a + b << endl;
    else if ( s == '-' ) cout << a - b << endl;
    return 0;
}


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

int main() {
  int N; cin >> N;
  string S;
  int size;
  bool flag = true;
  vector<string> str(N);
  for (int i = 0; i < N; i++) {
    cin >> str.at(i);
  }
  for (int i = 0; i < N-1; i++) {
    if (str.at(i).back() != str.at(i+1).front()) {
      flag = false;
    }
  }
  sort(str.begin(), str.end());
  for (int i = 0; i < N-1; i++) {
    if (str.at(i) == str.at(i + 1)) {
      flag = false;
    }
  }


  if (flag) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
def array_integer(a)
	0.upto(a.count) {|x|
		a[x] = a[x].to_i
	}
	return a
end

eof = false

until eof do
	h,w = array_integer(STDIN.gets.split(" "))
	
	if h == 0 && w == 0 then
		return
	end

    mark = "#"
	1.upto(h) {|y|
		1.upto(w) {|x|
			if ((x + y) % 2) == 0 then
				mark = "#"
			else
				mark = "."
			end
			
			print mark
		}
		print "\n"
	}

	print "\n"
end



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

// マクロ
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) x * x

// 型エイリアス
using lint = long long;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;

int main() {

	int N;

	cin >> N;

	vector<pair<string, int>> list(N);
	string name;
	int time;

	rep(i, N) {
		cin >> name >> time;
		list[i].first = name;
		list[i].second = time;
	}
	int sleeptime = 0;

	string X;
	cin >> X;

	rep(i, N) {
		if (list[i].first == X) {
			i++;
			for (; i < N; i++) {
				sleeptime += list[i].second;
			}
		}
	}
	cou(sleeptime);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            :oyhhhhhhyo:    
#define next         .sdNNNmNNNNNNNmds. 
#define y0          -hNNNNy`yNNNNNN`/Nh-
#define y1          mNNNNNd+dNNNNNN+sNNm
#define yn          mNNNNNNNNy--:smNNNms
#define tm          .+oooooosyysooooo+- 
#define read               :yhy/        
#define rank              :mNmo         
#define index              ... 
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

const int N = 11;
int p[N][N];
int n, d;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> d;
    rep(i, 1, n) {
        rep(j, 1, d) {
            cin >> p[i][j];
        }
    }
    int ans = 0;
    rep(i, 1, n) {
        rep(j, i + 1, n) {
            int sum = 0;
            rep(k, 1, d) {
                int diff = p[i][k] - p[j][k];
                sum += diff * diff;
            }
            int s = sqrt(sum);
            ans += s * s == sum;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cctype>
#include <cmath>
#include <cassert>
using namespace std;

#define dump(a) (cerr << #a << " = " << (a) << endl)

const string NO = "Impossible";
int a,b,c,d;

bool ok(int p, int x, int r, int y) {
  int bun = 2*a;
  if(!((p * x) % bun == 0 && (r * y) % bun == 0)) return false;
  int q = p * x / bun;
  int s = r * y / bun;

  if(!(p * r == a && p * s + r * q == b && q * s == c)) return false;
  cout << p << " " << q << " " << r << " " << s << endl;
  return true;
}

bool valid(int p, int r){
  int x = -(-b+(int)sqrt(d));
  int y = -(-b-(int)sqrt(d));

  if(p > r) {
	if(ok(p, x, r, y)) return true;
	if(ok(p, y, r, x)) return true;
  }
  else {
	if(ok(p, max(x, y), r, min(x, y))) return true;
  }
  return false;
}
bool cal(int p){
  int r = a / p;
  if(p < r) swap(p, r);
  if(valid(p, r)) return true;
  return false;
}
int main(){
  while(cin >> a >> b >> c && a!=0){
	d = b*b-4*a*c;
	if((int)sqrt(d) != sqrt(d)){
	  cout << NO << endl;
	  continue;
	}
	for(int i = 1;i <= 10000;i++){
	  if(a % i == 0) {
		if(cal(i))break;
	  }
	}
  }
  return 0;
}

Measured memory_bytes: 1208
import itertools

N = int(input())
L = [int(x) for x in input().split()]

seq = [int(x) for x in range(1,N+1)]
lis = list(itertools.combinations(seq,3))
cnt = 0

for i in lis :
    a = i[0]-1
    b = i[1]-1
    c = i[2]-1
    if L[a] != L[b] and L[b] != L[c] and L[c] != L[a] :
        if L[a] + L[b] > L[c] :
            if L[b]+L[c] > L[a] :
                if L[c] + L[a] > L[b] :
                    cnt += 1

print(cnt)

Measured memory_bytes: 20544
def main():

    N = int(input())
    S = input()
    count = {'R':0, 'G': 0, 'B': 0}
    for c in S: count[c] += 1

    remove = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            k = j + (j-i)
            if k < N:
                if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                    remove += 1

    ans = count['R'] * count['G'] * count['B']

    return ans - remove

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 67984
H, W = map(int,input().split())
N = int(input())
a = list(map(int,input().split()))

G = [[0]*W for k in range(H)]

i = 0
for k in range(H):
    for l in range(W):
        if a[i] != 0:
            G[k][l] = i+1
            a[i] -= 1
        else:
            i += 1
            G[k][l] = i+1
            a[i] -= 1
for k in range(H):
    if k%2 == 0:
        print(*G[k])
    else:
        print(*G[k][::-1])


Measured memory_bytes: 3828
#include <bits/stdc++.h>
//#include "Local_Debug.h"
using namespace std;
#define Endl endl
#define debug(x) cout << #x << " = " << (x) << endl
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)2e5 + 5;
string s;
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	map<string, ll> m;
	m["SAT"] = 1;
	m["SUN"] = 7;
	m["MON"] = 6;
	m["TUE"] = 5;
	m["WED"] = 4;
	m["THU"] = 3;
	m["FRI"] = 2;
	while (cin >> s)
		cout << m[s] << endl;
}
/*
SAT

SUN
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//#define ll long long
#define pb emplace_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=1e9+7;
const ll inf=LONG_LONG_MAX;
const ll ms=(1e5)+5;





int main()
{
    idfc;
    string s,t;
    cin>>s;
    cin>>t;
    int ans=0;
    int i=0;
    for(char ii:s)
    {
        ans+=(ii!=t[i]);
        i++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3760
N = int(input())
A = sorted(map(int, input().split()))

ave = int(sum(A) / len(A))
tmp = sum(A) / len(A)
if(tmp > ave + 0.5):
    ave += 1
ans = 0
for i in range(N):
    ans += (A[i] - ave)**2
print(ans)

Measured memory_bytes: 3064
#文字列入力
s = str(input())

rtn = [0]*len(s)

alpha = 0
beta = 0
f = 0
a = 0
b = 0

for i,si in enumerate(s):
    if (f == 0): #R
        if (si == "R"):
            alpha += 1
        else:
            a = i - 1
            b = i
            rtn[a] += (alpha + 1) //2
            rtn[b] += alpha // 2
            beta = 1
            f = 1
    else: #L
        if (si == "L"):
            beta += 1
        else:
            rtn[a] += beta // 2
            rtn[b] += (beta + 1) // 2
            alpha = 1
            f = 0

rtn[a] += beta // 2
rtn[b] += (beta + 1) // 2

print(*rtn ,sep=" ")

Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	int s=a*b;
	if(s<c)
	{
		cout << s <<endl;
		return 0;
	}
	else if(s>c)
	{
		cout << c <<endl;
		return 0;
	}
	else
	{
		cout << s <<endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
// #define int long long
// #define repeat(i, n) for (int i = 0; i < n; ++i)

#include <cmath> // cmath includes sqrt, abs
#include <iostream> // iostream includes cout, endl
#include <string> // string
#include <algorithm> // algorithm includes sort

#include <set>

using namespace std;

int main() {
  bool can = false;
  int num = 0;
  // string S;
  string T = "";
  int N;
  string S[100];
  
  int L;

  cin >> N >> L;
  
  for (int i = 0; i < N; ++i) cin >> S[i];

  sort(S, S + N);

  for (int i = 0; i < N; ++i) T += S[i];

  cout << T << endl;

  // if (can) cout << "Yes" << endl;
  // else cout << "No" << endl;
  return 0;
}


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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
			int n = cin.Int();
			int[] p = cin.ArrayInt(n);
			int[] indexes = new int[n];
			for (int i = 0; i < n; i++) {
				indexes[p[i] - 1] = i;
			}

			long ans = 0;
			var temp = new SortedList<int, int>(n);
			for (int i = n - 1; i >= 0; --i) {
				int index = indexes[i];
				temp.Add(index, index);
				int l1 = -1;
				int l2 = -1;
				int r1 = n;
				int r2 = n;

				int current = index;
				int currentIndex = temp.IndexOfKey(index);
				var keys = temp.Keys;

				if (currentIndex - 1 >= 0) {
					l1 = keys[currentIndex - 1];
				}

				if (currentIndex - 2 >= 0) {
					l2 = keys[currentIndex - 2];
				}

				if (currentIndex + 1 < temp.Count()) {
					r1 = keys[currentIndex + 1];
				}

				if (currentIndex + 2 < temp.Count()) {
					r2 = keys[currentIndex + 2];
				}

				int rangeL1 = current - l1;
				int rangeL2 = l1 - l2;
				int rangeR1 = r1 - current;
				int rangeR2 = r2 - r1;

				ans += (i + 1) * ((long)rangeL2 * rangeR1 + (long)rangeR2 * rangeL1);
			}

			Console.WriteLine(ans);
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;

		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			return double.Parse(Next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 20448
#include <bits/stdc++.h>
#define pb push_back
#define ll long long 
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1; 
    for(int T = 0; T < t ; T++){
        int a , b;
       cin >> a >> b;
       std::cout << a*b << std::endl;
    }
    return 0;
}

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

int main(){
    int c, n, m;
    cin >> c >> n >> m;
    vector<int> dp(c+1, 0);
    for(int i = 0; i < n; i++){
        int s, p;
        cin >> s >> p;
        for(int j = c; j-s >= 0; j--)   dp[j] = max(dp[j], dp[j-s]+p);
    }
    for(int i = 1; i <= m; i++){
        cout << dp[c/i]*i << endl;
    }
    return 0;
}


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

string a,b="CF"; //打表
int asdasdasadfsdfasd,fdfsdfsgefdfsdfsdcsddgazxczxcadfsgdfsdczxcxzxczxczxczxczxczxcasdasdasdafsdsdfsdfsgdgdhfghfghtrrtyerweqwqwds;

int main(){
    getline(cin,a);
    asdasdasadfsdfasd=a.length();
    for(int i=0;i<asdasdasadfsdfasd;i++)
        if(a[i]==b[fdfsdfsgefdfsdfsdcsddgazxczxcadfsgdfsdczxcxzxczxczxczxczxczxcasdasdasdafsdsdfsdfsgdgdhfghfghtrrtyerweqwqwds]){ //当找到一个的时候加一
            fdfsdfsgefdfsdfsdcsddgazxczxcadfsgdfsdczxcxzxczxczxczxczxczxcasdasdasdafsdsdfsdfsgdgdhfghfghtrrtyerweqwqwds++;
            if(fdfsdfsgefdfsdfsdcsddgazxczxcadfsgdfsdczxcxzxczxczxczxczxczxcasdasdasdafsdsdfsdfsgdgdhfghfghtrrtyerweqwqwds==2)   //都找到的时候就退出
                break;
        }
    if(fdfsdfsgefdfsdfsdcsddgazxczxcadfsgdfsdczxcxzxczxczxczxczxczxcasdasdasdafsdsdfsdfsgdgdhfghfghtrrtyerweqwqwds==2) cout<<"Yes"; //判断并且输出
    else cout<<"No";
    cout<<endl;//最后不要忘了打个换行
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
int pow(int a,int n){
	int b=1;
	for(int i=0;i<n;i++){
		b=b*a;
	}
	return b;
}
int main(){
	int n;
	scanf("%d",&n);
	int a[n]={};
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	int y=1;
	for(int i=0;i<n;i++){
		if(a[i]%2==0)y=y*2;
	}
	printf("%d\n",pow(3,n)-y);
	return 0;
}

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

int main(void)
{
  double weight;
  while (cin >> weight)
  {
    if (weight <= 48)
    {
      cout << "light fly";
    }
    else if (weight <= 51)
    {
      cout << "fly";
    }
    else if (weight <= 54)
    {
      cout << "bantam";
    }
    else if (weight <= 57)
    {
      cout << "feather";
    }
    else if (weight <= 60)
    {
      cout << "light";
    }
    else if (weight <= 64)
    {
      cout << "light welter";
    }
    else if (weight <= 69)
    {
      cout << "welter";
    }
    else if (weight <= 75)
    {
      cout << "light middle";
    }
    else if (weight <= 81)
    {
      cout << "middle";
    }
    else if (weight <= 91)
    {
      cout << "light heavy";
    }
    else
    {
      cout << "heavy";
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1220