akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <climits>
#include <vector>
#include <algorithm>
using namespace std;

void lazy_query(int k, vector<int>& node, vector<int>& lazy, int n) {
	if (lazy[k] == INT_MAX)return;
	node[k] = lazy[k];
	if (k < n - 1) {
		lazy[2 * k + 1] = lazy[k];
		lazy[2 * k + 2] = lazy[k];
	}
	lazy[k] = INT_MAX;
}

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

int find(int a, int b, int k, int l, int r, vector<int>&node, vector<int>& lazy, int n) {
	lazy_query(k, node, lazy, n);
	if (r <= a || b <= l)return INT_MAX;
	if (a <= l && r <= b) {
		return node[k];
	}
	else {
		lazy_query(k, node, lazy, n);
		int vl = find(a, b, 2 * k + 1, l, (l + r) / 2, node, lazy, n);
		int vr = find(a, b, 2 * k + 2, (l + r) / 2, r, node, lazy, n);
		node[k] = min(node[2 * k + 1], node[2 * k + 2]);
		return min(vr, vl);
	}
}

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, INT_MAX);
	vector<int> lazy(2 * n - 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;
			update(s, t + 1, x, 0, 0, n, node, lazy, n);
		}
		else {
			int s, t; cin >> s >> t;
			cout << find(s, t + 1, 0, 0, n, node, lazy, n) << endl;
		}
	}
}

Measured memory_bytes: 4940
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

int main(){
    int a, b, c;
    while(cin >> a >> b >> c, a != -1 || b != -1 || c != -1){
        char grade;
        if(a == -1 || b == -1) grade = 'F';
        else if(a + b >= 80) grade = 'A';
        else if(a + b >= 65) grade = 'B';
        else if(a + b >= 50) grade = 'C';
        else if(a + b >= 30){
             grade = 'D';
             if(c >= 50) grade = 'C';
        }else
            grade = 'F';
        cout << grade << endl;
    }
}

Measured memory_bytes: 1152
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter("\n");
		for(;sc.hasNext();) {
			String[] str = sc.nextLine().split(" ");
			if(str[0].charAt(0) == '0') break;
			int A = 0;
			int bj = 0;
			for(int i=0;i<str.length;i++) {
				int val = min(10, Integer.parseInt(str[i]));
				if(val != 1) bj += val;
				else A++;
			}
			
			if( bj > 21 ) {
				System.out.println(0); 
			}
			else if( A == 0) {
				System.out.println(bj);
			}
			else {
				int tmp = bj;
				bj = 0;
				for(int i=0;i<=A;i++) {
//				debug(tmp);
					if(tmp + i + 11*(A-i) > 21) continue;
					bj = max(bj, tmp + i + 11*(A-i));
				}
				System.out.println(bj);
			}
			
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
#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(){
	string s;
	cin >> s;
	ll k;
	cin >> k;
	k--;
	int id = 0;
	rep(i,s.size()){
		if(s[i] != '1'){
			id = i;
			break;
		}
	}
	if(k < id){
		cout << 1 << endl;
	}else{
		cout << s[id] << endl;
	}
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#define ull unsigned long long 
#define ll long long
using namespace std;
bool cmp (ll x, ll y)
{
	return x > y;
}
int main()
{
	int n, a, b;
	ll v[50];
	double ans = 0;
	ull cnt = 0;
	scanf("%d %d %d", &n, &a, &b);
	for(int i = 1; i <= n;i++)
	{
		scanf("%lld", &v[i]);
	}
	sort(v + 1, v + n + 1, cmp);
	if(v[1] == v[a])
	{
		printf("%0.6lf\n",(double)v[1]);
		int x = a;
		while(x <= n && v[1] == v[x])
		{
			x++;	
		}
		x--;
		ull tmp = 1;
		for(int i = 1; i < a; i++)
			tmp = tmp * (x - i + 1) / i;
		if(x >= b)
			for(int i = a; i <= b; i++)
			{
				tmp = tmp * (x - i + 1) / i;
				cnt += tmp;
			}
		else
			for(int i = a; i <= x; i++)
			{
				tmp = tmp * (x - i + 1) / i;
				cnt += tmp;
			}
	}	
	else
	{
		for(int i = 1; i <= a; i++)
			ans += (double)v[i];
		ans /= a;
		printf("%0.6lf\n",ans);
		int l, r;
		for(l = a; v[a] == v[l]; l--);
			l++;
		for(r = a;r <= n && v[a] == v[r]; r++);
			r--;
		int x = a - l + 1;
		int y = r - l + 1;
		cnt = 1;
		for(int i = 1; i <= x; i++)
			cnt = cnt * (y - i + 1) / i;
	}
	printf("%llu \n",cnt);
	return 0;
 } 

Measured memory_bytes: 128
#include <iostream>
#include<math.h>
using namespace std;
int m[1000][1000];
int p[10000];
#define MAX 10000000
int n;
int x(){
    int q;
    for(int i=0;i<=n;i++){
        m[i][i]=0;
    }
    for(int l=2;l<=n;l++){
        for(int i=1;i<=n-l+1;i++){
            int j=i+l-1;
            m[i][j]=MAX;
            for(int k=i;k<=j-1;k++){
                q=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
                if(q<m[i][j]){
                    m[i][j]=q;
                }
            }
        }
    }return m[1][n];
}
int main(){
   
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> p[i]>>p[i+1];
    }
    cout << x()<<endl;
}


Measured memory_bytes: 3412
a,b,c = map(int,input().split())
k = int(input())
 
for i in range(k):
  if(a >= b):
    b*=2
    continue
  if(b >= c):
    c*=2
    continue
  if(a<=b and b<=c):
      c*=2
      continue


if(a<b and b<c):
  print("Yes")
  exit()
print("No")

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

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string a,b,c; cin>>a>>b>>c;
	if (a.back()==b.front()&&b.back()==c.front()) cout<<"YES";
	else 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(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int a, b, c; cin >> a >> b >> c;
  cout << c << " " << a << " " << b << endl;

  system("pause");
}

Measured memory_bytes: 504
# ALDS_1_D.
from math import sqrt, floor

def intinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    n = int(input())
    R = []
    for i in range(n): R.append(int(input()))
    # R[j] - R[i](ただしj > i)の最大値を求める。
    # 計算量がO(n^2)だと失敗するように出来ているので注意。
    # 簡単。R[j] - R[i]の最大値はj固定の時
    # R[j] - min(R[0], R[1], ..., R[j - 1])なので、
    # 常にこの最小値を更新しつつ、R[j]との差も更新し続ければいい。
    Maxprof = R[1] - R[0]
    currentMin = R[0]
    for i in range(2, n):
        currentMin = min(currentMin, R[i - 1])
        Maxprof = max(Maxprof, R[i] - currentMin)
    print(Maxprof)        

if __name__ == "__main__":
    main()


Measured memory_bytes: 13576
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;

ll one(ll a,ll b){
  return (a + b -1)/b;
}

ll my_gcd(ll c,ll d){
  if(d>c) swap(c,d);

  ll r = c%d;
  while(r!=0){
    c = d;
    d = r;
    r = c%d;
  }

  return d;

}

int main(){
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll cd = c*d/my_gcd(c,d);
  ll ans = 0;

  if(one(a,c)*c<=b){
    ans += (b-one(a,c)*c)/c+1;
  }

  if(one(a,d)*d<=b){
    ans += (b-one(a,d)*d)/d+1;
  }

  if(one(a,cd)*cd<=b){
    ans -= (b-one(a,cd)*cd)/cd+1;
  }

  cout << (b-a+1)-ans << endl;


}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    cin >> N;
    string A[3];
    rep(i, 3) cin >> A[i];
    ll ans = 0;
    rep(i, N) {
        set<ll> s;
        rep(j, 3) s.insert(A[j][i]);
        ans += s.size() - 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

#define ALL(x) (x).begin(), (x).end()
#define REP(i, n) for (size_t i = 0; i < (size_t) (n); i++)

using namespace std;
using ll = long long;

int main(void) {
  ll a, b, c, k;
  cin >> a >> b >> c >> k;

  if (a >= k) {
    cout << k << endl;
  } else if (a + b >= k) {
    cout << a << endl;
  } else {
    cout << a - (k - a - b) << endl;
  }
}


Measured memory_bytes: 3620
import sys
sys.setrecursionlimit(10**8)

def find_path(now, par):
    if now == n - 1:
        path.append(n - 1)
        return True
    for to in g[now]:
        if to == par: continue
        if find_path(to, now):
            path.append(now)
            return True
    return False

def dfs(now, par, color):
    color[now] = 'b'
    for to in g[now]:
        if to == par: continue
        if color[to] == "w": continue
        dfs(to, now, color)

n = int(raw_input())
g = [[] for _ in xrange(n)]
for i in xrange(n - 1):
    a, b = map(int, raw_input().split())
    a -= 1; b -=1
    g[a].append(b)
    g[b].append(a)
path = []
find_path(0, -1)
path.reverse()
color = ["bl"] * n
color[0] = "b"
color[n - 1] = "w"
j = 1
k = len(path) - 2
for i in xrange(1, len(path) - 1):
    if i % 2 == 1:
        v = path[j]
        color[v] = "b"
        j += 1
    else:
        v = path[k]
        color[v] = "w"
        k -= 1
dfs(0, -1, color)
cnt = 0
for i in xrange(n):
    if color[i] == "b":
        cnt += 1
if cnt > n - cnt:
    print "Fennec"
else:
    print "Snuke"


Measured memory_bytes: 132892
A, V = list(map(int,input().split()))
B, W = list(map(int,input().split()))
N = int(input())
dis = abs(B - A)
if W >= V:
    print("NO")
else:
    dx = V - W
    if dis <= N * (V - W):
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 61800
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n;cin>>n;
  vector<int> a(n);
  vector<pii> ans;
  rep(i, n) {
    cin>>a[i];
    ans.pb(mp(a[i],i+1));
  }
  dump(a);
  sort(all(ans));
  vi res;
  each(el, ans){
    res.pb(el.second);
  }
  rep(i, sz(res)) cout << res[i] << (i!=sz(res)-1 ? " " : "\n");
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 4976
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
    int n;
    cin >> n;
    vector<int>a(n);
    int i;
    for (i = 0; i < n; i++)
    {
        cin >> a.at(i);
    }
    long long int ans=0;
    for (i = 1; i < n; i++)
    {
        if (a.at(i - 1) > a.at(i))
        {
            ans += (a.at(i-1) - a.at(i));
            a.at(i) += (a.at(i - 1) - a.at(i));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3996
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
    	Scanner sn = new Scanner(System.in);
      int x = sn.nextInt();
      int res = 1;
      int top = 1999;
      int interval = 199;
      while( true ) {
      	if(x <= top && x>= (top - interval)) {
        	System.out.println(res);	
          	break;
        } else {
        	top = top - interval - 1;
           res++;
        }
      }
    }
}

Measured memory_bytes: 35496
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    vector<int> b(N);
    for (int i=0; i<N; i++) {cin >> b[i]; b[i]--;}
    
    vector<int> ans;
    int k=b.size();
    while(k > 0){ 
        int pos = -1;
        for (int i=b.size() - 1; i >= 0; i--){
            if(b[i] == i){
                pos = i;
                
                break;
            }
        }
        // 
        if (pos == -1) {cout << -1 << endl; return 0;}
        ans.push_back(pos + 1);
        b.erase(b.begin() + pos);
        k--;
    }
    reverse(ans.begin(), ans.end());
    for (auto it: ans){
        cout << it << endl;
    }
}


Measured memory_bytes: 3612
k = int(input())
ans = [1,2,3,4,5,6,7,8,9]
cnt = 0
def lunlun(a,cnt):
  if cnt == 10:
    return a
  else:
    cnt += 1
    x = a%10
    for i in x-1,x,x+1:
      if 0 <= i <= 9:
        ans.append(a*10+i)
        lunlun(a*10+i,cnt)
for i in range(1,10):
  lunlun(i,0)
ans.sort()
print(ans[k-1])

Measured memory_bytes: 92532
def main():
    h,w=map(int,input().split(' '))
    maze = [[i for i in list(input())] for i in range(h)]
    upside = ['#']*(w+2)
    downside=['#']*(w+2)
    for i in upside:
        print(i,end='')
    print('')
    for i in maze:
        print('#',end='')
        for j in i:
            print(j,end='')
        print('#')
    for i in downside:
        print(i,end='')



if __name__ == '__main__':
    main()

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

int min(int a, int b){
    if( a < b ){
        return a;
    }
    else {
        return b;
    }
}

int main(){
    string s;
    cin >> s;
    int countA = 0,countB = 0;
    for(int i = 0; i < s.size(); i++){
        if(i % 2 ){
            if(s[i] == '1'){
                countA++;
            }
        }
        else{
            if(s[i] == '0'){
                countA++;
            }
        }
    }
    countB = s.size() - countA;
    cout << min(countA, countB) << endl;
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
using namespace std;
int main()
{
	int n, k,ans=0;
	cin >> n >> k;
	vector<int> p(n);
	for (int i = 0; i < n; i++)
	{
		cin >> p[i];
	}
	sort(p.begin(), p.end());
	for (int i = 0; i < k; i++)
	{
		ans += p[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 3592
K, N = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

lst = []
for n in range(N):
    if n + 1 != N:
        lst.append(A[n+1] - A[n])
    else:
        lst.append(K - A[n] + A[0])

print(K - max(lst))


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

#define ll long long int
using namespace std;

int main()
{
    int A, B;
    cin>>A>>B;
    int ans = -1;
    for(int i=1; i<=2000; i++){
        if(i * 8 / 100 == A && i * 10 / 100 == B){
            ans = i;
            break;
        } 
    }
    cout<<ans<<"\n";
    return 0;
}


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

int n, tot = 0;
long long k, x, y;

const double eps = 1e-8;

int main() {
	cin >> n >> k;
	while(n--) {
		cin >> x >> y;
		if((x * x + y * y) <= k * k) tot++;
	}
	cout << tot << endl;
	return 0;
}

Measured memory_bytes: 3636
# 計算機

while True:
    calc_formula = input()
    op = calc_formula.split()
    a = int(op[0])
    b = int(op[2])
    if op[1]=="?": # stop condition
        break

    if op[1]=="+":
        print(a + b)
    elif op[1]=="-":
        print(a - b)
    elif op[1]=="*":
        print(a * b)
    else:
        print(a // b)



Measured memory_bytes: 5596
import java.util.Scanner;

public class Main {

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

    boolean flag = false;

    if (kaibun(S) &&
        kaibun(S.substring(0, (S.length()-1)/2)) &&
        kaibun(S.substring((S.length()+3)/2-1, S.length()))) {

      flag = true;
    }

    if (flag) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }

  private static boolean kaibun(String s) {
    for (int i = 0; i < s.length(); i++) {
      if (s.charAt(i) != s.charAt(s.length() - i - 1)) {
        return false;
      }
    }

    return true;
  }

}

Measured memory_bytes: 24916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int a[30];
int main(void){
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        a[s[i]-'a']++;
    }
    for(int i=0;i<30;i++){
        if(a[i]%2==0){
            
        }else{
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    
}


Measured memory_bytes: 3596
N,K = map(int,input().split())

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
############################
 
 
#####関数をつかってみる．#####
######今回は二進数に変換######
x10 = 35
x2 = Base_10_to_n(N,K)
print(len(x2))#"100011"が表示される




Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
  
struct Data {
  int w, h;
};
  
  
int main()
{
  int n, w, d;

  while(scanf("%d %d %d", &n, &w, &d), n||w||d) {
    Data data[128];
    data[1] = (Data){w, d};
    int ptr = 2;
    for(int i = 0; i < n; i++) {
      int p, s;
      scanf("%d %d", &p, &s);
      Data temp = data[p];
      s %= temp.w + temp.h;
              
      for(int j = p; j < ptr - 1; j++) {
        swap(data[j], data[j + 1]);
      }
  
      if(s < temp.w) {
        int Pos = min(s, temp.w - s);
        data[ptr++] = (Data){temp.w - Pos, temp.h};
        data[ptr - 2].w = Pos;
      } else {
        s -= temp.w;
        int Pos = min(s, temp.h - s);
        data[ptr++] = (Data){temp.w, temp.h - Pos};
        data[ptr - 2].h = Pos;
      }
    }
    vector< int > dat;
    for(int i = 1; i < ptr; i++) {
      dat.push_back(data[i].w * data[i].h);
    }
    sort(dat.begin(), dat.end());
    bool first = false;
    for(int i = 0; i < dat.size(); i++) {
      if(first++) printf(" ");
      printf("%d",dat[i]);
    }
    printf("\n");
  }
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF (ll)1E9
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

int main() {
	int n,ans=INF;
	string s;
	cin >> n >> s;
	vi l(n,0), r(n,0);
	int tmp = 0;
	rep(i, n - 1) {
		if (s[i] == 'W') {
			tmp++;
		}
		l[i + 1] = tmp;
	}
	tmp = 0;
	rep(j, n - 1) {
		int i = n - 1 - j;
		if (s[i] == 'E') {
			tmp++;
		}
		r[i - 1] = tmp;
	}
	//cout << l << endl << r << endl;
	rep(i, n) {
		ans = min(ans, l[i] + r[i]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3076
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<vector>
using namespace std;
#define read freopen("in.in","r",stdin)
#define write freopen("out.out","w",stdout)
#define FastIO ios::sync_with_stdio(0)
typedef long long ll;
int n;
int cost[100005][4];
int memo[100005][4];
int dp(int idx, int last) {
	if (idx == n)
		return 0;
	int &ret = memo[idx][last];
	if (ret != -1)return ret;
	ret = -1e9;
	for (int i = 1; i <= 3; i++)
		if (i != last)
			ret = max(ret, dp(idx + 1, i) + cost[idx + 1][i]);
	return ret;


}
int main() {
	FastIO;
#ifndef ONLINE_JUDGE
	//write; read;
#endif 
	memset(memo, -1, sizeof memo);
	cin >> n;
	for(int i=1;i<=n;i++)
		for (int j = 1; j <=3; j++)
		{
			cin >> cost[i][j];
		}
	cout << dp(0, 0) << endl;
	return 0;
}

Measured memory_bytes: 11136
#include <cstdio>
#include <cstdlib>
using namespace std;

int main()
{
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);
	if ((a - b) % 2 == 0) printf("Alice\n");
	else printf("Borys\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  
  while(1){
    c-=b;
    if(c <= 0){
      cout << "Yes" << endl;
      break;
    }
    
    a-=d;
    if(a <= 0){
      cout << "No" << endl;
      break;
    }    
  }
  return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   int N, K; cin >> N >> K;
   ll h[100100]; rep(i, N) cin >> h[i];
   ll dp[100100]; rep(i, N) dp[i] = INF;
   dp[0] = 0;
   rep(i, N) {
       rep1(j, K) {
           if(i >= j) chmin(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
       }
   }
   cout << dp[N - 1] << endl;

   return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define mod 1000000007ll
#define mod1 998244353ll
#define endl '\n'
#define inf ((ll)1e18+1)
#include<chrono>
using namespace chrono;
mt19937_64 rng(high_resolution_clock::now().time_since_epoch().count());
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define debr(x,y) {cout<<"-->  "<<#x<<" to "<<#y<<" :  "; auto itr=x; while(itr!=y) cout<<(*itr++)<<' '; cout<<endl; }
#define deba(x) {cout<<"-->  "<<#x<<" :  "; for(auto ele:(x)) cout<<ele<<"  "; cout<<endl; }
#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s);istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a <<"  ,  ";
    err(++it, args...);
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    vector<ll> ar(n);
    for(ll x=0;x<n;x++){
        cin>>ar[x];
    }
    sort(ar.rbegin(),ar.rend());
    ll ans=ar[0];
    ll count=2;
    ll idx=1;
    while(count<n){
        if(count+2<=n){
            ans+=2*ar[idx];
            count+=2;
        }else{
            ans+=ar[idx];
            count+=1;
        }
        idx++;
    }
    cout<<ans<<endl;
    return 0;

}

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

#include <iostream>
#include <vector>
// #include <map>
#include <string>
// #include <algorithm>
// #include <numeric>
// #include <limits>

using namespace std;

int n;
const short type_n = 0; // number
const short type_p = 1; // plus
const short type_s = 2; // star

struct Data {
	short type = -1;
	int level = 0;
	int val = -1;

	Data() {}

	Data(string str) {
		for (auto c : str) {
			if (c == '.') {
				level++;
			} else if (isdigit(c)) {
				type = type_n;
				val = c - '0';
			} else {
				if (c == '+') {
					type = type_p;
				} else {
					type = type_s;
				}
			}
		}
	}

	void print() {
		cout << "level " << level << " type " << type << " : " << val << endl;
	}

};

vector<Data> datas;

void input() {
	datas.resize(n);
	string str;
	for (int i = 0; i < n; i++) {
		cin >> str;
		Data d(str);
		datas[i] = d;
	}
}

int run(int key) {
	auto& d = datas[key];
	if (d.val != -1) {
		return d.val;
	}
	if (d.type == type_p) {
		d.val = 0;
		int l = d.level + 1; // target level
		for (key += 1; key < n; key++) {
			if (datas[key].level == l) {
				d.val += run(key);
				continue;
			}
			if (datas[key].level < l) {
				break;
			}
		}
	} else if (d.type == type_s) {
		d.val = 1;
		int l = d.level + 1; // target level
		for (key += 1; key < n; key++) {
			if (datas[key].level == l) {
				d.val *= run(key);
				continue;
			}
			if (datas[key].level < l) {
				break;
			}
		}
	}
	return d.val;
}

void solve() {
	input();
	cout << run(0) << endl;
	//std::cout << "debug " << std::endl; // debug
	//for (auto d : datas) {
	//	d.print();
	//}
	//std::cout << "debug end " << std::endl; // debug
}

int main() {

	while (true) {
		cin >> n;
		if (n == 0) {
			break;
		}
		solve();
	}

	//std::cout << "\e[38;5;0m\e[48;5;40m --- end ---  \e[m" << std::endl; // debug
	return 0;
}

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

using namespace std;

#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define all(x) (x).begin(),(x).end()

using ll = long long;

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

    vector<int> A(n);

    ll sum = 0;
    rep(i, n) {
        cin >> A[i];
        sum += A[i];
    }

    if(sum >= h) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    
	return 0;
}


Measured memory_bytes: 640
R, G, B, N = map(int, input().split())
l = [R, G, B]
l.sort(reverse=True)

ans = 0
for i in range(N//l[0]+1):
  mod = N - l[0]*i
  for j in range(mod//l[1]+1):
    n = mod - l[1]*j
    if n % l[2] == 0:
      ans += 1
print(ans)

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

void call(int n);
void mycall(int n);
bool include_three(int x);

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

void mycall(int n){
  for(int i=1; i<=n;i++){
    if((i%3==0|include_three(i))){
      cout << " " << i;
    }
  }
  cout << endl;
}

bool include_three(int x){
  for (x; x>0; x/=10) {
    if (x%10==3) return true;
  }
  return false;
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int k;
int h1,m1,h2,m2;
int main(){
	ios::sync_with_stdio(0);
	cin>>h1>>m1>>h2>>m2>>k;
	if(h2<h1)
	h2+=24;
	else{
		if(h2==h1&&m2<m1)
		h2+=24;
	}
	int ans=h2-h1;
	ans*=60;
	if(m2<m1){
		ans-=60;
		m2+=60;
	}
	ans+=m2-m1;
	ans-=k;
	cout<<ans;
	re 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int a,b,c,d,k,hour,minu;

int main() 
{   cin>>a>>b>>c>>d>>k;
	hour=c-a;minu=d-b;
	cout<<max(0,hour*60+minu-k)<<endl;
    return 0;
}

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

long long int gcd(long long int x, long long int y)
{
	if (y == 0) { return x; }
	return gcd(y, x % y);
}

int main(void)
{
	long long int x,bank = 100,count = 0;
	cin >> x;
	while (bank < x)
	{
		bank *= 1.01;
		count++;
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
char s[105];
int n;
int s1,s2,t1,t2;

int main(){
	cin>>s+1;
	n=strlen(s+1);
	s1=1,t1=(n-1)/2;
	s2=(n+3)/2,t2=n;
	for(int i=1;i<=n;i++){
		if(s[i]!=s[n+1-i]){puts("No");return 0;}
	}
	for(int i=s1;i<=t1;i++){
		if(s[i]!=s[s1+t1-i]){puts("No");return 0;}
	}
	for(int i=s2;i<=t2;i++){
		if(s[i]!=s[s2+t2-i]){puts("No");return 0;}
	}
	puts("Yes");

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cmath>
#include<climits>
using namespace std;

int cost[7][7] = {
    {   0,  300,  500,  600,  700, 1350, 1650},
    { 300,    0,  350,  450,  600, 1150, 1500},
    { 500,  350,    0,  250,  400, 1000, 1350},
    { 600,  450,  250,    0,  250,  850, 1300},
    { 700,  600,  400,  250,    0,  600, 1150},
    {1350, 1150, 1000,  850,  600,    0,  500},
    {1650, 1500, 1350, 1300, 1150,  500,    0}
};

int dist[7][7] = {
    { 0,  6, 13, 18, 23, 43, 58},
    { 6,  0,  7, 12, 17, 37, 52},
    {13,  7,  0,  5, 10, 30, 45},
    {18, 12,  5,  0,  5, 25, 40},
    {23, 17, 10,  5,  0, 20, 35},
    {43, 37, 30, 25, 20,  0, 15},
    {58, 52, 45, 40, 35, 15,  0}
};

int ToMinute(int h, int m){
	return h*60 + m;
}

bool IsInTime(int h, int m){
	return ToMinute(17, 30) <= ToMinute(h, m) && ToMinute(h, m) <= ToMinute(19, 30);
}

int ToHalf(int n){
	n /= 2;
	if(n%50) n += 50 - n%50;
	return n;
}

int main(){
	int ic1, ic2, h1, h2, m1, m2;
	while(cin >> ic1, ic1){
		cin >> h1 >> m1 >> ic2 >> h2 >> m2;
		ic1--; ic2--;
		bool is_half = ( IsInTime(h1, m1) || IsInTime(h2, m2) ) && dist[ic1][ic2] <= 40;
		if(is_half) printf("%d\n", ToHalf(cost[ic1][ic2]) );
		else printf("%d\n", cost[ic1][ic2]);
	}
	return 0;
}

Measured memory_bytes: 1144
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.4.3)

import math
import statistics
import numpy as np
import queue
import itertools

n = int(input())
x = np.array(list(int(i) for i in input().split()))

ans = 0xFFFFFFFF
for p in range(1, 100 + 1):
	ans = min(np.sum((x - p) ** 2), ans)
print(ans)



Measured memory_bytes: 20884
# -*- coding: utf-8 -*-
l = [] 
r = []
count = 0

N, M = map(int, input().split())
l = [0] * M
r = [0] * M
for i in range(0,M):
    l[i], r[i] = map(int, input().split())

#idカードの生成
    
ml = max(l)
mr = min(r)

for i in range(1,N+1):
    if  ml <= i and i <= mr:
        count += 1

print(count)

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

int main() {
  string A, B;
  cin >> A >> B;
  int al = A.size();
  int bl = B.size();

  if (al > bl) {
    cout << "GREATER" << endl;
    return 0;
  }

  if (al < bl) {
    cout << "LESS" << endl;
    return 0;
  }

  for (int i = 0; i < al; i++) {
    if (A[i] > B[i]) {
      cout << "GREATER" << endl;
      return 0;
    }

    if (A[i] < B[i]) {
      cout << "LESS" << endl;
      return 0;
    }
  }

  cout << "EQUAL" << endl;
}

Measured memory_bytes: 3628
s = list(map(int, input().split()))
n = s[0]
m = s[1]
q = s[2]

abcd = []

for i in range(q):
    inpu = list(map(int, input().split()))
    abcd.append(inpu)

maximum = 0

for i1 in range(1, m + 1):
    for i2 in range(i1, m + 1):
        for i3 in range(i2, m + 1):
            for i4 in range(i3, m + 1):
                for i5 in range(i4, m + 1):
                    for i6 in range(i5, m + 1):
                        for i7 in range(i6, m + 1):
                            for i8 in range(i7, m + 1):
                                for i9 in range(i8, m + 1):
                                    for i10 in range(i9, m + 1):
                                        iarray = [i1, i2, i3, i4, i5, i6, i7, i8, i9, i10]
                                        goukei = 0
                                        for j in range(q):
                                            if iarray[abcd[j][1] - 1] - iarray[abcd[j][0] - 1] == abcd[j][2]:
                                                goukei = goukei + abcd[j][3]

                                        if goukei > maximum:
                                            maximum = goukei

print(maximum)



Measured memory_bytes: 9276
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,y,sum,pos,k,x[ohara],dp[ohara];
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n;
    rep(i,n)cin>>x[i];
    dp[2]=abs(x[0]-x[1]);
    dp[3]=abs(x[0]-x[2]);
    rrep(i,4,n+1){
        dp[i]=min(dp[i-2]+abs(x[i-3]-x[i-1]),dp[i-1]+abs(x[i-2]-x[i-1]));
    }
    Cout(dp[n]);
    return 0;
}


Measured memory_bytes: 5120
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <iterator>
#include <climits>
#include <unordered_map>
#include <queue>


#define rep(i, n) for(int i = 0, end = (int)(n); i < end; i++)

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

inline int ctoi(char c) {
    return (int)(c -'0');
}

// ----------------------------------------------------------

int main() {
    ll n, x;
    cin >> n >> x;
    vector<ll> berger(n+1);
    vector<ll> paty(n+1);
    berger[0] = 1;
    paty[0] = 1;
    rep(i, n) {
        berger[i+1] = berger[i] * 2 + 3;
        paty[i+1] = paty[i] * 2 + 1;
    }
    ll dansu = n;
    ll ans = 0;
    while (x > 0) {
        if (dansu == 0) {
            ans += 1;
            break;
        } 
        if (x==berger[dansu]) {
            ans += paty[dansu];
            break;
        } else if (berger[dansu - 1] + 2 < x) {
            ans += paty[dansu - 1] + 1;
            x -= berger[dansu - 1] + 2;
            --dansu;
            continue;
        } else if (berger[dansu - 1] + 2 == x) {
            ans += paty[dansu - 1] + 1;
            break;
        } else if (x != 1) {
            --dansu;
            x -= 1;
            continue;
        } else {
            break;
        }
    }
    cout << ans <<  endl;
    return 0;
}

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

int main(){

    int n;
    cin >> n;

    vector<int> a(n);

    int cnt=0;
    rep(i,n){
        cin >> a[i];
        if(a[i]<0){
            cnt++;
        }
        a[i]=abs(a[i]);
    }

    sort(a.begin(),a.end(),greater<int>());
    ll ans=0LL;
    rep(i,n){
        if(n-i>cnt%2){
            ans+=abs(a[i]);
        }else{
            ans+=-1*abs(a[i]);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = A[0]
    for i in range(1,N):
        B ^= A[i]

    ans = [0] * N
    for i in range(N):
        ans[i] = B ^ A[i]

    print(*ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 98744
import java.util.*;

public class Main {
	 
	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt(),m=cin.nextInt(),l=cin.nextInt();
		Long A[][]=new Long[100][100],B[][]=new Long[100][100];
		
		
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				A[i][j]=cin.nextLong();
			}
		}
		for(int i=0;i<m;i++) {
			for(int j=0;j<l;j++) {
				B[i][j]=cin.nextLong();
			}
		}
		
		for(int i=0;i<n;i++) {
			for(int j=0;j<l;j++) {
				Long sum=(long) 0;
				for(int k=0;k<m;k++) {
					sum+=A[i][k]*B[k][j];
				}
				if(j!=l-1)System.out.print(sum+" ");
				else System.out.println(sum);
			}
		}
		
	}
	
}


Measured memory_bytes: 68844
#include <stdio.h>
int main(void){
	while(1){
		int h,w;
		scanf("%d %d\n",&h,&w);
		if(h==0 && w==0){
			break;
		}else{
			int x,y;
			for(x=0;x<h;x++){
				for(y=0;y<w;y++){
					if((x+y)%2==1){
						printf(".");
					}else{
						printf("#");
					}
					if(y==w-1){
						printf("\n");
					}
				}
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 576
// =====================================================
//   File    :   main.cpp
//   Author  :   eezyl
//   Synopsis:   codeforces/atcoder template v2
//   Address :
//   Date    :   2020/09/19
// =====================================================
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;

typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<db> vdb;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;
typedef vector<vi> vvi;

#define mp make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const ll INF = 1e18;
const ld PI = acos((ld)-1);
const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};

// TO_STRING
#define ts to_string
string ts(char c) { return string(1,c); }
string ts(const char* s) { return (string)s; }
string ts(string s) { return s; }
string ts(bool b) { return b ? "true" : "false"; }
string ts(vector<bool> v) { string res; F0R(i,sz(v)) res += char('0'+v[i]); return res; }
template<size_t SZ> string ts(bitset<SZ> b) { string res; F0R(i,SZ) res += char('0'+b[i]); return res; }

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
constexpr int pct(int x) { return __builtin_popcount(x); }
constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x))

const ll MOD = 1e9+7; // 998244353;
const int MX = 1e5+5;

// BIT
int tree[1];
int sum(int k, int a = 0) {
    while (k >= 1) { a += tree[k]; k -= k&-k; }
    return a; }
void add(int k, int x) {
    while (k <= MX) { tree[k] += x; k += k&-k; }
}
// Disjoint Set
int find(vi& ds, int i) {
    return ds[i] < 0 ? i : ds[i] = find(ds, ds[i]);
}

void solve()
{
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i < N; ++i) {
        for (int j = 1; j < N; ++j) {
            if (i*j >= N)
                break;
            ++ans;
        }
    }

    cout << ans << endl;
}


int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#define LOCAL
#ifdef LOCAL
    freopen("data.in", "r", stdin); while (!feof(stdin)) {
#endif // LOCAL

    int t = 1;
    //cin >> t;
    while (t--) solve();

#ifdef LOCAL
    }    printf("Time used = %.2lf\n", (double)clock() / CLOCKS_PER_SEC);
#endif // LOCAL
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <set>
using namespace std;
const int MAXN = 200005;
int n, k, c;
char s[MAXN];

int main()
{
    cin >> n >> k >> c;
    cin >> (s + 1);

    set<int> s1, s2;
    for (int i = 1; i <= n; i++)
    {
        if (s[i] == 'o') s1.insert(i), i += c; 
    }

    for (int j = n; j >= 1; j--)
    {
        if (s[j] == 'o') s2.insert(j), j -= c;
    }

    if (s1.size() > k || s2.size() > k) return 0;
    for (int v : s1)
    {
        if (s2.count(v)) cout << v << endl;
    }
}

Measured memory_bytes: 20480
a,b,h,m=map(int,input().split())
hh=30*h+0.5*m
mm=6*m
s=min(abs(hh-mm), 360-abs(hh-mm))
import math
c=a**2+b**2-2*a*b*math.cos(math.radians(s))
print(c**0.5)


Measured memory_bytes: 62412
import java.util.*;

public class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] dist =new int[5];
		for(int i=0;i<5;i++){
			dist[i]=sc.nextInt();
		}
		int limit =sc.nextInt();

		if(dist[4]-dist[0] <= limit){
			System.out.println("Yay!");
		}else{
			System.out.println(":(");
		}
	}
}

Measured memory_bytes: 21972
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 1000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

int n,m,k,ans;
int A,B;
int a[111111],b[111111];
int x[111111],y[111111],c[111111];
signed main(){
	 cin>>A>>B>>m;
	 rep(i,A)cin>>a[i];
	 rep(i,B)cin>>b[i];
	 rep(i,m)cin>>x[i]>>y[i]>>c[i];
	 int min=INF*2;
	 rep(i,m){
	 	min=std::min(min,a[x[i]-1]+b[y[i]-1]-c[i]);
	 }
	 sort(a,a+A);sort(b,b+B);
	 cout<<std::min(min,a[0]+b[0]);
}


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

const int mxn = 1e5 + 5;
vector<int> adj[mxn];
bool vis[mxn];
void dfs(int node){
    vis[node] = 1;
    for(int x : adj[node]){
        if(!vis[x]) dfs(x);
    }
}

void bfs(int n){
    for(int i = 0; i<=n; i++) vis[i] = 0;

    vector<int> ans(n+1);
    queue<int> q;
    q.push(1);
    vis[1] = 1;
    int x;
    while(!q.empty()){
        x = q.front();
        q.pop();
        for(int y : adj[x]){
            if(!vis[y]){
                q.push(y);
                ans[y] = x;
                vis[y] = 1;
            }
        }
    }

    for(int i = 2; i<=n; i++) cout<<ans[i]<<"\n";
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    //good luck kittu!

    int n, m, x, y; cin>>n>>m;
    while(m--){
        cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }

    int cc = 0;
    for(int i = 1; i<=n; i++){
        if(!vis[i]){
            dfs(i);
            cc++;
        }
    } 

    if(cc!=1) return cout<<"No\n", 0;
    cout<<"Yes\n";
    bfs(n);
    return 0;
}

Measured memory_bytes: 12312
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n = ni()
a = nl()

print(max(a) - min(a))

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int k = ri();
	int cur = 0;
	int res = -1;
	for (int i = 1; i <= k; i++) {
		cur = (cur * 10 + 7) % k;
		if (cur == 0) {
			res = i;
			break;
		}
	}
	printf("%d\n", res);
	return 0;
}


Measured memory_bytes: 3832
def combinations(l):
    sl = sorted(l)
    r = range(len(sl)-1)
    for i in r:
        for j in range(i+1, len(sl)):
            yield (sl[i], sl[j])


m,n = [ int(s) for s in input().split() ]
d = {}

for i in range(m):
    l = input().split()[1:]
    for e in combinations(l):
        if e in d:
            d[e] += 1
        else:
            d[e] = 1
sl = sorted([e[0][0] + " " + e[0][1] for e in d.items() if e[1] >= n])
print(len(sl))
for i in sl:
    print(i)


Measured memory_bytes: 6656