akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
	int N,C0=0,C1=0,C2=0,C3=0;
	cin >> N;
	while(N--)
	{
		string S;
		cin >> S;
		if(S=="AC")C0++;
		if(S=="WA")C1++;
		if(S=="TLE")C2++;
		if(S=="RE")C3++;
	}
	cout << "AC x " << C0 << endl;
	cout << "WA x " << C1 << endl;
	cout << "TLE x " << C2 << endl;
	cout << "RE x " << C3 << endl;
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

const int K_MAX = 1e5+5;
bool to(int &x,int y){
  if(x>y){
    x = y;
    return true;
  }
  return false;
}

int solve(){
  int K;cin >> K;
  deque<int> dq(1,1);
  vector<int> dp(K,1e9);
  dp[1] = 1;
  while(!dq.empty()){
    //cout << dq.front().first SP dq.front().second << endl;
    int u = dq.front(); dq.pop_front();
    if(to(dp[u*10%K], dp[u])) dq.push_front(u*10%K);
    if(to(dp[(u+1)%K], dp[u]+1)) dq.push_back((u+1)%K);
  }
  return dp[0];
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  cout << solve() << endl;
  return 0;
}


Measured memory_bytes: 896
#include <iostream>
using namespace std;
int main(void){
    int N,M,i,j,num=0;
    char A[2000][2000],B[2000][2000];
    
    cin >> N >> M;
    
    for(i=0;i<N;i++){
        for(j=0;j<M;j++){
            cin >> A[i][j];
        }
    }
    for(i=0;i<N;i++){
        for(j=0;j<M;j++){
             cin >> B[i][j];
             if(A[i][j] != B[i][j])
                num++;
        }
    }
    
    cout << num << endl;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> x(n), tmp(n);
    rep(i,n) {
        cin >> x[i];
        tmp[i] = x[i];
    }
    sort(tmp.begin(), tmp.end());
    int f = tmp[n / 2 - 1], b = tmp[n / 2];
    
    for (int i = 0; i < n; i++)
    {
        if (x[i] <= f) {
            cout << b << endl;
        }
        else if (x[i] >= b) {
            cout << f << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 4852
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;


int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int k;
    cin >> k;
    int cnt = 0;
    while(a>=b){
        b*=2;
        cnt++;
    }
    while(b>=c){
        c*=2;
        cnt++;
    }
    if(cnt<=k){
        cout << "Yes"<<endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


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

int main(){
    string buf;
    int n;
    vector<string> A;
    cin >> n;
    int kind;
    kind = 1;
    int i;
    for(i=0;i<n;i++){
        cin >> buf;
        A.push_back(buf);
        //cout << A[i] << endl;
    }
    sort(A.begin(), A.end());
    //cout << "reflesh" << endl;
    for(i=0;i<n;i++){
        if(A[i] != A[i+1]){
            kind++;
        }
        //cout << A[i] << endl;
    }
    //cout << "buf:" << buf << endl;
    cout << kind-1 << endl;

    return 0;
}



Measured memory_bytes: 11632
import java.util.*
import kotlin.math.*

fun str() = readLine()!!
fun int() = str().toInt()
fun long() = str().toLong()

fun read(d:String = " ") = str().split(d)
fun <T> list(d:String = " ",f:String.()->T) = read(d).map {f(it)}
fun list() = list {toInt()}

const val mod = 998244353L

fun main() {
	abc000X()
}

fun abc000X() {
	val n = int()
	val t = (1..n).map {str()}

	fun f(v:String) = println("$v x ${t.count {it==v}}")

	f("AC")
	f("WA")
	f("TLE")
	f("RE")
}


Measured memory_bytes: 60772
#include<bits/stdc++.h>
using namespace std;
int INF = 100000000;
int book[15][15];
int cost[15];
int main(){
	int n,m,x;
	cin>>n>>m>>x;
	for(int i=0; i<n; i++){
		cin>>cost[i];
		for(int j=0; j<m; j++) cin>>book[i][j];
	}
	int mincost = INF;
	for(int state =  1; state<(1<<n); state++){
		int skill[m]={0};
		int price = 0;
		for(int j=0; j<n; j++){
			if(state&(1<<j)){
				for(int k=0; k<m; k++) skill[k]+=book[j][k];
				price+=cost[j];
			}
		}
		bool possible = true;
		for(int j=0; j<m; j++){
			if(skill[j]<x) possible = false;
		}
		if(possible) mincost = min(mincost,price);
	}
	if(mincost==INF) cout<<-1;
	else cout<<mincost;
}

Measured memory_bytes: 3556
#include <iostream>
#include <math.h>

#define lli long long int
#define ld long double
#define endl "\n"

using namespace std;

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

	#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("D:\\My Folder\\Programming\\[code] Competetive Programming\\input.txt", "r", stdin);
	// for writing the output to output.txt
	freopen("D:\\My Folder\\Programming\\[code] Competetive Programming\\output.txt", "w", stdout);
	#endif

	lli N;
	cin>>N;

	lli count = 0;

	// for (lli c = 1; c<N; c++){
	// 	cout<<"c = "<<c<<endl;
	// 	lli k = N-c; 
	// 	for (lli a = 1; a<N; a++){
	// 		if(k/a == floor(k/a) && floor(k/a) != 0){
	// 			count += 1;
	// 			cout<<a<<" "<<k/a<<" "<<c<<endl;
	// 			// break;
	// 		}
	// 	}
	// }

	for (lli a = 1; a<N; a++){
		for (lli b = 1; b<N; b++){
			if (a*b < N){
				count +=1;
			}
			else break;
		}
	}
	cout<<count;
}

Measured memory_bytes: 3648
import java.io.BufferedReader
import java.io.InputStreamReader

val reader by lazy { BufferedReader(InputStreamReader(System.`in`)) }

@Suppress("ReplaceJavaStaticMethodWithKotlinAnalog")
fun main(a: Array<String>) {
    val card = (0..2).map { reader.readArgs().map(String::toInt) }
    val checker = (0..2).map { (0..2).map { false }.toMutableList() }
    val n = reader.readInt()
    val numbers = (1..n).map { reader.readInt() }

    (0..2).forEach { i ->
        (0..2).forEach { j ->
            checker[i][j] = numbers.any { it == card[i][j] }
        }
    }
    checker.forEach { list ->
        if (list.none { !it }) {
            println("Yes")
            return
        }
    }
    (0..2).forEach { i ->
        if ((0..2).map { j -> checker[j][i] }.none { !it }) {
            println("Yes")
            return
        }
    }
    if ((0..2).map { checker[it][it] }.none { !it }) {
        println("Yes")
        return
    }
    if (arrayListOf(checker[0][2], checker[1][1], checker[2][0]).none { !it }) {
        println("Yes")
        return
    }
    println("No")
}

fun BufferedReader.readArgs() = readLine().split(" ")
fun BufferedReader.readInt() = readLine().toInt()
fun BufferedReader.readLong() = readLine().toLong()
fun BufferedReader.readChar() = readLine().toInt().toChar()
fun BufferedReader.readString() = readLine().toInt().toString()


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

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

	int A,B,C,K;
	int i,j;
	int tmp;
	int answer=0;
	int counter=0;
	double ave;
	vector<int> given;

	cin >> A >> B >> C >> K;

	{
		if(A<=K){
			answer+=A;
			K-=A;
		}else{
			answer+=K;K=0;
		}

		if(B<=K){
			K-=B;
		}else{
			K=0;
		}

		if(C<=K){
			answer-=C,K-=C;
		}else{
			answer-=K;
		}
	}
	
	cout << answer << endl;

	return 0;
}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vv(P) data(N);
  rep(i,N) {
    int A;
    cin >> A;
    rep(j,A) {
      int x,y;
      cin >> x >> y;
      x--;
      data[i].push_back(P(x,y));
    }
  }
  int ans = 0;
  rep(i,(1<<N)) {
    bool allok = true;
    rep(j,N) {
      if(((i>>j)&1)==1) {
        bool ok = true;
        rep(k,sz(data[j])) {
          int tar = data[j][k].first;
          int honest = data[j][k].second;
          if(honest==1&&((i>>tar)&1) == 0) {
            ok = false;
            break;
          } else if(honest==0&&((i>>tar)&1) == 1) {
            ok = false;
            break;
          }
        }
        if(!ok) {
          allok = false;
          break;
        }
      }
      
    }
    if(allok) {
      int tmp = 0;
      rep(j,N) {
        if(((i>>j)&1)==1) {
          tmp++;
        }
      }
      ans = max(tmp,ans);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
using namespace std;

 ll mod=1e9 +7;


const ll M=200006;
ll f[M],inv[M];
ll expo(ll base,ll exponent){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
void compute(){
    f[0]=1;
    rep(i,1,M-1){
        f[i]=(1LL*i*f[i-1])%mod;
    }
    inv[M-1]=expo(f[M-1],mod-2);
    for(ll i=M-2;i>=0;i--){
        inv[i]=(1LL*(i+1)*inv[i+1])%mod;
    }
}
ll C(ll n,ll r){
    return (1LL*((1LL*f[n]*inv[r])%mod)*inv[n-r])%mod;
}

vector<bool>  prime(1000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=1000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=1000001; i += p) 
                prime[i] = false; 
        } 
    } 
}

int main()
{

	// #ifndef ONLINE_JUDGE
 //    // for getting input from input.txt
 //    freopen("input.txt", "r", stdin);
 //    // for writing output to output.txt
 //    freopen("output.txt", "w", stdout);
 //    #endif

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // compute();

    ll tests=1,t=1;
   // cin>>tests;
    while(tests--)
    {
    	int i,j,x,y;
    	cin>>x>>y;
    	i=0;
    	while(i*4<=y && i<=x)
    	{
    		if(i*4 + 2*(x-i)==y)
    		{
    			cout<<"Yes";
    			return 0;
    		}
    		i++;
    	}
    	cout<<"No";
    	

    }

	return 0;
}

Measured memory_bytes: 3776
n, k = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
h = Hash.new(0)
ans = 0

a.each do |e|
    h[e] += 1
end

if h.size <= k then
    puts "0"
    exit
end

hashToArray = h.sort_by{|key, value| value}

(h.size-k).times do |i|
    ans += hashToArray[i][1]
end

puts ans


Measured memory_bytes: 42752
n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
b = 0
bi = 0
c = 0
for i in range(n - 1):
    if a[i] == a[i + 1]:
        b = a[i]
        bi = i + 1
        break
if bi != 0:
    for i in range(bi + 1, n - 1):
        if a[i] == a[i + 1]:
            c = a[i]
            break
print(b * c)

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

int main(){
  int a,b; cin>>a>>b;
  if(a+b==15){
    cout<<"+";
  }else if(a*b==15){
    cout<<"*";
  }else{
    cout<<"x";
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
     
    long long x;
    string s="";
    int main()
      {
      
    cin>>x;
      while(x)
        {
        x--;
        int c = x%26;
        x/=26;
        s+=('a'+c);
      
        }
      reverse(s.begin(),s.end());
      cout<<s<<endl;
      }

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define INF 10000000000000009
#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

signed main(){
    string S;
    cin >> S;
    int Ans=INF;
    for(int i=0;i<S.size()-2;i++){
        int e=0;
        REP(j,3){
            e*=10;
            e+=(int)(S[i+j]-'0');
        }
        Ans=min(Ans,abs(e-753));
    }
    cout << Ans << endl;
    return 0;
}   


Measured memory_bytes: 256
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<bits/stdc++.h>
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#pragma GCC optimization ("O3")
using namespace std;
const long long int N = 6999999;
#define all(x) begin(x),end(x)
#define ll long long int
const ll mod = 1000000007;
int main()
{
 
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n,l,ans = 0;
  cin >> n >> l;
  vector <int> f(n);
  f[0] = l;
  for (int i = 1; i < n; ++i)
  {
    f[i] = l + i;
  }
  if(l < 0)
  {
    if( l +(n-1) < 0)
    {
      f[n-1] = 0;
    }
  }
  else
    f[0] = 0;
  for (int i = 0; i < n; ++i)
  {
    ans += f[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b, c;
	int yaku = 0, i;
	
	scanf("%d %d %d", &a, &b, &c);
	
	for (i = a; i <= b; i++){
		if (c % i == 0){
			yaku++;
		}
	}
	
	printf("%d\n", yaku);
	
	return (0);
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
vector<int> a;
int n;
int gcd(int x,int y){
	while( x*y > 0){
		if( x>y ) x= x%y;
		else y = y%x;
	}
	return x+y;
}
int hantei(int turn){
	int even_cnt=0, one_cnt=0;
	for(int i=0;i<n;i++){
		if( a[i] % 2 == 0 )even_cnt++;
		if( a[i] == 1 ) one_cnt++;
	}
	if( even_cnt % 2 == 1 )return turn;
	if( even_cnt < n-1 )return -turn;
	if( one_cnt > 0)return -turn;
	for(int i=0;i<n;i++){
		if( a[i]%2 ) a[i]--;
	}
	int gc = a[0];
	for(int i=1;i<n;i++){
		gc = gcd(gc,a[i]);
	}
	for(int i=0;i<n;i++){
		a[i] /= gc;
	}
	return hantei(-turn);
}
signed main(){
	cin>>n;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		a.pb(x);
	}
	int ans = hantei(1);
	if( ans == 1 )cout<<"First"<<endl;
	else cout<<"Second"<<endl;
	return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <deque>
using ll = long long;
using namespace std;


int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if((a*100+b*10+c)%4 == 0) 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 abc119d
{
    class Program
    {
        static void Main(string[] args)
        {
            var ABCDE = new int[5];
            var sum = 0;
            var min = 10;
            for (int i = 0; i < 5; i++)
            {
                var x = ABCDE[i] = ReadInt();
                if (x%10 == 0)
                {
                    sum += x;
                } else
                {
                    var y = x % 10;
                    sum += x + 10 - y;
                    min = (min > y) ? y : min;
                }
            }
            if (min != 10)
            {
                sum -= 10 - min;
            }
            Console.WriteLine(sum);
       
#if DEBUG
            Console.ReadKey();
#endif
        }

        private static bool IsRange(int a, int from, int to) => (from <= a && a <= to);
        private static int ReadInt() => int.Parse(Console.ReadLine());
        private static List<int> ReadIntList() => Console.ReadLine().Split().Select(int.Parse).ToList();
        private static double ReadDouble() => double.Parse(Console.ReadLine());
        private static List<double> ReadDoubleList() => Console.ReadLine().Split().Select(double.Parse).ToList();
        private static long ReadLong() => long.Parse(Console.ReadLine());
        private static List<long> ReadLongList() => Console.ReadLine().Split().Select(long.Parse).ToList();
        private static List<int> Int2Digits(int a) => a.ToString().ToCharArray().Select(_ => int.Parse(_.ToString())).ToList();
        private static int BinarySearch<Type>(IReadOnlyList<Type> s, Type target) // target 以下の最大要素のインデックスを返す
            where Type : IComparable
        {
            var lower = 0;
            var upper = s.Count - 1;
            while (upper - lower > 1)
            {
                var mid = lower + (upper - lower) / 2;
                if (s[mid].CompareTo(target) <= 0)
                {
                    lower = mid;
                }
                else
                {
                    upper = mid;
                }

            }
            return lower;
        }
    }
}


Measured memory_bytes: 13140
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define vv vector
#define pp pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define fastio                    \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);
typedef pair<ll, ll> pll;
typedef vv<ll> vll;
typedef vv<pll> vpll;
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//adds two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set]
//(2)set.order_of_key(k)[count of elements strictly less than k]
#define LG(args...)                               \
	{                                             \
		string _s = #args;                        \
		replace(_s.begin(), _s.end(), ',', ' ');  \
		stringstream _ss(_s);                     \
		err(istream_iterator<string>(_ss), args); \
		cerr << endl;                             \
	}
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "(" << *it << ":" << a << ") ";
	err(++it, args...);
}
//:::::::::::::::::::::::::::::::::::::::::::::
const ll INF = 9e18;
const ll MOD = 1e9 + 7;
// #define dbg

int main(){
	fastio;
	ll n;
	cin>>n;
	vll v(n);
	map<ll,ll> mp;
	ll sm=0;
	for(ll i=0; i<n; i++){
		cin>>v[i];
		mp[v[i]]++;
		sm+=v[i];
	}

	ll q;
	cin>>q;
	while(q--){
		ll b,c;
		cin>>b>>c;
		sm-= b*mp[b];
		sm+= c*mp[b];
		ll cnt = mp[b];
		mp[b]=0;
		mp[c]+=cnt;
		cout<<sm<<endl;
	}
	// ll ans=0;
	// for(auto& i: mp){
	// 	ans+= i.ff*i.ss;
	// }

	// cout<<ans;

}

Measured memory_bytes: 9996
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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

    ans = [0] * (10000 + 1)

    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                if x * x + y * y + z * z + x * y + y * z + z * x >= 10001:
                    continue
                ans[x * x + y * y + z * z + x * y + y * z + z * x] += 1

    for i in range(1, N + 1):
        print(ans[i])


if __name__ == '__main__':
    main()



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

#define INF (1<<30)
typedef pair<int, int> intpair;

vector<int> m[200100],g[200100];
queue<int> qu;
priority_queue< intpair, vector<intpair>, greater<intpair> > pq;
int c[10010],r[10010],d[10010];

int main(void){
	int n,k,a,b,i,j,s,e,dis,ext;
	intpair tmp;
	cin >> n >> k;
	for(i=0; i<n; i++){
		cin >> c[i] >> r[i];
	}
	for(i=0; i<k; i++){
		cin >> a >> b;
		a--;
		b--;
		m[a].push_back(b);
		m[b].push_back(a);
	}
	for(i=0; i<n; i++){
		fill(d,d+10010,0);
		d[i] = r[i];
		qu.push(i);
		while(!qu.empty()){
			s = qu.front();
			qu.pop();
			if(d[s] != 0){
				for(j=(m[s].size()-1); j>=0; j--){
					e = m[s][j];
					if(d[e] == 0){
						d[e] = d[s]-1;
						g[i].push_back(e);
						qu.push(e);
					}
				}
			}
		}
	}
	fill(d,d+10010,INF);
	d[0] = 0;
	pq.push(intpair(0,d[0]));
	while(!pq.empty()){
		tmp = pq.top();
		pq.pop();
		s = tmp.second;
		dis = tmp.first;
		for(i=(g[s].size()-1); i>=0; i--){
			e = g[s][i];
			if(dis + c[s] < d[e]){
				d[e] = dis + c[s];
				pq.push(intpair(d[e],e));
			}
		}
	}
	cout << d[n-1] << endl;
	return 0;
}

Measured memory_bytes: 83844
import numpy as np

array = list(map(int,input().strip().split()))

a = array[0]
b = array[1]

min8 = a/0.08
max8 = (a+1)/0.08
min10 = b/0.1
max10 = (b+1)/0.1

def lists(a,b):
    if a%1==0:
        a2 = a
    else:
        a2 = int(a)+1
    if b%1==0:
        b2 = b-1
    else:
        b2 = int(b)
    return np.arange(a2,b2+1)

list8 = lists(min8,max8)
list10 = lists(min10,max10)

hosii = list(set(list8)&set(list10))
if len(hosii)>0:
    print(int(np.min(hosii)))
else:
    print(-1)

Measured memory_bytes: 21024
#include <iostream>
#include <set>
#include <string>
#include <vector>

int main(void)
{
    int n;
    std::cin >> n;
    std::vector<int> r(n, 0);
    for (int i = 0; i < n - 1; i++)
    {
        int d;
        std::cin >> d;
        r[d - 1] += 1;
    }
    for (const auto &v : r)
    {
        std::cout << v << std::endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;

const int inf = 1e5 + 9;

int a[inf], b[inf];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n; cin >> n;
    for (int i = 1; i <= n + 1; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) cin >> b[i];
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += min(b[i], a[i] + a[i + 1]);
        a[i + 1] -= min(a[i + 1], max(0, b[i] - a[i]));
    }
    cout << ans << '\n';
}


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

int main() {
	string b;
	cin >> b;
	if(b == "A"){
		cout << 'T' << endl;
	}
	if (b == "T") {
		cout << 'A' << endl;
	}
	if (b == "G") {
		cout << 'C' << endl;
	}
	if (b== "C") {
		cout << 'G' << endl;
	}
	
	
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int S, h = 0, m = 0, s = 0, i= 0;
    scanf("%d", &S);

    while(i < S){
        s++;
        if(s == 60){
            s = 0;
            m++;
            if(m == 60){
                m = 0;
                h++;
            }
        }
        i++;
    }

    printf("%d:%d:%d\n", h, m, s);

    return 0;
}


Measured memory_bytes: 2056
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#define nummax 110000
typedef long long ll;
using namespace std;


int main() 
{
	ll N, sqN, m, i, A, ans = 0;
	cin >> N;
	sqN = sqrt(N);
	for (m = 1; m <= sqN; m++)
	{
		if ((N - m) % m == 0)
		{
			A = (N - m) / m;
			if (A > m)
				ans += A;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int32_t MOD = 1e9 + 7;
typedef int64_t ll;
typedef std::vector<bool> vbb;
typedef std::vector<std::string> vss;
using namespace std;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        ll N;
        in >> N;
        vector<vbb> memo(2, vbb(N));
        vss S(2);
        in >> S[0];
        in >> S[1];
        if (N == 1) {
            out << 3 << '\n';
            return;
        }
        if (N == 2) {
            out << 6 << '\n';
            return;
        }
        ll ans = 0;
        int pos = 0;
        bool tate = true;
        if (S[0][0] == S[1][0]) {
            ans += 3;
            pos += 1;
            tate = true;
        }
        else if (S[0][0] == S[0][1]) {
            ans += 6;
            pos += 2;
            tate = false;
        }
        reu(i, pos, N) {
            if (tate) {
                if (S[0][i] == S[1][i]) {
                    ans = (ans * 2) % MOD;
                    tate = true;
                }
                else if (i + 1 < N && S[0][i] == S[0][i + 1]) {
                    ans = (ans * 2) % MOD;
                    i++;
                    tate = false;
                }
            }
            else {
                if (S[0][i] == S[1][i]) {
                    ans = (ans * 1) % MOD;
                    tate = true;
                }
                else if (i + 1 < N && S[0][i] == S[0][i + 1]) {
                    ans = (ans * 3) % MOD;
                    i++;
                    tate = false;
                }
            }
        }
        out << ans << '\n';
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


Measured memory_bytes: 256
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

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

#define int ll

//get vector of prime numbers which is lower than or equal n
vector<int> get_primes(int n)
{
    vector<bool> is_prime(n + 1, true);
    vector<int> res;
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++)
    {
        if (is_prime[i])
        {
            res.push_back(i);
            for (int j = 2 * i; j < is_prime.size(); j = j + i)
            {
                is_prime[j] = false;
            }
        }
    }
    return res;
}

vector<pair<int, int>> factorize(int n)
{
    vector<pair<int, int>> res;
    for (int i = 2; i * i <= n; i++)
    {
        int tmp = 0;
        while (n % i == 0)
        {
            tmp++;
            n /= i;
        }
        res.push_back(make_pair(i, tmp));
    }
    if (n != 1)
    {
        res.push_back(make_pair(n, 1));
    }
    return res;
}

int mpow(int x, int n)
{
    int res = 1;
    while (n != 0)
    {
        if (n & 1)
            res = res * x % INF;
        x = x * x % INF;
        n = n >> 1;
    }
    return res;
}

//mod frac
vector<int> mfrac;
void set_mfrac(int n)
{
    if (mfrac.size() == 0)
    {
        mfrac.push_back(1);
    }
    for (int i = mfrac.size(); i <= n; i++)
    {
        mfrac.push_back((i * mfrac[i - 1]) % INF);
    }
}

//get nCm mod INF
int mcomb(int n, int m)
{
    if (mfrac.size() <= n)
    {
        set_mfrac(n);
    }
    int res = mfrac[n];
    res = res * mpow(mfrac[m], INF - 2) % INF;
    res = res * mpow(mfrac[n - m], INF - 2) % INF;
    return res;
}

vector<int> get_gcd(int n)
{
    vector<int> res;
    for (int i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            if (i * i == n)
            {
                res.push_back(i);
            }
            else
            {
                res.push_back(i);
                res.push_back(n / i);
            }
        }
    }
    return res;
}

signed main()
{
    int X, Y;
    cin >> X >> Y;
    cout << X + Y / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define tc printf("Case %d: ", cs)
#define tcn printf("Case %d:\n", cs);
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);

#define dbg1(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define dbg4(w,x, y, z) cerr << #w << " = " << w << ", " <<#x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
	return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
	os << "{";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin() ) os << ", ";
		os << *it;
	}
	return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
	os << "[";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin()) os << ", ";
		os << *it;
	}
	return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
	os << "[";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin() ) os << ", ";
		os << it -> first << " = " << it -> second ;
	}
	return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () { cerr << endl; }

template <typename T>
void faltu( T a[], int n ) {
	for (int i = 0; i < n; ++i) cerr << a[i] << ' ';
	cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) { cerr << arg << ' '; faltu(rest...); }
// Program showing a policy-based data structure.
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less 
#include <iostream>
using namespace __gnu_pbds;
using namespace std;
// GNU link : https://goo.gl/WVDL6g
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;

/**___________________________________________________**/



int main()
{
	FASTIO
	///*
// #ifndef ONLINE_JUDGE
// 	freopen("in.txt", "r", stdin);
// 	freopen("out.txt", "w", stdout);
// 	freopen("error.txt", "w", stderr);
// #endif
//*/
	int a, b;
	cin >> a >> b;
	if (max(a, b) < 10) cout << (a * b) << endl;
	else cout << "-1\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace  std;
typedef long long ll;
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max(a*c,max(b*d,max(a*d,b*c)));
//    if(b<=0&&d<=0){
//        cout<<a*c;
//    }else{
//        if(a>=0&&c>=0){
//            cout<<b*d;
//        }else{
//            if()
//        }
//    }
    return 0;
}


Measured memory_bytes: 3652
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static int[][] map;
	static int[][] directions8= {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
	static int[][] directions4= {{-1,0},{1,0},{0,-1},{0,1}};
	static int ans;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		while(true) {

			int n = sc.nextInt();

			if(n==0) {
				break;
			}

			Plant[] array = new Plant[n];

			for(int i = 0; i < n; i++) {
				String name = sc.next();
				int seedPrice = sc.nextInt();
				int hatsuga = sc.nextInt();
				int wakaba = sc.nextInt();
				int leaf = sc.nextInt();
				int bloom = sc.nextInt();
				int makeFruit = sc.nextInt();
				int FruitNum = sc.nextInt();
				int fruitPrice = sc.nextInt();
				int kisaku = sc.nextInt();

				array[i] = new Plant(name, seedPrice, hatsuga, wakaba, leaf, bloom, makeFruit, FruitNum, fruitPrice, kisaku);
			}

			Arrays.sort(array);
			for(Plant plant :array) {
			System.out.println(plant.name);
			}
			System.out.println("#");
		}


	}

	//BFS用に二つの配列を足し算する
	static int[] addArrayElms(int[] a, int[] b) {
		int[] c = new int[a.length];
		for(int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;
	}

//	//二分探索
	//k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray){
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//二分探索
	//k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList){
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
		return b == 0 ? a: gcd(b, a % b);
	}
	public static long gcd(long a, long b) {
		return b == 0 ? a: gcd(b, a % b);
	}

}


class Plant implements Comparable<Plant>{
	String name;
	double efficiency;

	Plant(String name, int seedPrice, int hatsuga, int wakaba, int leaf, int bloom, int makeFruit, int fruitNum, int fruitPrice, int kisaku){
		this.name = name;
		int sumTime = hatsuga + wakaba + leaf +( bloom + makeFruit) *kisaku;
		this.efficiency = (double)(fruitNum*kisaku*fruitPrice-seedPrice)/sumTime;
	}

	@Override
	public int compareTo(Plant other) {
		if(this.efficiency > other.efficiency) {
			return -1;
		}else if(this.efficiency < other.efficiency){
			return 1;
		}else {
			return this.name.compareTo(other.name);
		}
	}


}



Measured memory_bytes: 50060
<?php
//error_reporting(0);
//$N = trim(fgets(STDIN));
list($N,$D) =  explode(" ",trim(fgets(STDIN)));
//$d =  explode(" ",trim(fgets(STDIN)));
for($i=0;$i<$N;$i++) {
  $x[]=explode(" ",trim(fgets(STDIN)));
}
$ans=0;
for($i=0;$i<$N-1;$i++) {
  for($j=$i+1;$j<$N;$j++) {
    $diff=0;
    foreach($x[$i] as $k=>$v) {
      $diff+=pow($x[$i][$k]-$x[$j][$k],2);
    }
    $diff_int = sqrt($diff);
    if ($diff_int == intval($diff_int)) {
      $ans++;
    }
  }
}
printf("%d\n",$ans);


Measured memory_bytes: 4604
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <map>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}

ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}

#define MOD 1000000007

int main(void) {
  int n;
  cin>>n;
  vector<string> v;
  ll ans=1;
  for(int i=0; i<2; i++) {
    string s;
    cin>>s;
    v.push_back(s);
  }
  int i=0;
  if(v[0][0] == v[1][0]) {
    ans = 3;
    i = 1;
  } else {
    ans = 6;
    i = 2;
  }

  while(i<n) {
    if(i+1 <= n and v[0][i] == v[0][i+1]) {
      if(v[0][i-1] == v[1][i-1]) {
	ans = ans * 2;	
      } else {
	ans = ans * 3;
      }
      i+=2;
    } else {
      if(v[0][i-1] == v[1][i-1]) {
	ans = ans * 2;
      } 
      i++;
    }
  }
  std::cout << ans % MOD << std::endl;

  return 0;
}



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

int main() {
    int N;
    string A;
    cin >> N;
    map<string, int> S;
    for (int i = 0; i < N; i++){
        cin >> A;
        S[A]++;
    }
    cout << S.size() << endl;
}

Measured memory_bytes: 19204
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	x=0;char c=getchar();bool f=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return  x;
}
template<class t> inline void write(t x){
	if(x<0){putchar('-'),write(-x);}
	else{if(x>9)write(x/10);putchar('0'+x%10);}
}

const int N=82;
int n,m,a[N][N],b[N][N],g[N][N];
bool f[N][N][12801];

signed main(){
	read(n);read(m);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			read(a[i][j]);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			read(b[i][j]),a[i][j]=abs(a[i][j]-b[i][j]);
	f[1][1][a[1][1]]=1;
	g[1][1]=a[1][1];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++){
			if(i>1){
				for(int k=0;k<=g[i-1][j];k++) if(f[i-1][j][k])
					f[i][j][abs(k-a[i][j])]=f[i][j][k+a[i][j]]=1;
				g[i][j]=max(g[i][j],g[i-1][j]+a[i][j]);
			}
			if(j>1){
				for(int k=0;k<=g[i][j-1];k++) if(f[i][j-1][k])
					f[i][j][abs(k-a[i][j])]=f[i][j][k+a[i][j]]=1;
				g[i][j]=max(g[i][j],g[i][j-1]+a[i][j]);
			}
		}
	for(int k=0;k<=g[n][m];k++) if(f[n][m][k]){
		write(k);
		return 0;
	}
}

Measured memory_bytes: 82816
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




int main() {
    
    
    
    int n;
    cin >> n;
    string str;
    cin >> str;
    
    for (int i = 0; i < 2 * n; i += 2) {
        str[i] = (str[i] == 'W' ? 'B' : 'W');
    }
    
    rep(i, 2 * n) {
        str[i] = (str[i] == 'W' ? 'L' : 'R');
    }
    // cout << str << endl;
    
    {
        int cnt = 0;
        rep(i, 2 * n) {
            if (str[i] == 'L') cnt++;
        }
        if (cnt != n) {
            cout << 0 << endl;
            return 0;
        }
    }
    
    ll ans = 1;
    {
        int cnt_l = 0;
        rep(i, 2 * n) {
            if (str[i] == 'L') cnt_l++;
            else {
                (ans *= cnt_l) %= inf;
                cnt_l--;
            }
        }
        rep3(i, 1, n + 1) (ans *= i) %= inf;
    }
    cout << ans << endl;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <set>
#include <numeric>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;
 
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }


// const double PI = acos(-1);
// int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
// int a[12][12];

void solve() {
  int n,m,c; cin >> n >> m >> c;
  vector<int> b(m);
  rep(i,m) cin >> b[i];
  vector<vector<int>> a(n, vector<int> (m));
  for (int i= 0; i < n; i++) {
    for (int j=0; j< m; j++) {
      cin >> a[i][j];
    }
  }
  int cnt = 0;
  for (int i= 0; i < n; i++) {
    int ans=0;
    for (int j=0; j< m; j++) {
      ans += a[i][j]*b[j];
    }
    if (ans + c > 0) cnt++;
  }

  cout << cnt << endl;


}


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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string>
using namespace std;

int main(){
	int N;
	int a[10009];
	cin >> N;
	int count = 0;
	for (int i = 1; i <= N; i++) {
		cin >> a[i];
		while (a[i] % 2 == 0) {
			count++;
			a[i] /= 2;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
import math
while True:
    try:
        a,l,x=map(int,raw_input().split())
    except EOFError:
        break

    ANS=math.sqrt(pow(l,2)-pow(a/2.0,2))*a/2+math.sqrt(pow((l+x)/2.0,2)-pow(l/2.0,2))*l/2*2
    print ANS


Measured memory_bytes: 4732
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<int,string> tp;
//typedef vector<tp> vt;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
#define MOD 1000000007
// a^b mod MOD
ll powmod(ll a,ll b){
	ll out=1;
	ll p=a%MOD;
	while(b){
		if(b&1)out=out*p%MOD;
		p=p*p%MOD;
		b>>=1;
	}
	return out;
}
#define M 100010
vector<ll> fact;
void init(){
	fact=vector<ll>(M);
	fact[0]=fact[1]=1;
	loop(i,2,M)fact[i]=fact[i-1]*i%MOD;
}
// nCr
ll nCr(ll n,ll r){
	if(n<r)return 1;
	ll out=fact[n]*powmod(fact[r]*fact[n-r]%MOD,MOD-2)%MOD;
	return out;
}
int main(){
	init();
	int n;
	cin>>n;
	vi q(n+1,-1);
	int a,b;
	rep(i,n+1){
		int z;
		cin>>z;
		if(q[z]+1){
			a=q[z];
			b=i;
		}
		q[z]=i;
	}
	cout<<n<<endl;
	loop(i,2,n+2){
		ll out=nCr(n+1,i);
		if(a+n-b>=i-1)(out+=MOD-nCr(a+n-b,i-1))%=MOD;
//		if(a>=i-1)(out+=MOD-nCr(a,i-1))%=MOD;
//		if(n-b>=i-1)(out+=MOD-nCr(n-b,i-1))%=MOD;
		cout<<out<<endl;
	}
}










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

using namespace std;

typedef long long ll;
typedef long double ld;

int dp[2005][2005];
int bit[2005];

map <int, int> u;

const int MOD = 1000000007;

int add(int a, int b){
    return (a+b)%MOD;
}

int mul(int a, int b){
    return ((ll)a*b)%MOD;
}

int query(int x){
    int res = 0;
    while(x){
        res = add(res, bit[x]);
        x -= x & -x;
    }
    return res;
}

void upd(int x, int val){
    while(x <= 2000){
        bit[x] = add(bit[x], val);
        x += x & -x;
    }
}

int a[10005];
int b[10005];

int main(){
    ios_base::sync_with_stdio(false);
	cout.precision(10);
	cout << fixed;

    int n, m;
    cin >> n >> m;
    for(int i=1; i<=n; i++){
        cin >> a[i];
    }
    for(int i=1; i<=m; i++){
        cin >> b[i];
    }
    dp[0][0] = 1;
    int res = 0;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            if(a[i] != b[j]) continue;
            dp[i][j] = query(j-1) + 1;
            res = add(res, dp[i][j]);
        }
        for(int j=1; j<=m; j++){
            upd(j, dp[i][j]);
        }
    }
    cout << add(res, 1);
    return 0;
}


Measured memory_bytes: 15872
#include <stdio.h>

int main()
{
    int n, i;
    long long a = 0;

    scanf("%d", &n);

    for( i = 1; i < n+1; i++ )
    {
        if( i % 3 != 0 && i % 5 != 0 )
            a += i;
    }
    printf("%lld\n", a);
       return 0;
}

Measured memory_bytes: 1728
#include <stdio.h>
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<complex>
#include<vector>
#include <climits>

using namespace std;


int main(void)
{
    int d;
    scanf("%d",&d);

    if(d==22)
    {
        cout << "Christmas Eve Eve Eve" << "\n";
    }
    else if(d==23)
    {
        cout << "Christmas Eve Eve" << "\n";
    }
    else if(d==24)
    {
        cout << "Christmas Eve" << "\n";
    }
    else if(d==25)
    {
        cout << "Christmas" << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use std::cmp;
use std::collections::HashMap;
use std::collections::HashSet;
use std::char;
use std::cmp::min;
use num_traits::abs;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn read_tuple2<T: FromStr, S: FromStr>() -> (T, S) {
    let a = read();
    let b = read();
    (a, b)
}

fn read_tuple3<T: FromStr, S: FromStr, R: FromStr >() -> (T, S, R) {
    let a = read();
    let b = read();
    let c = read();
    (a, b, c)
}

fn count_two(n: u64) -> u64 {
    fn go(count: u64, num: u64) -> u64 {
        if num % 2 == 0 {
            go(count + 1, num / 2)
        } else {
            count
        }
    }
    go(0, n)
}

fn main() {
    let (a, b, c): (u64, u64, u64) = read_tuple3();
    let mut v = vec![a, b, c];
    v.sort();
    let mut count = 0;
    loop {
        if v[0] == v[1] && v[1] == v[2] {
            break;
        }
        if v[2] == v[1] {
            v[0] += 2;
        } else {
            v[0] += 1;
            v[1] += 1;
        }
        v.sort();
        count += 1;
    }
    println!("{}", count);
}



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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define inf 0x3f3f3f3f
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

/* 
 * * stuff you should look for
 * * int overflow, array bounds
 * * special cases (n=1?), set tle
 * */

string s;
int n, k;
ll dp[100][4][2];

ll solve(int i, int nonz, int block){
    if(i == n and nonz == k) return 1;
    if(i == n or nonz > k) return 0;

    ll& ret = dp[i][nonz][block];
    if(~ret) return ret;

    ret = 0;

    ret += solve(i + 1, nonz, block and s[i] == '0');
    for(int j = 1; j <= (block ? s[i] - '0' : 9); j++){
        ret += solve(i + 1, nonz+1, (block and j >= (s[i] - '0')));
    }

    return ret;
}

int main(){
    fcin;

    cin >> s;

    n = s.size();

    cin >> k;

    memset(dp, -1, sizeof dp);
    ll ans = solve(0, 0, 1);

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



Measured memory_bytes: 256