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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, b, e) for (i64 i = (b); i <= (e); ++i)
#define repr(i, b, e) for (i64 i = (b); i >= (e); --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

#ifdef DEBUG
#define dump(...) dump_(#__VA_ARGS__, __VA_ARGS__);
#else
#define dump(...)
#endif

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// input
void input() {}
template <class Head, class... Tail>
void input(Head&& head, Tail&&... tail) {
  cin >> head;
  input(forward<Tail>(tail)...);
}

// outs
void outs() {}
template <class Head, class... Tail>
void outs(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  outs(forward<Tail>(tail)...);
}

template <class T>
void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void outs(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// outl
void outl() {}
template <class Head, class... Tail>
void outl(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  outl(forward<Tail>(tail)...);
}

template <class T>
void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// outn
void outn() {}
template <class Head, class... Tail>
void outn(Head&& head, Tail&&... tail) {
  cout << head;
  outn(forward<Tail>(tail)...);
}

template <class T>
void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

// dump
template <class T>
void dump_(const char *s, T&& x) {
  clog << '{';
  while(*s != '\0') clog << *(s++);
  clog << ": " << x << '}' << "\n";
}

template <class Head, class... Tail>
void dump_(const char *s, Head&& head, Tail&&... tail) {
  clog << '{';
  while(*s != ',') clog << *(s++);
  clog << ": " << head << "}, ";
  for (++s; !isgraph(*s); ++s);
  dump_(s, forward<Tail>(tail)...);
}
// }}} End

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  var(int, N);

  map<char, i64> cnt;
  rep(i, N) {
    var(string, s);
    ++cnt[s.front()];
  }

  i64 res = 0;
  string march = "MARCH";

  for (int i = 0; i < 5; ++i) {
    for (int j = i + 1; j < 5; ++j) {
      for (int k = j + 1; k < 5; ++k) {
        i64 c1 = cnt[march[i]], c2 = cnt[march[j]], c3 = cnt[march[k]];
        if (c1 && c2 && c3) {
          res += c1 * c2 * c3;
        }
      }
    }
  }

  outl(res);

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int a;
   long double b;
   cin >> a >> b;
   long double ans = a*b;
   cout << int(ans);   
   return 0;
} 

Measured memory_bytes: 3760
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;

public class Main{

static PrintWriter out;
static InputReader ir;

static void solve(){
 for(;;){
  int n=ir.nextInt();
  if(n==0) break;
  int ans=1;
  int[] d=new int[]{1,2,4,5,3,6};
  while(n-->0){
   String command=ir.next();
   int top=d[0];
   int front=d[1];
   int left=d[2];
   int back=d[3];
   int right=d[4];
   int bottom=d[5];
   if("North".equals(command)){
    d[3]=top;
    d[0]=front;
    d[1]=bottom;
    d[5]=back;
   }
   else if("East".equals(command)){
    d[4]=top;
    d[5]=right;
    d[2]=bottom;
    d[0]=left;
   }
   else if("West".equals(command)){
    d[2]=top;
    d[0]=right;
    d[4]=bottom;
    d[5]=left;
   }
   else if("South".equals(command)){
    d[1]=top;
    d[5]=front;
    d[3]=bottom;
    d[0]=back;
   }
   else if("Right".equals(command)){
    d[2]=front;
    d[3]=left;
    d[4]=back;
    d[1]=right;
   }
   else{
    d[4]=front;
    d[1]=left;
    d[2]=back;
    d[3]=right;
   }
   ans+=d[0];
  }
  out.println(ans);
 }
}

public static void main(String[] args) throws Exception{
 ir=new InputReader(System.in);
 out=new PrintWriter(System.out);
 solve();
 out.flush();
}

static class InputReader {
 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;

 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
 
 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }

 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
 
 private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
 
 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
 
 public boolean hasNext(){skip(); return hasNextByte();}
 
 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }
 
 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }
}
}

Measured memory_bytes: 26112
#include <stdio.h>

int main(void)
{
  int str[32] = {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};
  int k;
  
  scanf("%d", &k);
  printf("%d", str[k - 1]);
  
  return 0;
}

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

int main(void){
    int N,K,sum=0,res=0;
    cin>>N>>K;
    int a[N];
    rep(i,N)cin>>a[i];
    sort(a,a+N,greater<int>());
    rep(i,N)if((sum+=a[i])>=K){
        //res = max(res,i+1);
        res = i+1;
        sum -= a[i];
    }
    cout<<N-res<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=200010;
int n;
ll a[maxn],s[maxn],ans;
map<ll,int> cnt;
int main() {
	//freopen("1.txt","r",stdin);
	scanf("%d",&n);
	for (int i=1;i<=n;i++) {
		scanf("%lld",&a[i]);
		s[i]=s[i-1]+a[i];
		ans+=cnt[s[i]];
		cnt[s[i]]++;
	}
	ans+=cnt[0];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,c;
cin >> n >> c;
int s[n];
int sum = 0;
for(int i=0; i<n;i++){
	cin >> s[i];
}
sort(s,s+n);
for(int i=0;i<c;i++){
	sum+=s[i];
}
cout << sum << endl;
return 0;	
}


Measured memory_bytes: 3604
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

int main(){
  string s;
  cin>>s;
  if(s[2]==s[3]&&s[4]==s[5]){
      cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [i-j for i,j in zip(a,b)]
plus = 0
minus = 0
for i in c:
  if i >= 0:
    plus += i
  else:
    minus += math.ceil(i / 2)
print("Yes") if abs(minus) >= plus else print("No")

Measured memory_bytes: 4664
#include <stdio.h>

#define FREE 0
#define NOT_FREE 1
#define N 8

int row[N],col[N],dpos[N*2-1],dneg[N*2-1];
int Q[N][N];

void printBoard()
{
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(Q[i][j]==1){
	if(row[i]!=j)return;
      }
    }
  }
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j)printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}


void putQueen(int i)
{
  int j;
  //クイーンの配置に成功
  if(i==N){
    printBoard();
    return;
  }

  for(j=0;j<N;j++){
    //iとjが他のクイーンに襲撃されている場合は無視
    if(col[j]==NOT_FREE || dpos[i+j]==NOT_FREE || dneg[i-j+N-1]==NOT_FREE)continue;
    //(i,j)にクイーンを置く
    row[i]=j;
    col[j]=dpos[i+j]=dneg[i-j+N-1]=NOT_FREE;
    putQueen(i+1);
    row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
  }
}


int main()
{
  int n,i,j,a,b;
  for(i=0;i<N;i++)
    {
      row[i]=FREE;
      col[i]=FREE;
    }
  for(i=0;i<2*N-1;i++)
    {
      dneg[i]=FREE;
      dpos[i]=FREE;
    }
  
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      Q[i][j]=0;
    }
  }
    
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d",&a,&b);
    Q[a][b]=1;
  }
  
  putQueen(0);

  return 0;
}
  
  



Measured memory_bytes: 2112
s = input()


def insert_string(target_string, insert_point, ins_string):
    return target_string[:insert_point] + ins_string + target_string[insert_point:]


sum = 0

for i in range(2**(len(s)-1)):
    insert_count = 0
    temp_s = s
    for j in range(len(s)-1):
        if (i >> j) & 1: # 1 = +
            temp_s = insert_string(temp_s, j+1+insert_count, '+')
            insert_count += 1

    sum += eval(temp_s)

print(sum)

Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int ans = 0;
    REP(i, s.size()) {
        if(s[i] == '+') ans++;
        else ans--;
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
s = input()

max = -1
buf = []
flag = False

for i in range(len(s)):
    if flag == True:
        buf.append(s[i])
        if s[i] == 'Z':
            if len(buf) >= max:
                max = len(buf)
    elif s[i] == 'A':
        buf.append(s[i])
        flag = True

print(max)


Measured memory_bytes: 5096
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define ALL(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PRINT(var) std::cout<<#var"= "<<var<<std::endl

using namespace std;
typedef long long unsigned int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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


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

  ll a,b,x;
  cin >> a;
  cin >> b;
  cin >> x;
  int num=0;


  if(a%x==0) num=1;
  cout <<num +b/x -a/x <<endl;
  return 0;
}


Measured memory_bytes: 256
// https://qiita.com/e869120/items/eb50fdaece12be418faa

#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    int n;
    cin >> n;

    int res = 0;
    for (int i = 1; i <= n; i+=2) {
        int count = 0;
        for (int j = 1; j * j <= i; j+=2) {
            if (i % j == 0) {
                count++;
                if (n / j != j) count++;
            }
        }
        if (count == 8) res++;
    }

    cout << res << endl;

    return 0;
}

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

int main(){
    int i,j,n,x[101],y[101];
    double q[4];
    cin >> n;
    for(i=0; i<n; i++)cin >> x[i];
    for(i=0; i<n; i++)cin >> y[i];
    for(i=0; i<4; i++)q[i]=0.0;
    for(j=1; j<=3; j++){
        for(i=0; i<n; i++)q[j]+=pow(fabs(x[i]-y[i]),j);
        q[j]=pow(q[j],1.0/j);
    }
    for(i=0; i<n; i++)q[0]=(q[0]<fabs(x[i]-y[i])?fabs(x[i]-y[i]):q[0]);
    
    printf("%lf\n",q[1]);
    printf("%lf\n",q[2]);
    printf("%lf\n",q[3]);
    printf("%lf\n",q[0]);
    
    return 0;
}


Measured memory_bytes: 3356
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main(){
    input!{
        a:usize,
        b:usize,
    }
    let ans = if a  >= 13 {
        b
    } else if a >= 6 && a <= 12 {
        b / 2
    } else {
        0
    };
    println!("{}",ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define tt this->
#define ll long long
using namespace std;
int main ()
{
string a,b;
int cn=0;
cin>>a>>b;
for (int i=0;i<a.size();i++)
{
    if (a[i]!=b[i])cn++;

}
cout<<cn<<endl;





    return 0;
}

/*
▀█████████▄     ▄████████    ▄████████    ▄████████
  ███    ███   ███    ███   ███    ███   ███    ███
  ███    ███   ███    ███   ███    ███   ███    ███
 ▄███▄▄▄██▀    ███    ███  ▄███▄▄▄▄██▀   ███    ███
▀▀███▀▀▀██▄  ▀███████████ ▀▀███▀▀▀▀▀   ▀███████████
  ███    ██▄   ███    ███ ▀███████████   ███    ███
  ███    ███   ███    ███   ███    ███   ███    ███
▄█████████▀    ███    █▀    ███    ███   ███    █▀
                            ███    ███

*/


Measured memory_bytes: 3920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  string s;
  cin>>s;
  static ll cnt;
  if(s[0]=='o') cnt++;
  if(s[1]=='o') cnt++;
  if(s[2]=='o') cnt++;
  cout<<700+(cnt*100)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
  public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial{
  public:
  vl Fac;
  Factrial(int MAX){
    Fac = vl(MAX+1);
    rep(i,MAX) {
      if(i == 0) Fac[i+1] = 1;
      else Fac[i+1] = ((i+1)*Fac[i])%MOD;
    }
  }
};

int main(){
  int n; cin >> n;
  vvi G(n);
  vi deg(n);
  rep(i,n-1) {
    int a,b; cin >> a >> b;
    a--; b--;
    G[a].pb(b); G[b].pb(a);
    deg[a]++; deg[b]++;
  }
  vi c(n);
  rep(i, n) cin >> c[i];
  sort(all(c),greater<int>());
  ll M = 0;
  rep(i,n-1) M += c[i+1];

  vi d(n,-1);

  queue<int> q;
  q.push(0);
  int i = 0;

  while(!q.empty()){
    int v = q.front(); q.pop();
    d[v] = c[i];
    i++;
    for(auto nv : G[v]) {
      if(d[nv] != -1) continue;
      q.push(nv);
    }
  }

  cout << M << endl;
  rep(i,n){
    if(i == n-1) cout << d[i] << endl;
    else cout << d[i] << " ";
  }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0), ios::sync_with_stdio(false);
  int k, n;
  cin >> k >> n;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
    v.push_back(v[i] + k);
  }
  int m = k;
  for (int i = 0; i < n; ++i) {
    if (v[i + n - 1] - v[i] < m) m = v[i+n-1] - v[i];
  }
  cout << m << endl;
}

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

typedef long long ll;
#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define REPM(i,n) for(ll i=(n); 0<=i; i--)
#define VI vector<int>
#define VL vector<ll>
#define VD vector<double>
#define VS vector<string>
#define V_SORT_U(x) sort(x.begin(), x.end());                   //昇順
#define V_SORT_D(x) sort(x.begin(), x.end(),greater<int>());    //降順
#define V_SUM(x) accumulate(x.begin(), x.end(), 0)
#define STR_TRANS_UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper); 
#define STR_TRANS_LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
#define SetPre(x) setprecision(x)

int main(void){
    ll n,k;
    cin >> n >> k;
    VL p(n);

    REP(i,n)
    {
        cin >> p.at(i);
    }

    V_SORT_U(p);

    ll result = 0;
    REP(i,k)
    {
        result += p.at(i);
    }

    cout << result;
    
    return 0;
}

Measured memory_bytes: 3624
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    for i in range(1, 50000):
        if (i * 1.08) // 1 == n:
            print(i)
            exit()
    print(":(")


if __name__ == '__main__':
    solve()


Measured memory_bytes: 38640
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t="keyence";
  cin>>s;
  for(int i=0;i<=7;i++){
    string a=t.substr(0,i),b=t.substr(i,7-i);
    if(a==s.substr(0,i)&&b==s.substr(s.length()-(7-i),7-i)){
      cout<<"YES";
      return 0;
    }
  }
  cout<<"NO";
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var aa int
	fmt.Scanf("%d", &aa)
	var result int
	if aa%2 == 0 {
		result = aa/2 - 1
	} else {
		result = aa / 2
	}
	fmt.Printf("%d\n", result)
}


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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010, M = 110, mod = 1e9 + 7;

int n, m;
int p[N], sz[N];
PII e[N];
vector<LL> res;

int find(int x)
{
	if (x != p[x]) p[x] = find(p[x]);
	return p[x];
}

int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 0; i <= n; i ++ ) p[i] = i, sz[i] = 1;
	
	for (int i = 0; i < m; i ++ )
	{
		int a, b;
		scanf("%d%d", &a, &b);
		e[i] = {a, b};
	}
	for (int i = m - 1; i >= 0; i -- )
	{
		int a = e[i].F, b = e[i].S;
		int pa = find(a), pb = find(b);
		if (pa != pb)
		{
			res.push_back((LL)sz[pa] * sz[pb]);
			sz[pa] += sz[pb];
			p[pb] = pa;
		}
		else res.push_back(0);
	}
	
	reverse(res.begin(), res.end());
	LL s = 0;
	for (int i = 0; i < res.size(); i ++ )
	{
		s += res[i];
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,k,r;
	cin>>a>>b>>k;
	for(int i=min(a,b);i>0;i--)
	{
		if(a%i==0&&b%i==0) k--;
		if(k==0)
		{
			cout<<i<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int v, i, j;
    int a[51], b[51];
    scanf("%d", &v);
    for (i = 0; i < v; i++)
        scanf("%d", &a[i]);
    int sum = 0;
    for (i = 0; i < v; i++)
    {
        scanf("%d", &b[i]);
        if (a[i] - b[i] > 0)
            sum = sum + a[i] - b[i];
    }
    printf("%d\n", sum);
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

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

        int N = sc.nextInt();
        String S = sc.next();
        int[] SInts = splitAsIntArray(S, N);
        int cnt = 0;

        for (int i = 0; i < 1000; i++) {

            int[] PIN = {i / 100, (i / 10) % 10, i % 10};
            int digitCnt = 0;

            for (int j = 0; j < N; j++) {
                if (SInts[j] == PIN[digitCnt]) {
                    digitCnt++;
                }
                if (digitCnt == 3) {
                    cnt++;
                    break;
                }
            }
        }

        System.out.println(cnt);
    }

    static int[] splitAsIntArray(String S, int N) {
        int[] SInts = new int[N];
        for (int i = 0; i < N; i++) {
            SInts[i] = Character.getNumericValue(S.charAt(i));
        }
        return SInts;
    }
}

Measured memory_bytes: 22484
#include <iostream>
#define endl '\n'
using namespace std;

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

	int N, tmp;
    cin >> N;
    int *a = new int[N]();

    for(int i=1;i<N;i++){
        cin >> tmp;
        a[tmp-1]++;
    }

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

    return 0;
}



Measured memory_bytes: 4428
#C

#デバッグ
debug=1
def pront(*n):
    if debug==1:
        print(n)
        
#10**9+7を底とした処理

base=10**9+7

def add(a,b):#a+b
    return (a+b)%base

def sub(a,b):#a-b
    return (a-b)%base

def multi(a,b):#a*b
    return (a*b)%base

def exp(a,b):#a**b
    x=1
    c=a
    d=b
    while d!=0:
        if d%2==1:
            x=multi(x,c)
        c=(c**2)%base
        d=d//2
    return x

def div(a,b):#a/b
    return(multi(a,exp(b,base-2)))

#入力
N=int(input())
A=list(map(int,input().split()))

#処理
X={}

for i in range(1,N+1):
    X[i]=0

for i in range(N+1):
    if i==0 or i==1:
        continue
    if i in X:
        X[A[i-2]]+=1
    else:
        X[A[i-2]]=1
        
for i in X.values():
    print(i)

Measured memory_bytes: 38816
n,a,b = map(int,input().split())

# ans 
# = 1本選ぶ,2本選ぶ,...n本選ぶ - (a本選ぶ + b本選ぶ)
# = nC1+nC2+...+nCn - (nCa + nCb)
# = 2^n-1 - nCa - nCb

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
  
def cmb(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

mod = 10**9+7
ans = 2**n % mod
ans -= 1 + cmb(n,a,mod) + cmb(n,b,mod)
ans = ans % mod
print(ans)

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

int main() {
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<>());
    string ans;
    if (s < t) ans = "Yes";
    else ans = "No";
    cout << ans << 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 T = sc.nextInt();
    
    long ans = 0;
    int prev = sc.nextInt();
    for (int i = 1; i < N; i++) {
      int t = sc.nextInt();
      if (t - prev <= T) {
        ans += t-prev;
      } else {
        ans += T;
      }
      prev = t;
    }
    ans += T;
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 66640
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int A = int.Parse(input[0]);
        int B = int.Parse(input[1]);
        int T = int.Parse(input[2]);

        Console.WriteLine(((T-(T%A))/A)*B);
    }
}



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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:
int n;
ll D[110],A[110];

ll dp[110][6010];

using state=vector<int>;
vector<state> i2p;
map<state,int> p2i;


int main(void){
	cin >> n;
	rep(i,n) cin >> D[i];
	rep(i,n) cin >> A[i];

	{
		vector<int> tmp(7);
		iota(_all(tmp),0);
		do{
			int idx=i2p.size();
			i2p.push_back(tmp);
			p2i[tmp]=idx;
		}while(next_permutation(_all(tmp)));
	}

	rep(i,n)rep(j,i2p.size()){
		rep(a,8){
			vector<int> cur=i2p[j];

			for(auto &it:cur) it++;
			cur.insert(begin(cur)+a,0);


			ll add=0LL;
			rep(b,8){
				if(a==b) continue;
				int idx=i-cur[b];
				if(idx<0) continue;
				if(b<a and abs(i-idx)<=D[idx]){
				 	add+=A[idx];
				}

				if(a<b and abs(i-idx)<=D[i]){
				 	add+=A[i];
				}
			}
			cur.erase(remove(_all(cur),7),end(cur));
			int nj=p2i[cur];
			chmax(dp[i+1][nj],dp[i][j]+add);
		}
	}

	ll ans=0;
	rep(j,i2p.size()) chmax(ans,dp[n][j]);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 8348
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  int two;
  for(int i=0;i<N;++i) {
    for(int j=i+1;j<N;++j) {
      for(int k=0;k<10;++k) {
        if((i&(1<<k))!=(j&(1<<k))) {
          cout<<k+1<<" ";
          break;
        }
      }
    }
    cout<<endl;
  }
}



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

typedef long long  ll;

ll MOD = 1000000007;
ll INF = 100000000;
double PI = 3.1415926535;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<pair<ll,ll>>>;

int main(){
  ll K,A,B;cin >> K >> A >> B;
  ll ans = 1;
  ans += min(K,A-1);
  K -= min(K,A-1);
  if(B - A <= 2){
    ans += K;
    cout << ans << endl;
  }else{
   ans += (K / (ll)2) * (B - A);
   ans += K % 2;
   cout << ans << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
using namespace std;
typedef long long ll;
double ans;
vector<pair<int,int> > G[100];
int n,m;
ll sta,St[100];
ll dfs(int u,int fa,int ed,int eg){
    if(u==ed)return 1ll<<eg;
    if(G[u].size()==1&&~fa){return 0;}
    ll ret=0;
    for(auto v: G[u])if(v.first!=fa){
        ret|=dfs(v.first,u,ed,v.second);
        if(ret&&eg>=0)ret|=1ll<<eg;
        //cerr<<u<<" "<<v.first<<" "<<ret<<" "<<eg<<endl;
    }
    return ret;
}
void solve(){
    scanf("%d",&n);
    for(int i=1,u,v;i<n;++i){
        scanf("%d%d",&u,&v);
        G[u].push_back(mp(v,i-1));
        G[v].push_back(mp(u,i-1));
    }
    scanf("%d",&m);
    for(int i=1,u,v;i<=m;++i){
        scanf("%d%d",&u,&v);
        St[i-1]=dfs(u,-1,v,-1);
        //cerr<<"State:: "<<St[i-1]<<endl;
    }
    for(int s=0,c,S=1<<m,cnt;s<S;++s){
        c=__builtin_popcount(s);
        sta=0;
        for(int i=0;i<m;++i)
            if(s&(1<<i))sta|=St[i];
        cnt=0;
        for(int i=0;i<n;++i)
            if(sta&(1ll<<i))++cnt;
        ans+=pow(2,n-1-cnt)*pow(-1,c);
    }
    printf("%.0lf\n",ans);
}
int main(){
    solve();

    return 0;
}

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

if 400 <= x and x <= 599:
    print(8)
elif 600 <= x and x <= 799:
    print(7)
elif 800 <= x and x <= 999:
    print(6)
elif 1000 <= x and x <= 1199:
    print(5)
elif 1200 <= x and x <= 1399:
    print(4)
elif 1400 <= x and x <= 1599:
    print(3)    
elif 1600 <= x and x <= 1799:
    print(2)
else:
    print(1)

Measured memory_bytes: 9128
N = int(input())
S = input()
if S[0] == "E":
    e = 0
    w = S.count("E") - 1
    before = "E"
else:
    e = 0
    w = S.count("E")
    before = "W"
now = w
for s in S[1:]:
    if s == "E":
        w -= 1
    if before == "W":
        e += 1
    before = s
    now = min(e + w, now)
print(now)


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

const int m=998244353;
int main(){
  int n;
  cin >> n;
  vector<int> a(n),b(n);
  rep(i,n) cin >> a[i];
  b[0]=1;
  if(a[0]!=0){
    cout << 0 << "\n";
    return 0;
  }
  sort(a.begin(),a.end());
  if(a[1]!=1){
    cout << 0 << "\n";
    return 0;
  }
  int i=1; ll ans=1;
  while(i<n){
    ans*=b[a[i]-1];
    ans%=m;
    b[a[i]]++;
    i++;
  }
  cout << ans << "\n";
  return 0;
}

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

#define int long long

#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef pair < int , int > pp;
const int N = 1e3 + 3;

int X[N], Y[N];

signed main(){
    int n;
    cin >> n;
    int h = -1;
	for(int i=1; i<=n; i++){
        cin >> X[i] >> Y[i];
        int t = ((X[i] + Y[i]) % 2 + 2) % 2;
        if(h != -1 && t != h){
            cout << -1;
            return 0;
        }
        h = (t+2) % 2;
    }
if(h == 1){
    cout << "31\n";
    for(int i=30; i>=0; i--)
        cout << (1LL << i) << " ";
    cout << "\n";
    for(int i=1; i<=n; i++){
        int x = X[i];
        int y = Y[i];
        string ans = "";
        for(int j=30; j>=0; j--){
            int t = 1LL << j;
    	    int temp = x;
            x += x < 0 ? t : -t;
        	if(llabs(x) + llabs(y) < t){
                ans += temp < 0 ? 'L' : 'R';
                continue;
            }
            
			x = temp;
            ans += y < 0 ? 'D' : 'U';
            y += y < 0 ? t : -t;
        }
        
        cout << ans << endl;
    }
return 0;
}
		cout << "32\n";
    cout << 1 << " ";
    for(int i=30; i>=0; i--)
        cout << (1LL << i) << " ";
    cout << "\n";
    for(int i=1; i<=n; i++){
        int x = X[i];
        int y = Y[i];
        string ans = "L";
        x++;
        for(int j=30; j>=0; j--){
            int t = 1LL << j;
    	    int temp = x;
            x += x < 0 ? t : -t;
        	if(llabs(x) + llabs(y) < t){
                ans += temp < 0 ? 'L' : 'R';
                continue;
            }
            
			x = temp;
            ans += y < 0 ? 'D' : 'U';
            y += y < 0 ? t : -t;
        }
        
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3612
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    R = [[] for _ in range(2 * N)]
    B = [[] for _ in range(2 * N)]
    for _ in range(N):
        a, b = map(int, input().split())
        R[a].append(b)
    for _ in range(N):
        c, d = map(int, input().split())
        B[c].append(d)

    for i in range(2 * N):
        R[i].sort(reverse=True)
        B[i].sort(reverse=True)

    ans = 0
    Bx = 1
    for By_list in B[1:]:
        for By in By_list:
            Rx = Bx - 1
            max_Ry = [-1, -1]
            for Ry_list in R[:Rx + 1][::-1]:
                for Ry in Ry_list:
                    if max_Ry[1] < Ry < By:
                        max_Ry = [Rx, Ry]
                Rx -= 1
            if max_Ry[1] != -1:
                ans += 1
                R[max_Ry[0]].remove(max_Ry[1])
        Bx += 1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9240
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

struct Unionfind {
  vector<int> d;

  Unionfind(int n) : d(n,-1) {}

  int root(int x) {
    if(d[x] < 0) return x;
    return d[x] = root(d[x]);
  }

  bool unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if(rx==ry) return false;
    if(d[rx] < d[ry]) swap(rx,ry);
    d[rx] += d[ry];
    d[ry] = rx;
    return true;
  }

  bool same(int x, int y) {
    return root(x) == root(y);
  }

  int size(int x) {
    return -d[root(x)];
  }
};

int main() {
  ll n, m;
  cin >> n >> m;
  Unionfind g(n);
  rep(i,m) {
    ll a, b;
    cin >> a >> b;
    a--; b--;
    g.unite(a,b);
  }
  map<ll,ll> mp;
  rep(i,n) mp[g.root(i)]++;
  cout << mp.size() - 1 << endl;
  return 0;
}

Measured memory_bytes: 8848
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>
#include<map>
#include<queue>
#include<deque>
#include<fstream>
#include<random>
 
#define rep(i, n) for (ll i = 0; i < n; i++) 
#define rrep(i, n) for(ll i = n-1; i>=0; i--)
#define range(i, n, m) for (ll i = n; i < m; i++) 
#define rrange(i, n, m) for (ll i = n - 1; i => m; i--) 
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vp vector<pair<ll, ll> >
#define vvp vector<vector<pair<ll, ll> > >
#define First first
#define Second second.first
#define Third second.second
#define Sort(X) sort(X.begin(), X.end())
#define RSort(X, T) sort(X.begin(), X.end(), greater<T>())
//#define MOD 998244353
#define MAX 100000
 
typedef long long int ll;
typedef unsigned long long int ull;
 
using namespace std;
 
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() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	ll N, K;
	cin >> N >> K;

	string S;
	cin >> S;

	vl T;
	vector<pair<ll, ll>> PT;
	ll cnt = 0;
	ll ind = 0;
	rep(i, N-1) {
		cnt++;
		if (S[i] != S[i + 1]) {
			T.pb(cnt);
			cnt = 0;
		}
	}
	T.pb(cnt+1);

	ll d1, d2, d3;
	ll lst = T.size() - 1;

	rep(i, K) {
		if (T.size() == 1)break;
		if (T.size() >= 3) {
			d1 = T.back();
			T.pop_back();
			d2 = T.back();
			T.pop_back();
			d3 = T.back();
			T.pop_back();

			T.pb(d1 + d2 + d3);
		}
		else {
			d1 = T.back();
			T.pop_back();
			d2 = T.back();
			T.pop_back();
			T.pb(d1 + d2);
		}
	}

	ll out = 0;
	rep(i, T.size()) {
		out += T[i] - 1;
	}


	cout << out << endl;
	return 0;
}

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

int main() {
	int a, b, c, d, e, k;

	cin >> a >> b >> c >> d >> e >> k;

	if ((b - a) <= k && (c - a) <= k && (d - a) <= k && (e - a) <= k) {
		cout << "Yay!" << endl;
	}
	else {
		cout << ":(" << endl;
	}
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n,l;cin>>n>>l;
  vl a(n);
  rep(i,n)cin>>a[i];
  ll MAX=0;
  ll key=0;
  rep(i,n-1){
    if(MAX<a[i]+a[i+1]){
      MAX=a[i]+a[i+1];
      key=i+1;
    }
  }
  if(MAX<l){
    cout<<"Impossible"<<endl;
    return 0;
  }
  cout<<"Possible"<<endl;
  for(ll i=1;i<key;i++)cout<<i<<endl;
  for(ll i=n-1;i>key;i--)cout<<i<<endl;
  cout<<key<<endl;
}

Measured memory_bytes: 1664
#include<iostream>
using namespace std;
int main(){
	int n, m, l, a[100][100] = {}, b[100][100] = {};
	long long int c[100][100] = {};
	cin >> n;
	cin >> m;
	cin >> l;
	for (int i = 0; i < n; i++){
		for (int i2 = 0; i2 < m; i2++){
			cin >> a[i][i2];
		}
	}
	for (int i = 0; i < m; i++){
		for (int i2 = 0; i2 < l; i2++){
			cin >> b[i][i2];
		}
	}
	for (int i = 0; i < n; i++){
		for (int i2 = 0; i2 < l; i2++){
			for (int i3 = 0; i3 < m; i3++){
				c[i][i2] += a[i][i3] * b[i3][i2];
			}
		}
	}
	for (int i = 0; i < n; i++){
		for (int i2 = 0; i2 < l - 1; i2++){
			cout << c[i][i2] << " ";
		}
		cout << c[i][l - 1] << endl;
	}
}

Measured memory_bytes: 3236
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
  Q[tail] = x;
  tail = (tail +1) % LEN;
}

P dequeue(){
  P x = Q[head];
  head = (head + 1) % LEN;
  return x;
}


int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1; tail = n + 1;
  
  while(head != tail){
    u = dequeue();
    if(q < u.t) c = q;
    else c = u.t;
    u.t -= c;
    elaps += c;
    if(u.t >0)enqueue(u);
    else printf("%s %d\n",u.name,elaps);
  }
  
  return 0;
}



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

namespace abc_b
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split().Select(a => int.Parse(a)).ToArray();
            int N = inputs[0];
            int M = inputs[1];

            int[] foods = new int[M];

            for (int i = 0; i < N; i++)
            {
                var inputsN = Console.ReadLine().Split().Select(a => int.Parse(a)).ToArray();
                var K = inputsN[0];
                for (int j = 1; j < (K+1); j++)
                {
                    var foodsIndex = inputsN[j]-1;
                    foods[foodsIndex]++;
                }

            }

            int ans = foods.Count(a => a == N);
            Console.WriteLine(ans);
        }
    }
}


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

using namespace std;
using lli = int_fast64_t;
using ulli = unsigned long long;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = copy(x);cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

constexpr lli MOD = (lli)1e9 + 7;
constexpr lli LIMIT = 1000000000000000000 * 5;

constexpr lli plusScore = (lli)1e6;
constexpr size_t D = 365;
constexpr size_t asize = 26;

array<lli, asize> C;
array<array<lli,asize>,D> S;

lli calcScore(const vector<lli>& t) {
	vector<lli> last_open(asize, -1);
	lli score = 0;
	for (int i = 0; i < D; i++) {
		score += S[i][t[i] - 1];
		last_open[t[i] - 1] = i;
		for (int j = 0; j < asize; j++) {
			score -= C[j] * (i - last_open[j]);
		}
		cout << score << endl;
	}
	return score;
};

int main() {
	int devNull;
	cin >> devNull;
	for (lli& i : C)cin >> i;
	for (auto& arr : S) {
		for (lli& i : arr) {
			cin >> i;
		}
	}

	vector<lli> T(D);
	for (lli& i : T)cin >> i;

	vector<int> lastOpen(asize, -1);

	calcScore(T);

	//
	//int M;
	//cin >> M;
	//while (M--) {
	//	int d, q;
	//	cin >> d >> q;
	//	T[d-1] = q;
	//	cout << calcScore(T) << endl;
	//}
	return 0;
}



Measured memory_bytes: 3704
#include<bits/stdc++.h>
#define pdd              pair<double,double>
#define ll               long long
#define mod              1000000007
#define endl              "\n"
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll factorial(ll n)
{
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
ll gcd(ll a, ll b)
{
    if (a == 0)
      return b;
    return gcd(b % a, a);
}
ll lcm(ll a, ll b)
{
   return (a*b)/gcd(a, b);
}
bool sortByVal(const pair<int, int> &a,
               const pair<int, int> &b)
{
    return (a.second < b.second);
}
ll Powb(ll b,ll n)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2);
    if(n%2==0){return (temp*temp)%mod;}
    else{return (b*((temp*temp)%mod))%mod;}
}
int main()
{
    fast;
    ll i,j,n,c=0,d=0,e=0,f=0,g=0,h=0,sum=0,k;
     cin>>n;
     c=n/500;
     sum+=(c*1000);
     n-=(c*500);
     if(n>=0)
     {
     d=n/5;
     sum+=(d*5);
     cout<<sum;
     }

}


Measured memory_bytes: 256
#include <cstdio>
    #include <string>
    #include <cmath>
    #include <string>
    #include <algorithm>
    #include <iostream>
    #include <map>
    #include <vector>
    #include <iomanip>
    #include <tuple>
    #include <queue>
    #include <numeric>
    using namespace std;
    typedef long long ll;
    #define rep(i, a, n) for (int i=a;i<n;++i)
    #define repeq(i, a, n) for(int i=a;i<=n;++i)
    #define repi(m, itr) for (auto itr = m.begin();itr != m.end();++itr)
    #define per(i, a, n) for (int i=n-1; i>=a;--i)
    #define pb push_back
    #define mp make_pair
    #define all(x) (x).begin(), (x).end()

    // C - String Transformation
    string S, T;
    string ans = "Yes";
    int s[26], t[26];

    int main(){
        cin >> S >> T;

        //iota(begin(s), end(s), -1);
        //iota(begin(t), end(t), -1);
        rep(i, 0, 26){
            s[i] = t[i] = -1;
        }

        rep(i, 0, S.size()){
            int s_tmp = S[i] - 'a';
            int t_tmp = T[i] - 'a';
            if(s[s_tmp] != -1 || t[t_tmp] != -1){
                if(s[s_tmp] != t_tmp || t[t_tmp] != s_tmp){
                    cout << "No" << endl;
                    return 0;
                }
            }else{
                s[s_tmp] = t_tmp;
                t[t_tmp] = s_tmp;
            }
        }

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




Measured memory_bytes: 776
#include <iostream>
using namespace std;
int a[110];
int main() {
	int n, d, x;cin >> n >> d >> x;
	for (int i = 0;i < n;i++)cin >> a[i];
	int count = 0;

	for (int j = 0;j < n;j++) {
		for (int k = 1;k <= d;k++) {
			if ((k-1)%a[j] == 0)count++;
			}
	}
	cout << count+x << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.*;

public class Main {
	
	public static void main(String[] args) throws NumberFormatException, IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		
		Card[][] cardSet = new Card[4][14];
		for (int i = 0 ; i < cardSet.length; i++) {
			for (int j = 0; j < cardSet[i].length; j++) {
				cardSet[i][j] = new Card(i, j);
			}
		}
		
		int n = Integer.parseInt(br.readLine());
		String[] str = new String[2];
		int a, b = 0;
		for (int i = 0; i < n; i++) {
			str = br.readLine().split("\\s+");
			a = "S".equals(str[0]) ? 0 : "H".equals(str[0]) ? 1 : "C".equals(str[0]) ? 2 : "D".equals(str[0]) ? 3 : 4;
			b = Integer.parseInt(str[1]);
			cardSet[a][b].setIsOwn(true);;
		}

		for (Card[] cards : cardSet) {
			for (Card card : cards) {
				if (!card.getIsOwn() && card.getNumber() != 0) System.out.println(card.getSuitbyRom() + " " + card.getNumber());
			}
		}
	}
}

class Card {
	private String suitbyRom;
	private int number;
	private Boolean isOwn;
	
	public Card(int i, int j) {
		this.suitbyRom = 0 == i ? "S" : 1 == i ? "H" : 2 == i ? "C" : 3 == i ? "D" : "X";
		this.number = j;
		this.isOwn = false;
	}
	
	public String getSuitbyRom() {
		return this.suitbyRom;
	}
	
	public int getNumber() {
		return this.number;
	}
	
	public Boolean getIsOwn() {
		return this.isOwn;
	}
	
	public void setIsOwn(Boolean bool) {
		this.isOwn = bool;
	}
	
}

Measured memory_bytes: 24584
#include <cstdio>

using namespace std;
typedef long long llong;

#define MAX 7
const llong mod = 1000000000 + 7;

int main()
{
  char S[MAX];

  scanf("%s", S);

  if (S[2] == S[3] && S[4] == S[5])
    printf("Yes");
  else
    printf("No");

  return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <iomanip>
using namespace std;
 
int main(void){
    int a,b;
    cin >> a;
    cin >> b;
    int d = a / b;
    int r = a % b;
    double f = double(a) / double(b);
    cout << d;
    cout << " ";
    cout << r;
    cout << " ";
    cout << fixed << setprecision(5) << f;
    cout << endl;
}


Measured memory_bytes: 3268
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define puts(i) cout<<i<<endl
#define pi 3.14159265358979323846264338
#define pb push_back
#define mp make_pair
#define inf 10000
using ll = long long;
using P = pair<int,int>;
using Pll = pair<ll,ll>;

ll divisor=1000000007;

int main(){
	int n,q;
	cin>>n;
	int a[n];
	rep(i,n)cin>>a[i];
	int d[100001]={};
	rep(i,n)d[a[i]]++;
	ll sum=0;
	rep(i,n)sum+=a[i];
	cin>>q;
	while(q--){
		int b,c;
		cin>>b>>c;
		int t=d[b];
		sum+=(c-b)*d[b];
		puts(sum);
		d[c]+=t;
		d[b]=0;
	}
	
}


Measured memory_bytes: 4316