akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    double R;
    cin >> R;

    cout << fixed << setprecision(6);
    cout << R*2.0*3.14159265 << endl;

    return 0;
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n;i++)
typedef long long ll;
int main() {
	string s; ll k;cin>>s>>k;
	int n=s.length(), ans1=0, ans2=0;
	if (s==string(n,s[0])) {
		cout<<1ll*k*n/2<<endl;
		return 0;
	}
	rep(i,n -1)
		if (s[i]==s[i+1])
			ans1++,i++;
	for (int i=0; i+1<2*n; i++)
		if (s[i%n]==s[(i+1)%n])
			ans2++,i++;
	cout<<ans1+(ans2-ans1)*(k-1)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
// #include "Template.cpp"
#define endl "\n"

void solve()
{
    int curr, moves, jump; cin >> curr >> moves >> jump;
    curr = abs(curr);
    int maxxJump = curr/jump;
    if(maxxJump >= moves) {
        curr = curr - (jump * moves);
        cout << curr << endl;
        return ;
    }
    curr = curr - (jump * maxxJump);
    moves -= maxxJump;
    int dist1 = curr;
    int dist2 = abs(curr - jump);
    // t(dist1, dist2, moves);
    if((moves&1) == 0) {
        cout << dist1 << endl;
    }
    else {
        cout << dist2 << endl;
    }
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>

using namespace std;

int main()
{
	int N;
  	cin >> N;
  	int a = 0;
  	if(N % 10 == 9){
      	a = 1;
    }
  	if(N > 89){
      	a = 1;
    }
  	if(a){
      	cout << "Yes";
    }else{
      	cout << "No";
    }
  	return 0;
}

Measured memory_bytes: 256
nums ,limit ,wait = map(int, input().split())
nums_ary = [0 for i in range(nums)]

for i in range(nums):
    nums_ary[i] = int(input())

nums_ary.sort()
nums_ary.append(10000000000000)
count = 0
i = 0
while i < nums:
    time = nums_ary[i]
    for x in range(limit):
        if not time <= nums_ary[i] <= time + wait:
            count += 1
            break
        i += 1
    else:
        count += 1
print(count)

Measured memory_bytes: 7392
#include <iostream>
#include <vector>
#include <set>
#include <stack>
#include <algorithm>

using namespace std;

struct SccTarjan {
    int n;
    vector<vector<int>> g;
    set<int> points;
    vector<int> parent;
    vector<int> discTime;
    vector<int> lowTime;
    vector<bool> visited;
    vector<pair<int, int>> bridges;
    vector<int> sccno;
    int sccCount = 0;
    stack<int> s;
    
    int time = 0;
    
    SccTarjan(int n): n(n) {
        g.assign(n, vector<int>());
        parent.assign(n, -1);
        discTime.assign(n, -1);
        lowTime.assign(n, n + 1);
        sccno.assign(n, -1);
    }
    
    void addEdge(int from, int to) {
        g[from].push_back(to);
    }
    
    void solve() {
        for (int i = 0; i < n; i++) {
            if (sccno[i] == -1) {
                dfs(i, -1);
            }
        }
    } 
    
    bool sameScc(int u, int v) {
        return sccno[u] == sccno[v];
    }
    
    void dfs(int u, int p) {
        discTime[u] = time++;
        lowTime[u] = discTime[u];
        s.push(u);
        for (int v : g[u]) {
            if (discTime[v] == -1) {
                parent[v] = u;
                dfs(v, u);
                lowTime[u] = min(lowTime[u], lowTime[v]);
            }
            else if (sccno[v] == -1) {
                lowTime[u] = min(lowTime[u], discTime[v]);
            }
        }
        if (lowTime[u] == discTime[u]) {
           sccCount++;
           while (true) {
               int v = s.top(); s.pop();
               sccno[v] = sccCount;
               if (v == u) { 
                   break;
               }
           }
        }  
    }   
};

int main() {
    int n, m;
    cin >> n >> m;
    SccTarjan scc(n);
    
    for (int i = 0; i < m; i++) {
        int from, to;
        cin >> from >> to;
        scc.addEdge(from, to);
    }
 
    scc.solve();
    
//    for (int i = 0; i < n; i++) {
//        cout << i << " " << scc.sccno[i] << " " << scc.discTime[i] << " " << scc.lowTime[i] << endl;
//    }
    
    int k;
    cin >> k;
    for (int i = 0; i < k; i++) {
        int u, v;
        cin >> u >> v;
        cout << (scc.sameScc(u, v)? 1 : 0) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 4032
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	int n,i,j,cnt,x[205]={0};
	for(i=1;i<=200;i++)
	{
		if(i%2 == 1){
			for(j=1;j<=i;j++)
				if(i%j == 0)
					x[i]++;	
		}
	}
	while(cin>>n){
		cnt=0;
		for(i=1;i<=n;i++){
			if(x[i] == 8)
				cnt++;
		} 
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
PROGRAM oddsOfOddness
      IMPLICIT NONE
      INTEGER :: N
      
      INTEGER :: i, counterOdd, counterEven
      LOGICAL :: flag
      REAL :: ans
      READ*,N
      
      
      counterOdd = 0
      counterEven = 0
      flag = .true. !odd
      DO i = 1,N
        if(flag)then
          counterOdd = counterOdd + 1
        else
          counterEven = counterEven + 1
        end if
        
        flag = .not.(flag)
      END DO
      
      ans = real(counterOdd)/real(N)
      
      print*,ans
      
      
      
      
      END PROGRAM
      

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;

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

Measured memory_bytes: 256
# coding: utf-8
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        # print(i)
        if n % i == 0:
            divisors.append(i)
            # if i != n // i:
            divisors.append(n//i)
                # print(n//i)
    return divisors
N = int(input())
tmp = make_divisors(N)
anss = []
for i in range(len(tmp)//2):
    anss.append(tmp[2*i] + tmp[2*i+1])
print(min(anss) - 2)
# print(tmp)

Measured memory_bytes: 3296
import java.util.Arrays;
import java.util.Scanner;

class Main{



	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String string = sc.next();
		char[] cs = string.toCharArray();
		Arrays.sort(cs);
		int count = 1;
		for(int i = 0;i < string.length()-1;i++){
			if(cs[i] == cs[i+1]){
				count++;
			}else{
				if(count%2 != 0){
					System.out.println("No");
					return;
				}
				count = 1;
			}
		}
		if(count%2 != 0){
			System.out.println("No");
			return;
		}else{
			System.out.println("Yes");
		}

	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
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;
typedef pair<long long,long long> Pll;
const ll LINF = 1e18;
const int INF = 1e9;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int x,n; cin >> x >> n;
    vector<bool> ok(1000,0);
    rep(i,n){
        int p; cin >> p;
        ok[p+500]=1;
    }
    int now=1001001;
    int ans;
    rep(i,1000){
        if(!ok[i]){
            if(abs(x-(i-500))<now){
                now=abs(x-(i-500));
                ans=i-500;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9+7;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	string a = "", b = "";
	int n,x;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x;
		a += (x + '0');
	}
	for(int i=0;i<n;i++){
		cin>>x;
		b += (x + '0');
	}
	if(a>b)
		swap(a,b);
	
	int ans = 0;
	while(a!=b){
		ans++;
		next_permutation(a.begin(),a.end());
	}	
	cout<<ans;
	return 0;
}
	
	
	
	
	
	
	
	
	
	
	

























Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

struct mint {
	ll x;
	mint(ll x = 0) :x(x% mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	mint ans = 0;
	for (int i = 0; i < 60; ++i) {
		mint cnt0 = 0, cnt1 = 0;
		rep(j, n) {
			if (a[j] & (1LL << i)) cnt1 += 1;
			else cnt0 += 1;
		}
		mint tmp = (1LL << i);
		tmp *= cnt1;
		tmp *= cnt0;
		ans += tmp;
	}
	printf("%d\n", ans);
	//001
	//010
	//011
	return 0;
}


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



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

	vector<int64_t>ryuca(N+1);
	ryuca.at(0) = 2ll;
	ryuca.at(1) = 1ll;
	for (int i = 2; i < N+1; i++) {
		ryuca.at(i) = ryuca.at(i - 2) + ryuca.at(i - 1);
	}
	printf("%lld\n", ryuca.at(N));

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int main() {
    int n; cin >> n;
    ll a;
    ll sum = 0, ans = 0;
    rep(i,0,n) {
        cin >> a;
        if(a != 0) sum += a;
        else {
            ans += (sum / 2);
            sum = 0;
        }
    }
    if(a != 0) ans += (sum / 2);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<set>
typedef long long ll;
using namespace std;
typedef vector<int> vi;
int N,m;
int c[505];
int d[505];
bool triple[1005];
int main()
{
  memset(triple,false,sizeof(triple));
  ll ans=0;
  cin >> N >> m;
  for(int i=0;i<m;i++)
    {
      cin >> c[i] >> d[i];
      if(d[i]>c[i])
	{
	  for(int j=c[i];j<d[i];j++)
	    {
	      triple[j]=true;
	    }
	}
    }
  for(int i=0;i<=N;i++)
    {
      ans+=1;
      if(triple[i]) ans+=2;
    }
  cout << ans << endl;
}



Measured memory_bytes: 3128
num_dec = int(input())
num_bin = ''

while num_dec != 0:
  if num_dec % 2:
    num_dec -= 1
    num_bin += '1'
  else:
    num_bin += '0'
  num_dec /= -2

if num_bin == '':
  num_bin += '0'

print(num_bin[::-1])

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64 T;
  cin >> T;
  REP(_, T) {
    int64 N, M, A, B;
    cin >> N >> M >> A >> B;
    cout << floor_sum(N, M, A, B) << endl;
  }
}


Measured memory_bytes: 3684
#include<iostream>
#include<cstdio>
#include<cmath>
#include<map>
using namespace std;
#define LL long long
#define N 500
#define lowb(x) x&-x

int c[N][N];
map<pair<int,int>,int>mp;
void add(int x,int y)
{
    for(int i=x;i<=N;i+=lowb(i))
    {
        for(int j=y;j<=N;j+=lowb(j))
        {
            c[i][j]+=1;
        }
    }
}

int sum(int x,int y)
{
    int ans=0;
    for(int i=x;i;i-=lowb(i))
    {
        for(int j=y;j;j-=lowb(j))
        {
            ans+=c[i][j];
        }
    }
    return ans;
}
int main()
{
    int n,m,q;
    int l,r;
    cin>>n>>m>>q;
    for(int i=1;i<=m;i++)
    {
        scanf("%d%d",&l,&r);
        add(l,r);
    }
    for(int i=1;i<=q;i++)
    {
        scanf("%d%d",&l,&r);
        cout<<sum(r,r)-sum(r,l-1)-sum(l-1,r)+sum(l-1,l-1)<<endl;
    }
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 ll a,b;
 cin>>a>>b;
 //vector<int> aa(101),bb(101);
 for(int i=0;i<=100000;i++){
  int aa = i*0.08;
  int bb = i*0.10;
  if( aa == a && bb == b ){
   cout<<i<<endl;
   return 0;
  }
 }
 cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define MIN3(a,b,c) (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c))
#define MAX(a,b) (a)>(b)?(a):(b)
#define MIN2(a,b) (a)<(b)?(a):(b)
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
#define ull unsigned long long
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;
#define deb(x )     cerr << #x << " here "<< x << endl;
#define endl    "\n"
#define printCase() "Case #" << caseNum << ": "
inline bool is_palindrome(const string& s){ return std::equal(s.begin(), s.end(), s.rbegin()); }
const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
#define ff first
#define ss second
/*----------------------------------------------------------------------*/

const int N = 51;
int arr[N],arr2[N];

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

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n; cin>>n;
    FOR(i, 0, n) {
    	cin>>arr[i];
    	arr2[i] = arr[i];
    }
    sort(arr2, arr2+n);
    bool poss = true;
    FOR(i, 0, n) {
    	poss &= (arr[i] == arr2[i]);
    }
    if(poss) {
    	cout<<"YES";
    	return 0;
    }
    FOR(i, 0, n) {
    	FOR(j, i+1, n) {
    		swap(arr[i], arr[j]);
    		bool done = true;
    		FOR(k, 0, n) {
    			if(arr[k] != arr2[k]) done = false; 
    		}
    		swap(arr[i], arr[j]);
    		if(done) {
    			cout<<"YES";
    			return 0;
    		}
		}
    }
    cout<<"NO";
    return 0;
}

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

const int MOD = 100000;
int W, H;

enum DIR {
	EAST,
	NORTH,
	NONE
};

int dp[100][100][3][2];

int solve(int x, int y, DIR d, bool turn)
{
	//cerr << x << " " << y << " ";
	
	if (x==W-1 && y==H-1) {
	//	cerr << "OK" << endl;
		return 1;
	} else if (x>=W || y>=H) {
	//	cerr << endl;
		return 0;
	}
	//cerr << endl;
	
	if (dp[x][y][d][turn]>=0) return dp[x][y][d][turn];
	
	int res=0;
	
	if (turn) {
		if (d!=NORTH)
			res += solve(x+1, y, EAST, false);
		if (d!=EAST)
			res += solve(x, y+1, NORTH, false);
	} else {
		res += solve(x+1, y, EAST, NORTH==d);
		res += solve(x, y+1, NORTH, EAST==d);
	}
	return dp[x][y][d][turn] = res%MOD;
}

int main()
{
	while (cin>>W>>H, W) {
		memset(dp, -1, sizeof(dp));
		cout << solve(0, 0, NONE, false) << endl;
	}
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(auto &t : a) cin >> t;
    vector<int> PS(n);
    PS[0] = a[0];
    for(int i = 1; i < n; i++) PS[i] = a[i] + PS[i - 1];
    int mn =  (1 << 30);
    for(int i = 0; i < n - 1; i++) {
        if (!i) mn = min(mn, PS[n - 1]);
        mn = min(mn, abs(PS[n - 1] - 2 * PS[i]));
    }
    cout << mn << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = Integer.parseInt(sc.next());
		int N = Integer.parseInt(sc.next());
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		sc.close();

		//必殺技を攻撃力が高い順にソート
		Collections.sort(list, Collections.reverseOrder());

		//判定フラグ
		boolean check = false;
		for(int i = 0; i < list.size(); i++) {
			H -= list.get(i);
			if(H <= 0) {
				check = true;
				break;
			}else {
				continue;
			}
		}
		System.out.println(check ? "Yes" : "No");
	}
}

Measured memory_bytes: 49004
N = int(input())
A = list(map(int,input().split()))
arr = []
ans = 0
n = 1
for i, a in enumerate(A):
  ans += a*(-1)**(i)
  
a1 = ans  
arr.append(ans)

while(n < N-1):
  ans = 2*A[n-1] - ans
  n += 1
  arr.append(ans)
  
ans = 2*A[N-1] - a1
arr.append(ans)

print(*arr)

    


    
    

Measured memory_bytes: 14032
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
//#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (10);   小数点以下１０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);

int main() {
  int a,b;
  cin >>a>>b;
  
  vector<vector<string>> masu(a,vector<string>(b));
  
  vector<char> al = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
  
  rep(i,a) {
    rep(j,b) {
    cin >> masu.at(i).at(j);
      if(masu.at(i).at(j)=="snuke") {
      char an=al[j];
      int ans=i+1;
      cout << an << ans << endl;
      return 0;
      }
    }
  }
  
  
  
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.TreeSet;

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

		Scanner scan = new Scanner (System.in);
		
		//list作成
		TreeSet<Integer> set = new TreeSet<>();
		
		int a = scan.nextInt();
		for(int i=0; i<a; i++) {
			int num = scan.nextInt();
			set.add(num);
		}
		
		//list2作成
		TreeSet<Integer> set2 = new TreeSet<>();
		
		int b = scan.nextInt();
		for(int i=0; i<b; i++) {
			int num = scan.nextInt();
			set2.add(num);
		}
		
		//差集合
		TreeSet<Integer> difference = new TreeSet<>(set);
		difference.removeAll(set2);
		
//		System.out.println("dubug");
//		System.out.println(intersection.size());
		
		for(int i : difference) {
			System.out.println(i);
		}

	}
}


Measured memory_bytes: 198096
#include <iostream>
#include <climits>
#include <vector>
#include <algorithm>
using namespace std;

int find(int x,int n,vector<int>& node) {
	x += n - 1;
	int ret = node[x];
	while (x > 0) {
		x = (x - 1) / 2;
		ret = max(ret, node[x]);
	}
	return ret;
}

void update(int a, int b,int i, int k, int l, int r, vector<int>& node) {
	if (r <= a || b <= l)return;
	if (a <= l && r <= b) {
		node[k] = i; return;
	}
	else {
		update(a, b, i, 2 * k + 1, l, (l + r) / 2, node);
		update(a, b, i, 2 * k + 2, (l + r) / 2, r, node);
	}
}


int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int n_, q;  cin >> n_ >> q;
	int n = 1;
	while (n < n_) n *= 2;
	vector<int> node(2 * n - 1, 0);
	vector<int> ans(q + 1, INT_MAX);

	for (int i = 0; i < q; i++) {
		int com; cin >> com;
		if (com == 0) { 
			int s, t, x; cin >> s >> t >> x;
			ans[i + 1] = x;
			update(s, t + 1, i + 1, 0, 0, n, node);
		}
		else{
			int x; cin >> x;
			cout << ans[find(x,n,node)] << endl;
		}
	}
}

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

int main(){
	int N;
	cin >> N;
	string s,t;
	cin >> s >> t;
	rep(i,N){
		cout << s[i] << t[i];
	}
	cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void)
{
	int i,j,k,t,s=0,u=0,c[3][3];
	for(i=0;i<3;i++)for(j=0;j<3;j++){scanf("%d",&c[i][j]);}
	for(i=0;i<101;i++)for(j=0;j<101;j++)for(k=0;k<101;k++){
		for(t=0;t<3;t++){
			if(pow((c[0][t]-i)-(c[1][t]-j),2)+pow(c[1][t]-j-c[2][t]+k,2)!=0){s=1;}
		}
		if(s==0){u=1;}
		s=0;
	}
	if(u==1){printf("Yes\n");}else{printf("No\n");}
	return 0;
}

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

using namespace std;

typedef long long ll;

#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i < ll(b); i++)
#define FORD(i, a, b) for (ll i = b - 1; i >= ll(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
    int N;
    cin >> N;
    vector<int> ans(N);
    REP(i, N)
    {
        string s;
        cin >> s;
        if (s == "AC")
            ans[0]++;
        if (s == "WA")
            ans[1]++;
        if (s == "TLE")
            ans[2]++;
        if (s == "RE")
            ans[3]++;
    }
    cout<<"AC x "<<ans[0]<<endl;
    cout<<"WA x "<<ans[1]<<endl;
    cout<<"TLE x "<<ans[2]<<endl;
    cout<<"RE x "<<ans[3]<<endl;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define gr vector<vector<pii>>
#define fi first
#define se second
using namespace std;
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    if (s == "AAA" || s == "BBB")
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    return 0;
}

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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(ll it=0;it<n;it++) cout<<a[it]<<" ";cout<<endl;
#define pcont(a)                     for(auto it:a) cout<<it<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

/*constants*/
#define MAXN                         100005
#define PI                           3.14159265358979323846

/*debug*/
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>void __f(const char* name, Arg1&& arg1){ std::cout << name << " : " << arg1 << '\n';}
    template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ','); std::cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    ll i,j,n,m,k,cnt=0,ans=0,t=1;
    cin>>n>>m;
    if(n>=13) ret(m)
    if(n>5 && n<13) ret(m/2)
    ret(0)    
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

void solve()
{
	int a[4], b[4];
	while(cin >> a[0])
	{
		for(int i = 1; i < 4; ++i)
		{
			cin >> a[i];
		}
		for(int i = 0; i < 4; ++i)
		{
			cin >> b[i];
		}
		int Hit = 0;
		int Blow = 0;
		for(int i = 0; i < 4; ++i)
		{
			for(int j = 0; j < 4; ++j)
			{
				if(a[i] == b[j] && i == j)
				{
					++Hit;
				}
				else if(a[i] == b[j])
				{
					++Blow;
				}
			}
		}
		cout << Hit << " " << Blow << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 0
x, y, a, b, c = gets.split.map(&:to_i)
p = gets.split.map(&:to_i)
q = gets.split.map(&:to_i)
r = gets.split.map(&:to_i)
p.sort!{|i,j| j<=>i}
q.sort!{|i,j| j<=>i}
r.sort!{|i,j| j<=>i}

pid = x-1
qid = y-1
for i in 0..(c-1)
  break if p[pid] > r[i] && q[qid] > r[i]
  if p[pid] < q[qid]
    p[pid] = r[i]
    pid -= 1 if pid > 0
  else
    q[qid] = r[i]
    qid -= 1 if qid > 0
  end
end
sum = 0
for i in 0..(x-1)
  sum += p[i]
end
for i in 0..(y-1)
  sum += q[i]
end
puts sum

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

#define kNumCard = 52;

int main()
{
	// Create a complete deck
	std::vector<std::string> deck(52);

	int id = 0;
	for (int i = 0; i < 4; i++) {
		for (int j = 1; j <= 13; j++) {
			if (i == 0)
				deck[id] = "S " + std::to_string(j);
			else if (i == 1)
				deck[id] = "H " + std::to_string(j);
			else if (i == 2)
				deck[id] = "C " + std::to_string(j);
			else if (i == 3)
				deck[id] = "D " + std::to_string(j);

			id++;
		}
	}

	// Remove card from the list
	int x = 0;
	std::cin >> x;
	std::getchar();

	std::string card;
	std::vector<std::string>::iterator p;
	for (int i = 0; i < x; i++) {
		std::getline(std::cin, card);
		p = std::find(deck.begin(), deck.end(), card);
		if (p != deck.end())
			deck.erase(p);
	}

	
	// Print the rest of the deck
	for (int i = 0; i < deck.size(); i++) {
		std::cout << deck[i] << std::endl;
	}

	return 0;
}


Measured memory_bytes: 3264
#include <bits/stdc++.h>
using namespace std;
using ll = long long;



int main(){
    ll N, M, X;cin >> N >> M >> X;
    vector<ll> C;
    vector<vector<ll>> v(N, vector<ll>(M));
    for(int i = 0;i < N;i++){
        ll _C;cin >> _C;
        C.push_back(_C);
        for(int j = 0;j < M;j++){
            cin >> v[i][j];
        }
    }
    vector<int> bits(N);
    ll ans = 1e18;
    function<void(int)> zrk = [&](int i){
        if(i == N){
            ll uku = 0;
            vector<ll> q(M);
            for(int j = 0;j < N;j++){
                if(bits[j] == 1){
                    uku += C[j];
                    for(int k = 0;k < M;k++){
                        q[k] += v[j][k];
                    }
                }
            }
            bool f = true;
            for(int j = 0;j < M;j++){
                if(q[j] < X)f = false;
            }
            if(f)ans = min(ans, uku);
            return;
        }
        bits[i] = 1;zrk(i + 1);
        bits[i] = 0;zrk(i + 1);
    };
    zrk(0);
    if(ans != 1e18)cout<<ans<<endl;
    else cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
typedef long long ll;
#define FOR(i,n) for(int i=0;i<n;i++)

int main(){
  string s;
  cin >> s;
  if(s == "ABC") cout << "ARC";
  else cout << "ABC";
  return 0;
}


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


//#define FOR(i,0,n) for(int i=0;i<n;i++)
int main() {
  ios_base::sync_with_stdio(false); 
    cin.tie(NULL);cout.tie(NULL);
  // your code goes here
 /* int t;
  cin>>t;
  while (t--)
  {
    */
 
    ll i,n,k,d,s=0;cin>>n>>k;
    while(n)
    {
      d=n%k;
      s++;
      n=n/k;
    }
    cout<<s;}

Measured memory_bytes: 384
S = input()


A = list(S)
A =  list(reversed(A))


while len(A)!=0:
    if len(A)>= 5 and A[0]+A[1]+A[2]+A[3]+A[4] == "esare":
        del A[:5]
    elif len(A)>= 5 and A[0]+A[1]+A[2]+A[3]+A[4] == "maerd":
        del A[:5]
    elif len(A)>= 6 and A[0]+A[1]+A[2]+A[3]+A[4]+A[5] =="resare":
        del A[:6]
    elif len(A)>= 7 and A[0]+A[1]+A[2]+A[3]+A[4]+A[5]+A[6] =="remaerd":
        del A[:7]
    else:
        print('NO')
        break;
if len(A) ==0:
    print('YES')


Measured memory_bytes: 4852
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

const ll INF = 1LL << 50;

ll get(vvll& csum, ll x1, ll y1, ll x2, ll y2) {
  return csum[y1][x1] - csum[y1][x2] - csum[y2][x1] + csum[y2][x2];
}

int main() {
  ll h, w, k;
  cin >> h >> w >> k;
  vector<string> mp(h);
  rep(i, h) { cin >> mp[i]; }

  vvll csum(h + 1, vll(w + 1, 0));
  rep(i, h) {
    rep(j, w) {
      ll add = (mp[i][j] == '1') ? 1 : 0;
      csum[i + 1][j + 1] = csum[i + 1][j] + csum[i][j + 1] - csum[i][j] + add;
    }
  }

  ll ans = LONG_LONG_MAX;
  rep(dh, 1 << (h - 1)) {
    bool dhfail = false;
    vll hlst;
    rep(hh, h - 1) {
      if (dh & 1 << hh) hlst.push_back(hh);
    }
    hlst.push_back(h - 1);
    ll cnt = 0;
    ll prevx = 0;
    for (ll x = 1; x <= w; x++) {
      ll prevy = 0;
      rep(ii, (ll)hlst.size()) {
        ll y = hlst[ii] + 1;
        bool cond = get(csum, x, y, prevx, prevy) > k;
        if (cond) {
          cnt++;
          if(prevx == x - 1){
            dhfail = true;
          } else {
            prevx = x - 1;
            x--;
          }
          break;
        }
        prevy = y;
      }  // ii
    }    // x
    if (dhfail) continue;
    chmin(ans, cnt + (ll)hlst.size() - 1);
  }  // dh

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1000005;

int n,c[10005],p,a[N],s[N],pw[N],ans;
char str[N];

signed main() {
    cin>>n>>p>>str+1;
    for(int i=1;i<=n;i++) a[i]=str[i]-'0';
    if(__gcd(p,10ll)==1) {
        pw[0]=1;
        for(int i=1;i<=n;i++) pw[i]=pw[i-1]*10%p;
        for(int i=1;i<=n;i++) s[i]=(s[i-1]+pw[n-i]*a[i])%p;
        for(int i=0;i<=n;i++) c[s[i]]++;
        for(int i=0;i<p;i++) ans+=c[i]*(c[i]-1)/2;
        cout<<ans;
    }
    else if(p==2) {
        for(int i=1;i<=n;i++) if(a[i]%2==0) ans+=i;
        cout<<ans;
    }
    else if(p==5) {
        for(int i=1;i<=n;i++) if(a[i]%5==0) ans+=i;
        cout<<ans;
    }
}




Measured memory_bytes: 9728
#include <cstdio>
#include <algorithm>
using namespace std;
int n, a[100005];
int main() {
	int i;
	scanf("%d", &n);
	for(i=0; i<n; i++) scanf("%d", &a[i]);
	sort(a, a+n);
	for(i=0; 2*a[i]<a[n-1]; i++);
	printf("%d %d", a[n-1], a[n-1]-2*a[i-1] <= 2*a[i]-a[n-1] ? a[i-1] : a[i]);
	return 0;
}

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

int main(){
    int a, b, t;
    std::cin >> a >> b >> t;
    
    std::cout << b * (t / a) << std::endl;

    return 0;
}

Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int copy;
		
		if(a > b){
			copy = b;
			b = a;
			a = copy;
		}
		
		if(b > c){
			copy = c;
			c = b;
			b = copy;
		}
		
		if(a > b){
			copy = b;
			b = a;
			a = copy;
		}
		
		System.out.println(a + " " + b + " " + c);
		sc.close();
	}
}


Measured memory_bytes: 26196
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N = get_int
H = get_ints

cur = 0
max = H.max
hx = [0] + H
count = 0
1.step(max) do |n|
  hx.each_cons(2) do |a, b|
    count += 1 if a < n && b >= n
  end
end

puts count


Measured memory_bytes: 14444
# C問題
S = input()
if "eraser" in S:
    S = S.replace("eraser", "")
if "erase" in S:
    S = S.replace("erase", "")
if "dreamer" in S:
    S = S.replace("dreamer", "")
if "dream" in S:
    S = S.replace("dream", "")
    
if len(S) == 0:
    print("YES")
else:
    print("NO")
    

Measured memory_bytes: 3188
N, K = map(int, input().split())
N += 1

res = 0
s = [i for i in range(N)]

if K == 1:
    res += N
    K = 2

if N == 0:
    print(res)
    exit(0)

res += 1
minimum = sum(s[:K - 1])
maximum = sum(s[-K + 1:])

for i in range(K, N):
    minimum += s[i]
    maximum += s[-i + 1]
    res = (res + (maximum - minimum + 1)) % (10 ** 9 + 7)

print(res)


Measured memory_bytes: 81168
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;

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


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
using namespace std;
int n,x,y,z,ans;
void fr(int &num){
	num=0;char c=getchar();int p=1;
	while(c<'0'||c>'9') c=='-'?p=-1,c=getchar():c=getchar();
	while(c>='0'&&c<='9') num=num*10+c-'0',c=getchar();
	num*=p;
}
int main(){
	fr(n);
	while(n--){
		fr(x),y=log2(x);
		if((1<<y)<x) z<=y?++y:z=y;
		y>z?ans+=y-z,z=y:z=y;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <cmath>
#include <limits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric> // 最大公約数が使える
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
const int inf = 1000000000; //10^9

int main()
{
    ll A,B,C,K;
    cin >> A >> B >> C >> K;
    if (K<=A)
    {
        cout << K << endl;
        return 0;
    }else if (K<=(A+B))
    {
        cout << A << endl;
        return 0;
    }
    
    else {
        ll c;
        c = K-A-B;
        cout << A-c << endl;
        return 0;
    }
    
    
    
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;


int main() {
int a,b,c,d;
cin >> a >> b >> c >> d;
if (abs(a-c) <= d) cout << "Yes" << endl;
else if (abs(b-a) <= d && abs(b-c) <= d) cout << "Yes" << endl;
else cout << "No" << endl;



return 0;
}


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

#define fi first
#define se second
#define long long long
typedef pair<int,int> ii;

int main()
{
	// freopen("input.in", "r", stdin);
	int n; scanf("%d", &n);
	printf("%d\n", (n-1)/2);
}

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

#define MAX_SIZE 100

int main() {
  int a[MAX_SIZE][MAX_SIZE];
  int b[MAX_SIZE][MAX_SIZE];
  long long c[MAX_SIZE][MAX_SIZE];

  int i, j, k;
  int n, m, l;
  cin >> n >> m >> l;

  // a の入力
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  // b の入力
  for (i = 0; i < m; i++) {
    for (j = 0; j < l; j++) {
      cin >> b[i][j];
    }
  }

  // 正解行列の初期化
  for (i = 0; i < n; i++) {
    for (j = 0; j < l; j++) {
      c[i][j] = 0;
    }
  }

  // 行列の掛け算
  for (i = 0; i < n; i++) {
    for (j = 0; j < l; j++) {
      for (k = 0; k < m; k++) {
        c[i][j] += a[i][k] * b[k][j];
      }
      cout << c[i][j];
      if (j == l - 1)
        cout << endl;
      else
        cout << " ";
    }
  }

  return 0;
}



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

#define mod      1e9+7;
#define INF      1e9+9;
#define ps(x,y)  fixed<<setprecision(y)<<x
# define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);
#endif
	int n,m;
	cin>>n>>m;
	int modi=1e9+7;
	char ch[n][m];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>ch[i][j];
		}
	}
	int dp[n][m]; dp[0][0]=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(ch[i][j]=='#') dp[i][j]=0;
			else if(i==0 && j==0) dp[i][j]=1;
			else if(i==0)  dp[i][j]=dp[i][j-1];
			else if(j==0)  dp[i][j]=dp[i-1][j];
			else{
				dp[i][j]=dp[i-1][j]+dp[i][j-1];
				if(dp[i][j]>=modi)
					dp[i][j]-=modi;
			}
		}
	}
/*	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cout<<dp[i][j]<<' ';
		}
		cout<<endl;
	}*/
	cout<<dp[n-1][m-1]<<endl;
	return 0;
}

Measured memory_bytes: 8468
# coding:utf-8
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
# A,B,C,D,Eの順で並んでいる
# 条件的にAとEが一番遠いので、それがk以上だったらアウト
if (e-a > k):
    print(':(')
else:
    print('Yay!')


Measured memory_bytes: 3060
A, B, C, D = [int(elem) for elem in input().split()]


def gcd(a, b):
    return a if b == 0 else gcd(b, a % b)


num_mul_C = B // C - A // C + (A % C == 0)
num_mul_D = B // D - A // D + (A % D == 0)

lcm = C * D // gcd(C, D)
num_mul_lcm = B // lcm - A // lcm + (A % lcm == 0)
print(B - A + 1 - (num_mul_C + num_mul_D - num_mul_lcm))


Measured memory_bytes: 38256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		String symbols = scanner.nextLine();
		String[] arr_split = symbols.split(" ",0);
		scanner.close();
		String let = arr_split[0];
		if (let.equals(arr_split[1])) {
			System.out.println(Integer.parseInt(arr_split[2]));
		} else {
			if (let.equals(arr_split[2])) {
				System.out.println(Integer.parseInt(arr_split[1]));
			} else {
				System.out.println(Integer.parseInt(arr_split[0]));
			}
		}
	}

}


Measured memory_bytes: 22996
//#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<ctype.h>
#include <fstream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
int dy[4]={0,1,0,-1};
//----------program from here----------

int main(){
  int N=0;

  cin >> N;
  cout << N*800-(N/15)*200 << endl;

  return 0;
}

Measured memory_bytes: 256
while True:
	a,b=map(int,input().split())
	if a==0 and b==0:
		break
	o=0	
	for i in range(1,a-1):
		for c in range(i+1,b):
			for f in range(c+1,a+1):
				if i+c+f==b:
					o+=1
	print(o)


Measured memory_bytes: 5592
#include <iostream>
#include <cstdio>
#include <utility>
using namespace std;
int get_answer(int num[],int num2[],int j,int n1,int n2);
int main()
{
	int i=0,j,num[6],num2[6],n1,n2,ans;
	char order[100],c;	
	for(i=0;i<6;i++)cin>>num[i];
	for(i=0;i<6;i++)cin>>num2[i];
	while(1){
		for(i=0;i<6;i++){
				if(num2[i]==num[0])n1=i;
				if(num2[i]==num[1])n2=i;
			}
		j=0;
		ans = get_answer(num,num2,j,n1,n2);
		if(ans==1)break;
		for(i=0;i<6;i++){
				if(num2[i]==num[2])n1=i;
				if(num2[i]==num[4])n2=i;
			}
		j=2;
		ans = get_answer(num,num2,j,n1,n2);
		if(ans==1)break;
		for(i=0;i<6;i++){
				if(num2[i]==num[3])n1=i;
				if(num2[i]==num[5])n2=i;
			}
		j=3;
		ans = get_answer(num,num2,j,n1,n2);
		break;
	}
	if(ans==0)cout<<"No"<<endl;
	else if(ans==1)cout<<"Yes"<<endl;
    return 0;
}
int get_answer(int num[],int num2[],int j,int n1,int n2){
	int i=0,m1,m2,ans;
	m1=num[j];
	if(j>1)j+=1;
	m2=num[j+1];
	n1=num2[n1];
	n2=num2[n2];
	
	while(1){
		if(num[1]==m2)break;
		swap(num[0],num[1]);
		swap(num[1],num[4]);
		swap(num[1],num[5]);
		if(i==4){
		swap(num[0],num[3]);
		swap(num[2],num[3]);
		swap(num[3],num[5]);	
		}
		i++;
	}
	while(1){
		if(num[0]==m1)break;
		swap(num[0],num[3]);
		swap(num[2],num[3]);
		swap(num[3],num[5]);
	}
	i=0;
	while(1){
		if(num2[1]==n2)break;
		swap(num2[0],num2[1]);
		swap(num2[1],num2[4]);
		swap(num2[1],num2[5]);
		if(i==4){
		swap(num2[0],num2[3]);
		swap(num2[2],num2[3]);
		swap(num2[3],num2[5]);
		}
		i++;
	}
	while(1){
		if(num2[0]==n1)break;
		swap(num2[0],num2[3]);
		swap(num2[2],num2[3]);
		swap(num2[3],num2[5]);
	}
	if(num[0]==num2[0]&&num[1]==num2[1]&&num[2]==num2[2]&&num[3]==num2[3]&&num[4]==num2[4]&&num[5]==num2[5])ans=1;
	else ans=0;
	
		return (ans);
}

Measured memory_bytes: 1156
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,*ab = map(int, read().split())

    AB = []
    for a, b in zip(*[iter(ab)]*2):
        AB.append((a, b))

    if N % 2 == 0:
        AB.sort()
        a1, _ = AB[N // 2 - 1]
        a2, _ = AB[N // 2]
    
        AB.sort(key=lambda x: x[1])
        _, b1 = AB[N // 2 - 1]
        _, b2 = AB[N // 2]

        ans = b1 + b2 - (a1 + a2) + 1
    
    else:
        AB.sort()
        a, _ = AB[N // 2]
    
        AB.sort(key=lambda x: x[1])
        _, b = AB[N // 2]
        
        ans = b - a + 1
    
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 55368
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int n;
    while(cin >> n){
        vi cnt(7),lp(7);
        rep(i,n){
            int in;
            cin >> in;
            if(in/10 == in%10)lp[in/10]++;
            else cnt[in/10]++,cnt[in%10]++;
        }
        bool ans = true;
        int t = 0;
        rep(i,7){
            if(cnt[i] == 0 && lp[i] && n > 1)ans = false;
            if(cnt[i]&1)t++;
        }
        if(t > 2)ans = false;
        if(ans)cout << "Yes" << endl;
        else cout << "No" << endl;
    }

}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
template <typename T>
inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}

int main(){
    string s, t;
    cin >> s;
    rep(i, s.size()){
        if (s[i] != 'x')
            t.push_back(s[i]);
    }

    rep(i, t.size()){
        if (t[i] != t[t.size() - 1 - i]){
            cout << -1 << endl;
            return 0;
        }
    }

    ll bl = 0, ans = 0;
    vector<ll> block;

    rep(i, s.size()){
        if (s[i] == 'x'){
            bl++;
        }
        else{
            block.push_back(bl);
            bl = 0;
        }

        if (i == (ll)(s.size() - 1))
            block.push_back(bl);
    }

    /*rep(i,block.size()){
        cout<<block[i]<<endl;
    }*/

    rep(i, block.size() / 2){
        ans += abs(block[i] - block[block.size() - 1 - i]);
    }

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

Measured memory_bytes: 4524