akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdlib>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>
#include <sstream>
#include <math.h>

using namespace std;

#define ll long long int
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecchar vector<char>
#define vecstr vector<string>
#define vecbool vector<bool>
#define vec2bool vector<vector<bool>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

#define Pi 3.1415926535897932384626

int main() {
	ll n,d, ans = 0,count = 0;
	string s;
	bool flag = false;

	cin >> n;
	cin >> s;

	ll w=0, r=0;

	for (ll i = 0; i < s.size(); i++)
	{
		if (s[i] == 'W')
		{
			w++;
		}
		else
		{
			r++;
		}
	}

	if (w == 0 || r == 0)
	{
		ans = 0;
	}
	else
	{
		ll wcount = 0, rcount = 0;
		ll pointL = 0, pointR = s.size() - 1;
		while (1)
		{
			forll(i,0,s.size())
			{
				if (s[i] == 'W')
				{
					wcount++;
					pointL = i;
					forllde(j, pointR)
					{
						pointR = j;

						if (pointR <= pointL)
							break;

						if (s[j] == 'R')
						{
							s[i] = 'R';
							s[j] = 'W';
							pointR--;
							ans++;
							break;
						}
					}
				}
				else
				{
					rcount++;
				}

				if (pointL == pointR)
				{
					break;
				}
			}
			if (pointL >= pointR)
			{
				break;
			}
		}
	}

	cout << ans;
}


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

typedef long long ll;
typedef pair <int , int> pii;
typedef long double ld;

const int N = 3e5+10 , mod = 1e9+7;

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int n;
   cin >> n;
   int a[3 * n];
   for(int i = 0 ; i < 3 * n ; i++)
      cin >> a[i];
   int dp[n + 1][n + 1] , mxx[n + 1] , hlp[n + 1][n + 1];
   for(int i = 0 ; i < n + 1 ; i++){
      mxx[i] = -mod;
      for(int j = 0 ; j < n + 1 ; j++)
         dp[i][j] = hlp[i][j] = -mod;
   }
   dp[a[0]][a[1]] = dp[a[1]][a[0]] = 0;
   int add = 0;
   int mx = 0;
   mxx[a[0]] = mxx[a[1]] = 0;
   for(int i = 2 ; i < 3 * n - 1 ; i += 3){
      if(a[i] == a[i + 1] && a[i + 1] == a[i + 2]){
         add++;
         continue;
      }
      vector <pii> v;

      hlp[a[i + 1]][a[i + 2]] = max(hlp[a[i + 1]][a[i + 2]] , dp[a[i]][a[i]] + 1);
      v.push_back({a[i + 1] , a[i + 2]});
      hlp[a[i]][a[i + 2]] = max(hlp[a[i]][a[i + 2]] , dp[a[i + 1]][a[i + 1]] + 1);
      v.push_back({a[i] , a[i + 2]});
      hlp[a[i]][a[i + 1]] = max(hlp[a[i]][a[i + 1]] , dp[a[i + 2]][a[i + 2]] + 1);
      v.push_back({a[i] , a[i + 1]});

      if(a[i] == a[i + 2]){
         for(int j = 1 ; j <= n ; j++){
            hlp[j][a[i + 1]] = max(hlp[j][a[i + 1]] , dp[j][a[i]] + 1);
            v.push_back({j , a[i + 1]});
         }
      }
      if(a[i] == a[i + 1]){
         for(int j = 1 ; j <= n ; j++){
            hlp[j][a[i + 2]] = max(hlp[j][a[i + 2]] , dp[j][a[i]] + 1);
            v.push_back({j , a[i + 2]});
         }
      }
      if(a[i + 1] == a[i + 2]){
         for(int j = 1 ; j <= n ; j++){
            hlp[j][a[i]] = max(hlp[j][a[i]] , dp[j][a[i + 1]] + 1);
            v.push_back({j , a[i]});
         }
      }

      for(int j = 0 ; j <= 2 ; j++)
         for(int k = j + 1 ; k <= 2 ; k++){
            hlp[a[i + j]][a[i + k]] = max(hlp[a[i + j]][a[i + k]] , mx);
            v.push_back({a[i + j] , a[i + k]});
         }

      for(int j = 0 ; j <= 2 ; j++){
         for(int k = 1 ; k <= n ; k++){
            hlp[a[i + j]][k] = max(hlp[a[i + j]][k] , mxx[k]);
            v.push_back({a[i + j] , k});
         }
      }

      for(pii x : v){
         dp[x.first][x.second] = dp[x.second][x.first] = max(dp[x.first][x.second] , hlp[x.first][x.second]);
         mxx[x.first] = max(mxx[x.first] , dp[x.first][x.second]);
         mxx[x.second] = max(mxx[x.second] , dp[x.first][x.second]);
         mx = max(mx , dp[x.first][x.second]);
      }
      /*for(int i = 1 ; i <= n ; i++)
         for(int j = i ; j <= n ; j++)
            cout << i << " " << j << " " << dp[i][j] << endl;
      cout << "-----------------" << endl;*/
   }
   dp[a[3 * n - 1]][a[3 * n - 1]]++;
   int ans = 0;
   for(int i = 1 ; i <= n ; i++)
      for(int j = 1 ; j <= n ; j++)
         ans = max(ans , dp[i][j]);
   cout << ans + add;
   return 0;
}


Measured memory_bytes: 35104
// G - Longest Path
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

int dfs(vvi &V, vi &D, int p){
	if(D[p]>0 || V[p].size()<=0) return D[p];
	for(int c:V[p]) D[p] = max(D[p], dfs(V,D,c)+1);
	return D[p];
}

int in(){int x;cin>>x;return x;}

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

	vvi V(N+1);
	while(M--) V[in()].push_back(in());

	vi D(N+1);
	for(int p=1; p<=N; p++) D[0] = max(D[0], dfs(V,D,p));
	cout<< D[0] <<endl;
}

Measured memory_bytes: 12160
class UnionFind:
	def __init__(self, n):
		self.n = n
		self.root = [-1]*(n+1)
		self.rnk = [0]*(n+1)
		self.Maxroot = -1

	def Find_Root(self, x):
		if (self.root[x] < 0):
			return x
		else:
			self.root[x] = self.Find_Root(self.root[x])
			return self.root[x]

	def Unite(self, x, y):
		x = self.Find_Root(x)
		y = self.Find_Root(y)
		if x == y:
			return 
		elif self.rnk[x] > self.rnk[y]:
			self.root[x] += self.root[y]
			if self.root[x] < self.Maxroot:
				self.Maxroot = self.root[x]
			self.root[y] = x
		else:
			self.root[y] += self.root[x]
			if self.root[y] < self.Maxroot:
				self.Maxroot = self.root[y]
			self.root[x] = y
			if self.rnk[x] == self.rnk[y]:
				self.rnk[y] += 1

	def isSameGroup(self, x, y):
		return self.Find_Root(x) == self.Find_Root(y)

	def Count(self, x):
		return self.root[self.Find_Root(x)] * (-1)

N, M = map(int, input().split())
a, b = [],[]
for _ in range(M):
	at, bt = map(int, input().split())
	a.append(at)
	b.append(bt)

solve = UnionFind(N)
ans = [0]
for i in reversed(range(M)):
	ca,cb = a[i],b[i]
	if solve.isSameGroup(ca,cb):
		ans.append(ans[-1])
		continue
	num_group_a = solve.Count(ca)
	num_group_b = solve.Count(cb)
	tmp = num_group_a * num_group_b
	solve.Unite(ca, cb)
	ans.append(ans[-1]+tmp)
			
tot = N*(N-1)//2

for i in range(2,M+2):
	print(tot-ans[-i])

Measured memory_bytes: 18148
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
int a[210];
int main()
{
	int n,ans=0;
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++) scanf("%d",&a[i]);
	sort(a+1,a+2*n+1);
	for(int i=1;i<=2*n;i+=2) ans+=a[i];
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

int main()
{
	string a;
	cin>>a;
	int temp=a[a.length()-1]-'0';
	if (temp==2||temp==4||temp==5||temp==7||temp==9)
		cout<<"hon";
	else if (temp==3)
		cout<<"bon";
	else
		cout<<"pon";
    return 0;
}


Measured memory_bytes: 3572
#include <iostream>
#include <string>
#include <vector>

#define MIN(a,b) (a)>(b)?(b):(a)

using namespace std;

int main() {
	int N;
	vector<int> B;
	cin >> N;
	for (int i = 0; i < N-1; i++) {
		int b;
		cin >> b;
		B.push_back(b);
	}
	int ans=B[0];
	for (int i = 1; i < N - 1; i++) {
		ans += MIN(B[i], B[i-1]);
	}
	ans += B.back();
	cout << ans;
	return 0;
}

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

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl




signed main() {

	int N;
	cin >> N;
	int a = 0, b = 0;
	int ba = 0;

	int ab = 0;
	rep(i, N) {
		string s;
		cin >> s;

		if (s[s.length() - 1] == 'A' && s[0] == 'B') ba++;
		else {
			if (s[s.length() - 1] == 'A') a++;
			if (s[0] == 'B') b++;
		}

		rep(i, s.length() - 1) {
			if (s[i]=='A' && s[i+1]=='B') ab++;
		}
	}

	int ans = 0;
	string tmp;
	char last = 0;
	if (a == 0) {
		if (b > 0)
			ans = ba;
		else
			ans += max(0LL, ba - 1);
	}
	else {
		// [xA][BA][BA]...[Bx]
		// ([xA][Bx])
		a--;
		ans += ba;
		if (b > 0) {
			ans++; b--;
		}
		ans += min(a, b);
	}

	cout << ans +ab << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define all(a) a.begin(),a.end()
#define lb(s,x) lower_bound(all(s),x)-s.begin()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define INF 1e9
typedef long long ll;

int main(void){
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    rep(i,n){
        cin>>a[i];
    }
    int cnt = 0;
    int pos = 0;
    while(pos<n-1){
        pos += k-1;
        cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
char s[110],a[110],b,i,t;
main(){
  while(fgets(s,110,stdin)){
    if(s[1]=='\n'&&s[0]==46)break;
    for(t=1,b=0,i=0;s[i]&&t;++i){
      if(s[i]==40||s[i]==91) a[b++]=s[i];
      else if(s[i]==41||s[i]==93) {
        if(!b){t=0;break;}
        if((s[i]==41&&a[b-1]==40)||(s[i]==93&&a[b-1]==91)) --b;
        else t=0;
      }
    }
    puts(((t&&!b)?1:0)?"yes":"no");
  }
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;
long long int d[200][200] = {}, n, combination[55][55] = {};






int main() {
	complex<long double>cmpmp;
	const long long int mod = 1000000007;
	map<long long int, long long int>mp;
	string str,str2,tmp;
	cout << fixed << setprecision(10);
	long long int ten[20] = {1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000};
	long long int res = 10, y, id = 0, m = 0, a[200060], b[2000], c[2000], x, k, ng[2000] = {}, left = 0, dp[100][3] = {};
	cin >> n ;
	long double big = 0.0;
	for (int i = 1; i <= 3500; i++) {
		for (int j = i; j <= 3500; j++) {
			if ((4 * i * j - i * n - j * n) <= 0) { continue; }
			if ((n * i * j) % (4 * i * j - i * n - j * n) == 0 ) {
				cout << i << " " << j << " " << (n * i * j) / (4 * i * j - i * n - j * n) << endl; return 0;
			}
		}
	}
} 


Measured memory_bytes: 256
char s[9999],t[999];
main(i,j,m,r){
	for(scanf("%s",&s),i=j=0;i<strlen(s);)
		if(s[i]=='e')t[j++]='e',i+=3;
		else t[j++]='c',i+=7;
	for(m=i=0;i<strlen(t);i=j){
		for(j=i+1;j<strlen(t);j++)if(t[j]==t[j-1])break;
		if(m<j-i)m=j-i,r=t[j-1];
	}
	puts(r=='c'?"chicken":"egg");exit(0);
}

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

int main(){
    int N;
    int64_t L, T;
    cin >> N >> L >> T;
    vector<int64_t> X(N), W(N);
    for(int i=0; i<N; i++) cin >> X[i] >> W[i];

    int z0 = 0;
    for(int i=0; i<N; i++) if(W[i] != W[0]){
        if(W[0] == 1){
            int64_t d = (X[i] - X[0] + L) % L;
            int t = (2*T-1+L-d)/L;
            z0 = (z0 + t) % N;
        }else{
            int64_t d = (X[0] - X[i] + L) % L;
            int t = (2*T-1+L-d)/L;
            z0 = (z0 - t%N + N) % N;
        }
    }
    
    vector<vector<int64_t>> poss(N);
    for(int i=0; i<N; i++){
        int64_t p = (X[i] + T*(W[i] == 1 ? 1 : -1)%L + L) % L;
        poss[i] = {p, W[i], i};
    }
    vector<int> ans(N);
    sort(poss.begin(), poss.end());
    for(int s=0; s<N; s++) if(poss[s][2] == 0){
        for(int i=0; i<N; i++) ans[(i-s+z0+N)%N] = poss[i][0];
    }
    for(int i=0; i<N; i++) cout << ans[i] << endl;
}

Measured memory_bytes: 8576
import sys

# 標準入力からデータを読み込む
def read_data():
    n, m = [int(i) for i in sys.stdin.readline().strip().split(' ')]
    matrix = []
    for _ in range(n):
        matrix.append([int(num) for num in sys.stdin.readline().strip().split(' ')])

    vector = []
    for _ in range(m):
        vector.append(int(sys.stdin.readline().strip()))

    return matrix, vector

# 行列xベクトルの計算
def multiple(matrix, vector):
    n = len(matrix)
    m = len(vector)
    ans = []

    for i in range(n):
        sum = 0
        for j in range(m):
            sum += (matrix[i][j] * vector[j])

        ans.append(sum)

    return ans

# メイン関数
def main():
    matrix, vector = read_data()
    ans = multiple(matrix, vector)
    for i in ans:
        print(i)
        
if __name__ == '__main__':
    main()


Measured memory_bytes: 5944
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
#include <functional>
using namespace std;
typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA cerr << "AAAAA" << endl
#define debug_ cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    cout << #v << endl;                \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;
#define debug_vec2(v)                         \
    cout << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cout << v[i][j] << " ";           \
        }                                     \
        cout << endl;                         \
    }

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

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

template <typename T>
void quit(T a)
{
    cout << a << endl;
    exit(0);
}

using Graph = vector<vector<int>>;
using P = pair<int, int>;
using P1 = pair<int, pair<int, int>>; // クラスカル法とかで、{cost, {from, to}}的に使う。
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double pi = acos(-1);

int main()
{
    int n;
    cin >> n;
    cout << (n+1)/2<<endl;

    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <numeric>
using namespace std;

int main(void){
  int N;
  cin>>N;
  int ans=N;
  for(int i=0;i<=N;i++){
      int res=0;
      int n=i;
      while(n>0){
          res+=n%6; n/=6;
      }
      n=N-i;
      while(n>0){
          res+=n%9; n/=9;
      }
      ans=min(res,ans);
  }
  cout<<ans;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

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

	auto maxA = 0ll;
	auto maxF = 0ll;
	vector<ll> A(N);
	vector<ll> F(N);
	for (auto i = 0; i < N; ++i)
	{
		cin >> A[i];
		maxA = max(maxA, A[i]);
	}
	for (auto i = 0; i < N; ++i)
	{
		cin >> F[i];
		maxF = max(maxF, F[i]);
	}

	sort(A.begin(), A.end());
	sort(F.begin(), F.end(), greater<ll>());
	vector<ll> S(N);
	for (auto i = 0; i < N; ++i)
	{
		S[i] = A[i] * F[i];
	}

	auto l = 0ll;
	auto h = maxF * maxA;
	while (l <= h)
	{
		auto mid = (l + h) / 2;
		auto num = 0ll;
		for (auto i = 0; i < N; ++i)
		{
			if (S[i] > mid)
			{
				num += (S[i] - mid + F[i] - 1) / F[i];
			}
		}

		if (num <= K)
		{
			h = mid - 1;
		}
		else
		{
			l = mid + 1;
		}
	}

	cout << l << endl;

	return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>

int main(void){
  int dis,vel,time,mergin_dis;
  scanf("%d%d%d",&dis,&vel,&time);
  mergin_dis = time*vel - dis;
  if(0 <= mergin_dis){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
}

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

int main(){
  int N; cin >> N;
  vector<int> A(N);
  for(int i=0; i<N; i++)
    cin >> A.at(i);
  sort(A.begin(), A.end());
  
  while(A.at(A.size()-2) != 0){
    auto it = upper_bound(A.begin(),A.end(),0);
    for(int i=it-A.begin()+1; i<A.size(); i++)
      A.at(i) %= *it;
    sort(A.begin(), A.end());
  }
  cout << A.at(A.size()-1) << endl;
}


Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

int main(){
   int N;
   long long int x;
   std::cin >> N >> x;
   std::vector<long long int> a(N);
   for (int i=0; i<N; i++){
      std::cin >> a.at(i);
   }
   long long int sum = std::accumulate(a.begin(), a.end(), 0LL);
   std::sort(a.begin(), a.end());
   if (sum == x){
      std::cout << N << std::endl;
   } else if (sum < x){
      std::cout << N-1 << std::endl;
   } else{
      for (int i=0; i<N; i++){
         x = x - a.at(i);
         if (x == 0){
            std::cout << i+1 << std::endl;
            break;
         } else if (x < 0){
            std::cout << i << std::endl;
            break;
         }
      }
   }
}



Measured memory_bytes: 256
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int32_t, int32_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int32_t N;
  cin >> N;
  int32_t minimum = INT32_MAX;
  int32_t count = 0;
  for (int32_t i = 0; i < N; ++i) {
    int32_t value;
    cin >> value;
    if (value < minimum) {
      minimum = value;
      ++count;
    }
  }
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long int
#define ull unsigned long long
#define pb push_back
#define mk make_pair
#define flp(i, k, n) for(int i=k; i<n; i++)
#define F first
#define S second

int func(int k, int n)
{
    while((n%k)==0)
    {
        n=n/k;
    }

    return (n%k==1);
}

int32_t main(void)
{
    int n;
    cin>>n;
    int ans=0;
    for(int i=1; i*i<=(n-1); i++)
    {
        if((n-1)%i==0)
        {
            ans++;
            if(i!=n/i) ans++;
        }
    }

    for(int i=2; i*i<=n; i++)
    {
        if(n%i==0)
        {
            ans+=func(i, n);
            if(i!=n/i) ans+=func(n/i, n);
        }
    }
  
    if(n==2) ans=1;
    
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 256
import math
n, m = map(int, input().split())

if n >= 2:
  a = math.factorial(n)/(math.factorial(2)*math.factorial(n-2))
else:
  a = 0

if m >= 2:
  b = math.factorial(m)/(math.factorial(2)*math.factorial(m-2))
else:
  b = 0

print(int(a + b))

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().run();
	}
	
	private void run() throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String str;
		while ((str = reader.readLine()) != null) {
			int ans = 0;
			int n = Integer.parseInt(str);
			for (int i = 2; i <= n; i++) {
				if (isPrimeNumber(i)) ans++;
			}
			System.out.println(ans);
		}
		reader.close();
	}

	private boolean isPrimeNumber(int n) {
		if (n <= 1) return false;
		if (n == 2) return true;
		if (n % 2 == 0) return false;
		for (int i = 3; i <= Math.sqrt(n); i+=2) {
			if (n % i == 0) return false;
		}
		return true;
	}
}


Measured memory_bytes: 24952
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a-b==b-c){
    cout<<"YES"<<endl;
    return 0;
    }
    cout<<"NO"<<endl;
    return 0;
}

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

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

using ll = long long;
const ll mod = 1e9 + 7;
const ll e7 = 1e6;

ll inv[e7 + 1], f[e7 + 1], fi[e7 + 1];
ll pow2[e7 + 1];

ll comb(ll x, ll y) {
    if (0 <= y && y <= x)
        return f[x] * fi[y] % mod * fi[x - y] % mod;
    else
        return 0;
}

int main() {
    inv[1] = 1;
    for (ll i = 2; i <= e7; i++)
        inv[i] = -mod / i * inv[mod % i] % mod;
    f[0] = fi[0] = 1;
    for (ll i = 1; i <= e7; i++) {
        f[i] = f[i - 1] * i % mod;
        fi[i] = fi[i - 1] * inv[i] % mod;
    }
    pow2[0] = 1;
    rep(i, e7) pow2[i + 1] = pow2[i] * inv[2] % mod;
    int N, M;
    cin >> N >> M;
    ll p = 1, q = 0;
    rep(x, N + M) {
        ll ans = (p * inv[2] + q) % mod;
        cout << (ans + mod) % mod << endl;
        ll _p = p;
        if (x + 1 >= N) _p = (_p - comb(x, N - 1) * pow2[x] % mod * inv[2]) % mod;
        if (x + 1 >= M) _p = (_p - comb(x, M - 1) * pow2[x] % mod * inv[2]) % mod;
        q = (q + comb(x, M - 1) * pow2[x] % mod * inv[2]) % mod;
        p = _p;
    }
}


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

int main() 
{
  vector<int> v;
  int a, b, c;
  cin >> a >> b>> c;
  v.push_back(a);
  v.push_back(b);
  v.push_back(c);
  if (count(v.begin(), v.end(), 5)==2 && count(v.begin(), v.end(), 7)==1)
  {
    cout << "YES" << endl;
  }
  else
  {
    cout << """NO" << endl;
  }
}



Measured memory_bytes: 256
import java.util.*;

class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
for(;;){
int ans =0;
String s=sc.nextLine();
if(s.equals("0"))break;
for(int i=0; i<s.length(); i++){
	ans += Character.digit(s.charAt(i),10);
}
System.out.println(ans);
	}
}
}

Measured memory_bytes: 17468
//shara's here
#include <bits/stdc++.h>
using namespace std;
typedef int q;
typedef double w;
typedef string s;
typedef long long ll;
void yoinks(){
std::ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
}
int main(){
    yoinks();
    s ss,dd;
    cin>>ss>>dd;
    cout<<dd+ss;

















return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/


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

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  string a,b,c;cin>>a>>b>>c;

  if(a[a.size()-1]==b[0]&&b[b.size()-1]==c[0])out("YES")
  else out("NO")

  return 0;
}


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

typedef long long ll;
using namespace std;

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

	int n; cin >> n;
	int p[105];

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

	int ans = 1;
	int cnt = 0;
	for (int j = 1;j <= 100;j++){
		cnt = 0;
		for (int i = 0;i < n;i++){
			if(p[i] >= j) cnt++;
		}
		if (cnt >= j) ans = j;
	}

	cout << ans << endl;

	return 0;

}



Measured memory_bytes: 3160
import numpy as np
N, D = map(int, input().split(" "))
X = []
Y = []
for i in range(N):
    _X, _Y = map(int, input().split(" "))
    X.append(_X)
    Y.append(_Y)
cnt = 0
for i in range(N):
    dist = np.sqrt(X[i]*X[i] + Y[i]*Y[i])    
    if dist <= D:
        cnt += 1
print(cnt)

Measured memory_bytes: 42656
n,m=map(int,input().split())
A=[int(i) for i in input().split()]
if 2 in A and 3 in A:
  A.remove(2)
if 3 in A and 5 in A:
  A.remove(3)
if 2 in A and 5 in A:
  A.remove(2)
if 6 in A and 9 in A:
  A.remove(6)
m=len(A)
D={}
D[1]=2
D[2]=5
D[3]=5
D[4]=4
D[5]=5
D[6]=6
D[7]=3
D[8]=7
D[9]=6
DP=[-float("inf")]*(n+1)
DP[0]=0
for i in range(n):
  for j in range(m):
    if D[A[j]]<=i+1 and DP[i+1-D[A[j]]]!=float("inf") and DP[i+1-D[A[j]]]+1>=DP[i+1]:
      DP[i+1]=DP[i+1-D[A[j]]]+1
A.sort(reverse=True)
k=DP[n]
ans=""
cur=n
for _ in range(k):
  for j in range(m):
    if cur>=D[A[j]] and DP[cur-D[A[j]]]==DP[cur]-1:
      ans+=str(A[j])
      cur-=D[A[j]]
      break
print(ans)

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

int main()
{
    int h, w;
    cin >> h >> w;

    vector<string> vec;
    for (int i = 0; i < h; i++)
    {
        string s;
        cin >> s;
        vec.push_back(s);
    }

    string edge;
    for (int i = 0; i < w + 2; i++)
    {
        edge += '#';
    }

    cout << edge << endl;
    for (int i = 0; i < h; i++)
    {
        cout << '#' << vec.at(i) << '#' << endl;
    }
    cout << edge << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<tuple>
#include<utility>
#include<stack>
using namespace std;

using ll=long long int;

int main() {

	int H, W, h, w;
	cin >> H >> W >> h >> w;

	cout << (H-h)*(W-w) << endl;

	return 0;
}





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

int n;
int minn = 2e9 + 5;
int ans = -2e9 - 5;

int main(){
  scanf("%d",&n);
  for(int i = 1;i <= n; i++){
    int k;
    scanf("%d",&k);
    if(ans < k-minn){
      ans = k-minn;
    }
    if(minn > k){
      minn = k;
    }
  }
  printf("%d\n",ans);
}

Measured memory_bytes: 3204
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 200200;
const int K = 14;
int dp[N][K];
int n;
char s[N];

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%s", s);
	n = strlen(s);
	for (int i = 0; i <= n; i++)
		for (int j = 0; j < K; j++)
			dp[i][j] = -1;
	dp[0][0] = 0;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < K; j++) {
			if (dp[i][j] == -1) continue;
			for (int z = 1; z < K; z++) {
				if (i + z > n) break;
				bool ok = j != z;
				for (int h = 0; !ok && h < j; h++)
					ok |= s[i - j + h] != s[i + h];
				if (ok)
					dp[i + z][z] = max(dp[i + z][z], 1 + dp[i][j]);
			}
		}
	int ans = 0;
	for (int i = 0; i < K; i++)
		ans = max(ans, dp[n][i]);
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 11900
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.map f

[<EntryPoint>]
let main argv =
    let [|x;a|] = reads int
    if x < a then 0 else 10
    |> printfn "%i"
    0

Measured memory_bytes: 14044
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);

    ll n;
    cin >> n;

    ll ans=0;
    for (ll i=1;i<=n;i++)
    {
        if ((i%3!=0)&&(i%5!=0))
        {
            ans=ans+i;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3664
#include <stdio.h>
#include <string.h>

int main( void )
{
	char card[201];
	char temp[201];
	int m, h, i;
	
	while( 1 ){
		scanf("%s", card);
		
		if(!strcmp(card, "-")) break;
		
		scanf("%d", &m);
		
		for(i = 0; i < m; i++){
			scanf("%d", &h);
			
			strcpy(temp, card+h);
			strncat(temp, card, h);
			strcpy(card, temp);
		}
		
		printf("%s\n", card);
	}
	
	return 0;
}

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

int main() {
  int H, W;
  cin >> H >> W;

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

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S[i][j] == '#') continue;
      int count = 0;
      for (int r = -1; r <= 1; r++) {
        if ((i + r < 0) || (H <= i + r)) continue;
        for (int c = -1; c <= 1; c++) {
          if ((j + c < 0) || (W <= j + c)) continue;
          if ((r == 0) && (c == 0)) continue;
          if (S[i + r][j + c] == '#') {
            count++;
          }
        }
      }
      S[i][j] = to_string(count)[0];
    }
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll N, Q;
  cin >> N >> Q;
  vector<tuple<ll, ll, ll>> XLR(N);
  for (ll i = 0; i < N; i++)
  {
    ll s, t, x;
    cin >> s >> t >> x;
    XLR.at(i) = make_tuple(x, s - x, t - x);
  }
  sort(XLR.begin(), XLR.end());

  set<ll> st;
  st.emplace(-INF), st.emplace(INF);
  map<ll, ll> ans;
  for (ll q = 0; q < Q; q++)
  {
    ll D;
    cin >> D;
    st.emplace(D);
    ans[D] = -1;
  }

  ll cnt = 0;
  while (cnt < N)
  {
    ll x = get<0>(XLR.at(cnt));
    ll l = get<1>(XLR.at(cnt)), r = get<2>(XLR.at(cnt));
    auto it = st.lower_bound(l);
    if (*it < r)
    {
      ans[*it] = x;
      st.erase(it);
    }
    else
      cnt++;
  }

  for (auto a : ans)
  {
    cout << a.second << endl;
  }
}

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

int main() {
  string s;
  cin >> s;
  int count = 0;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()-i-1]) count ++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    D=int(readline())
    c=list(map(int,readline().split()))
    s=[list(map(int,readline().split())) for _ in range(D)]

    kaisai=[0]*26
    kaisai_all=[[0]*26 for _ in range(D)]
    manzokudo=0
    t=[]
    for i in range(D):
        res=-float("inf")
        res_i=-1
        for j in range(26):
            henka=s[i][j]
            kaisai_kari=kaisai[:]
            kaisai_kari[j]=i+1
            for k in range(26):
                henka-=c[k]*(i+1-kaisai_kari[k])
            if res<henka:
                res=henka
                res_i=j
        manzokudo+=res
        if i!=0:
            kaisai_all[i]=kaisai_all[i-1][:]
        kaisai[res_i]=i+1
        kaisai_all[i][res_i]=i+1
        t.append(res_i)

    for i in range(D):
        print(t[i]+1)

if __name__=="__main__":
    main()

Measured memory_bytes: 9524
#include <bits/stdc++.h>
#define Mid ((L + R) >> 1)
#define Left (Node << 1)
#define Right (Node << 1 | 1)

using namespace std;

typedef pair <int,int> pii;

const int N = 200200;
const int M = 4 * N;
const int Inf = 2e9;

int n, m;
int A[N];
pii a[N];
set <pii> Have[N];
vector <pii> Cur[N];

int Tree[M];
int Lazy[M];

void Merge(int Node)
{
    Tree[Node] = Tree[Left] ^ Tree[Right];
}

void PushLazy(int Node, int Len)
{
    if(Lazy[Node])
    {
        Tree[Node] ^= Lazy[Node];

        if(Len > 1)
        {
            Lazy[Left] ^= Lazy[Node];
            Lazy[Right] ^= Lazy[Node];
        }

        Lazy[Node] = 0;
    }
}

void Build(int Node = 1, int L = 0, int R = n - 1)
{
    Tree[Node] = Lazy[Node] = 0;

    if(L == R)  return void(Tree[Node] = A[L]);

    Build(Left, L, Mid);
    Build(Right, Mid + 1, R);

    Merge(Node);
}

void Update(int i, int j, int x, int Node = 1, int L = 0, int R = n - 1)
{
    PushLazy(Node, R - L + 1);

    if(i > j || L > R)  return ;
    if(j < L || R < i)  return ;

    if(i <= L && R <= j)
    {
        Lazy[Node] ^= x;
        return PushLazy(Node, R - L + 1);
    }

    Update(i, j, x, Left, L, Mid);
    Update(i, j, x, Right, Mid + 1, R);

    Merge(Node);
}

int Query(int i, int j, int Node = 1, int L = 0, int R = n - 1)
{
    PushLazy(Node, R - L + 1);

    if(i > j || L > R)      return 0;
    if(j < L || R < i)      return 0;
    if(i <= L && R <= j)    return Tree[Node];

    return Query(i, j, Left, L, Mid) ^ Query(i, j, Right, Mid + 1, R);
}

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

    for(int i = 0; i < n; i++)  scanf("%d%d", &a[i].first, &a[i].second);

    sort(a, a + n);

    for(int i = 0; i < n; i++)  A[i] = a[i].second;

    for(int i = 0; i < m; i++)
    {
        int L, R;   scanf("%d%d", &L, &R);

        L = lower_bound(a, a + n, pii(L, -Inf)) - a;
        R = upper_bound(a, a + n, pii(R, +Inf)) - 1 - a;

        if(L > R) continue;

        Have[L].insert(pii(R, i));
    }

    Build();

    vector <bool> Used(m, false);

    for(int i = 0; i < n; i++)
    {
        for(pii p : Have[i])    Cur[i].push_back(p);

        Have[i].clear();

        int Last = i;

        for(pii p : Cur[i])
        {
            if(Last <= p.first)
            {
                Have[Last].insert(pii(p.first, p.second));
                Last = p.first + 1;
            }
        }

        if(Query(i, i))
        {
            if(Have[i].empty()) return 0 * puts("-1");

            Update(i, (*Have[i].begin()).first, 1);

            Used[(*Have[i].begin()).second] = true;
        }
    }

    for(int i = n - 1; ~i; --i)
    {
        reverse(Cur[i].begin(), Cur[i].end());

        bool Last = false;

        for(pii p : Cur[i])
        {
            Used[p.second] = Last ^ Used[p.second];
            Last ^= Used[p.second];
        }

        reverse(Cur[i].begin(), Cur[i].end());
    }

    vector <int> Ans;

    for(int i = 0; i < m; i++)
        if(Used[i])
            Ans.push_back(i);

    cout << Ans.size() << endl;
    for(int x : Ans)    printf("%d ", x + 1);
    puts("");
}


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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


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

  int diff = 0;
  rep(i,S.length()-1) if (S[i]!=S[i+1]) diff++;
  diff = max(0, diff-2*K);
  int result = (N-1) - diff;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 512
import numpy as np
from scipy.sparse.csgraph import dijkstra

h,w = map(int,input().split())
c = np.array([list(map(int,input().split())) for _ in range(10)])
a = np.array([list(map(int,input().split())) for _ in range(h)])

shortest = dijkstra(c.T,indices=1)

print(shortest[a[a>-1].reshape(-1)].sum().astype(int))

Measured memory_bytes: 20696
# 1. 入力をちゃんと受け取ること
# ex: 「2 5」 => a=2, b=5 みたいにしないといけない
a, b = map(int, input().split())
# print(a)
# print(b)

# 2. 目的通りの計算をする
# ex: 2つの整数AとBの掛け算をやる
answer = a * b

# 3. 計算の結果を出力する
print(answer)

Measured memory_bytes: 9024
def splitcount(l):
    if len(l) == 0:
        return 0
    minl = min(l)
    #print("l",l)
    if minl==0:
        #print("l[:max(0,l.index(0))]",l[:max(0,l.index(0))])
        #print("splitcount(l[l.index(0)+1:])",splitcount(l[l.index(0)+1:]))
        return splitcount(l[:l.index(0)]) + splitcount(l[l.index(0)+1:])
    else:
        return minl + splitcount(list(map(lambda x: x - minl, l)))

n = int(input())
h = list(map(int,input().split()))


print(splitcount(h))    


Measured memory_bytes: 64904
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int r = sc.nextInt();
		sc.close();
		if (n < 10) {
			int calibrate = 100 * (10 - n);
			r = r + calibrate;
		}
		print(r);
	}

	public static void print(Object obj) {
		System.out.println(obj);
	}

}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, ans = 1;
  cin >> n;
  
  for(int i = 1; i < (int)sqrt(n)*2 +1; i++) {
    if((i*(i+1))/2 >= n) {
      ans = i;
      break;
    }
  }
  
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define PI 3.14159265359
#define sz(c) (int)c.size()
#define len(c) (int)c.length()
#define hcf(a, b) __gcd(a, b)
#define all(c) c.begin(), c.end()
#define vint vector<int>
#define vll vector<ll>
#define vpint vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define fr(it, a, b) \
    for (int it = (a); it < (b); it++)
#define tr(con, it) \
    for (auto it = con.begin(); it != con.end(); it++)
#define present(con, ele) (con.find(ele) != con.end())
#define cpresent(con, ele) (find(all(con), ele) != con.end())
#define maximum(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
#define minimum(a, b, c) (a < b ? (a < c ? a : c) : (b < c ? b : c))
typedef long long ll;
typedef long double lf;
typedef pair<int, int> pi;
typedef unsigned long long lu;
const ll mod = 1e9 + 7;
int32_t main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, ans = 0;
    cin >> n;
    fr(i, 0, n)
    {
        int u;
        cin >> u;
        if (u % 2 == 1 && i % 2 == 0)
        {
            ans++;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define r(z,x) for(int z=0;z<x;z++)
int a[100][100],b[100][100];
int main(){
	int n,m,l;
	cin>>n>>m>>l;
	r(i,n)r(j,m)cin>>a[i][j];
	r(i,m)r(j,l)cin>>b[i][j];
	r(i,n)r(j,l){long long sum=0;r(k,m)sum+=a[i][k]*b[k][j];(j==l-1)?cout<<sum<<endl:cout<<sum<<" ";}
}

Measured memory_bytes: 3092
#include<stdio.h>

int main(){
  int n, ans;
  scanf("%d", &n);
  if(n%2 == 0){                                                                                
    ans = n/2 * n/2;
  } else {
    ans = n/2 * (n/2 + 1);
  }

  printf("%d\n", ans);
}


Measured memory_bytes: 128
#include<stdio.h>
#define MAX 100000
#define MAX2 1000000000

typedef struct{
    char gara;
    int value;
}point;
point L[MAX/2+2],R[MAX/2+2];
void merge(point A[],int n,int l,int m,int r){
    int i,j,k;
    int x1=r-m;
    int x2=m-l;
    for(i=0;i<x1;i++)R[i]=A[m+i];
    for(i=0;i<x2;i++)L[i]=A[l+i];
    L[x2].value=R[x1].value=MAX2;
    i=j=0;
    for(k=l;k<r;k++){
        if(L[i].value<=R[j].value){
            A[k]=L[i++];
        }else{
            A[k]=R[j++];
        }
    }
}
void sort(point A[],int n,int l,int r){
    int m;
    if(l+1<r){
        m=(l+r)/2;
        sort(A,n,l,m);
        sort(A,n,m,r);
        merge(A,n,l,m,r);
    }
}
int part(point A[],int n,int p,int r){
    int i,j;
    point k,x;
    x=A[r];
    i=p-1;
    for(j=p;j<r;j++){
        if(A[j].value<=x.value){
            i++;
            k=A[i];
            A[i]=A[j];
            A[j]=k;
        }
    }
    k=A[i+1];
    A[i+1]=A[r];
    A[r]=k;
    return i+1;
}
void quick(point A[],int n,int p,int r){
    int q;
    if(p<r){
        q=part(A,n,p,r);
        quick(A,n,p,q-1);
        quick(A,n,q+1,r);
    }
}
int main(){
    int n,i,x,stable=1;
    point data[MAX],data2[MAX];
    char C[10];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s %d",C,&x);
        data[i].value=data2[i].value=x;
        data[i].gara=data2[i].gara=C[0];
    }
    sort(data,n,0,n);
    quick(data2,n,0,n-1);
    for(i=0;i<n;i++){
        if(data[i].gara!=data2[i].gara)stable=0;
    }
    if(stable==1)printf("Stable\n");
    else printf("Not stable\n");
    for(i=0;i<n;i++){
        printf("%c %d\n",data2[i].gara,data2[i].value);
    }
    return 0;

}



Measured memory_bytes: 4084
H,W = map(int,input().split())

a = [""]*H

for i in range(H):
    a[i]=input()

row = [False]*H
col = [False]*W

for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            row[i] = True
            col[j] = True

for i in range(H):
    if row[i]:
        for j in range(W):
            if col[j]:
                print(a[i][j],end='')
        print()

Measured memory_bytes: 4468
unittest
{
	assert( [ "2", "01", "10" ].parse.expand.solve == 2 );
	assert( [ "3", "011", "101", "110" ].parse.expand.solve == -1 );
	assert( [ "6", "010110", "101001", "010100", "101000", "100000", "010000" ].parse.expand.solve == 4 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	auto sss = new long[][]( n, n );
	foreach( ref ss; sss )
	{
		input.popFront;
		foreach( ref s, a; lockstep( ss, input.front ) )
		{
			s = a - '0';
		}
	}
	return tuple( n, sss );
}

auto solve( long n, long[][] sss )
{
	// 二部グラフにできるか判定
	auto uft = UnionFindTree( sss.length * 2 );
	foreach( i, ss; sss )
	{
		foreach( j, s; ss )
		{
			if( s != 1 ) continue;
			uft.unite( i,     j + n );
			uft.unite( i + n, j     );
		}
	}
	foreach( i; 0L .. n )
	{
		if( uft.same( i, i + n ) ) return -1;		// むり
	}
	
	// 二部グラフをn部グラフに広げるときの最大のnを計算（一番遠い頂点間の距離+1がnになる）
	auto ans = 0L;
	foreach( i, ref ss; sss )
	{
		foreach( j, ref s; ss )
		{
			if( i != j && s == 0 ) s = long.max;
		}
	}
	warshallfloyd( sss );
	foreach( ss; sss )
	{
		foreach( s; ss )
		{
			if( s == long.max ) continue;
			ans = max( ans, s + 1 );
		}
	}
	return ans;
}

// UnionFind木
struct UnionFindTree
{
	long[] ps;
	long[] rs;
	
	this( long n )
	{
		ps.length = n;
		ps[] = -1;
		rs.length = n;
	}
	
	long root( long i )
	{
		if( ps[ i ] < 0 ) return i;
		else              return ps[ i ] = root( ps[ i ] );
	}
	
	auto same( long i, long j )
	{
		return root( i ) == root( j );
	}
	
	void unite( long i, long j )
	{
		i = root( i );
		j = root( j );
		if( i == j ) return;
		if( rs[ i ] < rs[ j ] )
		{
			ps[ j ] += ps[ i ];
			ps[ i ] = j;
		}
		else
		{
			ps[ i ] += ps[ j ];
			ps[ j ] = i;
			if( rs[ i ] == rs[ j ] ) rs[ i ]++;
		}
	}
}

// 正負の重み付きグラフの全二点間最短経路探索（ワーシャルフロイド法）
auto warshallfloyd( ref long[][] dss )
{
	foreach( p; 0L .. dss.length )
	{
		foreach( f; 0L .. dss.length )
		{
			foreach( t; 0L .. dss.length )
			{
				if( dss[ f ][ p ] == long.max || dss[ p ][ t ] == long.max ) continue;
				dss[ f ][ t ] = min( dss[ f ][ t ], dss[ f ][ p ] + dss[ p ][ t ] );
			}
		}
	}
	return dss;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define rep(i, n) for(int i = 0;i < 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 INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,x; cin >> n >> x;
  ll ans = 1;
  ll pos = 0;
  rep(i,n){
      ll tmp; cin >> tmp;
      pos += tmp;
      if(pos<=x)ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            int N = readInt(reader);

            System.out.println((double) ((N + 1) / 2) / N);
        }
    }

    public static int readInt(BufferedReader reader) throws Exception {
        return Integer.parseInt(reader.readLine());
    }

}


Measured memory_bytes: 22996
#116_C
N=int(input())
H=list(map(int,input().split()))

def search(h):
    if len(h)==0:
        return 0
    else:
        x=min(h)
        h_=[h[i]-x for i in range(len(h))]
        res=x
        if 0 in h_:
            i=h_.index(0)
            res+=search(h_[0:i])+search(h_[i+1:])
        return res

print(search(H))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    string S;
    cin >> S;
     int a = 0;
    int  N = S.length();
    bool frag = 1;
    string S7 = S.substr(2,N-3);
    int Cplace = 0;
    if(count(S7.begin(),S7.end(),'C') == 1){
        for(int i = 0;i < N-3;i++){
            if(S[i+2] == 'C'){
                Cplace = i + 2;
            }
        }
    }
    else frag = 0;
    
    for(int i = 0;i < N;i++){
        if(i == 0){
            if(S[i] != 'A') frag = 0;
        }
        if(i != 0 && i != Cplace){
            bool frag2 = 0;
            for(int j = 0;j < 26;j++){
                if(S[i] == j + 'a')frag2 = 1;
            }
            if(frag2 == 0)frag = 0;
        }
    }
    if(frag)cout << "AC" << endl;
    else cout << "WA" << endl;
}

Measured memory_bytes: 256
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>
 
using namespace std;
//using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
 
#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,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
 
const int MOD = 1000000007;
double PI = 4*atan(1);
 
int H,W,h,w, INF = 500000000; 
int ans[500];
 
int main() {
    cin >> H >> W >> h >> w;
    if (H % h != 0) {
        cout << "Yes\n";
        F0R(i,H) {
            if (i % h == 0) ans[i] = INF;
            else if (i % h == h-1) ans[i] = -INF-1;
        }
        F0R(i,H) {
            F0R(j,W) cout << ans[i] << " ";
            cout << "\n";
        }
    } else if (W % w != 0) {
        cout << "Yes\n";
        F0R(i,W) {
            if (i % w == 0) ans[i] = INF;
            else if (i % w == w-1) ans[i] = -INF-1;
        }
        F0R(i,H) {
            F0R(j,W) cout << ans[j] << " ";
            cout << "\n";
        }
    } else {
        cout << "No";
        return 0;
    }
    
}

Measured memory_bytes: 2816