akhauriyash/Code-Regression huggingface dataset:
S = input()
check = 0
tmp = S[2:-1].split('C')
if (S[0]=='A') and (len(tmp)==2) and S[1].lower()==S[1] and S[-1].lower()==S[-1]:
    for i in range(len(tmp)):
        if tmp[i].lower() == tmp[i]:
            check += 1
    if check == len(tmp):
        print('AC')
    else:
        print('WA')
else:
    print('WA')


Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		sc.close();
		
		int n= s.length();
		char[] c = s.toCharArray();
		int ans = 0;
		
		char cc = c[0];
		for(int i=0; i<n; i++){
			if(cc != c[i]){
				cc = c[i];
				ans++;
			}
		}
		System.out.println(ans);
		

	}

}

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

typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

int main() {
	int n, m, k;
	cin >> n >> m >> k;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j) {
			int ans = i + j + i * (m - 1 - j) + j * (n - 1 - i);
			if (ans == k) {
				cout << "Yes\n";
				return 0;
			}
			ans = i + j + 1 + i * j + (n - 1 - i) * (m - 1 - j);
			if (ans == k) {
				cout << "Yes\n";
				return 0;
			}
		}
	cout << "No\n";
	return 0;
}




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

using namespace std;

int main() {
	string t, op, p;
	int q, a, b;

	cin >> t;
	cin >> q;

	for (int i = 0; i < q; i++) {
		cin >> op;
		if (op == "print") {
			cin >> a >> b;
			cout << t.substr(a, b-a+1) << endl;
		}
		if (op == "reverse") {
			cin >> a >> b;
			reverse(t.begin()+a, t.begin()+b+1);
		}
		if (op == "replace") {
			cin >> a >> b >> p;
			t.replace(t.begin()+a, t.begin()+b+1, p);
		}
	}

	return 0;
}

Measured memory_bytes: 1220
#include <stack>
#include <queue>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <tuple>
#include <cmath>
#include <random>
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <chrono>
#include <numeric>

#define fio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
#define rng mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count())

#define ri(...) i64 __VA_ARGS__; rx(__VA_ARGS__)
#define rc(...) char __VA_ARGS__; rx(__VA_ARGS__)
#define rs(...) string __VA_ARGS__; rx(__VA_ARGS__)
#define rvi(x, n) vi x(n); cin >> x
#define rvvi(x, n, m) vvi x(n, vi(m)); cin >> x

#ifndef ONLINE_JUDGE
#define dbg(...) cerr << '[' << #__VA_ARGS__ << "]: "; dbg_log(__VA_ARGS__)
#else
#define dbg(...) ;;
#endif

#define fa(i, v) for (auto &i : v)
#define fi(i, n) for (i32 i = 0; i < n; i++)
#define fp(i, n) for (i32 i = 1; i < n; i++)
#define fr(i, n) for (i32 i = n - 1; i >= 0; i--)
#define fu(i) ri(_i); fi(i, _i)

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

typedef uint32_t u32;
typedef int32_t i32;
typedef uint64_t u64;
typedef int64_t i64;
#ifdef __SIZEOF_INT128__
typedef __uint128_t u128;
typedef __int128_t i128;
#endif
typedef vector<i64> vi;
typedef vector<vi> vvi;

template<typename T>
inline istream &operator>>(istream &in, vector<T> &v) {
    fa(x, v) in >> x;
    return in;
}

template<typename T>
inline ostream &operator<<(ostream &out, const vector<T> &v) {
    fa(x, v) out << x << ' ';
    return out;
}

template<typename T>
inline void rx(T &x) {
    cin >> x;
}

template<typename T, typename... R>
inline void rx(T &x, R &... l) {
    cin >> x;
    rx(l...);
}

template<typename T>
inline void dbg_log(const T &x) {
    cerr << x << '\n';
}

template<typename T, typename... R>
inline void dbg_log(const T &x, const R &... l) {
    cerr << x << ", ";
    dbg_log(l...);
}

template<typename T>
inline void wl(const T &x) {
    cout << x << '\n';
}

template<typename T, typename... R>
inline void wl(const T &x, const R &... l) {
    cout << x << ' ';
    wl<R...>(l...);
}

int main() {
    fio;

    ri(n);

    i64 k = 1;
    i32 m = 1;
    while (k * 26 < n) {
        k *= 26;
        m++;
        n -= k;
    }
    n--;

    vector<i32> res;
    while (n) {
        res.push_back(n % 26);
        n /= 26;
    }
    fi(i, m - res.size()) {
        cout << 'a';
    }
    fr(i, res.size()) {
        cout << (char) ('a' + res[i]);
    }

    return 0;
}


Measured memory_bytes: 3652
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
std::random_device rd;
std::mt19937 mt(rd());
constexpr int MOD = 1e9 + 7; constexpr int MAX = 200020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e16;
typedef array<int, 3>arr3;

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

// テーブルを作る前処理
void COMinit() {
	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;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}

ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p - 1));
	return bin_pow(mult(x, x), p / 2);
}

void solve() {
	int N, M; cin >> N >> M;
	vector<int>X(N), Y(M);
	REP(i, N)cin >> X[i];
	REP(i, M)cin >> Y[i];
	VSORT(X); VSORT(Y);
	int h = 0, w = 0;
	REP(i, N) {
		h += X[i] * i%MOD;
		h %= MOD;
		h -= X[i] * (N - i - 1) % MOD;
		h %= MOD;
		if (h < 0)h += MOD;
	}
	REP(j, M) {
		w += Y[j] * j%MOD;
		w %= MOD;

		w -= Y[j] * (M - j - 1) % MOD;
		w %= MOD;
		if (w < 0)w += MOD;
	}
	print(h*w%MOD);
}

signed main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
		solve();
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename S, typename T>
void xmin(S&a, T const&b){if(b<a) a=b;}
template<typename S, typename T>
void xmax(S&a, T const&b){if(b>a) a=b;}

signed main()
{
    #ifdef LOCAL_RUN
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    int TTT; cin >> TTT; while(TTT--){
    #else
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    #endif // LOCAL_RUN



    array<ll, 3> v;
    for(auto &e:v) cin >> e;
    sort(v.begin(), v.end());
    ll sum = accumulate(v.begin(), v.end(), 0ll);
    ll ans = v[2]-v[1] + v[1]-v[0];
    cout << ans << "\n";


    #ifdef LOCAL_RUN
    }
    #endif // LOCAL_RUN
    return 0;
}


Measured memory_bytes: 256
#include <iostream> 
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>  
#define ll long long
  
using namespace std; 
 
vector<int> graph[1000]; 
 
void print_array(int* A, int n) {
    for (int i = 0; i < n; i++) {
        cout << A[i] << ' ';
    }
    cout << endl;
}
 
void print_vector(vector<int> A) {
    for (auto x : A) {
        cout << x << ' ';
    }
    cout << endl;
}
 
void find_loop(int st_node, int N, vector<int> &coll) {
    int from_node[N], visited[N];
    queue<int> next_node;
    for (int i = 0; i < N; ++i) visited[i] = 0;
    next_node.push(st_node);
    visited[st_node] = 1;
 
    while (!next_node.empty()) {
        bool loop = false;
        int curr_node = next_node.front();
        next_node.pop();
        for (auto vx : graph[curr_node]) {
            if (!visited[vx]) {
                next_node.push(vx);
                from_node[vx] = curr_node;
                visited[vx] = 1;
            }
            if (vx == st_node) {
                // Loooop
                loop = true;
                from_node[vx] = curr_node;
                break;
            }
        }
        if (loop) {
            // Collect loop nodes
            int pointer = st_node;
            do
            {
                coll.push_back(pointer);
                pointer = from_node[pointer];
            } while (pointer != st_node);
            break;
        }
    }
    // print_array(from_node, N);
}
 
int main() {
    int N, M;
    cin >> N >> M;
    vector<int> collect[N];
 
    for (int i = 0; i < M; i++) {
        int u, v;
        cin >> u >> v;
        graph[u-1].push_back(v-1);
    }
 
    vector<int> *final_collect;
    int min_loop_length = 99999;
    for (int i = 0; i < N; i++) {
        find_loop(i, N, collect[i]);
        if (collect[i].size() > 0) {
            if (collect[i].size() < min_loop_length) {
                min_loop_length = collect[i].size();
                final_collect = &collect[i];
            }
            
        }
    }
    if (min_loop_length != 99999) {
        cout << final_collect->size() << endl;
        for (auto x : *final_collect) {
            cout << x+1 << endl;
        }
        return 0;
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod ((int)1e9+7)
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a,ll b) {
   ll res=1;
   while(b){
      if(b%2==1) res=(res*a)%mod;
      a=(a*a)%mod;
      b>>=1;
   }
   return res;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)1e5+5;
const int M = (int)3e3+5;
const int Q = 401;
const int logN = 19;

ll dp[Q][Q], a[N], sum[N];
void solve() {
    int n;
    cin>>n;
    REP(i,1,n) {
        cin>>a[i];
        sum[i] = a[i] + sum[i-1];
    }
    REPN(i,n,1) {
        dp[i][i] = 0;
        REP(j,i+1,n) {
            dp[i][j] = lim;
            REP(k,i,j-1) {
                dp[i][j] = min(dp[i][j],dp[i][k]+dp[k+1][j]+sum[j]-sum[i-1]);
            }
        }
    }
    cout<<dp[1][n];
}
int main() {
    //freopen("output.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        cout<<"\n";
    }
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int k;
	scanf("%d",&k);
	queue<ll>q;
	for(int i=1;i<=9;i++)q.push(i);
	ll ans;
	for(int i=1;i<=k;i++){
		ans=q.front();
		q.pop();
		if(ans%10)q.push(10*ans+(ans%10)-1);
		q.push(10*ans+(ans%10));
		if(ans%10!=9)q.push(10*ans+(ans%10)+1);
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

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

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        ArrayList<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        int n = Integer.valueOf(mylist.get(0).split(" ")[0]);

        double mysum = 0;
        for (int i = 1; i < 1 + n; i++) {
            for (int j = i + 1; j < 1 + n; j++) {
                String arr_temp01[] = mylist.get(i).split("\\s");
                String arr_temp02[] = mylist.get(j).split("\\s");

                int x1 = Integer.valueOf(arr_temp01[0]);
                int y1 = Integer.valueOf(arr_temp01[1]);
                int x2 = Integer.valueOf(arr_temp02[0]);
                int y2 = Integer.valueOf(arr_temp02[1]);

                double x_long = Math.pow(x1 - x2, 2);
                double y_long = Math.pow(y1 - y2, 2);
                double xy = Math.sqrt(x_long + y_long);
                //拠点間の合計をプラス
                mysum += xy;

            }

        }
        //階乗計算
        int k = 1;
        for (int i = 1; i <= n; i++) {
            k *= i;
        }
        k /= 2;

        int goukei = k * (n - 1) / (n * (n - 1) / 2 * 1);

        System.out.println(mysum * goukei / k);

    }

}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vl vaector<long>
#define vll vector<long long int>
#define vC  vector<char>
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
ll pow(ll x, ll y,ll m) { ll res = 1;x=x%m; while (y > 0) { if (y & 1) res = ((res%m) * (x%m))%m; y = y >> 1; x = ((x%m) * (x%m))%m; } return res%m; }
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
const ll INF = 0xFFFFFFFFFFFFFFFL;
clock_t time_p=clock();
void abhigyan10()
{time_p=clock()-time_p;cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";}
ll seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline ll rnd(ll l=0,ll r=INF){return uniform_int_distribution<ll>(l,r)(rng);}
#define clrbuf cin.ignore(numeric_limits<streamsize>::max(),'\n');
#define preciset(x) cout<<setprecision(x)<<fixed;
const ll mod =1000000007;
int main()
{
    
	
    	
        FastIO
        ll k,x;
        cin>>k>>x;

        if(k*500 >=x)
        	cout<<"Yes\n";
        else
        	cout<<"No\n";
        return 0;
    }

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

  int N;
  cin >> N;
  vector<string> S(N);
  rep(i, N) cin >> S[i];

  std::sort(S.begin(), S.end());
  string S_tmp {""};
  int answer {};
  rep(i, N) {
    if (S_tmp != S[i]) {
      S_tmp = S[i];
      ++answer;
    }
  }
  cout << answer << '\n';
}


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

int main(){
  int n,k;
  long long int dis[100][100];
  int s,a,b;
  long long int c;

  while(1){
    cin >> n >> k;
    if(!n && !k)break;

    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(i==j)dis[i][j] = 0;
	else dis[i][j] = -1;
      }
    }

    for(int i=0;i<k;i++){
      cin >> s;
      if(s){
	cin >> a >> b >> c;
	a--;
	b--;
	for(int j=0;j<n;j++){
	  for(int l=0;l<n;l++){
	    if(dis[j][a] >= 0 && dis[l][b] >=0){
	      if( (dis[j][l] < 0) || (dis[j][l] > (dis[j][a] + c + dis[l][b]) ) ){
		dis[j][l] = dis[j][a] + c + dis[l][b];
		dis[l][j] = dis[j][a] + c + dis[l][b];
	      }
	    }
	  }
	}
      }else{
	cin >> a >> b;
	cout << dis[a-1][b-1] << endl;
      }
    }
  }
}

Measured memory_bytes: 940
#include <stdio.h>

int main(void)
{
        int S;
        int h;
        int m;
        int s;

        scanf("%d", &S);

        s = S % 60;
        m = (S - s) / 60;
        m = m % 60;
        h = (S - s) / 60 - m;
        h = h / 60;

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

        return 0;
}



Measured memory_bytes: 2092
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n-1];
        int sum = 0;
 
        for(int i =0 ; i< n; i++ ){
            a[i] = sc.nextInt();
        }
 
        for(int i = 0;i<n;i++){
            b[i] = sc.nextInt();
        }
 
        for(int i = 0;i<n-1;i++){
            c[i] = sc.nextInt();
        }
 
        for(int i = 0; i<n;i++){
            sum += b[a[i]-1];
            if(i>0 && a[i]==a[i-1]+1){
                sum+=c[a[i]-2];
            }
        }
 
        System.out.println(sum);
		
	}
}


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

using namespace std;

int main() {
	int N,H,W;
	cin >> N >> H >> W;
	int ans=0;
	int A, B;
	for (int i = 0; i < N; i++) {
		cin >> A >> B;
		if (A >= H && B >= W) {
			ans++;
		}
	}
	cout << ans;
	return 0;
}

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

public class Program {
    public static void Main() {
        var arr = ReadLib.ReadAsIntArray();
        var sub = new int[] { arr[0] - arr[1], arr[1] - arr[2], arr[2] - arr[0] };
        var abs = sub.Select(s => Math.Abs(s)).OrderByDescending(i => i).Skip(1).Sum();
        Console.WriteLine(abs);
    }
}

static class ReadLib {
    public static long ReadAsLong() {
        return long.Parse(Console.ReadLine());
    }

    public static int ReadAsInt() {
        return int.Parse(Console.ReadLine());
    }

    public static int[] ReadAsIntArray() {
        return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
    }

}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#include <unistd.h>
#define inf 1000000007LL
#define INF 1000000000000000007LL
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define st first
#define nd second
#define ll long long
#define ld long double
#define pii pair<int,int>
#define vi vector<int>
#define vll vector<long long>
#define vpii vector< pair<int,int> >
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define LOG(x) (63-__builtin_clzll(x))
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i, n) for(int i=1; i<=(n); ++i)
#define endr cerr<<'\n'
#define endl '\n'
#ifdef DEBUG
#define pv(...) cerr<<'\n',dbg(#__VA_ARGS__, __VA_ARGS__)
#define ps(x) {cerr<<'\n'<<#x<<":\n:";for(auto _q:(x)){cerr<<_q<<" ";}cerr<<'\n';}
#define pa(x, xs) {cerr<<'\n'<<#x<<":\n:";for(int _q=0; _q<=(xs); ++_q){cerr<<x[_q]<<" ";}cerr<<'\n';}
#define pal(x, xs) {cerr<<'\n'<<#x<<":\n";for(int _q=0; _q<=(xs); ++_q){cerr<<_q<<": "<<setw(_q? 3-(int32_t)log10(_q):3)<<x[_q]<<'\n';}cerr<<'\n';}
#define ppii(x, xs) {cerr<<'\n'<<#x<<":\n";for(int _q=0; _q<=(xs); ++_q){cerr<<_q<<": "<<setw(_q? 6-(int32_t)log10(_q):6)<<x[_q].first<<" "<<setw(5)<<x[_q].second<<'\n';}cerr<<'\n';}
#define pm(x, xn, xm) {cerr<<'\n'<<#x<<":\n";for(int _qa=0; _qa<=(xn); ++_qa){for(int _qb=0; _qb<=(xm); ++_qb){cerr<<setw(6)<<x[_qa][_qb]<<" ";}cerr<<'\n';}cerr<<'\n';}
#else
#define cerr if(0)cout
#define pv(...) if(0)endr
#define ps(x) if(0)endr
#define pa(x, xs) if(0)endr
#define pal(x, xs) if(0)endr
#define ppii(x, xs) if(0)endr
#define pm(x, xn, xm) if(0)endr
#endif
using namespace std;
template<class T> void dbg(const char* xn, T x){cerr<<xn<<": "<<x<<"\n";} template<class T, class... TA> void dbg(const char* xn, T x, TA... t){while(*xn!=',')cerr<<*xn++;cerr<<": "<<x<<",";dbg(xn+1, t...);}
template<class T> inline bool upd_max(T &x, T y){return y>x?x=y,true:false;} template<class T> inline bool upd_min(T &x, T y){return y<x?x=y,true:false;}
const int N = 1000007;
#define int long long

int n, A[N], B[N];


void solve()
{
  cin>>n;
  rep1(i, n) cin>>A[i];
  rep1(i, n) cin>>B[i];

  int have = 0, need = 0;
  for (int i=1; i<=n; ++i)
  {
    if (A[i] <= B[i])
    {
      have += (B[i]-A[i])/2;
    }
    else
    {
      need += A[i] - B[i];
    }
  }

  pv(have, need);
  if (have >= need) cout<<"Yes";
  else cout<<"No";
}

int32_t main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
cout<<fixed<<setprecision(10);

  solve();

return 0;
}


Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

int main()
{
  int h1,m1,h2,m2,k;
  cin>>h1>>m1>>h2>>m2>>k;
  cout<<(h2-h1)*60+(m2-m1)-k<<endl;
}

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



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

    int a=s.at(0)-'0',b=s.at(1)-'0',c=s.at(2)-'0',d=s.at(3)-'0';

    if(a+b+c+d==7)cout<<a<<'+'<<b<<'+'<<c<<'+'<<d<<"=7"<<endl;
    else if(a+b+c-d==7)cout<<a<<'+'<<b<<'+'<<c<<'-'<<d<<"=7"<<endl;
    else if(a+b-c+d==7)cout<<a<<'+'<<b<<'-'<<c<<'+'<<d<<"=7"<<endl;
    else if(a-b+c+d==7)cout<<a<<'-'<<b<<'+'<<c<<'+'<<d<<"=7"<<endl;
    else if(a+b-c-d==7)cout<<a<<'+'<<b<<'-'<<c<<'-'<<d<<"=7"<<endl;
    else if(a-b+c-d==7)cout<<a<<'-'<<b<<'+'<<c<<'-'<<d<<"=7"<<endl;
    else if(a-b-c+d==7)cout<<a<<'-'<<b<<'-'<<c<<'+'<<d<<"=7"<<endl;
    else if(a-b-c-d==7)cout<<a<<'-'<<b<<'-'<<c<<'-'<<d<<"=7"<<endl;

}

Measured memory_bytes: 256
def month_candidate?(x)
  (1 <= x) && (x <= 12)
end
 
def main(argv)
  s = gets.chomp
  
  f = month_candidate?((s[0] + s[1]).to_i)
  g = month_candidate?((s[2] + s[3]).to_i)
  
  if (f && g) then
    puts 'AMBIGUOUS'
  elsif f then
    puts 'MMYY'
  elsif g then
    puts 'YYMM'
  else
    puts 'NA'
  end
end
 
if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <limits.h>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
    long long X,Y;
    cin >> X >> Y;
    cout << ( abs(X-Y) >= 2 ? "Alice" : "Brown" ) << endl;
    return 0;
}


Measured memory_bytes: 256
# Takahashi: A:HP, B:AP
# Aoki: C:HP, D:AP
A, B, C, D = map(int, input().split())

HP = [A, C]
AP = [B, D]

attack_turn = 0
defence_turn = 1

while(min(HP) > 0):
    HP[defence_turn] -= AP[attack_turn]    
    attack_turn = (attack_turn + 1)%2
    defence_turn = (defence_turn + 1)%2

if HP[0] <= 0:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 9112
s=int(input())
T = []
T.append(s)
ans=s
for i in range(10000):
    if ans%2==0:
    	ans=ans//2
    	if ans in T:
    		print(len(T)+1)
    		break
    	else:
    		T.append(ans)
    else:
    	ans=3*ans+1
    	if ans in T:
    		print(len(T)+1)
    		break
    	else:
    		T.append(ans)

Measured memory_bytes: 3060
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 *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

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

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

N, K = getNM()
X = getList()

pos = sorted(v for v in X if v >= 0)
neg = sorted(-v for v in X if v < 0)

# 全てのXの要素を使うなら答えは自明
if N == K:
    ans = 1
    for x in X:
        ans *= x
        ans %= mod
    print(ans % mod)
    exit()

ok = False  # True: ans>=0, False: ans<0
if pos:
    #正の数があるとき
    ok = True
else:
    #全部負-> Kが奇数なら負にならざるをえない。
    ok = (K % 2 == 0)

ans = 1
if ok:
    # ans >= 0
    if K % 2 == 1:
        #Kが奇数の場合初めに1つ正の数を掛けておく
        #こうすれば後に非負でも負でも2つずつのペアで
        #考えられる
        ans = ans * pos.pop() % mod

    # 答えは非負になる→二つの数の積は必ず非負になる．
    cand = []
    while len(pos) >= 2:
        x = pos.pop() * pos.pop()
        cand.append(x)

    while len(neg) >= 2:
        x = neg.pop() * neg.pop()
        cand.append(x)

    cand.sort(reverse = True) # ペアの積が格納されているので必ず非負
    # ペア毎に掛けていく
    for i in range(K // 2):
        ans = ans * cand[i] % mod
else:
    # ans <= 0
    cand = sorted(X, key=lambda x: abs(x))
    for i in range(K):
        ans = ans * cand[i] % mod

print(ans)

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

int main(){
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if(max({a, b, c, d, e})-min({a, b, c, d, e})<=k)cout << "Yay!";
  else cout << ":(";
  return 0;
}

Measured memory_bytes: 384
A,B,K = map(int, input().split())

if K == A:
    A = 0
    K = 0
elif K < A:
    A -= K
    K = 0
else:
    K -= A
    A = 0
    
if K >= B:
    B = 0
else:
    B -= K
print(A,B)

Measured memory_bytes: 3060
Data = []

while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    else:
        Data.append(list((m, f, r)))
        
Judge = []

for data in Data:
    m, f, r = data[0], data[1], data[2]
    if m + f >= 80:
        Judge.append('A')
    elif (m == -1 or f == -1) or (m + f < 30):
        Judge.append('F')
    elif 65 <= m + f < 80:
        Judge.append('B')
    elif 50 <= m + f < 65 or (30 <= m + f < 50 and r >= 50):
        Judge.append('C')
    elif 30 <= m + f < 50 and r < 50:
        Judge.append('D')

for judge in Judge:
    print(judge, end='\n')


Measured memory_bytes: 5608
import sys
import heapq 
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    A = list(map(lambda x : int(x) * -1, input().split()))
    heapq.heapify(A)

    for _ in range(M):
        a = heapq.heappop(A) * -1
        a = a // 2
        heapq.heappush(A, a * -1)

    print(sum(A) * -1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 14200
# -*- coding: utf-8 -*-
from sys import stdin
# import numpy as np

s_in = lambda: stdin.readline()[:-1]  # s = s_in()
d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()


S = s_in()

keyence = 'keyence'
idx = 0
flag = False
for i in range(len(keyence)):
    if S[:i] + S[i-len(keyence):] == keyence:
        flag = True
        break

if flag:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
 
      if(a>=b){
        for(int i=0; i<a; i++){
    		System.out.print(b);
      }
         }else{
		for(int i=0; i<b; i++){
			System.out.print(a);
      }
      }
}
}

Measured memory_bytes: 18900
/*
 * Author : Sadi
 * Tue 14/07/2020
 * 13:48:44.78
 */
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <climits>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    int ans = 0;
    for(int i = 0; i < n; ++i) {
        cin >> v[i];
        if(v[i] >= k) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
n = int(input())
results = [input() for i in range(n)]

ac = sum(x == "AC" for x in results) 
wa = sum(x == "WA" for x in results) 
tle = sum(x == "TLE" for x in results) 
re = sum(x == "RE" for x in results) 

print("AC x {0}".format(ac))
print("WA x {0}".format(wa))
print("TLE x {0}".format(tle))
print("RE x {0}".format(re))

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

int main(){
	
	int a,b,C;
	double rad,S,L,h;
	
	cin >> a >> b >> C;
	rad=acos(-1)*C/180;
	S=a*b*sin(rad)/2;
	L=a+b+sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(rad));
	h=b*sin(rad);
	
	printf("%.8f\n""%.8f\n""%.8f\n",S,L,h);
	
	return 0;
}

Measured memory_bytes: 1196
def main():
    s = input()
    ans = 1
    if s != s[::-1]:
        print("No")
        return 0

    n = len(s)
    t_s = s[:(n-1)//2]
    if t_s != t_s[::-1]:
        print("No")
        return 0
    x_s = s[(n+3)//2-1:n]

    if x_s != x_s[::-1]:
        print("No")
        return 0

    print("Yes")
    return 0


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	int n;
	ll res=1e18;
	cin>>n;
	vector<ll> a(n);
	for(ll& x:a) cin>>x;
	ll sum=0,cnt=0;
	for(int i=0;i<n;++i){
		sum+=a[i];
		if(i%2==0&&sum>=0){
			cnt+=sum+1;
			sum=-1;
		}
		else if((i&1)&&sum<=0){
			cnt+=1-sum;
			sum=1;
		}
	}
	res=min(res,cnt);
	sum=cnt=0;
	for(int i=0;i<n;++i){
		sum+=a[i];
		if(i%2==0&&sum<=0){
			cnt+=1-sum;
			sum=1;
		}
		else if((i&1)&&sum>=0){
			cnt+=sum+1;
			sum=-1;
		}
	}
	res=min(res,cnt);
	cout<<res<<'\n';
}



Measured memory_bytes: 3968
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>


#define rep(p,q) for(int i = p;i < q;i++)
#define ll long long

using namespace std;

const int cons = 1e9 + 7;

//45D
int main(void) {
	map<pair<int,int>, ll> coordinate = map<pair<int,int>, ll>();
	ll count[10]{ 0,0,0,0,0,0,0,0,0,0 };
	ll h,w,n;
	cin >> h >> w >> n;
	rep(0, n) {
		int x, y;
		cin >> y >> x;
		for (int j = x - 2; j <= x; j++) {
			for (int k = y - 2; k <= y; k++) {
				if (j < 1 || k < 1 || j + 2 > w || k + 2  > h)continue;

				pair<int, int> rect = make_pair(j, k);
				if (coordinate.find(rect) != coordinate.end()) {
					coordinate.at(rect)++;
				}
				else {
					coordinate.insert(make_pair(rect, (ll)1));
				}
			}
		}
	}

	auto itr = coordinate.begin();
	rep(0, coordinate.size()) {
		count[itr->second]++;
		itr = next(itr, 1);
	}
	count[0] = (h - 2)*(w - 2);
	rep(1, 10) {
		count[0] -= count[i];
	}
	rep(0, 10) {
		cout << count[i] << endl;
	}
}

Measured memory_bytes: 56448
def is_prime(n): 
    i = 2
    while i * i <=n:
        if n % i == 0:
            return False
        i += 1
    return True
  

while True:
    try:
        n = int(raw_input())
    except EOFError:
        break    
    k = n - 1
    m = n + 1
    while not is_prime(k):
        k -= 1
    while not is_prime(m):
        m += 1
    print k,m

Measured memory_bytes: 4212
#include <bits/stdc++.h>
 
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------

int main(){
    int r;
    cin>>r;
    cout << fixed << setprecision(10);

    cout<<r*3.1415926535*2<<endl;
}
   




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

int main(){
  string S;cin>>S;int a=0,b=0,c=0;
  if(S[0]=='A')a=1;
  for(int i=2;i<S.size()-1;i++){
      if(S[i]=='C')b++;
  }
  for(int i=0;i<S.size();i++){
    if(96<S[i])c++;
  }
  if(a==1&&b==1&&c==S.size()-2)cout<<"AC"<<endl;
  else cout<<"WA"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define MOD 998244353
typedef double ld;
#define PI 3.14159265


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

    int n , m;
    cin >> n;
    set <string> s;
    string str;
    map<string , int> mp1;
    for(int i = 0 ;i < n ; i++) {
        cin >> str;
        s.insert(str);
        mp1[str]++;
    }
    cin >> m;
    int ans = 0;
    map<string , int> mp;
    for(int i = 0 ; i < m ; i++) {
        cin >> str;
        mp[str]++;
    }

    for(auto it : s) {
        ans = max(ans , ((mp1.find(it) == mp1.end() ? 0 : mp1[it]) - (mp.find(it) == mp.end() ? 0 : mp[it])));
    }
    cout << ans << endl;

    return 0;
}


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

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


Measured memory_bytes: 256
import Data.List

main = do
  n <- readLn :: IO Int
  ss <- lines <$> getContents :: IO [String]
  putStr $ unlines $ let total = count ss
                         k = fst (head total)
                         top x = fst x == k
                     in map snd $ takeWhile top total

count ss = sort $ uniq [] $ sort ss
    where uniq y [] = y
          uniq [] (s: ss) = uniq [(-1, s)] ss
          uniq y @((n, t): z) (s: ss) = uniq (if s == t then (n-1, t): z else (-1, s): y) ss


Measured memory_bytes: 142332
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	int r, g, b;
	cin >> r >> g >> b;

	int value = r * 100 + g * 10 + b;
	if (value % 4 == 0)
	{
		cout << "YES";
	}
	else
	{
		cout << "NO";
	}

	return 0;
}


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

int n;
string s;

int main(){

    cin >> n >> s;

    int i, count = 1;
    for (i=1; i<n; i++){
        if (s.at(i) != s.at(i-1)){
            count++;
        }
    }

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

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>

int main() {
	std::string s;
	std::cin >> s;

	int ans = int(1e9), n = s.size();

	for (int i = 0; i < n; ++i) {
		if (s[i] != s[i + 1]) {
			ans = std::min(ans, std::max(i + 1, n - i - 1));
		}
	}

	std::cout << ans << std::endl;

	return 0;
}

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

const int MOD = 1000000007;

const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

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

    string ans;
    if (S == "Sunny") {
        ans = "Cloudy";
    } else if (S == "Cloudy") {
        ans = "Rainy";
    } else {
        ans = "Sunny";
    }

    cout << ans << endl;
}

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

using namespace std;

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


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

int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> a(n,vector<int>(m));
    vector<int> b(m);
    vector<int> c(n);
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> a.at(i).at(j);
        }
    }
    for(int i=0;i<m;i++){
        cin >> b.at(i);
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            c.at(i) += a.at(i).at(j) * b.at(j);
        }
    }
    for(int i=0;i<n;i++){
        cout << c.at(i) << endl;
    }
    return 0;
    
}


Measured memory_bytes: 3160
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        String S = sc.nextLine();
        String T = sc.nextLine();

        int Sl = S.length();
        int Tl = T.length();
        int min = 1000;

        for(int i = 0; i < (Sl-Tl+1); i++) {
            char[] Schr = S.toCharArray();
            char[] Tchr = T.toCharArray();
            int tmp = 0;
            for (int j = 0; j < Tl; j++) {
                if (Schr[j + i] == Tchr[j]) {
                    tmp++;
                }
            }
            tmp = Tl - tmp;
            if(tmp < min){
                min = tmp;
            } else if(tmp == 0) {
                break;
            }
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 28908
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int N,K;
  cin>>N>>K;
  int h[N];
  int ans=0;
  REP(i,N){
    cin>>h[i];
    if(h[i]>=K)ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 640
// Problem : A - Kenken Race
// Contest : AtCoder - AtCoder Grand Contest 034
// URL : https://atcoder.jp/contests/agc034/tasks/agc034_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	//handmade_07
	// ios_base::sync_with_stdio(0); cin.tie(0);    
	// ifstream if1 ;
	// if1.open("handmade_07.in") ;

	int N,A,B,C,D;
	cin>>N>>A>>B>>C>>D;
	A--,B--,C--,D--;
	string str;
	cin>>str;
	FOR(x,B,D+1)
	{
		if(x==D || x+1==D)
			break;
		if(str[x+1]=='.')
			continue;
		if(str[x+2]=='.')
		{
			x++;
			continue;
		}
		else
		{
			cout<<"No";
			return 0;
		}
	}
	FOR(x,A,C+1)
	{
		if(x==C || x+1==C)
			break;
		if(str[x+1]=='.')
			continue;
		if(str[x+2]=='.')
		{
			x++;
			continue;
		}
		else
		{
			cout<<"No";
			return 0;
		}
	}
	if(C>D)
	{
		bool flag=true;
		
		FOR(x,B,D+1)
		{
			// if(x==D || x+1==D)
				// break;
			if(str[x+1]=='.' && str[x]=='.' && str[x-1]=='.')
			{
				goto aa;
			}
			if(str[x+1]=='.')
				continue;
			if(str[x+2]=='.')
			{
				x++;
				continue;
			}
			else
			{
				cout<<"No";
				return 0;
			}
		}
		cout<<"No";
		return 0;
	}
	aa:cout<<"Yes";
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)
#define Graph vector<vecctor<ll>>
#define pairs vector<pair<ll,ll>>
#define pb push_back



using namespace std;
using ll = long long;
const ll INF = 1e18;
const double PI = acos(-1);

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

const ll mod = 1e9 + 7;

ll modpow(ll a, ll b){
    if(b == 0)return 1;
    if(b%2 == 0){
        ll k = modpow(a,b/2);
        return k*k%mod;
    }else{
        return modpow(a,b-1)*a%mod;
    }
}

ll gcd(ll a,ll b){
    ll p = max(a,b);
    ll q = min(a,b);
    while(p%q != 0){
        ll s = p%q;
        p = max(s,q);
        q = min(s,q);
    }
    return q;
}

int main(void)
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    ll a,b;
    cin >> a >> b;
    ll m = max(a,b),n = min(a,b);

    ll ans = m*n/gcd(m,n);
    cout << ans << endl;

    return 0;


}


Measured memory_bytes: 3648
a_500 = int(input())
b_100 = int(input())
c_50 = int(input())
kadai = int(input())
sum_coin = 0
count = 0
sum_list = []

for n in range(a_500 + 1):
    for m in range(b_100 + 1):
        for l in range(c_50 + 1):
            sum_list.append((500*n) + (100*m) + (50*l))
print(sum_list.count(kadai))

Measured memory_bytes: 14216
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;

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

ll dp[310][310][310];

int main() {
    int N,K; cin>>N>>K;

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

    for (int i = 0; i < 310; ++i) {
        for (int j = 0; j < 310;++j) {
            for (int k = 0; k < 310; ++k) {
                dp[i][j][k]=(ll)1e15;
            }
        }
    }

    dp[0][0][0]=0;
    for (int i = 1; i <= N; ++i) {
        for (int j = 0; j <=K; ++j) {
            for (int k = 0; k < i; ++k) {
                //柱iを変えない
                dp[i][j][i]=min(dp[i][j][i],dp[i-1][j][k]+max(0ll,(ll)h[i]-h[k]));
                //柱iを変える
                if(j<K) dp[i][j+1][k]=dp[i-1][j][k];
            }
        }
    }

    ll ans=INT64_MAX;
    for (int j = 0; j <= K; ++j) {
        for (int k = 0; k <=N; ++k) {
            ans=min(ans,dp[N][j][k]);
        }
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 233088
#include <bits/stdc++.h>
#define long long long int
using namespace std;



const long MOD = 1000000007;

long mult(long a, long b) {
    return a * b % MOD;
}

long power(long a, long b) {
    long res = 1;
    while (b > 0) {
        if (b & 1) res = mult(res, a);
        a = mult(a, a);
        b /= 2;
    }
    return res;
}

long inv(long a) {
    return power(a, MOD - 2);
}

long calc(long a, long n) {
    long p = 1;
    for (long i = 0; i < a; i++) {
        p = mult(p, n - i);
    }
    long q = 1;
    for (long i = 1; i <= a; i++) {
        q = mult(q, i);
    }
    return mult(p, inv(q));
}

int main() {
    ios::sync_with_stdio(false);

    long n, a, b;
    cin >> n >> a >> b;
    long res = power(2, n) - 1;
    res -= calc(a, n);
    res -= calc(b, n);
    res %= MOD;
    if (res < 0) res += MOD;
    cout << res;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
 
using namespace std;
typedef long long int ll;
string S;
int main()
{
  ll i;
  ll sum=0;
  ll len, cl;
  ll last;

  cin >> S;

  len = S.size();
  last = 0;
  for (i=0; i<len; ) {
    cl=0;
    switch(S[i]) {
    case '<':
      while (S[i] == '<' && i<len) {cl++; i++;}
      sum += cl*(cl+1)/2;
      break;
    case '>':
      while (S[i] == '>' && i<len) {cl++;i++;}
      if (last <= cl) {
	sum += cl*(cl+1)/2 - last;
      } else {
	sum += cl*(cl-1)/2;
      }
      break;
    }
    last = cl;
//printf("%d %d\n", cl, sum);
  }

//  printf("%lld\n", sum);
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 900