akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

 /* Cut Cut Cut */	

 #define MAX 200010	

class Combination {	
  using _Tp = long long;	
public:	

  _Tp fac[MAX], finv[MAX], inv[MAX];	

  Combination() {	
    init();	
  }	

  void init() {	
    fac[0] = fac[1] = 1;	
    finv[0] = finv[1] = 1;	
    inv[1] = 1;	
  for(int i = 2; i < MAX; i++){	
      fac[i] = fac[i-1] * i % MOD;	
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;	
      finv[i] = finv[i-1] * inv[i] % MOD;	
    }	
  }	

   // n!! * k!^(-1) * ((n - k)!)^(-1)	
  _Tp comb(_Tp n, _Tp k) {	
    if (n < k) return 0;	
    if (n < 0 || k < 0) return 0;	
    return fac[n] * (finv[k]* finv[n - k] % MOD) % MOD;	
  }	
};	

 /* END END */	

int main() {
  Combination comb;

  ll h, w, a, b;
  cin >> h >> w >> a >> b;

  ll H = h - a;
  ll W = w - b;
  ll ans = 0;
  rep(i, H)
    ans += (comb.comb(i + b - 1, b - 1) * comb.comb(h - i - 2 + W, W - 1)) % MOD;
  cout << ans % MOD<< endl;
}


Measured memory_bytes: 4992
#include<stdio.h>

int main(){
 int a,b;

 scanf("%d",&a);
 scanf("%d",&b);

 if(a < b){
  printf("a < b\n");
 }
 else if(a > b){
  printf("a > b\n");
 }
 else if(a == b){
  printf("a == b\n");
 }
 return 0;
}


Measured memory_bytes: 2048
#include <stdio.h>
int main(void){
  int W,H,x,y,r;
  int a,b,c,d;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  a=x-r;
  b=y-r;
  c=W-(x+r);
  d=H-(y+r);
  
  if(a>=0&&b>=0&&c>=0&&d>=0) printf("Yes\n");
  else printf("No\n");
  
  return 0;
}



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

int main(){
  long long n; cin >> n;
  long long mini = 1e12;
  for(long long  i = 1 ; i <= sqrt(n); i++){
    if(n % i == 0){
      if(mini >i - 1 + n/i-1) mini = i - 1 + n/i-1;
    }
  }
  cout << defaultfloat;
  cout << mini << endl;
}


Measured memory_bytes: 256
/*input
5
1 3 4 5 7
*/

// Nihesh Anderson - knandy

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key
ll MOD=1000000007;

#define endl '\n'
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
ll INF = 2000000000000000001;
long double EPS = 1e-9;
ll power(ll a, ll n, ll md){if(n==0){return 1;}else{int res=power(a,n/2,md);res=(res*res)%md;if(n%2!=0){res=(res*a)%md;}return res;}}
random_device rndm;
mt19937 grndm(rndm());
void mix(int* a, int* b){shuffle(a,b,grndm);}

int main(){
	fast_cin();
	// freopen("input.in","r",stdin);
	// freopen("output.out","w",stdout);
	int n; cin >> n;
	vector<int> a(n);
	int cnt = 0;
	for(int i =0 ; i < n; i++) {
		cin >> a[i];
		if(((i + 1) & 1) && (a[i] & 1)) {
			cnt++;
		} 
	}
	cout << cnt << endl;
	return 0;
}




















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


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


	int counter = 0;
	for (int a = 0; a <=A; a++) {
		for (int b = 0; b <=B; b++) {
			for (int c = 0; c <=C; c++) {
				if (500 * a + 100 * b + 50 * c == X)counter++;
			}
		}
	}
	cout << counter << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    
    long sum = 0;
    PriorityQueue<Integer> q = new PriorityQueue(Comparator.reverseOrder());
    for (int i = 0; i < N; i++) {
      int A = sc.nextInt();
      q.offer(A);
      sum += A;
    }

    for (int i = 1; i <= M; i++) {
      int maxPrice = q.poll();
      int newPrice = maxPrice / 2;
      sum -= maxPrice - newPrice;

      q.offer(newPrice);
    }
    
    System.out.println(sum < 0 ? 0 : sum);
  }
}

Measured memory_bytes: 58992
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;

ll f(ll n) {
    if (n < 2) return 1;
    return n * f(n - 2);
}

ll calc_pow(ll x, ll y) {
    ll z = 1;
    while (y > 0) {
        if (y & 1) {
            z *= x;
        }
        x *= x;
        y /= 2;
    }
    return z;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    if (N % 2) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 0;
    ll now = 5;
    ll cnt = 1;
    while (now <= N) {
        ans += N / (now * 2);
        ++cnt;
        now = calc_pow(5, cnt);
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
  std::string a, b, c;

  std::cin >> a >> b >> c;

  if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) {
    std::cout << "YES" << std::endl;
  } else {
    std::cout << "NO" << std::endl;
  }

  return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    if(b==1){
        cout << 0 << endl;
        return 0;
    }

    int val = 0;
    for(int i=0; i<b; i++){
        val = a+(a-1)*i;
        if(val >= b){
            cout << i+1 << endl;
            return 0; 
        }
    }
 
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <math.h>
#include <queue>
using namespace std;
bool a[7368793];

int d(int i){
    int j=1;
    while(j*i<=7368791){
        a[i*j]=true;
        j++;
    }
    return 0;
}
int main()
{
    while(1){
        
        int n,m;
        cin>>m>>n;
        if(m==0)return 0;
        for(int i=0;i<7368793;i++)a[i]=false;
        int i=m,j=0;
        i=m;
        while(1){
            if(!a[i]){
                d(i);
                j++;
            }
            i++;
            if(j>n)break;
        }
        cout<<i-1<<endl;
    }
}


Measured memory_bytes: 10280
#include <stdio.h>

int main(int argc, const char * argv[])
{

    double input1, input2;
    while (scanf("%lf%lf",&input1 ,&input2) != EOF) {
        if (input1 < 35.50 && input2 < 71.00) {
            printf("AAA\n");
        }
        else if (input1 < 37.50 && input2 < 77.00) {
            printf("AA\n");
        }
        else if (input1 < 40.00 && input2 < 83.00) {
            printf("A\n");
        }
        else if (input1 < 43.00 && input2 < 89.00) {
            printf("B\n");
        }
        else if (input1 < 50.00 && input2 < 105.00) {
            printf("C\n");
        }
        else if (input1 < 55.00 && input2 < 116.00) {
            printf("D\n");
        }
        else if (input1 < 70.00 && input2 < 148.00) {
            printf("E\n");
        }
        else {
            printf("NA\n");
        }
    }
    
    
    return 0;
}

Measured memory_bytes: 608
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
#define MN 100005
int n,l;
long long a[MN];
int main(){
	n=read(),l=read();
	register int i,j;
	for(i=1;i<=n;i++) a[i]=read();
	for(i=1;i<n;i++) if(a[i]+a[i+1]>=l){
		puts("Possible");
		for(j=1;j<i;j++) printf("%d\n",j);
		for(j=n-1;j>i;j--) printf("%d\n",j);
		printf("%d\n",j);
		return 0;
	}
	puts("Impossible");
	return 0;
}

Measured memory_bytes: 1536
S = input()
T = input()


def solve(S, T):
    for t in set(T):
        if t not in set(S):
            return -1

    S_double = S+S
    len_s = len(S)
    ans = -1
    for t in T:
        ans += S_double[(ans+1) % len_s:].index(t) + 1
    return ans + 1


print(solve(S, T))


Measured memory_bytes: 3700
#include<iostream>
        #include<iomanip>
        #include<algorithm>
        #include<string>
        #include<vector>
        #include<deque>
        #include<queue>
         
        using std::cout;
        using std::cin;
        using std::setw;
        using std::setfill;
        using std::string;
        using std::pair;
        using std::make_pair;
        using std::vector;
        using std::queue;
        using std::deque;
        using std::priority_queue;
        using std::next_permutation;
        //using std::iota;
        using std::sort;
        using std::greater;
        using std::max;
        using std::min;
         
        using lli = long long int;
        using ulli = unsigned long long int;
         
        #define INF 999999999;
         
        #define EVEL 1
         
        #ifndef EVEL
        #define dbug(X) std::cout << #X << ":" <<X<<" " ;
        #define dbugf(s) std::cout << s << " ";
        #define dbugln std::cout<<"\n";
        #else
        #define dbug(X) {}
        #define dbugf(s) {}
        #define dbugln {}
        #endif
         
        int Cij[10][10];
        int H, W;
        int Aij[210][210];
        int eNumCnt[10];
        int ans;
         
        int main(){
        	cin.tie(0);
        	std::ios::sync_with_stdio(false);
        	cin >> H >> W;
        	for(int i = 0; i < 10; i++){
        		for(int j = 0; j < 10; j++){
        			cin >> Cij[i][j];
        		}
        	}
        	for(int j = 0; j < W; j++){
        		for(int i = 0; i < H; i++){
        			cin >> Aij[i][j];
        			if(Aij[i][j] >= 0){
        				eNumCnt[ Aij[i][j] ] ++;
        			}
        		}
        	}
         
        	for(int i = 0; i < 10; i++){
        		for(int j = 0; j < 10; j++){
        			dbugf(i)dbugf(j)dbugf(Cij[i][j])dbugf(":");
        		}
        		dbugln;
        	}
         
        	for(int i = 0; i < 10; i++){
        		for(int j = 0; j < 10; j++){
        			for(int k = 0; k < 10; k++){
        				Cij[j][k] = min(Cij[j][k], Cij[j][i] + Cij[i][k]);
        			}
        		}
        	}
         
        	for(int i = 0; i < 10; i++){
        		for(int j = 0; j < 10; j++){
        			dbugf(i)dbugf(j)dbugf(Cij[i][j])dbugf(":");
        		}
        		dbugln;
        	}
         
        	ans = 0;
        	for(int i = 0; i < 10; i++){
        		ans += Cij[i][1]*eNumCnt[i];
        	}
        	cout << ans;
         
        	return 0;
        }

Measured memory_bytes: 384
R = int(input())

# print(R)

# 高橋くんのレーティングが変動する次のコンテストの名称（ABC, ARC, AGC のいずれか）を出力せよ。

if R < 1200:
    print('ABC')
elif R < 2800:
    print('ARC')
else:
    print('AGC')

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

int main(){
  string S, T;
  cin >> S >> T;
  
  int count = 0;
  for(int i=0; i<3; i++){
    
    if(S.at(i) == T.at(i))
      count++;
  
  }

  cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <stack>
#include <limits>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <numeric>
//#include <tuple>

constexpr long long mod = static_cast<long long>(1e9 + 7);

struct State {
    int i;
    int j;
    int d;
};

int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main() {
    int H, W;
    std::cin >> H >> W;
    std::vector<std::string> map(H);
    for(auto& val: map)
        std::cin >> val;

    std::vector<std::vector<int>> dist(H, std::vector<int>(W, -1));
    dist[0][0] = 0;
    std::queue<State> que;
    que.push(State{0, 0, 0});
    while(!que.empty()) {
        auto now = que.front();
        if(now.i == H - 1 && now.j == W - 1) break;
        que.pop();
        for(int i = 0; i < 4; ++i) {
            int y = now.i + dy[i];
            int x = now.j + dx[i];
            if(0 <= y && y < H && 0 <= x && x < W && map[y][x] == '.' && dist[y][x] < 0) {
                dist[y][x] = now.d + 1;
                que.push(State{y, x, dist[y][x]});
            }
        }
    }

    int cnt = 0;
    for(const auto& str: map) {
        for(auto c: str) {
            if(c == '.') ++cnt;
        }
    }
    if(dist[H - 1][W - 1] < 0) std::cout << -1 << std::endl;
    else std::cout << cnt - dist[H - 1][W - 1] - 1 << std::endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
from collections import Counter
C = Counter(A)
ans = 0
for key,value in C.items():
    if value > 1:
        ans += value*(value-1)//2
for e in A:
    v = C[e]
    if v >= 3:
        print(ans-(v*(v-1)//2)+((v-1)*(v-2)//2))
    elif v == 2:
        print(ans-1)
    else:
        print(ans)

Measured memory_bytes: 24748
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

template <class T>
inline void read(T &x) {
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar()) f ^= c == '-';
    for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    T y = 1;
	int len = 1;
    for (; y <= x / 10; y *= 10) ++len;
    for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}

int a, b;

int main() {
	read(a), read(b);
	if (a >= 13) write(b);
	else if (a >= 6 && a <= 12) write(b >> 1);
	else write(0);
	putchar('\n');
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var h, w int
	fmt.Scan(&h, &w)

	if h == 1 || w == 1 {
		fmt.Println(1)
		return
	}

	ans := 0
	ans += ((w + 1) / 2) * ((h + 1) / 2)
	ans += (w / 2) * (h / 2)
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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; }

int main () {
  int n;
  cin >> n;
  int ans;
  for (int x = 1; x <= n; ++x) {
    if ((double)n/1.08 <= x && x < (double)(n+1)/1.08) {
      cout << x << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int N=5005;
int n,A,B,dp[N][N*2],g[N][N*2],p[N],q[N];
signed main(){
	scanf("%lld%lld%lld",&n,&A,&B);
	for (int i=1;i<=n;i++)scanf("%lld",&p[i]);
	for (int i=1;i<=n;i++)q[p[i]]=i;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=2*n+1;j++){
			if (j%2==0)dp[i][j]=g[i-1][j-1];
			else dp[i][j]=g[i-1][j];
			if (j<q[i]*2)dp[i][j]+=B;
			else if (j>q[i]*2)dp[i][j]+=A;
			g[i][j]=min(dp[i][j],(j==1?1000000000000000000ll:g[i][j-1]));
		}
	printf("%lld\n",g[n][2*n+1]);
}

Measured memory_bytes: 782720
a = int(input()) #iを取得し、intに値を入れる
b = int(input()) #iを取得し、intに値を入れる
c = int(input()) #iを取得し、intに値を入れる
d = int(input()) #iを取得し、intに値を入れる
e = int(input()) #iを取得し、intに値を入れる
k = int(input()) #iを取得し、intに値を入れる

if e-a<=k: print('Yay!')
else: print(':(')


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

using namespace std;

using occ_t = unordered_map<string, int>;

int main() {
  int n;
  cin >> n;
  occ_t occ;
  while(n--) {
    string verdict;
    cin >> verdict;
    occ[verdict] += 1;
  }
  
  cout << "AC x " << occ["AC"] << "\n"
       << "WA x " << occ["WA"] << "\n"
       << "TLE x " << occ["TLE"] << "\n"
       << "RE x " << occ["RE"] << "\n";
  return 0;
}

Measured memory_bytes: 3628
[N, X] = list(map(int, input().split()))
m = [int(input()) for _ in range(N)]
m.sort()
count = 0

for i in range(N):
  X -= m[i]
  if X < 0:
    break
  count += 1

if X > 0:
  while X > 0:
    X -= m[0]
    if X < 0:
      break
    count += 1

print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
typedef pair<int,int>P;
typedef pair<int,P>P2;
#define F first
#define S second
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};
 
signed main(){
	string s;
	cin >> s;
 
	if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3])cout<<"Bad"<<endl;
	else cout<<"Good"<<endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = nextInt()
    val A = listOfInt()
    fun gcd(a: Int, b: Int): Int = if (b > 0) gcd(b, a % b) else a
    val L = Array(N + 1) { 0 }
    val R = Array(N + 1) { 0 }
    for (n in 0 until N) L[n + 1] = gcd(L[n], A[n])
    for (n in (0 until N).reversed()) R[n] = gcd(R[n + 1], A[n])
    val M = Array(N) { 0 }
    for (n in 0 until N) M[n] = gcd(L[n], R[n + 1])
    println(M .max()!!)
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)

Measured memory_bytes: 59644
import numpy as np
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]

for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j] == b[k]:
                a[i][j] = 0
c = []
c.append(np.sum(a,axis = 0))
c.append(np.sum(a,axis = 1))
d = np.prod(c)
if d == 0:
    print("Yes")
elif (a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0) or (a[2][0] == 0 and a[1][1] == 0 and a[0][2] == 0):
    print("Yes")
else:
    print("No")
    



Measured memory_bytes: 27272
using System;

namespace AOJ.Volume2
{
    public class CuttingDownWaterBills
    {
        public static int Main()
        {
            // 先月の料金
            int prev = 4280;
            // 基本料金
            int basis = 1150;
            while (true)
            {
                int water = int.Parse(Console.ReadLine());
                if (water == -1) { break; }

                int bill = 0;
                // 基本料金
                bill += basis;
                water -= 10;
                // 第2段階
                if (water > 0)
                {
                    bill += (water >= 10 ? 10 : water) * 125;
                    water -= 10;
                    // 第3段階
                    if (water > 0)
                    {
                        bill += (water >= 10 ? 10 : water) * 140;
                        water -= 10;
                        // 第4段階
                        if (water > 0)
                        {
                            bill += water * 160;
                        }
                    }
                }
                Console.WriteLine(prev - bill);
            }
            return 0;
        }
    }
}

Measured memory_bytes: 9208
#![allow(unused_imports)]

use std::cmp;
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::stdin;
use std::ops::*;
use std::process::exit;
use std::str::FromStr;

#[macro_export]
macro_rules! minimum {
    ($($e:expr),+) => {
        {
            let mut res = Vec::new();
            $(
                res.push($e);
            )+
            res.into_iter().min().unwrap()
        }
    };
}

pub const MOD: usize = 1000000007;

fn main() {
    let mut a: Vec<u32> = input_vec();
    a.sort();
    if a == vec![1, 4, 7, 9] {
        println!("YES");
    } else {
        println!("NO");
    }
}

pub fn input<T: FromStr>() -> T {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().ok().unwrap()
}

pub fn input_vec<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect::<Vec<_>>()
}

pub fn input_chars() -> Vec<char> {
    let s: String = input();
    s.chars().collect()
}

pub fn input_lines<T: FromStr>(l: usize) -> Vec<T> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input());
    }
    res
}

pub fn input_lines_two<T: FromStr, U: FromStr>(l: usize) -> Vec<(T, U)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_two());
    }
    res
}

pub fn input_lines_three<T: FromStr, U: FromStr, V: FromStr>(l: usize) -> Vec<(T, U, V)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_three());
    }
    res
}

pub fn input_two<T: FromStr, U: FromStr>() -> (T, U) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
    )
}

pub fn input_three<T: FromStr, U: FromStr, V: FromStr>() -> (T, U, V) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
        s[2].parse::<V>().ok().unwrap(),
    )
}

pub fn input_four<T: FromStr, U: FromStr, V: FromStr, W: FromStr>() -> (T, U, V, W) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse().ok().unwrap(),
        s[1].parse().ok().unwrap(),
        s[2].parse().ok().unwrap(),
        s[3].parse().ok().unwrap(),
    )
}

pub fn input_matrix<T: FromStr + Clone>(h: usize) -> Vec<Vec<T>> {
    let mut res = vec![Vec::new(); h];
    for i in 0..h {
        res[i] = input_vec();
    }
    res
}


Measured memory_bytes: 4352
#include <stdlib.h>
#include <stdio.h>
#define REP(i, n) for(i = 0; i < n; ++i)
#define FOR(i, a, b) for(i = a; i < b; ++i)

typedef struct{
    int a;
    int b;
}nums;

void yes_or_no(char boolean){
    if(boolean){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}

int comp(const void * a, const void * b){
    nums s_a = *(nums*)a, s_b = *(nums*)b;
    return s_a.a - s_b.a;
}

int main(){
    int i, N;
    long int K;
    scanf("%d %ld", &N, &K);
    nums x[N];
    int ans = 0;
    REP(i, N){
        scanf("%d %d", &x[i].a, &x[i].b);
    }
    qsort(x, N, sizeof(nums), comp);
    REP(i, N){
        K -= x[i].b;
        if(K <= 0){
            ans = x[i].a;
            break;
        }
    }
    printf("%d\n", ans);
    return 0;
}

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

int main(void){

  int a[5];
  for( int i = 0 ; i < 5 ; i++ ){
    cin >> a[i]; 
    }
  sort( a , a + 5 );
  for( int i = 4 ; i >= 0 ; i-- ){
    cout << a[i];
    if( i != 0 )cout << " ";
  }
  cout << endl;
  return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


int N;
int A[101010],B[101010];
set<pair<int,int>> S;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>A[i]>>B[i];
		S.insert({A[i]+B[i],i});
	}
	
	ll ret=0;
	FOR(i,N) {
		x=S.rbegin()->second;
		if(i%2==0) {
			ret+=A[x];
		}
		else {
			ret-=B[x];
		}
		S.erase({A[x]+B[x],x});
	}
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 5760
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define _GLIBCXX_DEBUG
#define int long long
int INF = 1e9+7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
unsigned day;
if(dow < dow1) dow += 7;
day = dow - dow1;
day += 7 * n - 6;
return day;
}
unsigned DayToWeekNumber(unsigned day)
{
  return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
  return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main(){
	int a,b; cin>>a>>b;
	if(a==b){
		int count=1;
		int ans=1;
		REP(i,a+1){
			count*=i;
			if(count>=INF)count%=INF;
		}
		REP(i,b+1){
			ans*=i;
			if(ans>=INF)ans%=INF;
		}
		cout<<count*ans*2%INF<<endl;
	}
	else if(a-1==b||a+1==b){
		int count=1;
		int ans=1;
		REP(i,a+1){
			count*=i;
			if(count>=INF)count%=INF;
		}
		REP(i,b+1){
			ans*=i;
			if(ans>=INF)ans%=INF;
		}
		cout<<count*ans%INF<<endl;
	}
	else cout<<0<<endl;
}


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

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	string a,b,c;
	cin >> a>>b>>c;
	cout << a[0] << b[1] << c[2] << endl;
	return 0;
}



Measured memory_bytes: 256
N, M, X = map(int, input().split())
arr = [list(map(int, input().split())) for _ in range(N)]
ans = float('inf')
for i in range(2 ** N):
    tmp = [0]*M
    tmp_ans = 0
    for k in range(N):
        if 1 & i>>k:
            for l in range(1,M+1):
                tmp[l-1] += arr[k][l]
            tmp_ans += arr[k][0]
    flg = True
    for k in tmp:
        if k < X:
            flg = False
            break
    if flg:
        ans = min(ans,tmp_ans)
if ans == float('inf'):
    print(-1)
else:
    print(ans)

Measured memory_bytes: 68392
#include<bits/stdc++.h>
using namespace std;
int main(){
    int x, n, count;
    while(1){
        count = 0;
        cin >> n >> x;
        if(n == 0&&x == 0){
            return 0;
        }
        for(int i=1;i<=n-2;i++){
            for(int j=i+1;j<=n-1;j++){
                for(int k=j+1;k<=n;k++){
                    if(i+j+k == x){
                        count++;
                    }
                }
            }
        }
        cout << count << endl;
    }
}


Measured memory_bytes: 3108
#include <cstdio>

int main(){
    int pn, sn;
    char p[100], s[100];
    bool flag;
    scanf("%s", s);
    scanf("%s", p);
    for(int i = 0; s[i] != '\0'; i++){
        sn = i;
    }
    sn ++;
    for(int i = 0; p[i] != '\0'; i++){
        pn = i;
    }
    pn++;
    for(int i = 0; i < sn; i++){
        flag = true;
        for(int j = 0; j < pn; j++){
            if(s[(i+j) % sn] != p[j]){
                flag = false;
                break;
            }
        }
        if(flag){
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}


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

#define N_MAX 30
#define X_MAX 1000000

int n, x;
int P[N_MAX];
int dp[X_MAX+1];
bool isPrime[X_MAX+1];

void make() {
  fill(isPrime, isPrime + X_MAX + 1, true);
  isPrime[0] = isPrime[1] = false;
  for(int i = 2; i <= X_MAX; ++i) {
    if(!isPrime[i]) continue;
    for(int j = i*2; j <= X_MAX; j += i) isPrime[j] = false;
  }
}

void solve() {
  fill(dp, dp + x + 1, -1);
  dp[0] = 0;
  for(int i = 0; i < n; ++i) {
    for(int j = P[i]; j <= x; ++j) {
      if(dp[j-P[i]] == -1) continue;
      dp[j] = max(dp[j], dp[j-P[i]] + P[i]);
    }
  }
  for(int i = x; i >= 0; --i) {
    if(dp[i] != -1 && isPrime[dp[i]]) {
      cout << dp[i] << endl;
      return;
    }
  }
  cout << "NA" << endl;
}

main() {
  make();
  while((cin >> n >> x) && (n || x)) {
    for(int i = 0; i < n; ++i) {
      cin >> P[i];
    }
    solve();
  }
}

Measured memory_bytes: 5744
import java.io.IOException;
import java.util.Scanner;

class Main {

	public static void main(String[] args) throws IOException {

		Scanner sc = null;

		try {

			sc = new Scanner(System.in);
			int hit = 0;
			int blow = 0;
			String[] a = new String[4];
			String[] b = new String[4];

			while (sc.hasNext()) {

				a = sc.nextLine().split(" ");
				b = sc.nextLine().split(" ");

				for (int i = 0; i < a.length; i++) {
					for (int j = 0; j < b.length; j++) {

						if (a[i].equals(b[i])) {
							hit++;
							break;
						} else if (a[i].equals(b[j])) {

							blow++;
							break;
						}
					}
				}

				System.out.println(hit + " " + blow);
				hit = 0;
				blow = 0;

			}

		} finally {
			sc.close();
		}

	}

}

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

using namespace std;

#define pii pair<int,int>
#define ll long long
#define s second
#define f first

int n,m;

int main(){
  cin >> n >> m;
  if(n<m){swap(n,m);}
    for(int i=0;i<n;++i){
       cout << m;
    }
  return 0;
}


Measured memory_bytes: 256
#define mod 1000000007
#include<bits/stdc++.h>
using namespace std;
long long int m , n ;
bool grid[1002][1002];
long long int dp[1002][1002];
int f(int i , int j)
{
        if(i==m&&j==n)
            return dp[i][j] = 1;
        if(dp[i][j]!=-1)
            return dp[i][j];
        if(grid[i+1][j]==1&&grid[i][j+1]==1)
            return dp[i][j] = (f(i+1,j)+f(i,j+1))%mod;
        if(grid[i+1][j]==1&&grid[i][j+1]==0)
            return dp[i][j] = f(i+1,j);
        if(grid[i+1][j]==0&&grid[i][j+1]==1)
            return dp[i][j] =f(i,j+1);
        if(grid[i+1][j]==0&&grid[i][j+1]==0)
                return dp[i][j] = 0 ;


}
int main()
{
    scanf("%d%d",&m,&n);
    for(int i = 0 ; i<=m ; ++i)
        for(int j = 0 ; j <=n ; ++j)
            dp[i][j]=-1;
    for(int i = 1 ; i <=m ; ++i)
    {
        for(int j = 1 ; j<=n ; ++j)
        {
            char c ;
            scanf("%c",&c);
            if(c=='\n') j = 0 ;
            else grid[i][j] = c=='.';

        }
    }
    printf("%d",f(1,1));

}



Measured memory_bytes: 9216
// link:
// [prajwal1721]
// g++ -Wall -Wextra -Wshadow filename.cpp
// ./a.out >input <output
/*comments:
*/



#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b))
#define bits(x) __builtin_popcountll(x)
#define vi              vector<int>
#define vl              vector<ll>
#define all(v)          v.begin(),v.end()
#define UNIQUE(X)       (X).erase(unique(all(X)),(X).end())



typedef long long int ll;
void solve()
{
    ll n,t,m;cin>>n;
    ll a[n][3];
    for(int i=0;i<n;i++){cin>>a[i][0]>>a[i][1]>>a[i][2];}
    ll dp[n][3]={0};
    dp[0][0]=a[0][0];dp[0][1]=a[0][1];dp[0][2]=a[0][2];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            if(j==0)
                dp[i][j]=max(dp[i][j],a[i][j]+max(dp[i-1][2],dp[i-1][1]));
            if(j==1)
                dp[i][j]=max(dp[i][j],a[i][j]+max(dp[i-1][0],dp[i-1][2]));
            if(j==2)
                dp[i][j]=max(dp[i][j],a[i][j]+max(dp[i-1][0],dp[i-1][1]));
        }
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<"\n";

}


int main()
{ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // ll t;cin>>t;
    // cout<<t<<"Hi test complete\n";
    // while(t--)
        {
            solve();
        }


    return 0;
}

Measured memory_bytes: 8348
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
ll mod=1e9+7;
#define PI acos(-1)
struct edge{int from, to;};

int main(){
    int n;
    cin>>n;
    int b[n-1];
    int a[n];
    rep(i,n-1) cin>>b[i];

    rep(i,n){
        if(i==0) a[i]=b[0];
        else if(i==n-1) a[i]=b[n-2];
        else a[i]=min(b[i-1],b[i]);
    }
    int ans=0;
    rep(i,n) ans+=a[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N = getN()
A = getList()
Q = getN()
B = [getNM() for i in range(Q)]

num = [0] * (10 ** 5 + 10)
for i in range(N):
    num[A[i]] += 1

ans = sum(A)
for i in range(Q):
    bef, aft = B[i]
    bef_time = num[bef]
    num[bef] = 0
    ans += bef_time * (aft - bef)
    num[aft] += bef_time
    print(ans)


Measured memory_bytes: 116776
from collections import Counter
N,M = map(int,input().split())
A = list(map(int,input().split()))
B = [0]
for a in A:
    B.append((B[-1]+a)%M)
c = Counter(B)
ans = 0
for v in c.values():
    ans += v*(v-1)//2
print(ans)


Measured memory_bytes: 16548
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

#include "bits/stdc++.h"
using namespace std;

int main() {
	string S;
	cin >> S;
	int num_s = S.length();

	bool flag_tap = true;
	REP(i, num_s) {
		if ((i % 2 == 0) && (S[i] == 'L')) {
			flag_tap = false;
		}
		if ((i % 2 == 1) && (S[i] == 'R')) {
			flag_tap = false;
		}
	}

	if (flag_tap == true) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
import math

S = input()
pos = 0
N_r = 0
N_l = 0
ans = []

def convert_N_RL(right, left):
    # L = []
    
    # L.append('R' * right)
    # L.append('L' * left)
    
    child = [0] * (right + left)

    r = int(math.ceil(right / 2))    
    r += left // 2
    l = right + left - r
    
    child[right - 1] = r
    child[right] = l

    return(child)


while (pos < len(S)):
    
    while (S[pos] == 'R' and pos < len(S)):
        N_r += 1
        pos += 1
    
    while (S[pos] == 'L' and pos < len(S)):
        N_l += 1
        pos += 1

        if (pos >= len(S)):
            break
    
    ans += convert_N_RL(N_r, N_l)
    
    N_r = 0
    N_l = 0


print(*ans)

Measured memory_bytes: 6444
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int cmp(const void* p, const void* q) {
	return *(int*)p - *(int*)q;
}

int main(){
	int	n, m;
	int from[200000] = { 0 }, to[200000] = { 0 };
	int a, b, cnt_a = 0, cnt_b = 0;
	int flag = 0;

	scanf("%d %d", &n, &m);
	for (int i = 0; i < m; i++) {
		scanf("%d %d", &a, &b);
		if (a == 1)from[cnt_a] = b, cnt_a++;
		else if (b == n)to[cnt_b] = a, cnt_b++;
	}
	qsort(from, cnt_a, sizeof(int), cmp);
	qsort(to, cnt_b, sizeof(int), cmp);

	int left = 0;
	for (int i = 0; i < cnt_a; i++) {
		for (int j = left; j < cnt_b; j++) {
			//printf("j=%d\n",j);
			if (from[i] == to[j]) {
				flag = 1;
				break;
			}
			else if (from[i] < to[j]) {
				left = j;
				break;
			}
			else if (j == cnt_b - 1) {
				flag = 2;
				break;
			}
		}
		//printf("flag=%d\n", flag);
		if (flag)break;
	}
	if (flag==1)printf("POSSIBLE");
	else printf("IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 2172
#include<stdio.h>
int main()
{
    long long int n,res=0;
    scanf("%lld",&n);
    if(n>=500)
    {
        res=(n/500)*2*500;
        n=n-((n/500)*500);
    }
    if(n>=5)
    {
        res=res+((n/5)*5);
    }
    printf("%lld\n",res);
}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);

int n;

vector<vector<int>> graph(MAX_N);

int oa[MAX_N], ob[MAX_N];

bool visited[MAX_N];

int max_color = 0;

map<pair<int, int>, int> ans;

void coloring(int node) {
  if (visited[node]) return;

  visited[node] = true;

  set<int> used;

  vector<int> nexts;

  int new_node_num = 0;

  for (int i = 0; i < graph[node].size(); ++i) {
    int to = graph[node][i];
    auto node_to_to = make_pair(node, to);
    auto to_to_node = make_pair(to, node);

    if (ans.find(node_to_to) == ans.end() && ans.find(to_to_node) == ans.end()) {
      // printf("to: %d\n", to);
      nexts.push_back(to);
      new_node_num += 1;
      continue;
    }

    if (ans.find(node_to_to) != ans.end()) {
      used.insert(ans[node_to_to]);
      continue;
    }

    if (ans.find(to_to_node) != ans.end()) {
      used.insert(ans[to_to_node]);
    }
  }

  // printf("node: %d: new_node_num: %d used: ", node, new_node_num);

  // for (auto &e : used) {
  //   printf("%d", e);
  // }
  // printf("\n--------------\n");

  int remaining = max_color - (int)(used.size());

  if (remaining < new_node_num) {
    max_color += (new_node_num - remaining);
  }

  int idx = 1;

  for (auto &to : nexts) {
    auto node_to_to = make_pair(node, to);
    auto to_to_node = make_pair(to, node);

    while (used.find(idx) != used.end()) idx += 1;

    // printf("!!!to: %d, col: %d\n", to, idx);

    ans[node_to_to] = idx;
    ans[to_to_node] = idx;

    used.insert(idx);
  }

  for (auto &to : nexts) {
    coloring(to);
  }
}

int main(void) {
  // Here your code !
  scanf("%d", &n);

  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);

    oa[i] = a;
    ob[i] = b;

    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  for (int i = 1; i <= n; ++i) {
    visited[i] = false;
  }

  coloring(1);

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

  for (int i = 0; i < n - 1; ++i) {
    printf("%d\n", ans[make_pair(oa[i], ob[i])]);
  }

  return 0;
}


Measured memory_bytes: 32384
n, m, l = [int(i) for i in input().split()]

A = []
B = []
C = []

for ni in range(n):
    A.append([int(i) for i in input().split()])

for mi in range(m):
    B.append([int(i) for i in input().split()])

for i in range(n):
    C.append([])
    for j in range(l):
        C[i].append(0)
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]

for ni in range(n):
    print(" ".join([str(s) for s in C[ni]]))

Measured memory_bytes: 8968
//
//  main.cpp
//  HelloWorld
//
//  Created by purple on 2020/04/13.
//  Copyright © 2020 Purple. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <cmath>

using namespace std;

int main(int argc, const char * argv[]) {

    int a[3];
    for(int i=0; i<3; i++){
        cin >> a[i] ;
    }
    
    sort(a, a+3);
    
    cout << a[0] << " " << a[1] << " " << a[2] << endl;
    
    return 0;
    
}



Measured memory_bytes: 3144
program main
  implicit none
  integer :: n, i
  integer, allocatable :: b(:), res(:)

  read (*, *) n
  allocate (b(n), res(n))
  read (*, *) b(:)

  do i = 1, n
    call remove(b, res(n - i + 1))
  end do

  do i = 1, n
    write (*, "(i0)") res(i)
  end do

  contains

  subroutine remove(b, ret)
    integer, allocatable, intent(inout) :: b(:)
    integer, intent(out) :: ret
    integer :: n, i, c(size(b))
    n = size(b)
    c = [(b(i) - i, i = 1, n)]
    loop: block
      do i = n, 1, -1
        if (c(i) == 0) exit loop
      end do
      write (*, "(i0)") -1
      stop
    end block loop
    ret = b(i)
    b = [b(:i - 1), b(i + 1:)]
  end subroutine remove
end program main


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+7;
int n,n1,s1,s2,a[N],pw1[N],pw2[N];
char ch[N];
int solve(int x)
{
	if(!x)return 0;
	int num=0,tmp=x;
	while(x){if(x&1)num++;x/=2;}
	return 1+solve(tmp%num);
}
int main()
{
	scanf("%d",&n);
	scanf("%s",ch+1);
	for(int i=1;i<=n;i++){a[i]=ch[i]-'0';if(a[i])n1++;}
	if(n1>=2)
	{
		pw1[n]=1;
		for(int i=n-1;i;i--)pw1[i]=2ll*pw1[i+1]%(n1-1);
		for(int i=1;i<=n;i++)if(a[i])s1=(s1+pw1[i])%(n1-1);
	}
	pw2[n]=1;
	for(int i=n-1;i;i--)pw2[i]=2ll*pw2[i+1]%(n1+1);
	for(int i=1;i<=n;i++)if(a[i])s2=(s2+pw2[i])%(n1+1);
	for(int i=1,x;i<=n;i++)
	if(a[i])
	{
		if(n1<=1)puts("0");
		else x=(s1-pw1[i]+n1-1)%(n1-1),printf("%d\n",solve(x)+1);
	}
	else x=(s2+pw2[i])%(n1+1),printf("%d\n",solve(x)+1);
}


Measured memory_bytes: 6296
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include<iomanip>
#include<tuple>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int h,w;
    string board[60];

    cin>>h>>w;
    for(int i=0;i<h;i++){
        cin>>board[i];
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(board[i][j]=='#'){
                
                if((board[i-1][j]=='.' && i-1>=0) && (board[i+1][j]=='.' && i+1<h)
                &&(board[i][j-1]=='.' && j-1>=0)&& (board[i][j+1]=='.' && j+1<w )){
                    cout<<"No"<<endl;
                    return 0;
                    


                }
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

bool pal(string s){
  ll n = SZ(s);
  for(int i = 0, j = n-1; i <= j; i++, j--){
    if(s[i] != s[j]) return 0;
  }
  return 1;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  string s;
  cin >> s;
  ll n = SZ(s);
  Pr(pal(s) && pal(s.substr(0, (n-1)/2)) && pal(s.substr((n+1)/2, (n-1)/2)));
}


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

typedef long long ll;
#define rep(i, n) for(ll i=0; i<n; i++)
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define sz(v) ll(v.size)


void solve(long long A, long long B, long long T){
    ll time = A;
    ll res = 0;
    while(time < T+0.5) {
        res += B;
        time += A;
    }
    cout << res << endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long T;
    scanf("%lld",&T);
    solve(A, B, T);
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  string a,b,c;
  a = s.substr(0,5);
  b = s.substr(6,7);
  c = s.substr(14,5);
  cout << a << " " << b << " " << c << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }
//ミョ(-ω- ?)
int main() {
    ll n,m;
    cin >> n >> m;
    if(n > m)swap(n,m);
    if(n == 1 && n == m){
        cout << 1;
    }else if(n == 1 && n != m){
        cout << m-2 << endl;
    }else{
        cout << (n-2)*(m-2) << endl;
    }
    return 0;
}

Measured memory_bytes: 256