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

using namespace std;

int main(){
    long long int n,m,counter=0,flag=0;
    long long x=1;
    cin>>n;
    m=n;

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

    for(long long int i=2;i*i<=m;i++){
        if(n%i==0){   
            flag=1;
            break;
        }
    }
    if(flag==0){
        cout<<1<<endl;
        return 0;
        }  

    for(long long int i=2;i*i<=m;i++){
        x=i;
        while(n%x==0){
            counter++;
            n/=x;
            x*=i;
        }
        while(n%i==0){
            n/=i;
        }
    }
    if(n!=1){
        counter++;
    }
    cout<<counter<<endl;
    
}

Measured memory_bytes: 3584
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<cstring>
#include<string>
using namespace std;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n,y;
	scanf("%d %d",&n,&y);
	if(n*10000<y){
        printf("-1 -1 -1\n");
        return 0;
    }
    if(n*1000>y){
        printf("-1 -1 -1\n");
        return 0;
    }
    if(y%1000!=0){
        printf("-1 -1 -1\n");
        return 0;
    }
	for(int i=0;i*10000<=y&&i<=n;i++){
		for(int j=0;j*5000<=y&&j<=n&&i+j<=n;j++){
			for(int k=0;k*1000<=y&&k<=n&&i+j+k<=n;k++){
				if(i*10000+j*5000+k*1000==y&&i+j+k==n){printf("%d %d %d\n",i,j,k);return 0;}
			}
		}
	}
	printf("-1 -1 -1\n");
	return 0;
}


Measured memory_bytes: 256
while True:
  a, op, b = input().split()
  a = int(a)
  b = int(b)
  if op =='+':
    print(int(a + b))
  elif op == '-':
    print(int(a - b))
  elif op =='*':
    print(int(a * b))
  elif op == '/':
    print(int(a / b))
  elif op == '?':
    break


Measured memory_bytes: 5596
#include<iostream>
#include <string>
#include <stdio.h>
using namespace std;

int main()
{
    //　数値の定義
    //　文字列の定義
    int N; //種類
    int M; //人気数
    cin >> N;
    cin >> M;
    
    int A[N]; //投票数
    double amount = 0; //投票合計
    for(int i=0; i<N; i++){
        cin >> A[i];
        amount = amount + A[i];
    }

    //cout << amount << endl;

    //ソート
    for(int j = 0; j < N-1; j++){
        for(int i = 0; i < N-1 ; i++){
            int tmp = 0;
            if(A[i] < A[i+1]){
                tmp = A[i];
                A[i] = A[i+1];
                A[i+1] = tmp;
            } 
        }
    }
    
    //判定
    bool flag = true;

    for(int i=0; i<M; i++){
        if(A[i] < amount/(4*M)){
            flag = false;
            //cout << A[i] << "は" << amount/4 << "より小さい" << endl;
        }
    }

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

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

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

    int n;
    cin >> n;
    long long ans = 0;
    for (int i = 1; i <= n - 1; i++)
        ans += (n / i) - (n % i == 0);
    cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3644
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main implements Runnable {
	public static void main(String[] args) {
		new Thread(null, new Main(), "", Runtime.getRuntime().maxMemory()).start();
	}

	int N;
	int M;
	int[] a;
	int[] b;
	ArrayList<Integer>[] g;
	boolean[][] go;
	int[][] ref;

	void dfs(int cur, int ori) {
		go[ori][cur] = true;
		for (int dst : g[cur]) {
			if (!go[ori][dst])
				dfs(dst, ori);
		}
	}

	void paint_min(int cur, int ori, int col, int[] min) {
		if (min[cur] > col)
			min[cur] = col;
		else
			return;
		for (int dst : g[cur]) {
			if (dst == ori)
				continue;
			paint_min(dst, ori, col, min);
		}
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		M = sc.nextInt();
		a = new int[M];
		b = new int[M];
		g = new ArrayList[N];
		ref = new int[N][N];
		for (int i = 0; i < N; ++i)
			for (int j = 0; j < N; ++j)
				ref[i][j] = -1;
		for (int i = 0; i < N; ++i)
			g[i] = new ArrayList<>();
		//N<=10^3
		//M<=2*10^5
		for (int i = 0; i < M; ++i) {
			a[i] = Integer.parseInt(sc.next());
			b[i] = Integer.parseInt(sc.next());
			--a[i];
			--b[i];
			g[a[i]].add(b[i]);
			ref[a[i]][b[i]] = i;
		}
		go = new boolean[N][N];
		for (int i = 0; i < N; ++i)
			dfs(i, i);
		boolean[][] go2 = new boolean[N][N];
		int[] tmp = new int[N];
		for (int i = 0; i < N; ++i) {
			Arrays.fill(tmp, g[i].size());
			for (int j = 0; j < g[i].size(); ++j) {
				paint_min(g[i].get(j), i, j, tmp);
			}
			for (int j = 0; j < g[i].size(); ++j) {
				if (tmp[g[i].get(j)] != j) {
					go2[i][g[i].get(j)] = true;
				}
			}
			Arrays.fill(tmp, g[i].size());
			for (int j = g[i].size() - 1; j >= 0; --j) {
				paint_min(g[i].get(j), i, g[i].size() - 1 - j, tmp);
			}
			for (int j = g[i].size() - 1; j >= 0; --j) {
				if (tmp[g[i].get(j)] != g[i].size() - 1 - j) {
					go2[i][g[i].get(j)] = true;
				}
			}
		}
		PrintWriter pw = new PrintWriter(System.out);
		for (int i = 0; i < M; ++i) {
			if (!go[b[i]][a[i]] && !go2[a[i]][b[i]]) {
				pw.println("same");
			} else if (go[b[i]][a[i]] && go2[a[i]][b[i]]) {
				pw.println("same");
			} else {
				pw.println("diff");
			}
		}
		pw.close();
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


Measured memory_bytes: 106636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

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

  if ( a * b % 2 == 0 ) printf("Even\n");
  else printf("Odd\n");
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
int main()
{
long long int n,m,i,j;
  scanf("%lld %lld",&n,&m);
  
long long int a[n],b[n],c[m],d[m],max[n],ans[n],temp;
  for(i=0;i<n;++i)
  {scanf("%lld %lld",&a[i],&b[i]);}
  
  for(i=0;i<m;++i)
  {scanf("%lld %lld",&c[i],&d[i]);}

  for(i=0;i<n;++i)
  {
  max[i]=abs(a[i]-c[0])+abs(b[i]-d[0]);
    ans[i]=1;
    for(j=1;j<m;j++) {
     temp=abs(a[i]-c[j])+abs(b[i]-d[j]);
    if(temp<max[i]) {max[i]=temp;
                    ans[i]=j+1;
                    }
    }
  printf("%lld\n",ans[i]);
  }
  
return 0;
}

Measured memory_bytes: 1732
x, y = map(int, input().split())

ans = 10**18
if x <= y:
    ans = min(y - x, ans)
if -x <= y:
    ans = min(y - (-x) + 1, ans)
if x <= -y:
    ans = min((-y) - x + 1, ans)
if -x <= -y:
    ans = min((-y) - (-x) + 2, ans)
print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, t, a;
  cin >> n >> t >> a;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  auto f = [&](int x) {
    return t-x*0.006;
  };
  double num = f(h[0]);
  int ans = 1;
  for (int i = 1; i < n; i++) {
    double tmp = f(h[i]);
    if (abs(a-tmp) < abs(a-num)) {
      num = tmp;
      ans = i+1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  ll l,r;
  cin>>l>>r;
  //ll num=r-l+1;
 	r=min(r,l+2019);
  ll mi=2018*2017;
  for(ll i=l;i<=r;i++)
  {
    for(ll j=i+1;j<=r;j++)
    {
      mi=min(mi,(i*j)%2019);
    }
  }
  cout<<mi<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
vvi g;
vi a,b;

P dfs(int v,int d,int w){
	P p={d,v};
	for(auto u:g[v]) if(u!=w) p=max(p,dfs(u,d+1,v));
	return p;
}

bool DFS(int v,int w,int p){
	bool B=0;
	if(v==w) B=1;
	for(auto u:g[v]) if(u!=p){
		B|=DFS(u,w,v);
	}
	if(B) a.push_back(v),b[v]++;
	return B;
}

vi f(){
	vi c,num;
	int cnt=1;
	for(auto v:a){
		int t=0;
		for(auto u:g[v]) if(!b[u]) t++;
		num.push_back(t);
		for(int j=0;j<t;j++) c.push_back(cnt+j+1);
		c.push_back(cnt);
		cnt+=t+1;
	}
	if(num.back()) swap(c[n-2],c[n-1]);
	reverse(a.begin(),a.end());
	return c;
}

int main(){
	cin>>n;
	g=vvi(n);
	b=vi(n);
	for(int i=1;i<n;i++){
		int u,v;
		cin>>u>>v;
		u--;v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	int L=dfs(0,0,-1).second,R=dfs(L,0,-1).second;
	DFS(L,R,-1);
	for(auto v:a){
		for(auto u:g[v]) if(!b[u]&&g[u].size()>1){
			cout<<-1<<endl;
			return 0;
		}
	}
	vi l=f(),r=f();
	for(int i=0;i<n;i++){
		if(l[i]<r[i]){
			break;
		}
		if(l[i]>r[i]){
			swap(l,r);
			break;
		}
	}
	for(int i=0;i<n;i++) cout<<l[i]<<" \n"[i==n-1];
}

Measured memory_bytes: 16624
def same_check(a,b,c):
    if a in c and b in c:
        return True
    else:
        return False

def main():
    x,y=map(int,input().split(' '))
    a=[1,3,5,7,8,10,12]
    b=[4,6,9,11]
    c=[2]
    if same_check(x,y,a) or same_check(x,y,b) or same_check(x,y,c):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
//author:satwik_bhv1
#include<bits/stdc++.h>
//datatypes
#define ll long long 
#define ld long double
//loops
#define fr(i,z,n) for(ll i=z;i<n;i++)
#define br(i,z,n) for(ll i=z;i>n;i--)
//operations
#define mp  make_pair
#define ff  first
#define ss  second
#define pub push_back
#define all(v) v.begin(),v.end()
//map
#define mi map<ll,ll>
//vectors
#define vi vector<ll>
#define vpi vector<pair<ll,ll> >
//constants
#define pi 3.1415926535897932384626
#define mod 1000000007 
#define MAXN 100001
/*notes
    Don't use inbuilt fun for power
    Range of longlong=(-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 )
    INT_MAX = 2147483647(aprox 2*10^10)
    INT_MIN = -2147483648
    LLONG_MAX = 9223372036854775807 
    LLONG_MIN = -9223372036854775808
    __gcd is the function in built for hcf
    priority queue is max heap by default
    topological sort -> khan's algo use bfs and indegree of node  
    sssp(positive weighted edges) -> Dijkstras
    apsp -> Floydwarshall
    MST -> kruskal(DSU)
*/
using namespace std;
//functions
ll power(ll x,ll y){ll res=1;while(y){if(y%2){res*=x;}y/=2;x*=x;} return res;}
ll power(ll x,ll y,ll z){ll res=1;while(y){if(y%2){res=(res*x)%z;}y/=2;x=(x*x)%z;} return res;}
void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }
bool sortbysec(const pair<ll, ll>& a, const pair<ll, ll>& b) { return (a.second > b.second); }
ll ceil(ll x,ll y){return (x/y)+(x%y!=0);}
char arr[1001][1001];
ll dp[1001][1001];
ll n,m;
ll fun(ll a,ll b)
{
    if(a==n&&b==m)
    {
        return 1;
    }
    else if(a>n||b>m)
    {
        return 0;
    }
    else
    {
        ll ans=0;
        if(a!=n&&arr[a+1][b]!='#')
        {
            if(dp[a+1][b]==-1)
            {
                ans=((ans%mod)+(fun(a+1,b)%mod))%mod;
            }
            else
            {
                ans=(ans%mod+dp[a+1][b]%mod)%mod;
            }
        }
        if(b!=m&&arr[a][b+1]!='#')
        {
            if(dp[a][b+1]==-1)
            {
                ans=((ans%mod)+(fun(a,b+1)%mod))%mod;
            }
            else
            {
                ans=(ans%mod+dp[a][b+1]%mod)%mod;
            }
        }
        return dp[a][b]=ans;
    }
}
void solve()
{
    cin>>n>>m;
    fr(i,1,n+1)
    {
        fr(j,1,m+1)
        {
            cin>>arr[i][j];
            dp[i][j]=-1;
        }
    }
    cout<<fun(1,1);
}
int main()
{
    fast();
    ll t;
    t=1;
    //cin>>t;
    fr(i,0,t)
    {
        solve();
    }
}
/*





























*/

Measured memory_bytes: 12516
import sys
input=sys.stdin.readline

a,b=map(int, input().split())


ans=b*10



while int(ans*0.08) != a or int(ans*0.1) != b:
    ans+=1
    if int(ans*0.08) != a and int(ans*0.1) != b:
        print(-1)
        exit()

print(ans)

Measured memory_bytes: 3060
#include<stdio.h>

int main(){
  int n,u,k,l,i,j,a[101][101];
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      a[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&l);
      a[u][l]=1;
    }
  }
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      if(j!=1)printf(" ");
      printf("%d",a[i][j]);
    }
    printf("\n");
  }
  return 0;
}



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

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<string>> mat(H);
    queue<vector<P>> q;
    vector<P> p;
    // cout << "B" << endl;
    // cout << "mat: " << mat.size() << endl;

    rep(i, H) {
        string t;
        cin >> t;
        // cout << "?" << endl;

        rep(j, W) {
            string tt = {t[j]};
            // cout << "tt: " << tt << endl;

            mat[i].pb(tt);
            if (tt == "#") {
                p.pb({i, j});
            }
        }
    }
    // cout << "C" << endl;

    q.push(p);
    // cout << "D" << endl;

    int count = 0;
    while (!q.empty()) {
        vector<P> pp = q.front();
        // cout << "q.size(): " << q.size() << endl;
        q.pop();
        vector<P> tmp;
        for (P p : pp) {
            // cout << "x: " << p.first << " y: " << p.second << endl;
            // cout << "1" << endl;
            if (p.first > 0 && mat[p.first - 1][p.second] == ".") {
                mat[p.first - 1][p.second] = "#";
                tmp.pb({p.first - 1, p.second});
            }
            // cout << "2" << endl;
            // cout << "21" << endl;
            // cout << "p.first: " << p.first << endl;
            // cout << "W: " << W << endl;
            // cout << "mat.size(): " << mat.size() << endl;

            if (p.first < H - 1 && mat[p.first + 1][p.second] == ".") {
                // cout << "22" << endl;

                mat[p.first + 1][p.second] = "#";
                tmp.pb({p.first + 1, p.second});
            }
            // cout << "3" << endl;

            if (p.second > 0 && mat[p.first][p.second - 1] == ".") {
                mat[p.first][p.second - 1] = "#";
                tmp.pb({p.first, p.second - 1});
            }
            // cout << "4" << endl;

            if (p.second < W - 1 && mat[p.first][p.second + 1] == ".") {
                mat[p.first][p.second + 1] = "#";
                tmp.pb({p.first, p.second + 1});
            }
        }
        if (!tmp.empty()) {
            q.push(tmp);
        }
        // cout << "count++" << endl;

        count++;
    }

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

Measured memory_bytes: 78696
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
int a[1050],b[1050],c[1050][20];
int cost[4500];
const int INF = 1e9;

int main()
{
	int N,M;
	cin >> N >> M;
	rep(i,M)
	{
		cin >> a[i] >> b[i];
		rep(j,b[i])
		{
			cin >> c[i][j];
		}
	}

	rep(i,(1 << N))
	{
		cost[i] = INF;
	}
	cost[0] = 0;

	rep(i,M)
	{
		int now = 0;
		rep(j,b[i])
		{
			now |= (1 << c[i][j] - 1);
		}

		for (int bits = 0; bits < (1 << N); ++bits)
		{
			cost[bits | now] = min(cost[bits | now],cost[bits] + a[i]);
		}
	}

	if (cost[(1 << N) - 1] == INF) cost[(1 << N) - 1] = -1;
	cout << cost[(1 << N) - 1] << endl;
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#pragma warning(disable:4996)

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;

int main(int argc, char* argv[])
{
    char str[5001]={0};
    scanf("%s", str);
    long len=strlen(str);
    
    long k;
    scanf("%ld", &k);

    vector<string> vv;

    long i;
    for(i=0; i<len; i++) {
        long k;
        for(k=0; k<5; k++) {
            if(i+k<len) {
                vv.push_back( string(str).substr(i,k+1) );
            }
        }
    }
    sort(vv.begin(), vv.end());
    unique(vv.begin(), vv.end());

    printf("%s\n", vv[k-1].c_str());

    return 0;
}


Measured memory_bytes: 1660
let print_array l = Array.fold_left (fun x y -> (if x = "" then "" else x^" ")^(string_of_int y)) "" l
                    |> print_endline;;
let to_list s = Str.split (Str.regexp_string " ") s |> List.map (fun x -> int_of_string x) |> Array.of_list;;

let rec sort l = function
    i when i = Array.length l -> print_array l;l
  | i -> print_array l;
         let key = l.(i) in
         let rec insert l2 = function
             j when j < 0 || l2.(j) <= key -> l2.(j+1) <- key; l2
           | j -> l2.(j+1) <- l2.(j); insert l2 (j-1)
         in sort (insert l (i-1)) (i+1);;

let _ = read_int () and
    a = read_line () |> to_list;;

let _ = sort a 1;;

Measured memory_bytes: 4344
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include <string.h>
#include <iomanip>
using namespace std;
#define int long long
#define ull unsigned long long
#define F first
#define S second
#define nl "\n"
#define ld long double
#define div 1000000007
#define pi 3.14159265358979323846

void solve()
{
    int r;cin>>r;
    double ans=2*pi*r;
    cout<<fixed<<setprecision(2)<<ans<<nl;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t=1;
    //cin>>t;
    //int i=1;
    while(t--)
    {
        //cout<<"Case #"<<i<<": ";
        solve();
        //i++;
    }
    return 0;
}


Measured memory_bytes: 3796
#include <iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	long long sum = 0;
	while(n--)
	    {
	    	long long l,r;
	    	cin >> l >> r;
	    	sum = sum + (r - l) + 1;
		}
	cout << sum << endl; 
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int n;
    cin >> n;
    vector<int> arr(n, 0);
    unordered_map<int, int> cnt;
    for(int i = 0; i < n; i++) {
        cin >> arr[i];
        cnt[arr[i]] += 1;
    }
    // cout << (1 ^ 8 == 9) << endl;
    if (cnt.size() == 1 && cnt.begin()->first == 0) {
        cout << "Yes" << endl;
        return 0;
    }
    if ((n % 3) != 0) {
        cout << "No" << endl;
        return 0;
    }
    int target = n / 3;
    vector<int> ans = {};
    for(auto& p: cnt) {
        if (p.second % target != 0) {
            cout << "No" << endl;
            return 0;
        } else {
            while (p.second > 0) {
                ans.push_back(p.first);
                p.second -= target;
            }
        }
    }
    if ((ans[0] ^ ans[1]) == ans[2]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 4004
#include<bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define int         ll int
#define float       double
#define	endl		'\n'
#define mii         map<int,int>
#define msi         map<string,int>
#define mis         map< int, string>
#define mpi         map<pair< int, int>, int>
#define pii         pair< int, int>
#define vi          vector< int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
using namespace std;
 
#define N  100005

signed main()
{
      int n;
      cin>>n;
      int a=log(1000000000000)/log(2);
      int dp[a];
      dp[0]=1;
      dp[1]=3;
      for(int i=2;i<=a;i++)
      {
      	dp[i]=2*dp[i-1]+1;
	  }
	  int x=log(n)/log(2);
	  cout<<dp[x];
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
struct initon
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define pb push_back
#define pob pop_back
#define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
signed main(){
    string s[3];
    int a=0;
    cin >> s[0]>>s[1]>>s[2];
  REP(i,300){
    if(s[a].size()==0){
      if(a==0){
      cout << 'A';
      }else if (a==1){
      cout << 'B';
      }else if(a==2){
      cout << 'C';
      }
      return 0;   
    }else if(s[a][0]=='a'){
      s[a].erase(s[a].begin());
      a=0;
    }else if(s[a][0]=='b'){
      s[a].erase(s[a].begin());
      a=1;
    }else if(s[a][0]=='c'){
      s[a].erase(s[a].begin());
      a=2;
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define MOD 1000000007
#define pb push_back
#define cy cout<<"Yes\n"
#define cn cout<<"No\n"
typedef unsigned long long int ull;
typedef long long int ll;

int main()
{
   int a;
   cin>>a;
   cout<<a+a*a+a*a*a<<endl;
}


Measured memory_bytes: 3628
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    let (a, b, _c, k) = {
        let v: Vec<i64> = buf.split_whitespace().map(|x| x.parse().unwrap()).collect();
        (v[0], v[1], v[2], v[3])
    };
    println!("{}", if k % 2 == 0 { a - b } else { b - a });
}


Measured memory_bytes: 4352
#include <iostream>

using namespace std;

int main() {
    int N;
    cin >> N;
    long long int ans=0;
    for(int n=0; n<N; n++) {
        long long int A;
        cin >> A;
        while(A%2==0) {
            ans++;
            A/=2;
        }
    }
    
    cout << ans << endl;



    return 0;
    
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
long long MX = 1.0e18;

int main() {
    ll a[200000];
    ll n;
    ll ans = 1;
    bool zero = false;
    cin >> n;
    rep(i, n) {
        cin >> a[i];
        if (a[i] == 0) zero = true;
    }
    // ゼロかどうかの判定
    if (zero) {
        cout << 0 << endl;
        return 0;
    }
    rep(i, n) {
        // 最大かどうかの判定
        if (MX / ans < a[i]) {
            cout << -1 << endl;
            return 0;
        }
        ans *= a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4336
#include <stdio.h>

int main()
{
    long h, sum=0;
    int i, n;
    scanf("%ld %d", &h, &n);
    int a[n];
    for (i = 0; i < n; ++i) {
		scanf("%d", &a[i]);
		sum += a[i];
    }
    if (h - sum <= 0)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}


Measured memory_bytes: 512
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        var t1 = new int[] { 1, 5, 10, 50, 100, 500, 1000 };
        var t2 = new char[] { 'I', 'V', 'X', 'L', 'C', 'D', 'M' };
        var d = new Dictionary<char, int>();
        for (int i = 0; i < 7; i++) d[t2[i]] = t1[i];
        string line;
        for (; (line = Console.ReadLine()) != null;)
        {
            var s = line.Trim();
            Console.WriteLine(changeRoman(d, s));
        }
    }
    public static int changeRoman(Dictionary<char, int> d, string s)
    {
        var res = 0;
        var pre = d[s[0]];
        for (int i = 1; i < s.Length; i++)
        {
            if (pre == -1) pre = d[s[i]];
            else if (pre < d[s[i]]) { res += d[s[i]] - pre; pre = -1; }
            else { res += pre; pre = d[s[i]]; }
        }
        if (pre > 0) res += pre;
        return res;
    }
}

Measured memory_bytes: 9520
N = gets.chomp.to_i
D, X = gets.chomp.split(" ").map(&:to_i)
A = []
N.times do
  A << gets.chomp.to_i
end

cnt = X
(1..D).each do |i|
  A.each do |a|
    cnt += 1 if i % a == 1 or a == 1
  end
end

puts cnt

Measured memory_bytes: 1788
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;

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

    int ans = 1;
    char before = S[0];
    for (int i = 0; i < N; i++) {
        char curr = S[i];
        if (curr != before) ans++;
        before = curr;
    }

    cout << ans << endl;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(int i = a;i < n;i++)
#define LINF (ll)1e17
#define INF 1e9
#define MOD 1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
}


signed main(){
	
	
	ll n,m,a,b;
	string s;
	
	
	
	
	cin >> n >> m;
	
	cin >> s;
	
	ll cnt[n] = {0};
	
	cnt[0] = 0;
	
	rep(i,0,n){
		if(i > 0){
			cnt[i] = cnt[i-1];
			if(s[i] == 'C' && s[i-1] == 'A') cnt[i]++;
		}
	}
	
	rep(i,0,m){
		cin >> a >> b;
		cout << cnt[b-1] - cnt[a-1] << endl;
	}
	
	return 0;

}

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

int main(){

    int N, A, B;
    cin >> N >> A >> B;

    int max_num = 0, min_num = 0;
    max_num = min(A, B);
    if(A + B > N) min_num = A + B - N;

    cout << max_num << " " << min_num << endl;

    return 0;
}

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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;

LL GCD(LL a,LL b){
    LL t; LL r;
    if(a<b){t=a;a=b;b=t;}
    if(b==0){return a;}
    while(a%b!=0){r=a%b;a=b;b=r;}
    return b;
}

LL LCM(LL a,LL b){LL ab=(a*b);return ab/GCD(a%b,b);}

LL num_divisible2(LL n){
    LL tmp = n;
    LL cnt=0;
    while(tmp%2==0){
        tmp/=2;
        cnt++;
    }
    return cnt;
}

int main(){
    int n,m;
    cin>>n>>m;
    Vll a(n),a_div2(n);
    REP(i,n){
        cin>>a[i];
        a_div2[i] = a[i]/2;
    }

    bool flag = false;
    LL tmp = num_divisible2(a[0]);
    REP2(i,1,n){
        if(tmp!=num_divisible2(a[i])){
            cout<<0<<endl;
            return 0;
        }
    }
    

    LL T = 1;
    REP(i,n){
        T = LCM(T,a_div2[i]);
        if(m<T){
            cout<<0<<endl;
            return 0;
        }
    }

    LL p = 1;
    LL cnt = 0;
    while(T*p<=m){
        cnt++;
        p+=2;
    }

    cout<<cnt<<endl;

    return 0;
}

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

#define LIM 2000000

using namespace std;

int main(){

	bool nprime[LIM]={0};
	
	for(int i=2; i<LIM; ++i){
		
		if(!nprime[i]){
			for(int j=i+i; j<LIM; j+=i){
				nprime[j]=true;
			}
		}
	}
	
	vector<int> p;
	
	for(int i=2; i<LIM; ++i){
		if(!nprime[i]){
			p.push_back(i);
		}
	}
	
	int k;
	
	while(cin >> k, k){
		
		vector<int>::iterator it = lower_bound(p.begin(), p.end(), k);
		
		if(*it==k)
			cout << 0 << endl;
		else
			cout << *it - *(it-1) << endl;
	}
	
	return 0;
}
	

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

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 3140
using System;

public class ACSMBC_A
{
    public static void Main()
    {
        string[] date1 = Console.ReadLine().Split(' ');
        string[] date2 = Console.ReadLine().Split(' ');

        if(date1[0] != date2[0] && int.Parse(date2[1]) == 1 )
            Console.WriteLine(1);
        else Console.WriteLine(0);
    }
}

Measured memory_bytes: 11092
#include <iostream>
using namespace std;
int main(){
  long long n;
  cin >> n;
  long long a_S=1,b_S=1;
  for(int i = 0; n > i; i++){
    long long a,b;
    cin >> a >> b;
    if(a >= a_S && b >= b_S){
      a_S=a;
      b_S=b;
      continue;
    }else if(a < a_S && b < b_S){
      //aa = a_S
      long long aa = a_S / a + (a_S % a == 0 ? 0 : 1);
      long long bb = b_S / b + (b_S % b == 0 ? 0 : 1);
      if(aa > bb){
        a_S = aa*a;
        b_S = aa*b;
      } else {
        a_S = bb*a;
        b_S = bb*b;
      }
    }else if(a < a_S){
      //b_Sonly
      long long aa = a_S / a + (a_S % a == 0 ? 0 : 1);
      a_S = aa*a;
      b_S = aa*b;
    }else{
      //a_Sonly
      long long aa = b_S / b + (b_S % b == 0 ? 0 : 1);
      b_S = aa*b;
      a_S = aa*a;
    }
  }
  cout << a_S + b_S << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n;
  cin >> n;
  vi a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  ll l = 2, r = 2;
  bool ok = 2 % a.back() == 0;
  for (int i = n-1; i > 0; --i) {
//    cerr << l << ' ' << r << endl;
    l = (l + a[i-1] - 1) / a[i-1] * a[i-1];
    r = (r + a[i] - 1) / a[i-1] * a[i-1];
    if (r < l) ok = 0;
  }
  r += a[0] - 1;
  if (ok) cout << l << ' ' << r << endl;
  else cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
using namespace std;
 
int main() {
    string s;
  	cin >> s;
  	int cost = 700;
  	if (s[0] == 'o') cost = cost + 100;
  	if (s[1] == 'o') cost = cost + 100;
    if (s[2] == 'o') cost = cost + 100;
  	cout << cost << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <climits>
//#include <priority_queue>
using namespace std;
#define ll long long
#define x first
#define y second
#define pii pair<int, int>
#define pdd pair<double, double>
#define L(s) (int)(s).size()
#define VI vector<int>
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define inf 1000000000
int n;
int tt, xx, yy;
int main() {
  scanf("%d", &n);
  while(n--) {
    int t, x, y;
    scanf("%d%d%d", &t, &x, &y);
    if (abs(xx - x) + abs(yy - y) > t - tt) {
      cout << "No\n";
      return 0;
    }
    if ((abs(x - xx) + abs(y - yy)) % 2 != (t - tt) % 2) {
      cout << "No\n";
      return 0;
    }
    tt = t;
    xx = x;
    yy = y;
  }
  cout << "Yes\n";
}

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

const int Maxn = 200005;
int n, a[Maxn];
map <int, int> Ma[Maxn];
int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	for (int i = 1; i < n; i++)
		if (a[i] >= a[i + 1]) goto A;
	puts("1");
	return 0;
	A:int l = 2, r = n;
	while (l + 1 <= r)
	{
		int mid = (l + r) >> 1;
		for (int i = 1; i < n; i++)
		{
			Ma[i + 1] = Ma[i];
			if (a[i] >= a[i + 1])
			{
				while (Ma[i + 1].size() && Ma[i + 1].rbegin() -> first > a[i + 1]) Ma[i + 1].erase(--Ma[i + 1].end());
				Ma[i + 1][a[i + 1]]++;
				int pnt = a[i + 1];
				while (Ma[i + 1][pnt] == mid)
				{
					if (pnt == 1)
					{
						l = mid + 1;
						goto END;
					}
					Ma[i + 1][pnt] = 0, Ma[i + 1][pnt - 1]++;
					pnt--;
				}
			}
		}
		r = mid;
		END:;
	}
	printf("%d", l);
	return 0;
}


Measured memory_bytes: 118784
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>


using namespace std;


typedef pair<int, int> P;

bool pairCompare(const P& firstElof, const P& secondElof)
{
    return firstElof.second > secondElof.second;
}

int main()
{
    int N;
    cin >> N;
    map<string, vector<pair<int, int>>> mp;
    for(int i=1; i<=N; i++){
        string s;
        int num;
        cin >> s>> num;
        mp[s].push_back(make_pair(i, num));
    }

    for(auto& n : mp){
        sort(n.second.begin(), n.second.end(), pairCompare);
        for(auto& vec : n.second)
            cout << vec.first << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
int main ()
{
    int n, o=0;
    scanf ("%d", &n);
    int a[n];
    for (int i=0;i<n;i++) {
        scanf ("%d", &a[i]);
        if (a[i]%2==1) o++;
    }
    if (o%2==1) printf ("NO");
    else printf ("YES");
    return 0;
}


Measured memory_bytes: 2120
from math import sqrt
def cross(P0, P1, P2):
    x0, y0 = P0; x1, y1 = P1; x2, y2 = P2
    x1 -= x0; x2 -= x0
    y1 -= y0; y2 -= y0
    return x1*y2 - x2*y1

def dot(P0, P1, P2):
    x0, y0 = P0; x1, y1 = P1; x2, y2 = P2
    x1 -= x0; x2 -= x0
    y1 -= y0; y2 -= y0
    return x1*x2 + y1*y2

def dist2(P0, P1):
    x0, y0 = P0; x1, y1 = P1
    return (x1 - x0)**2 + (y1 - y0)**2

def collision_ll(S0, S1, T0, T1):
    return cross(S0, S1, T0)*cross(S0, S1, T1) < 0 and cross(T0, T1, S0) * cross(T0, T1, S1) < 0

def dist_lp(S, E, P):
    dd = dist2(S, E)
    if 0 <= dot(S, E, P) <= dd:
        return abs(cross(S, E, P))/sqrt(dd)
    return sqrt(min(dist2(S, P), dist2(E, P)))

def dist_ll(S0, S1, T0, T1):
    if collision_ll(S0, S1, T0, T1):
        return 0
    return min(
            dist_lp(S0, S1, T0),
            dist_lp(S0, S1, T1),
            dist_lp(T0, T1, S0),
            dist_lp(T0, T1, S1)
            )

n = int(input())
for i in range(n):
    x0, y0, x1, y1, X0, Y0, X1, Y1 = map(int, input().split())
    print("%.010f" % dist_ll((x0, y0), (x1, y1), (X0, Y0), (X1, Y1)))

Measured memory_bytes: 7920
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

ll mod = 1e9 + 7;

//zaki_UnionFind
class UnionFind
{
    std::vector<int> data;

  public:
    UnionFind(int size) : data(size, -1) {}
    bool unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x != y)
        {
            if (data[y] < data[x])
                std::swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    bool find(int x, int y)
    {
        return root(x) == root(y);
    }
    int root(int x)
    {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x)
    {
        return -data[root(x)];
    }
};

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

  ll n, m;
  cin >> n >> m;
  vector<P> p;
  ll a, b;
  REP(i, m){
    cin >> a >> b;
    a--;
    b--;
    p.push_back(P(a, b));
  }
  UnionFind uf(2 * n);

  int di = 1;

  REP(i, m){
    a = p[i].first, b = p[i].second;
    if(uf.find(a, b)){
      di = 0;
      break;
    }
    uf.unite(a, b + n);
    uf.unite(b, a + n);
  }
  ll ans;
  if(di){
    ll col1 = 0, col2;
    a = p[0].first;
    REP(i, n){
      if(uf.find(a, i)) col1++;
    }
    col2 = n - col1;
    ans = col1 * col2 - m;
  }
  else{
    ans = n * (n - 1) / 2 - m;
  }
  cout << ans << endl;

  return 0;
}


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

int     main() {
        int N;
        cin >>N;
        vector<double> v(N);
        for (int i=0; i<N; i++)
                cin >>v.at(i);
        sort(v.begin(), v.end());
        for (int i=1; i<=N-1; i++) {
                v.at(i) +=v.at(i-1);
                v.at(i) /=2;
        }
        cout << v.at(N-1) << endl;
        return 0;
};

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

int main()
{
	int n, m;
	int A[100][100] = { 0 }; //n,m
	int b[100] = { 0 }; //m
	int c[100] = { 0 };

	cin >> n >> m;

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cin >> A[i][j];
		}
	}
	
	for (int j = 0; j < m; j++)
	{
		cin >> b[j];
	}


	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			c[i] += A[i][j] * b[j];
		}
		cout << c[i] << "\n";
	}
	return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++) 
#define ll long long
#define ld long double
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)  
#define outdeb(fir, sec, thr) cout << fir << ":" << sec << ":" << thr << endl
#define DEV_VAL (1000000000 + 7)

int main()
{
  int h, w, k;
  cin >> h >> w >> k;
  int ans = 0;
  string data[6];

  rep(i, h)
  {
    string tmp;
    cin >> tmp;
    data[i] = tmp;
  }

  int hmax = pow(2,h);
  int wmax = pow(2,w);
  rep(hdef, hmax)
  {
    rep(wdef, wmax)
    {
      int count = 0;
      rep(y, h)
      {
        if(hdef & (1 << y))
        {
          continue;
        }

        rep(x, w)
        {
          if(wdef & (1 << x))
          {
            continue;
          }
          if(data[y][x] == '#')
          {
            count++;
          }
        }
      }
      if(count == k)
      {
        ans++;
      }
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4108
//This code was made by Chinese_zjc_.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<map>
#define int long long
#define INF 0x3fffffffffffffff
#define MOD 998244353
using namespace std;
int n,m,k,ans,d[200001],p[200001];
int power(int a,int b,int c)
{
	int tmp=1;
	while(b)
	{
		if(b&1)
		{
			tmp=(tmp*a)%c;
		}
		a=(a*a)%c;
		b>>=1;
	}
	return tmp;
}
int C(int n,int m)
{
	return d[n]*p[n-m]%MOD*p[m]%MOD;
}
int s(int n,int m)
{
	return m*power(m-1,n-1,MOD)%MOD;
//	int dp[2][200001];
//	fill(dp[1]+1,dp[1]+1+m,1);
//	for(int i=2;i<=n;++i)
//	{
//		for(int j=1;j<=m;++j)
//		{
//			dp[i&1][j]=0;
//			for(int k=1;k<=m;++k)
//			{
//				if(j==k)
//				{
//					continue;
//				}
//				dp[i&1][j]+=dp[!(i&1)][k];
//			}
//		}
//	}
//	int tmp=0;
//	for(int i=1;i<=m;++i)
//	{
//		tmp+=dp[n&1][i];
//	}
//	return tmp;
}
signed main()
{
	std::ios::sync_with_stdio(false);
//	for(int i=1;i<=10;++i)
//	{
//		for(int j=1;j<=10;++j)
//		{
//			cout<<s(i,j)<<' ';
//		}
//		cout<<endl;
//	}
	cin>>n>>m>>k;
	d[0]=1;
	p[0]=1;
	for(int i=1;i<=n;++i)
	{
		d[i]=d[i-1]*i%MOD;
		p[i]=power(d[i],MOD-2,MOD);
	}
	for(int i=0;i<=k;++i)
	{
		ans=(ans+s(n-i,m)*C(n-1,n-i-1)%MOD)%MOD;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 6668
// Problem : B - Mix Juice
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define debug(x) cerr << #x << " = " << x << '\n'
#define debug_arr(a , n) for(int i = 0 ; i < n ; i++)cerr << a[i] << " "
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll> 
#define all(x) (x).begin() , (x).end()
#define inf 1000000000
#define mod 1000000007

const int max_n = 1e5 + 9;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
int main()
{
    int n , k;
    cin >> n >> k;
    
    vi a(n);
    for(int i = 0 ; i < n ; i++)cin >> a[i];
    
    sort(all(a));
    
    int sum = 0;
    for(int i = 0 ; i < k ; i++){
    	sum += a[i];
    }
    
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3628
from collections import deque
n,k = map(int, input().split())
a=[-1]
a.extend(list(map(int, input().split())))
route=[-1]*(n+1)
q=deque([1])
cnt=0
roop=0
while q:
  p=q.pop()
  route[p]=cnt
  if route[a[p]] == -1:
    q.append(a[p])
    cnt+=1
  else:
    roop=[route[a[p]],route[p]]
    break

if k <= min(roop):
  for i,r in enumerate(route[1:],start=1):
    if r == k:
      print(i)
else:
  t=(k-min(roop))%(max(roop)-min(roop)+1)
  for i,r in enumerate(route[1:],start=1):
    if r == t+min(roop):
      print(i)

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

#define ll long long
#define fast_io ios::sync_with_stdio(0); cin.tie(0)
#define infl 1e18L+9
#define inf 1e9L+9
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()

const int mod=1e9L+7; 

void solve(){
  int a,b; 
  cin>>a>>b; 
  int cur=1; 
  int ans=0; 
  while(cur<b){
    ans++; 
    cur+=a-1; 
  }
  cout<<ans<<endl; 
}

int main()
{
	fast_io;
	clock_t beg=clock(); 
	solve(); 
	clock_t end=clock(); 
	fprintf(stderr,"%.2lf sec\n",(double)(end-beg)/CLOCKS_PER_SEC); 
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    
    int A[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    
    int count = 0;
    
    for(int i = 0; i < N; i++){
        int minj = i;
        
        for(int j = i; j < N; j++){
            if(A[j] < A[minj]){
                minj = j;
            }
        }
        int B = A[i];
        A[i] = A[minj];
        A[minj] = B;
        if(i != minj){
            count++;
        }
    }
    
    for(int i = 0; i < (N - 1); i++){
        cout << A[i] << " ";
    }
    
    cout << A[N - 1] << endl;
    cout << count << endl;
    
}


Measured memory_bytes: 3096
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		final int X = sc.nextInt();

		sc.close();

		int ans;

		for (int i = 1;; i++) {
			if (((1 + i) * i) / 2 >= X) {
				ans = i;
				break;
			}
		}

		out.println(ans);

	}

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


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

int main(){
	long X, Y, Z, K;
	vector<long> A, B, C, AB, ABC;

	cin >> X >> Y >> Z >> K;

	for(long i = 0; i < X; ++i){
		long Ai;
		cin >> Ai;
		A.push_back(Ai);
	}

	for(long i = 0; i < Y; ++i){
		long Bi;
		cin >> Bi;
		B.push_back(Bi);
	}

	for(long i = 0; i < Z; ++i){
		long Ci;
		cin >> Ci;
		C.push_back(Ci);
	}

	sort(A.begin(), A.end(), greater<long>());
	sort(B.begin(), B.end(), greater<long>());
	sort(C.begin(), C.end(), greater<long>());

	for(long i = 0; i < X; ++i){
		for(long j = 0; j < Y; ++j){
			AB.push_back(A[i]+B[j]);
		}
	}

	sort(AB.begin(), AB.end(), greater<long>());

	for(int i = 0; i < min(Z, K); ++i){
		for(int j = 0; j < min(K, X*Y); ++j){
			ABC.push_back(C[i]+AB[j]);
		}
	}
	sort(ABC.begin(), ABC.end(), greater<long>());

	for(int i = 0; i < K; ++i){
		cout << ABC[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 43128
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < s.size(); i++)
    {
        char c = s[i];
        if(c == 'A' || c == 'G' || c == 'C' || c == 'T')
        {
            int count = 1;
            for(int j = i+1; j < s.size(); j++)
            {
                char cand = s[j];
                if(cand == 'A' || cand == 'G' || cand == 'C' || cand == 'T')
                {
                    count++;
                }
                else
                {
                    break;
                }
            }
            ans = max(ans, count);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
# coding:utf-8

import sys
from collections import Counter


input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7


def inpl(): return list(map(int, input().split()))


D = int(input())
if D == 25:
    print('Christmas')
elif D == 24:
    print('Christmas Eve')
elif D == 23:
    print('Christmas Eve Eve')
else:
    print('Christmas Eve Eve Eve')



Measured memory_bytes: 3444