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

int main()
{
    string s, t;
    cin >> s >> t;
    int n = s.size();
    vector<int> x(26);
    vector<int> y(26);
    for (int i = 0; i < n; i++)
    {
        char ccc = 'a';
        for (int j = 0; j < 26; j++)
        {
            if (s[i] == ccc)
            {
                x.at(j)++;
                break;
            }
            ccc++;
        }
    }
    for (int i = 0; i < n; i++)
    {
        char ccc = 'a';
        for (int j = 0; j < 26; j++)
        {
            if (t[i] == ccc)
            {
                y.at(j)++;
                break;
            }
            ccc++;
        }
    }
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    int count = 0;
    for (int i = 0; i < 26;i++)
    {
        if (x[i] == y[i])
        {
            count++;
        }
    }
    if(count==26){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}


Measured memory_bytes: 776
#ifndef call_from_test
#include<bits/stdc++.h>
using namespace std;
#endif
//BEGIN CUT HERE
template<typename T>
struct DiameterForVertex{
  vector<T> vs,dp;
  vector<vector<int> > G;
  DiameterForVertex(int n):dp(n),G(n){}
  DiameterForVertex(vector<T> vs):vs(vs),dp(vs.size()),G(vs.size()){}

  void add_edge(int u,int v){
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  }

  void dfs(int v,int p,int &s){
    if(p<0) dp[v]=T(0);
    dp[v]+=vs[v];
    if(dp[s]<dp[v]) s=v;
    for(int u:G[v]){
      if(u==p) continue;
      dp[u]=dp[v];
      dfs(u,v,s);
    }
  }

  T build(){
    assert(!vs.empty());
    int s=0;
    dfs(s,-1,s);
    dfs(s,-1,s);
    return dp[s];
  }

  T build(vector<T> us){
    assert(us.size()==dp.size());
    vs=us;
    return build();
  }
};
//END CUT HERE
#ifndef call_from_test

// test build with argument vector<T>
signed ARC097_F(){
  int n;
  cin>>n;
  DiameterForVertex<int> G(n);
  vector<int> deg(n,0);
  for(int i=1;i<n;i++){
    int x,y;
    cin>>x>>y;
    x--;y--;
    G.add_edge(x,y);
    deg[x]++;
    deg[y]++;
  }

  string s;
  cin>>s;

  int cnt=(n-1)*2,num=0;
  queue<int> que;
  vector<int> dead(n,0);
  for(int i=0;i<n;i++){
    num+=(s[i]=='W');
    if((deg[i]==1)&&(s[i]=='B')){
      dead[i]=1;
      que.emplace(i);
    }
  }

  while(!que.empty()){
    int v=que.front();que.pop();
    cnt-=2;
    for(int u:G.G[v]){
      if(dead[u]) continue;
      deg[u]--;
      if(deg[u]==1&&(s[u]=='B')){
        dead[u]=1;
        que.emplace(u);
      }
    }
  }

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

  vector<int> vs(n,0);
  for(int i=0;i<n;i++){
    if(dead[i]) continue;
    vs[i]=deg[i]+(s[i]=='W');
    vs[i]%=2;
    cnt+=vs[i];
  }

  cout<<cnt-G.build(vs)*2<<endl;
  return 0;
}
/*
  verified on 2019/12/27
  https://atcoder.jp/contests/arc097/tasks/arc097_d
*/

signed main(){
  ARC097_F();
  return 0;
}
#endif


Measured memory_bytes: 11648
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
a = s[k-1]
print(a)

Measured memory_bytes: 3064
using System;
using System.Linq;

namespace ABC
{
    using System.Collections.Generic;
#if USE_STUB
    using static Stub.Console;
#else
    using static System.Console;
#endif
    using static System.Math;
    public class Program
    {
        private const int MOD = 1000000007;

        static long H;
        static long W;
        static char[][] S;
        static long[,] U, D, L, R;

        static void Main(string[] args)
        {
            WriteLine(Solve());
        }

        public static object Solve()
        {
            var hw = ReadLine().Split().Select(int.Parse).ToArray();
            H = hw[0];
            W = hw[1];
            S = new char[H][];
            for (int i = 0; i < H; i++)
            {
                S[i] = ReadLine().ToCharArray();
            }
            U = new long[H, W];
            D = new long[H, W];
            R = new long[H, W];
            L = new long[H, W];
            for (int row = 0; row < H; row++)
            {
                for (int col = 0; col < W; col++)
                {
                    // Up
                    {
                        var r = row;
                        var c = col;
                        var before = row == 0 ? 0 : U[r - 1, c];
                        if (S[r][c] == '.')
                            U[r, c] = 1 + before;
                    }
                    // Down
                    {
                        var r = H - row - 1;
                        var c = col;
                        var before = row == 0 ? 0 : D[r + 1, c];
                        if (S[r][c] == '.')
                            D[r, c] = 1 + before;
                    }
                    // Left
                    {
                        var r = row;
                        var c = col;
                        var before = col == 0 ? 0 : L[r, c - 1];
                        if (S[r][c] == '.')
                            L[r, c] = 1 + before;
                    }
                    // Right
                    {
                        var r = row;
                        var c = W - col - 1;
                        var before = col == 0 ? 0 : R[r, c + 1];
                        if (S[r][c] == '.')
                            R[r, c] = 1 + before;
                    }
                }
            }

            var ans = 0L;
            for (int r = 0; r < H; r++)
            {
                for (int c = 0; c < W; c++)
                {
                    ans = Math.Max(ans, U[r, c] + D[r, c] + R[r, c] + L[r, c] - 3);
                }
            }
            return ans;
        }
    }
}


Measured memory_bytes: 155316
#include<stdio.h>

int main(){
    int x,y;
    char op;
    while(scanf("%d %c %d",&x,&op,&y) && op !='?'){
        if(op == '+'){
            printf("%d\n",x+y);
        } else if(op == '-'){
            printf("%d\n",x-y);
        } else if(op == '*'){
            printf("%d\n",x*y);
        } else if(op == '/'){
            printf("%d\n",x/y);
        }
    }
    return 0;
}



Measured memory_bytes: 2688
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using namespace std;
using namespace boost::multiprecision;

typedef long long ll;
typedef long double ld;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mis map<int,string>
#define msi map<string,int>
#define mll map<ll,ll>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep1(i,n) for(int i=1; i<=(int)(n); i++)
#define all(c) c.begin(),c.end()
#define srta(a) sort(all(a))
#define srtd(a) sort(all(a),greater<型>())
#define rvs(s) reverse(all(s))
#define psb push_back
#define ppb pop_back
#define isu isupper
#define isl islower
#define lb(a,k) lower_bound(all(a),k)
#define ub(a,k) upper_bound(all(a),k)
#define bs(a,k) binary_search(all(a),k)
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const int I_INF = 1001001001;
const ll LL_INF = 1001001001001001001;
const ld EPS = 0.001;

ll f(ll x) {
    if (x == 0) return 0;
    return f(x%popcountll(x))+1;
}

int main() {
    ll N;
    string s;
    cin >> N >> s;

    vl a(N);
    ll pc = 0;
    rep (i, N) {
        a[i] = s[i]-'0';
        if (a[i] == 1) pc++;
    }

    vl ans(N);
    rep (b, 2) {
        ll xpc = pc;
        if (b == 0) xpc++; else xpc--;
        if (xpc <= 0) continue;

        ll rem = 0;
        rep (i, N) {
            rem = rem*2%xpc;
            rem += a[i];
        }

        ll m = 1;
        rep (i, N) {
            ll xrem = rem;
            if (b == 1 && a[N-1-i] == 1) {
                xrem = (xrem-m)%xpc;
                xrem = xrem < 0 ? xrem+xpc : xrem;
                ans[N-1-i] = f(xrem)+1;
            } else if (b == 0 && a[N-1-i] == 0) {
                xrem = (xrem+m)%xpc;
                ans[N-1-i] = f(xrem)+1;
            }

            m = m*2%xpc;
        }
    }

    rep (i, N) cout << ans[i] << endl;
}


Measured memory_bytes: 6804
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  int h, w, f, s,k, ans = 0;
  cin >> h >> w;
  char a[h][w];
  int b[h][w];
  fill((int*) b, (int*) b[h], 0);
  rep(i,h)
    cin >> a[i];
  rep(i,h)
  {
    f = -1;
    s = 0;
    rep(j,w)
    {
      if (a[i][j] != '#') {
        if (b[i][j] == 0) {
          k = i;
          while (a[k][j] != '#' && k < h) {
            b[i][j]++;
            k++;
          }
          for (int l = i + 1; l < k; l++){
            b[l][j] = b[i][j];
          }
        }

        if (f < j) {
          k = j;
          while (a[i][k] != '#' && k < w) {
            b[i][j]++;
            k++;
          }
          f = k;
          s = k - j;
        } else{
          cout << (i<-1?0:""); //原因不明エラー発生のため苦肉の策。なぜかiが0になる
          b[i][j] += s;
        }
        ans = max(ans, b[i][j]);
      }
    }
  }
  cout << ans - 1;
}


Measured memory_bytes: 19712
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define p (int)(998244353)

int MOD(int a){
	return (a %= p) >= 0 ? a : a + p;
}

int power(int a, int N){
	if(N == 0) return 1;
	else if(N % 2 == 0) return power(MOD(a * a), N / 2);
	else return MOD(a * power(a, N - 1));
}

int inverse(int a){
	return power(a, p - 2);
}

int fact(int N){
	static vector<int> _fact(1, 1);
	for(int i = _fact.size(); i <= N; i++){
		_fact.push_back(MOD(i * _fact[i - 1]));
	}
	return _fact[N];
}
 
int fact_inv(int N){
	static vector<int> inv(2, 1), _fact_inv(2, 1);
	for(int i = inv.size(); i <= N; i++){
		inv.push_back(MOD(-(p / i) * inv[p % i]));
		_fact_inv.push_back(MOD(inv[i] * _fact_inv[i - 1]));
	}
	return _fact_inv[N];
}
 
int combination(int N, int k){
	if(k < 0 || N < k || N < 0) return 0;
	else return MOD(fact(N) * MOD(fact_inv(N - k) * fact_inv(k)));
}

signed main(){
	int N, M, K, i, ans = 0;
	scanf("%lld%lld%lld", &N, &M, &K);
	for(i = 0; i <= K; i++){
		ans = MOD(ans + M * MOD(combination(N - 1, i) * power(M - 1, N - 1 - i)));
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 9808
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define all(x) (x).begin(), (x).end()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end());

int main() {
  ll X;
  cin >> X;

  ll tmp = 100;
  ll i = 0;
  while (tmp < X) {
    tmp = (ll)(tmp * (1 + 0.01));
    // cout << tmp << endl;
    i++;
  }

  cout << i << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    string a;
    cin >> a;
    sort(a.begin(), a.end());
    if (a[0] == a[1] && a[2] == a[3] && a[0] != a[3])
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    boolean[] p;
    int m, a, b;

    void run(){
	p = new boolean[1000000];
	setP();
	while(sc.hasNext()){
	    m = sc.nextInt();
	    a = sc.nextInt();
	    b = sc.nextInt();

	    if(m!=0) solve();
	}
    }

    void solve(){
	double c = (double)a/b;
	int ans1 = -1;
	int ans2 = -1;
	int a = -1;
	for(int s=1; s<=m; s++)
	    if(p[s]){
		int t = m/s;
		while(t>=2){
		    if(p[t]){		
			double u = (double)s/t;
			if(s*t<=m && u<=1 && c<=u)
			    if(a < s*t){
				//System.out.println("**"+s+" "+t);
				ans1 = s;
				ans2 = t;
				a = s*t;
			    }
		    }
		    t--;
		}
	    }
	System.out.println(ans1+" "+ans2);
    }

    void setP(){
	Arrays.fill(p, true);
	p[0] = p[1] = false;
	for(int i=2; i<p.length; i++)
	    if(p[i])
		for(int k=i+i; k<p.length; k+=i)
		    p[k] = false;
    }
}

Measured memory_bytes: 29408
N=int(input())
zls=[0 for _ in range(N)]
wls=[0 for _ in range(N)]
for i in range(N):
  x,y=[int(s) for s in input().split()]
  zls[i]=x+y
  wls[i]=x-y
print(max([max(zls)-min(zls),max(wls)-min(wls)]))

Measured memory_bytes: 24984
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>

using namespace std;

int main(){

  string S; cin >> S;
  int w; cin >> w;

  for (int i = 0; i < S.length(); i += w){
    cout << S[i];
  }
  cout << endl;
  

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
 
const long long mod = 1e9 + 7 ;
 
long long x, a, b;

bool check(long long y) {
	long long cnt = 0;
	long long res = y * a;
	while(y){
		cnt++;
		y/=10;
	}
	res+=cnt*b;
	return res <= x;
}
int main ( ) {

	
	string s;
	int n;
	cin >> n >> s;

	for(int i = 0; i < s.size(); i++)
		cout<<(char)((s[i]+n-'A')%26+'A');
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl
#define DOUBLE(d) cout << fixed << setprecision(15) << (d) << endl

int N, K;
int main() {
    cin >> N >> K;
    set<int> s;
    REP (i, K) {
        int d;
        cin >> d;
        REP (j, d) {
            int a;
            cin >> a;
            s.insert(a);
        }
    }
    cout << N-s.size() << endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
#define MAX 100

int graph[MAX+1][MAX+1];

int main(){
  int u,k,v,n,i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      if(graph[u][v] == 0)
        graph[u][v] = 1;
    }
  }

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      if(j<n){
      printf("%d ",graph[i][j]);
      }else{
      printf("%d\n",graph[i][j]);
      }
    }
  }
  return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#define INFTY 1000000001

using namespace std;

int cnt=0;

void merge(int A[], int left, int mid, int right){
  int n1 = mid - left;
  int n2 = right - mid;
  int L[n1], R[n2];
  int i, j, k;

  for(i = 0; i < n1; i++){
    L[i] = A[left+i];
  }
  for(i = 0; i < n2; i++){
    R[i] = A[mid+i];
  }

  L[n1] = INFTY;
  R[n2] = INFTY;
  i=0; j=0;

  for(k = left; k < right; k++){
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }
    else{
      A[k] = R[j];
      j++;
    }
    cnt++;
  }
}

void mergeSort(int A[], int left, int right){
  if(left+1 < right){
    int mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int main(){
  int n, S[500000];

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

  mergeSort(S, 0, n);

  for(int i = 0; i < n; i++){
    if(i > 0){ cout << " "; }
    cout << S[i];
  }
  cout << endl << cnt << endl;
  
  return 0;
}



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

int main() {
  int S, f, b;
  cin >> S;
  f = S / 100;
  b = S % 100;
  if (f <= 12 && b <= 12) {
    if (f != 0 && b != 0) {
      cout << "AMBIGUOUS" << endl;
    } else if (f == 0 && b != 0) {
      cout << "YYMM" << endl;
    } else if (f != 0 && b == 0) {
      cout << "MMYY" << endl;
    } else {
      cout << "NA" << endl;
    }
  } else if (f <= 12 && b > 12) {
      if (f != 0) {
        cout << "MMYY" << endl;
      } else {
        cout << "NA" << endl;
      }
  } else if (f > 12 && b <= 12) {
      if (b != 0) {
        cout << "YYMM" << endl;
      } else {
        cout << "NA" << endl;
      }
  } else {
    cout << "NA" << endl;
  }
}

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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<long> A(N, 0), S(N + 1, 0);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        S[A[i]]++;
    }

    long res = 0;
    for(const auto &x: S) {
        res += (x * (x - 1)) / 2;
    }

    for(const auto &x: A) {
        int c = S[x];
        cout << res - (c - 1) << endl;
    }
}

Measured memory_bytes: 5760
from collections import deque

# 行列の高さH、幅W
h, w = map(int, input().split())
# 色の数N
n = int(input())
# それぞれの色を塗る枚数のリストa
a = list(map(int, input().split()))

# bに答えとなる行列を構築していく、最初は0埋めしておく
ans = [[0] * w for i in range(h)]


colors = deque()
for i in range(n):
    for j in range(a[i]):
        colors.append(i + 1)

# i = 0,1,2,...,h-1
# j = 0,1,2,...,w-1
# 偶数行目は左から詰める、奇数行目は右から詰める
for i in range(h):
    for j in range(w):
        if i % 2 == 0:
            ans[i][j] = colors.popleft()
        else:
            ans[i][w - 1 - j] = colors.popleft()

for i in range(h):
    print(*ans[i])


Measured memory_bytes: 9616
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();

		char[] charArray = new char[str.length()];
		for (int i = 0; i < str.length(); i++) {
			charArray[i] = str.charAt(i);
		}
		if (charArray[0] != 65) {
			System.out.println("WA");
		} else if (Character.isUpperCase(charArray[1])) {
			System.out.println("WA");

		} else {
			int count = 0;
			for (int i = 2; i < str.length() - 1; i++) {
				if (charArray[i] == 67) {
					count++;
				}
			}
			if (count == 1) {
				if (charArray[str.length() - 1] != 67 && Character.isLowerCase(charArray[str.length() - 1])) {
					System.out.println("AC");
				} else {
					System.out.println("WA");
				}
			} else {
				System.out.println("WA");
			}

		}

	}
}

Measured memory_bytes: 23764
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)
#define rrep(i, j, n) for (int i = (int)n - 1; j <= i; --i)

constexpr int INF = 0x3f3f3f3f;

int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  for (int& a : x) cin >> a;

  int ans = INF;
  rep(i, 1, 101) {
    int cnt = 0;
    rep(j, 0, n) { cnt += (x[j] - i) * (x[j] - i); }
    ans = min(ans, cnt);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3560
n = int(input())
p = [int(x) for x in input().split()]

ans = 0
seat = [[min(i, j, n-i-1, n-j-1) for j in range(n)] for i in range(n)]
reserved = [[True for j in range(n)] for i in range(n)]

vec = [(-1, 0), (1, 0), (0, -1), (0, 1)]

for i in range(n**2):
    v = p[i]-1
    x, y = v//n, v % n
    reserved[x][y] = False
    ans += seat[x][y]
    q = [(x, y)]
    while q:
        x, y = q.pop()
        if 0 <= x+1 < n and 0 <= y < n and seat[x+1][y] > seat[x][y] + reserved[x][y]:
            seat[x+1][y] = seat[x][y] + reserved[x][y]
            q.append((x+1, y))
        if 0 <= x-1 < n and 0 <= y < n and seat[x-1][y] > seat[x][y] + reserved[x][y]:
            seat[x-1][y] = seat[x][y] + reserved[x][y]
            q.append((x-1, y))
        if 0 <= x < n and 0 <= y+1 < n and seat[x][y+1] > seat[x][y] + reserved[x][y]:
            seat[x][y+1] = seat[x][y] + reserved[x][y]
            q.append((x, y+1))
        if 0 <= x < n and 0 <= y-1 < n and seat[x][y-1] > seat[x][y] + reserved[x][y]:
            seat[x][y-1] = seat[x][y] + reserved[x][y]
            q.append((x, y-1))


print(ans)


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

#define ll long long
#define pb push_back
#define mp make_pair
#define fo(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;


int main() {
    
    int n,m;
    cin>>n>>m;
    vi hi;
    vi res;
    fo(i,n){
        int num;
        cin>>num;
        hi.pb(num);
        res.pb(1);


        
    }
    fo(i,m){
        int a,b;
        cin>>a>>b;
        if(hi[a-1]>hi[b-1]){
            res[b-1]=0;


        }else if(hi[a-1]<hi[b-1]){
            res[a-1]=0;
        }else {
            res[b-1]=0;
                        res[a-1]=0;

        }
    }
    int cnt=0;
    fo(i,n){
        if(res[i]==1)cnt++;
    }
    cout<<cnt<<endl;
     

}




Measured memory_bytes: 4320
//template code, C343, 2019
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;

class Graph1 {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public Graph1() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	public void printAdjMatrix() {
		Integer[][] adjMatrix = new Integer[totalVertex][totalVertex];
		//complete the following
		int size = totalVertex;
		
		for(int i=0;i<size;i++) {
			for(int l =0; l<size;l++) {
				if(adjList.get(i).contains(l)) {
					adjMatrix[i][l]=1;
					System.out.print("1");
				}else {
					adjMatrix[i][l]=0;
					System.out.print("0");
				}
				if(l!=size-1) {
					System.out.print(" ");
				}
				
			}
			System.out.println();
		}
		
		
	}
}

//change class name GraphRepresentation to Main() for submission to AIZU
public class Main {
	public static void main(String argv[]) {
		Graph1 g = new Graph1();
		g.loadAdjList();
		g.printAdjMatrix();
	}
}


Measured memory_bytes: 33992
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int temp;
	vector<int> a; 

	for (int i = 0; i < 3; i++)
	{
		cin >> temp;
		a.push_back(temp);
	}

	sort(a.begin(), a.end());

	cout << a[0];

	for (int i = 1; i < 3; i++)
	{
		cout << " " << a[i];
	}

	cout << "\n";

	return 0;
}


Measured memory_bytes: 3152
#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(),(a).end()
#define SZ(a) (int)(a).size()
#define FOR(i, a, b) for(int i=(a); i<=(b); ++i)
#define iFOR(i, a, b) for(int i=(a); i>=(b); --i)
#define make_unique(a) sort(all((a))), (a).resize(unique(all((a)))-(a).begin())

using namespace std;

typedef pair<int,int> PII;
typedef long long LL;
typedef double DD;
typedef long double LD;
typedef pair<LL,LL> PLL;
typedef pair<DD,DD> PDD;
typedef vector<int> VI;
typedef vector<LL> VL;
const LL mod = 1000000007;
int mp[] = {1,1,0,2,0,0,1,0,1,0};
string p[] = {"hon", "pon", "bon"};
int main(){
    int a;
    scanf("%d",&a);
    cout << p[mp[a%10]];
	return 0;
}
/*
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
  
int main(void){
    int h, w;
    cin >> h >> w ;
    
    for(int i=0; i<w+2; i++) cout << "#";
    cout << endl;
    
    for(int i=0; i<h; i++){
        cout << "#";
        for(int j=0; j<w; j++){
            char a;
            cin >> a;
            cout << a;
        }
        cout << "#" << endl;
    }
    for(int i=0; i<w+2; i++) cout << "#";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
#define LL long long
int N, A, B;
vector<int> P;
bool used[110];
int a, b, c;
int main(){
	cin >> N >> A >> B;
	for(int i = 0; i < N; i++){
		int tmp;
		cin >> tmp;
		if(tmp <= A) a++;
		if(tmp > A && tmp <= B) b++;
		if(tmp > B) c++;
	}
	cout << min({a, b, c}) << endl;
	return 0;
}

Measured memory_bytes: 256
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let _n:i32 = read();
    let list:Vec<i32> = read_vec();
    for i in (0..list.len()).rev() {
        print!("{}", list[i]);
        if i != 0 {
            print!(" ");
        }
    }
    println!("");
}


Measured memory_bytes: 5036
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)


void solve(std::string S){
    if(S.length()==2)
        cout << S << endl;
    else{
        reverse(S.begin(), S.end());
        cout << S << endl;
    }
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

int main(){
  int n; cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
  }
  sort(v.begin(),v.end());
  double ans=v[0];
  for(int i=1;i<n;i++){
    ans=(ans+v[i])/2;
  }
  cout<<ans<<endl;
}


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

using namespace std;


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

    int n;
    cin >> n;
    set<string> S;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        S.insert(s);
    }

    cout << S.size() << "\n";

    return 0;
}

Measured memory_bytes: 19248
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    vector<long> viTwoPow(n, -9);
    vector<long> viFivePow(n, -9);
    vector<vector<long>> vviNum(19, vector<long>(19, 0));
    vector<vector<long>> vviSum(19, vector<long>(19, 0));
    for(int i = 0; i < n; i++){
        double a;
        scanf("%lf", &a);
        a += 5.0 * 1.0e-10;
        long ia = long(a * 1.0e9);
        while(ia % 2 == 0){
            ia /= 2;
            viTwoPow[i]++;
            if(viTwoPow[i] >= 9){
                break;
            }
        }
        while(ia % 5 == 0){
            ia /= 5;
            viFivePow[i]++;
            if(viFivePow[i] >= 9){
                break;
            }
        }
        vviNum[viTwoPow[i] + 9][viFivePow[i] + 9]++;
        for(int j = viTwoPow[i]; j >= -9; j--){
            for(int k = viFivePow[i]; k >= -9; k--){
                vviSum[j+9][k+9]++;
            }
        }
    }
    
    long nAns = 0;
    for(int i = 0; i < 19; i++){
        for(int j = 0; j < 19; j++){
            nAns += vviNum[i][j] * vviSum[18 - i][18 - j];                
        }
    }
    nAns /= 2;
    if(vviSum[9][9] > 0){
        nAns -= (vviSum[9][9] * vviSum[9][9] / 2);
        nAns += (vviSum[9][9] * (vviSum[9][9] - 1) / 2);
    }
    printf("%ld", nAns);
    
    
    return 0;
}


Measured memory_bytes: 6004
n, a, b = map(int, input().split())
mod = 10 ** 9 + 7

def comb(n, x):
    numerator = 1
    for i in range(n - x + 1, n + 1):
        numerator = numerator * i % mod
    denominator = 1
    for j in range(1, x + 1):
        denominator = denominator * j % mod
    d = pow(denominator, mod - 2, mod)
    return numerator * d
print((pow(2, n, mod) - comb(n, a) - comb(n, b) - 1) % mod)


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

// O(|V| + |E|)
struct SCC
{
    using Graph = vector<vector<int>>;
    int V, K;
    Graph G, rG;
    vector<int> vs;
    vector<bool> used;
    vector<int> cmp;
    SCC(int _V) : V(_V), G(_V), rG(_V), used(_V, false), cmp(_V) {}
    void add_edge(int from, int to)
    {
        G[from].push_back(to);
        rG[to].push_back(from);
    }
    void dfs(int cur)
    {
        used[cur] = true;
        for (const auto &v : G[cur])
        {
            if (!used[v])
                dfs(v);
        }
        vs.push_back(cur);
    }
    void rdfs(int cur, int k)
    {
        used[cur] = true;
        cmp[cur] = k;
        for (const auto &v : rG[cur])
        {
            if (!used[v])
                rdfs(v, k);
        }
    }
    int scc()
    {
        for (int i = 0; i < V; i++)
            used[i] = false;
        vs.clear();
        for (int v = 0; v < V; v++)
        {
            if (!used[v])
                dfs(v);
        }
        for (int i = 0; i < V; i++)
            used[i] = false;
        int k = 0;
        for (int i = (int)vs.size() - 1; i >= 0; i--)
        {
            if (!used[vs[i]])
                rdfs(vs[i], k++);
        }
        return K = k;
    }
    Graph buildGraph()
    {
        scc();
        vector<set<int>> s(K);
        Graph ret(K);
        for (int v = 0; v < V; v++)
        {
            for (const auto to : G[v])
            {
                s[cmp[v]].insert(cmp[to]);
            }
        }
        for (int i = 0; i < K; i++)
        {
            for (auto j : s[i])
            {
                if (i != j)
                    ret[i].push_back(j);
            }
        }
        return ret;
    }
};

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

    int v, e;
    cin >> v >> e;
    SCC scc(v);
    while (e--)
    {
        int s, t;
        cin >> s >> t;
        scc.add_edge(s, t);
    }
    cout << (scc.scc() == v ? 0 : 1) << endl;
}



Measured memory_bytes: 3244
#include <bits/stdc++.h>
#define CFS cin.tie(nullptr);ios::sync_with_stdio(false);
#define CST(x) cout<<fixed<<setprecision(x);
using namespace std;
constexpr int IINF = numeric_limits<int>::max();
constexpr long LINF = numeric_limits<long>::max();
constexpr int MOD = (int) 1e9 + 7;
// constexpr int MOD = 998244353;

int main(){
    int n;
    cin >> n;
    set<string> st;
    for (size_t i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        st.insert(s);
    }
    cout << st.size() << "\n";
}

Measured memory_bytes: 19228
#include <bits/stdc++.h>
using namespace std;
using Point = pair<int,int>;

int main()
{
    int N;
    cin >> N;
    
    vector<int> p(N);
    vector<int> q(N);
    //vector<int> ref(N);
    for(int i=0;i<N;i++)
    {
        cin >> p[i];
    }
    for(int i=0;i<N;i++)
    {
        cin >> q[i];
    }
    
    vector<int> ref(N);
    for(int i=0;i<N;i++)
    {
        ref[i] = i+1;
    }
    int count;
    int x,y;
    
    int ref1=0;
    int ref2=0;
    
    for(int i=0;i<N;i++)
    {
        ref1 = ref1*10+p[i];
        ref2 = ref2*10+q[i];
    }
    do{
        count++;
        int temp=0;
        for(int i=0;i<N;i++)
        {
            temp = temp*10+ref[i];
        }
        if(temp==ref1)
        {
            x = count;
        }
        if(temp==ref2)
        {
            y = count;
        }
    }while(next_permutation(ref.begin(),ref.end()));
    
    
    //int ans;
    
    
    cout << abs(x-y) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

// ABC051 A - Haiku
// 2020.06.13

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S; cin >> S;
  S[5] = ' ';
  S[13] = ' ';
  cout << S << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
   int a,b;
   int sum1=0,sum2=0,small=0,great=0,store=0;
   cin>>a>>b;

  /* if(a==0||b==0||a==b){
    cout<<"NO"<<endl;
   }

   else {*/
        if(a<b){
         small=a;
         great=b;
        }
   else {
    small=b;
    great=a;
   }
   for(int i=small;i<=great;i++){
    sum1=abs(a-i);
    sum2=abs(b-i);
    if(sum1==sum2){

        store=i;
        break;

    }


   }
  // cout<<store<<endl;
   if(sum1==sum2){
    cout<<store<<endl;

   }
   else
    cout<<"IMPOSSIBLE"<<endl;




}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
     int a[n];
     int ma=1;
    for(int i=0;i<n;++i){
        cin>>a[i];
        ma=max(ma,a[i]);
    }
    int x,ans=1000000000;
    for(int i=1;i<=ma;++i){
        int sum=0;
        for(int j=0;j<n;++j){
            sum+=pow((i-a[j]),2);
        }
      ans=min(ans,sum);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll mod=1e9+7;
ll inf=1e18;

/*
ac
*/

ll n,a[100010],ok=1e9+7,ng=0;

template<typename T_n>
struct segment_tree{
	typedef struct node_{
		T_n value;
		int left,right; //[left,right)
		struct node_ *left_child,*right_child;
	}* node;
	node parent_node = new node_;
	T_n default_value=0;//範囲外の場合の評価値
	T_n eval(T_n a, T_n b){//segment_treeの評価関数
		return a+b;
	}
	T_n back_propagation(T_n before, T_n after){//伝播する値を計算
		return after-before;
	}
	segment_tree(int left,int right){//どんな範囲でも作れる
		make_segtree_(parent_node,left,right);
	};
	void make_segtree_(node p,int left,int right){
		p->left=left;
		p->right=right;
		p->value=default_value;
		if(left+1!=right){
			node q=new node_, r=new node_;
			p->left_child=q;
			p->right_child=r;
			make_segtree_(q,left,(left+right)/2);
			make_segtree_(r,(left+right)/2,right);
		}else{//要素数が1個
			p->left_child=NULL;
			p->right_child=NULL;
		}
	}
	T_n query(int left,int right){
		return query_(parent_node,left,right);
	}
	T_n query_(node p,int left,int right){
		if(p->right<=left || right<=p->left)return default_value;
		if(left<=p->left && p->right<=right)return p->value;
		return eval( query_(p->left_child,left,right), query_(p->right_child,left,right) );
	}
	void add(int pos,T_n value){
		add_(parent_node,pos,value);
	}
	T_n add_(node p,int pos,T_n value){
		//上に差分を伝播
		T_n diff;
		if(p->left<=pos && pos<p->right){//入っているなら
			if(p->left==pos && pos+1==p->right){//justなら
				diff=value;
				// diff = back_propagation(p->value,value);
			}else{
				diff = eval(add_(p->left_child,pos,value), add_(p->right_child,pos,value));
			}
			p->value = eval(p->value,diff);
		}else{
			diff=default_value;
		}
		return diff;//差分が上に伝播する
	}
};

bool f(ll x){
	ll b[100010],dp[100010],sum=0;
	dp[0]=0;
	segment_tree<ll> f(-100010,100010);
	f.add(dp[0],1);
	reg(i,1,n){
		if(a[i]>x){
			b[i]=1;
		}else{
			b[i]=-1;
		}
		dp[i]=dp[i-1]+b[i];
		sum+=f.query(dp[i]+1,100010);
		f.add(dp[i],1);
	}
	if(sum>=(n*(n-1)/2+n)/2+1){
		return true;
	}else{
		return false;
	}
}

int main(void){
	cin>>n;
	reg(i,1,n)cin>>a[i];
	while(ok-ng>1){
		ll mid=(ok+ng)/2;
		if(f(mid)){
			ok=mid;
		}else{
			ng=mid;
		}
	}
	cout<<ok<<endl;
	return 0;
}

Measured memory_bytes: 564480
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

void func_A(){
    
    int a;
    cin >> a;

    cout << (a + a * a + a * a*a);

}

void func_B() {

    string s, t;
    cin >> s >> t;

    int count = 0;
    for (int i = 0; i < s.length(); ++i) {
        if (s[i] != t[i]) count++;
    }

    cout << count;
}

int main() {

    //func_A();
    func_B();

    return 0;
}

Measured memory_bytes: 3920
A,V = list(map(int, input().split()))
B,W = list(map(int, input().split()))
T = int(input())
if V - W <= 0:
    print("NO")
else:
    remain = abs(A-B)
    r, q = divmod(remain, V-W)
    if r == T and q == 0:
        print("YES")
    elif r < T:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 9192
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret);
  if(n%2)((ret *= a));
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}

vector<ll> fac, finv, inv;
void COMinit(const int MAX = 5000000, const ll &MOD = MOD){
  fac.resize(MAX);finv.resize(MAX);inv.resize(MAX);
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  repd(i,2,MAX){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}
ll COM(int n, int k){
  if(n < k)return 0;
  if(n < 0 || k < 0)return 0;
  return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}


////////////////////////////////////////////////////////////////////

int h,w,k;bool s[15][1100];
signed main(){
  cin>>h>>w>>k;
  rep(i,h){
    string ss;cin>>ss;
    rep(j,w)s[i][j] = (ss[j] == '1');
  }
  int ans = INF;
  rep(bit, 1<<(h-1)){
    int sum = 0;int t[15], cnt;bool c = true;
    rep(i,15)t[i] = cnt = 0;
    rep(i,h-1)if(bit & (1<<i))sum++;
    int argsum = sum;
    rep(i,w){
      int a = 0;bool r = false;
      rep(j,h){
        a += s[j][i];
        if((bit & (1<<j)) || (j == h-1)){
          if(a > k)c = false;
          else if(t[j]+a > k){
            r = true;
          }
          a = 0;
        }
      }
      if(r){
        a = 0;cnt++;
        rep(j,h){
          a += s[j][i];
          if((bit & (1<<j)) || (j == h-1))t[j] = a, a = 0;
        }
      }else{
        a = 0;
        rep(j,h){
          a += s[j][i];
          if((bit & (1<<j)) || (j == h-1))t[j] += a, a = 0;
        }
      }
    }
    if(c)chmin(ans, sum+cnt);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
a = []
b = []
n, m = gets.split.map(&:to_i)
n.times do |i|
  a[i] = gets.split.map(&:to_i)
end
m.times do |j|
  b[j] = gets.to_i
end

c = []
n.times do |i|
  tmp = 0
  m.times do |j|
    tmp += a[i][j] * b[j]
  end
  puts tmp
end



Measured memory_bytes: 6976
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define KMAX (1000)
int s[KMAX + 1][2 * KMAX + 1];
int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    char c;
    int n, k, x, y;
    cin >> n >> k;
    REP(i, n) {
        cin >> x >> y >> c;
        y %= 2 * k;
        if (c == 'W') {
            if (y >= k) {
                y -= k;
            } else {
                x += k;
            }
        } else {
            if (y >= k) {
                y -= k;
                x += k;
            }
        }
        x %= 2 * k;
        s[y + 1][x + 1]++;
    }
    REP(y, k) REP(x, 2 * k) {
        s[y + 1][x + 1] += s[y][x + 1] + s[y + 1][x] - s[y][x];
    }
    int max = 0;
    int v = s[0][0] - s[0][2 * k];
    REP(y, k) {
        int u = v - s[y][0] + s[y][2 * k];
        REP(x, k) {
            int t = u - s[0][x] - s[k][x] + s[0][x + k] + s[k][x + k] +
                    2 * s[y][x] - 2 * s[y][x + k];
            t = t < n / 2 ? n - t : t;
            max = t > max ? t : max;
        }
    }
    cout << max << endl;
    return 0;
}


Measured memory_bytes: 8064
n=input()
l=[0]*(n+1)
for i in range(n*(n-1)/2):
    a,b,c,d=map(int,raw_input().split())
    if c>d:l[a]+=3
    if c<d:l[b]+=3
    if c==d:
    	l[a]+=1
        l[b]+=1
for i in range(1,n+1):
    x=1
    for j in range(1,n+1):
        if l[i]<l[j]:x+=1
    print x

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

using namespace std;
int main(void){
	int N , M , C;
	cin >> N >> M >> C;
	std::vector<vector<int>> A(N);
	std::vector<int> B(M);
	for(int j = 0; j < M; j++){
		cin >> B[j];
	}
	for(int i = 0; i < N; i++){
		A[i].resize(M);
		for(int j = 0; j < M; j++){
			cin >> A[i][j];
		}
	}
	int n = 0;
	for(int i = 0; i < N; i++){
		int sum = 0;
		for(int j = 0; j < M; j++){
			sum += A[i][j]*B[j];
		}
		if(sum + C > 0){
			n++;
		}
	}
	cout << n << endl;
	
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int W, H, N;
    cin >> W >> H >> N;
    vector<vector<int>> S(H, vector<int>(W, 0));
    rep(i, N) {
        int a, x, y;
        cin >> x >> y >> a;
        rep(X, W) rep(Y, H) {
            if (a == 1 && X < x) ++S[Y][X];
            if (a == 2 && x <= X) ++S[Y][X];
            if (a == 3 && Y < y) ++S[Y][X];
            if (a == 4 && y <= Y) ++S[Y][X];
        }
    }
    int cnt = 0;
    rep(y, H) rep(x, W) {
        if (S[y][x] == 0) ++cnt;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int t = N / 100;
    if (N > t * 111) {
      System.out.println((t + 1) * 111);
    } else {
      System.out.println(t * 111);
    }
  }
}


Measured memory_bytes: 22868
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#define ll long long
using namespace std;
int main()
{
	ll a,b,c;
	scanf("%lld%lld%lld",&a,&b,&c);
	if(a+b+c>=22) printf("bust\n");
	else printf("win\n");
	return 0;
}

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

int main(){
  string s;
  cin >> s;
  for(int i = 0; i < 19;++i){
	  if(s[i]== ',') s[i] = ' ';
  }
  
  cout << s << endl;
  
  return 0;
}

Measured memory_bytes: 256
### subroutines

def pkg_fee(s, w)
  return 600 if s <= 60 && w <= 2
  return 800 if s <= 80 && w <= 5
  return 1000 if s <= 100 && w <= 10
  return 1200 if s <= 120 && w <= 15
  return 1400 if s <= 140 && w <= 20
  return 1600 if s <= 160 && w <= 25
  0
end

### main

while true
  n = gets.strip.to_i
  break if n == 0

  total = 0
  n.times.each do
    x, y, h, w = gets.strip.split(' ').map{|s| s.to_i}
    total += pkg_fee(x + y + h, w)
  end

  puts total
end

Measured memory_bytes: 6120
Z = input().split()
A = int(Z[0])
B = Z[1].split('.')
B = int(B[0] + B[1])
#print(A*B)
if len(str(A*B)) <= 2:
  a = 0
else:
  a = str(A*B)[:-2]
  a = int(a)
print(a)


Measured memory_bytes: 9152
# ABC073D - joisino's travel (218ms)
from collections import defaultdict
from heapq import heapify, heappop, heappush
from itertools import permutations


def dijkstra(G: "Array[dict[int]]", size: int, start: int) -> list:
    dist = [float("inf")] * size
    unchecked = size - 1  # vertex_0 won't appear in 1-idx graph
    queue = [(0, start)]
    heapify(queue)
    while queue:
        cost, v = heappop(queue)
        if cost > dist[v]:
            continue
        dist[v] = cost
        for u, next_cost in G[v].items():
            if cost + next_cost < dist[u]:
                heappush(queue, (cost + next_cost, u))
        unchecked -= 1
        if not unchecked:
            break
    return dist


def main():
    global G, N
    N, M, R, *RABC = map(int, open(0).read().split())
    visit, ABC = RABC[:R], RABC[R:]
    G = {v: defaultdict(int) for v in range(1, N + 1)}
    for v, u, cost in zip(*[iter(ABC)] * 3):
        G[v][u] = G[u][v] = cost
    dist = {v: dijkstra(G, N + 1, v) for v in visit}
    ans = float("inf")
    for perm in permutations(visit):
        cur = sum(dist[v][u] for v, u in zip(perm, perm[1:]))
        ans = min(ans, cur)
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 9812
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

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

int main(){
    int N;
    cin >> N;
    vector<ll> A(N+2);
    for (int i = 1; i < N + 1; i++) cin >> A.at(i);
    vector<ll> B(N+2), C(N+2);

    B.at(0) = 0;
    C.at(N+1) = 0; 
    for (int i = 0; i < N + 1; i++) { 
        B.at(i+1) = gcd(B.at(i), A.at(i+1));
        C.at(N-i) = gcd(C.at(N-i+1), A.at(N-i));
    }

    ll ans = 0;
    for (int i = 1; i < N + 1; i++) {
        ll tmp = gcd(B.at(i-1), C.at(i+1));
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e18;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int N,K;
vector<int>ki[100005];
bool used[100005];
int cnt[100005];
void dfs(int now) {
    used[now] = true;
    int res = 0;
    for(int next:ki[now]) {
        if(used[next]) {
            res++;
        }
    }
    cnt[now] += K-res;
    for(int next:ki[now]) {
        if(!used[next]) {
            cnt[next]-=res;
            dfs(next);
            res++;
        }
    }
}
signed main() {
    cin >> N >> K;
    for(int i = 0; i < N-1; i++) {
        int a,b;
        cin >> a >> b;
        a--;b--;
        ki[a].push_back(b);
        ki[b].push_back(a);
    }
    dfs(0);
    int ans = 1;
    for(int i = 0; i < N; i++) {
        ans *= cnt[i];
        ans %= mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 13340